提交 706676b4 编写于 作者: J Jesse Glick

Merge branch 'master' into BuildStep-Job

Conflicts:
	core/src/main/java/hudson/tasks/test/AbstractTestResultAction.java
......@@ -67,6 +67,12 @@ Upcoming changes</a>
<li class="bug">
Improving security of <code>set-build-parameter</code> and <code>set-build-result</code> CLI commands.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-24080">issue 24080</a>)
<li class="bug">
Startup can be broken by deeply recursive causes in build records.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-24161">issue 24161</a>)
<li class="bug">
Displaying unabridged test result trend on project index page defeated lazy loading.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-23945">issue 23945</a>)
<li class="rfe">
Added support for host:port format in X-Forwarded-Host header.
(<a href="https://github.com/jenkinsci/jenkins/commit/19d8b80bb2f33e4877c7170bcca8bfa318ebe77d">commit 19d8b80</a>)
......@@ -75,9 +81,10 @@ Upcoming changes</a>
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-24006">issue 24006</a>)
<li class="rfe">
Modernized sidebar <code>&lt;l:pane&gt;</code>s and making them work better with new layout.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-23810">issue 23810</a>)
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-23810">issue 23810</a>,
<a href="https://issues.jenkins-ci.org/browse/JENKINS-23829">issue 23829</a>)
<li class="rfe">
CLI authentication with username/password try to read my .ssh/id_rsa and prompts for key password.
Add option to CLI to skip key authentication (e.g. when there's a password on the default key).
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-23970">issue 23970</a>)
<li class="rfe">
Modernize tabBar and bigtable. Makes the project view look better. Same for Plugin Manager.
......
......@@ -49,9 +49,9 @@ THE SOFTWARE.
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>ui-ext-icon-module</artifactId>
<version>${project.version}</version>
<groupId>org.jenkins-ci.plugins.icon-shim</groupId>
<artifactId>icon-set</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
......
......@@ -161,6 +161,7 @@ public class BuildCommand extends CLICommand {
}
AbstractBuild b = f.waitForStart(); // wait for the start
stdout.println("Started "+b.getFullDisplayName());
stdout.flush();
if (sync || follow) {
try {
......
......@@ -98,6 +98,13 @@ public abstract class Cause {
}
}
void onLoad(@Nonnull Job<?,?> job, int buildNumber) {
Run<?,?> build = job.getBuildByNumber(buildNumber);
if (build != null) {
onLoad(build);
}
}
@Deprecated
public void onLoad(AbstractBuild<?,?> build) {
if (Util.isOverridden(Cause.class, getClass(), "onLoad", Run.class)) {
......@@ -178,7 +185,7 @@ public abstract class Cause {
}
@Override
public void onLoad(@Nonnull Run run) {
public void onLoad(@Nonnull Job<?,?> _job, int _buildNumber) {
Item i = Jenkins.getInstance().getItemByFullName(this.upstreamProject);
if (i == null || !(i instanceof Job)) {
// cannot initialize upstream causes
......@@ -186,14 +193,8 @@ public abstract class Cause {
}
Job j = (Job)i;
Run r = j.getBuildByNumber(this.getUpstreamBuild());
if (r == null) {
// build doesn't exist anymore
return;
}
for (Cause c : this.upstreamCauses) {
c.onLoad(r);
c.onLoad(j, upstreamBuild);
}
}
......@@ -349,6 +350,7 @@ public abstract class Cause {
@Override public String toString() {
return "JENKINS-14814";
}
@Override public void onLoad(@Nonnull Job<?,?> _job, int _buildNumber) {}
}
}
......
......@@ -48,6 +48,7 @@ import hudson.util.FormValidation;
import hudson.util.PackedMap;
import hudson.util.RunList;
import net.sf.json.JSONObject;
import org.acegisecurity.AccessDeniedException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.types.FileSet;
import org.kohsuke.stapler.AncestorInPath;
......@@ -429,17 +430,24 @@ public class Fingerprinter extends Recorder implements Serializable, DependencyD
BuildPtr bp = fp.getOriginal();
if(bp==null) continue; // outside Hudson
if(bp.is(build)) continue; // we are the owner
AbstractProject job = bp.getJob();
if (job==null) continue; // project no longer exists
if (job.getParent()==build.getParent())
continue; // we are the parent of the build owner, that is almost like we are the owner
if(!includeMissing && job.getBuildByNumber(bp.getNumber())==null)
continue; // build no longer exists
Integer existing = r.get(job);
if(existing!=null && existing>bp.getNumber())
continue; // the record in the map is already up to date
r.put(job,bp.getNumber());
try {
AbstractProject job = bp.getJob();
if (job==null) continue; // project no longer exists
if (job.getParent()==build.getParent())
continue; // we are the parent of the build owner, that is almost like we are the owner
if(!includeMissing && job.getBuildByNumber(bp.getNumber())==null)
continue; // build no longer exists
Integer existing = r.get(job);
if(existing!=null && existing>bp.getNumber())
continue; // the record in the map is already up to date
r.put(job, bp.getNumber());
} catch (AccessDeniedException e) {
// Need to log in to access this job, so ignore
continue;
}
}
return r;
......
......@@ -34,8 +34,10 @@ import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import jenkins.model.RunAction2;
import jenkins.model.lazy.LazyBuildMixIn;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.CategoryAxis;
......@@ -203,13 +205,19 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio
* Gets the test result of the previous build, if it's recorded, or null.
*/
public T getPreviousResult() {
return (T)getPreviousResult(getClass());
return (T)getPreviousResult(getClass(), true);
}
private <U extends AbstractTestResultAction> U getPreviousResult(Class<U> type) {
private <U extends AbstractTestResultAction> U getPreviousResult(Class<U> type, boolean eager) {
Run<?,?> b = run;
Set<Integer> loadedBuilds;
if (!eager && run.getParent() instanceof LazyBuildMixIn.LazyLoadingJob) {
loadedBuilds = ((LazyBuildMixIn.LazyLoadingJob<?,?>) run.getParent()).getLazyBuildMixIn()._getRuns().getLoadedBuilds().keySet();
} else {
loadedBuilds = null;
}
while(true) {
b = b.getPreviousBuild();
b = loadedBuilds == null || loadedBuilds.contains(b.number - /* assuming there are no gaps */1) ? b.getPreviousBuild() : null;
if(b==null)
return null;
U r = b.getAction(type);
......@@ -292,7 +300,7 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio
DataSetBuilder<String,NumberOnlyBuildLabel> dsb = new DataSetBuilder<String,NumberOnlyBuildLabel>();
for( AbstractTestResultAction<?> a=this; a!=null; a=a.getPreviousResult(AbstractTestResultAction.class) ) {
for (AbstractTestResultAction<?> a = this; a != null; a = a.getPreviousResult(AbstractTestResultAction.class, false)) {
dsb.add( a.getFailCount(), "failed", new NumberOnlyBuildLabel(a.run));
if(!failureOnly) {
dsb.add( a.getSkipCount(), "skipped", new NumberOnlyBuildLabel(a.run));
......
......@@ -47,14 +47,11 @@ THE SOFTWARE.
</licenses>
<modules>
<module>ui-ext</module>
<module>ui-ext/icon/module</module>
<module>core</module>
<module>war</module>
<module>test</module>
<module>cli</module>
<module>plugins</module>
<module>ui-ext/icon/shim-plugin</module>
</modules>
<scm>
......
......@@ -81,7 +81,7 @@ THE SOFTWARE.
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>mailer</artifactId>
<version>1.8</version>
<version>1.10</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
......
<!--
The MIT License
Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>ui-ext-pom</artifactId>
<version>1.576-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>ui-ext-icon-module</artifactId>
<name>Jenkins icon ui extension core module</name>
<description>
Contains Jenkins icon ui extension code relied upon by both Jenkins Core and the icon "shim" plugin.
</description>
</project>
/*
* The MIT License
*
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.jenkins.ui.icon;
import org.apache.commons.jelly.JellyContext;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Simple icon metadata class.
*
* @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
*/
public class Icon {
public static final String ICON_SMALL_STYLE = "width: 16px; height: 16px;";
public static final String ICON_MEDIUM_STYLE = "width: 24px; height: 24px;";
public static final String ICON_LARGE_STYLE = "width: 32px; height: 32px;";
public static final String ICON_XLARGE_STYLE = "width: 48px; height: 48px;";
private static final Map<String, String> iconDims = new HashMap<String, String>();
static {
iconDims.put("16x16", "icon-sm");
iconDims.put("24x24", "icon-md");
iconDims.put("32x32", "icon-lg");
iconDims.put("48x48", "icon-xlg");
}
private final String classSpec;
private final String normalizedSelector;
private final String url;
private final String style;
private IconType iconType;
/**
* Icon instance.
* <p/>
* Creates a {@link IconType#CORE core} icon.
*
* @param classSpec The icon class names.
* @param url The icon image url.
* @param style The icon style.
*/
public Icon(String classSpec, String url, String style) {
this(classSpec, url, style, IconType.CORE);
if (url.startsWith("images/")) {
this.iconType = IconType.CORE;
} else if (url.startsWith("plugin/")) {
this.iconType = IconType.PLUGIN;
}
}
/**
* Icon instance.
*
* @param classSpec The icon class specification.
* @param url The icon image url.
* @param style The icon style.
* @param iconType The icon type.
*/
public Icon(String classSpec, String url, String style, IconType iconType) {
this.classSpec = classSpec;
this.normalizedSelector = toNormalizedCSSSelector(classSpec);
this.url = toNormalizedIconUrl(url);
this.style = style;
this.iconType = iconType;
}
/**
* Get the class specification for this Icon.
* @return The class specification for this Icon.
*/
public String getClassSpec() {
return classSpec;
}
/**
* Get the icon's normalized CSS selector.
*
* @return The icon normalized CSS selector.
* @see #toNormalizedCSSSelector(String)
*/
public String getNormalizedSelector() {
return normalizedSelector;
}
/**
* Get the icon url.
*
* @return The icon url.
*/
public String getUrl() {
return url;
}
/**
* Get the qualified icon url.
* <p/>
* Qualifying the URL involves prefixing it depending on whether the icon is a core or plugin icon.
* Core icons are prefixed with the
*
* @param context The JellyContext.
* @return The qualified icon url.
*/
public String getQualifiedUrl(JellyContext context) {
return iconType.toQualifiedUrl(url, context);
}
/**
* Get the icon style.
*
* @return The icon style.
*/
public String getStyle() {
return style;
}
/**
* Normalize the supplied string to an Icon name class e.g. "blue_anime" to "icon-blue-anime".
*
* @param string The string to be normalized.
* @return The normalized icon name class.
*/
public static String toNormalizedIconNameClass(String string) {
if (string == null) {
return null;
}
return "icon-" + toNormalizedIconName(string);
}
/**
* Normalize the supplied string to an Icon name e.g. "blue_anime" to "blue-anime".
*
* @param string The string to be normalized.
* @return The normalized icon name.
*/
public static String toNormalizedIconName(String string) {
if (string == null) {
return null;
}
if (string.endsWith(".png") || string.endsWith(".gif")) {
string = string.substring(0, string.length() - 4);
}
return string.replace("_", "-");
}
/**
* Normalize the supplied string to an Icon size class e.g. "16x16" to "icon-sm".
*
* @param string The string to be normalized.
* @return The normalized icon size class, or the unmodified {@code string} arg
* if it was an unrecognised icon size.
*/
public static String toNormalizedIconSizeClass(String string) {
if (string == null) {
return null;
}
String normalizedSizeClass = iconDims.get(string.trim());
return (normalizedSizeClass != null ? normalizedSizeClass : string);
}
/**
* Generate a normalized CSS selector from the space separated list of icon class names.
* <p/>
* The normalized CSS selector is the list of class names, alphabetically sorted and dot separated.
* This means that "icon-help icon-xlg" and "icon-xlg icon-help" have the same normalized
* selector ".icon-help.icon-xlg". Spaces are not relevant etc.
*
* @param classNames The space separated list of icon class names.
* @return The normalized CSS selector.
*/
public static String toNormalizedCSSSelector(String classNames) {
if (classNames == null) {
return null;
}
String[] classNameTokA = classNames.split(" ");
List<String> classNameTokL = new ArrayList<String>();
// Trim all tokens first
for (int i = 0; i < classNameTokA.length; i++) {
String trimmedToken = classNameTokA[i].trim();
if (trimmedToken.length() > 0) {
classNameTokL.add(trimmedToken);
}
}
// Refill classNameTokA
classNameTokA = new String[classNameTokL.size()];
classNameTokL.toArray(classNameTokA);
// Sort classNameTokA
Arrays.sort(classNameTokA, new StringComparator());
// Build the compound name
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < classNameTokA.length; i++) {
stringBuilder.append(".").append(classNameTokA[i]);
}
return stringBuilder.toString();
}
/**
* Normalize the supplied url.
*
* @param url The url to be normalized.
* @return The normalized url.
*/
public static String toNormalizedIconUrl(String url) {
if (url == null) {
return null;
}
final String originalUrl = url;
if (url.startsWith("/")) {
url = url.substring(1);
}
if (url.startsWith("images/")) {
return url.substring("images/".length());
}
if (url.startsWith("plugin/")) {
return url.substring("plugin/".length());
}
return originalUrl;
}
private static class StringComparator implements Comparator<String> {
@Override
public int compare(String s1, String s2) {
return s1.compareTo(s2);
}
}
}
/*
* The MIT License
*
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.jenkins.ui.icon;
import org.apache.commons.jelly.JellyContext;
import org.kohsuke.stapler.Stapler;
/**
* Icon type.
*
* @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
*/
public enum IconType {
CORE,
PLUGIN,;
/**
* Qualify the supplied icon url.
* <p/>
* Qualifying the URL involves prefixing it depending on whether the icon is a core or plugin icon.
*
* @param url The url to be qualified.
* @param context The JellyContext.
* @return The qualified icon url.
*/
public String toQualifiedUrl(String url, JellyContext context) {
String resURL = context.getVariable("resURL").toString();
switch (this) {
case CORE: {
return resURL + "/images/" + url;
}
case PLUGIN: {
return resURL + "/plugin/" + url;
}
}
return null;
}
}
/*
* The MIT License
*
* Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi,
* Yahoo! Inc., Stephen Connolly, Tom Huybrechts, Alan Harder, Manufacture
* Francaise des Pneumatiques Michelin, Romain Seguy
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.jenkins.ui.icon;
import org.junit.Assert;
import org.junit.Test;
/**
* @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
*/
public class IconSetTest {
@Test
public void test() {
test("icon-sm", "16x16", Icon.ICON_SMALL_STYLE);
test("icon-md", "24x24", Icon.ICON_MEDIUM_STYLE);
test("icon-lg", "32x32", Icon.ICON_LARGE_STYLE);
test("icon-xlg", "48x48", Icon.ICON_XLARGE_STYLE);
}
@Test
public void test_toNormalizedIconUrl() {
Assert.assertEquals(null, IconSet.toNormalizedIconUrl((String)null));
Assert.assertEquals("aaaa", IconSet.toNormalizedIconUrl("aaaa"));
Assert.assertEquals("aaaa", IconSet.toNormalizedIconUrl("images/aaaa"));
Assert.assertEquals("aaaa", IconSet.toNormalizedIconUrl("plugin/aaaa"));
Assert.assertEquals("aaaa", IconSet.toNormalizedIconUrl("/images/aaaa"));
Assert.assertEquals("aaaa", IconSet.toNormalizedIconUrl("/plugin/aaaa"));
}
private void test(String sizeClass, String sizeDims, String expectedStyle) {
Icon icon;
icon = IconSet.icons.getIconByClassSpec("icon-blue " + sizeClass);
Assert.assertEquals(sizeDims + "/blue.png", icon.getUrl());
icon = IconSet.icons.getIconByUrl(sizeDims + "/blue.png");
Assert.assertEquals(".icon-blue." + sizeClass, icon.getNormalizedSelector());
Assert.assertEquals(expectedStyle, icon.getStyle());
icon = IconSet.icons.getIconByClassSpec("icon-blue-anime " + sizeClass);
Assert.assertEquals(sizeDims + "/blue_anime.gif", icon.getUrl());
icon = IconSet.icons.getIconByUrl(sizeDims + "/blue_anime.gif");
Assert.assertEquals(".icon-blue-anime." + sizeClass, icon.getNormalizedSelector());
Assert.assertEquals(expectedStyle, icon.getStyle());
}
}
/*
* The MIT License
*
* Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi,
* Yahoo! Inc., Stephen Connolly, Tom Huybrechts, Alan Harder, Manufacture
* Francaise des Pneumatiques Michelin, Romain Seguy
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.jenkins.ui.icon;
import org.junit.Assert;
import org.junit.Test;
/**
* @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
*/
public class IconTest {
@Test
public void test_toNormalizedCSSSelector() {
Assert.assertEquals(".a.b.c", Icon.toNormalizedCSSSelector(" b c a"));
}
@Test
public void test_toNormalizedIconNameClass() {
Assert.assertEquals("icon-blue-anime", Icon.toNormalizedIconNameClass("blue_anime"));
Assert.assertEquals("icon-blue-anime", Icon.toNormalizedIconNameClass("blue_anime.gif"));
Assert.assertEquals("icon-blue", Icon.toNormalizedIconNameClass("blue.png"));
}
@Test
public void test_toNormalizedIconSizeClass() {
Assert.assertEquals("icon-sm", Icon.toNormalizedIconSizeClass("16x16"));
Assert.assertEquals("xxx", Icon.toNormalizedIconSizeClass("xxx"));
}
}
<!--
The MIT License
Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.480</version>
</parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>ui-ext-icon-shim-plugin</artifactId>
<version>1.576-SNAPSHOT</version>
<packaging>hpi</packaging>
<name>Icon Shim Plugin</name>
<description>Allows plugins make full use of the &lt;l:icon&gt; layout tag when running on newer versions of Jenkins, while still being compatible with older versions.</description>
<dependencies>
<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>ui-ext-icon-module</artifactId>
<version>${project.version}</version>
</dependency>
<!-- regular dependencies -->
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.3.1</version>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>(,2.1.0),(2.1.0,2.2.0),(2.2.0,)</version>
<message>Maven 2.1.0 and 2.2.0 produce incorrect GPG signatures and checksums respectively.
</message>
</requireMavenVersion>
<requireMavenVersion>
<version>(,3.0),[3.0.4,)</version>
<message>Maven 3.0 through 3.0.3 inclusive do not pass correct settings.xml to Maven Release
Plugin.
</message>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.5</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.5.2</version>
<configuration>
<excludeFilterFile>src/findbugs/excludesFilter.xml</excludeFilterFile>
<failOnError>true</failOnError>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jenkins-ci.tools</groupId>
<artifactId>maven-hpi-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>generate-taglib-interface</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<licenses>
<license>
<name>MIT License</name>
<url>http://opensource.org/licenses/MIT</url>
</license>
</licenses>
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>
</project>
<FindBugsFilter>
<Match>
<Class name="~.*\.Messages"/>
</Match>
</FindBugsFilter>
\ No newline at end of file
/*
* The MIT License
*
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.jenkins.ui.icon.shim;
import jenkins.model.Jenkins;
import java.io.IOException;
import java.io.InputStream;
/**
* @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
*/
public class CoreIconTagDetector {
public static final boolean TAG_AVAILABLE;
static {
InputStream coreTagFile = Jenkins.class.getResourceAsStream("/lib/layout/icon.jelly");
if (coreTagFile != null) {
TAG_AVAILABLE = true;
try {
coreTagFile.close();
} catch (IOException e) {
e.printStackTrace();
}
} else {
TAG_AVAILABLE = false;
}
}
}
/*
* The MIT License
*
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package shim.layout.icon
import org.jenkins.ui.icon.IconSet
import org.jenkins.ui.icon.shim.CoreIconTagDetector
import org.xml.sax.helpers.AttributesImpl
def attrs = context.getVariable('attrs')
def iconSpec = attrs['class']
def iconSize = attrs.iconSize
def mapAttribute(def name, def attributes) {
def attributeValue = attrs[name];
if (attributeValue != null) {
attributes.addAttribute("", name, name, "CDATA", attributeValue)
}
}
if (iconSize != null) {
iconSpec += ' ' + IconSet.toNormalizedIconSizeClass(iconSize)
}
if (iconSpec != null) {
if (CoreIconTagDetector.TAG_AVAILABLE) {
def l = namespace(lib.LayoutTagLib)
l.icon(class: iconSpec, onclick: attrs.onclick,
title: attrs.title, style: attrs.style,
tooltip: attrs.tooltip, alt: attrs.alt)
} else {
def iconDef = IconSet.icons.getIconByClassSpec(iconSpec);
if (iconDef != null) {
def AttributesImpl attributes = new AttributesImpl()
def style = attrs.style
attributes.addAttribute("", "src", "src", "CDATA", iconDef.getQualifiedUrl(context))
if (style == null) {
style = iconDef.getStyle()
}
attributes.addAttribute("", "style", "style", "CDATA", style)
mapAttribute("onclick", attributes)
mapAttribute("title", attributes)
mapAttribute("tooltip", attributes)
mapAttribute("alt", attributes)
output.startElement("img", attributes)
output.endElement("img")
}
}
}
/*
* The MIT License
*
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package shim.layout.icon
import org.jenkins.ui.icon.IconSet
IconSet.initPageVariables(context)
\ No newline at end of file
Tag library that defines the shim for the core icon tag in /lib/layout.
\ No newline at end of file
<!--
The MIT License
Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>pom</artifactId>
<version>1.576-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>ui-ext-pom</artifactId>
<packaging>pom</packaging>
<name>Jenkins UI Extensions.</name>
<description>
Contains Jenkins UI extension taglib modules and plugins.
</description>
<properties>
<stapler.version>1.227</stapler.version>
</properties>
<dependencies>
<dependency>
<groupId>org.kohsuke.stapler</groupId>
<artifactId>stapler-groovy</artifactId>
<version>${stapler.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>commons-jelly</groupId>
<artifactId>commons-jelly</artifactId>
</exclusion>
<exclusion>
<groupId>commons-jexl</groupId>
<artifactId>commons-jexl</artifactId>
</exclusion>
<exclusion>
<groupId>org.jvnet.hudson</groupId>
<artifactId>commons-jexl</artifactId>
</exclusion>
<exclusion>
<!-- we bundle groovy-all -->
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
......@@ -340,7 +340,7 @@ THE SOFTWARE.
<artifactItem>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>mailer</artifactId>
<version>1.8</version>
<version>1.10</version>
<type>hpi</type>
</artifactItem>
<artifactItem>
......
<div>
If you check this option, Jenkins will retain Javadoc for each successful build.
This allows you to browse Javadoc for older builds, at the expense of additional
disk space requirement.
<p>
If you leave this option unchecked, Jenkins will only keep the latest Javadoc,
so older Javadoc will be overwritten as new builds succeed.
</div>
<div>
Ist diese Option angewählt, bewahrt Jenkins Javadoc-Ausgaben jedes
erfolgreichen Builds auf. Dadurch können Sie die Javadocs früherer Builds
durchsuchen - auf Kosten eines höheren Speicherplatzverbrauchs auf Ihrer
Festplatte.
<p>
Ist diese Option abgewählt, bewahrt Jenkins nur die Javadoc-Ausgaben des
letzten erfolgreichen Builds auf und überschreibt diese, sobald ein neuer
Build erfolgreich abgeschlossen wird.
</div>
\ No newline at end of file
<div>
Si vous cochez cette option, Jenkins conservera les javadocs de chaque build passé avec succès.
Cela permet de naviguer dans les javadocs de build plus anciens, au prix d'une utilisation
plus importante de l'espace disque.
<p>
Si vous laissez cette option décochée, Jenkins ne conservera que les derniers javadocs.
Les anciens javadocs seront donc remplacés à chaque nouveau build qui passe avec succès.
</div>
\ No newline at end of file
<div>
このオプションをチェックすると、成功したビルド毎にJavadocを保存します。
追加のディスク容量が必要になりますが、古いビルドのJavadocを参照できます。
<p>
このオプションをチェックしなければ、最新のJavadocのみを保存しますので、古いJavadocはビルドが成功すると上書きされます。
</div>
\ No newline at end of file
<div>
If you check this option, Jenkins will retain javadoc for each successful build.
This allows you to browser javadoc for older builds, at the expense of additional
disk space requirement.
<p>
If you leave this option unchecked, Jenkins will only keep the latest javadoc,
so older javadoc will be overwritten as new builds succeed.
</div>
\ No newline at end of file
<div>
選用後,Jenkins 保留每次成功建置的 Javadoc。
讓您可以瀏覽舊版建置的 Javadoc,代價是拿磁碟空間來換。
<p>
如果您沒啟用這個選項,Jenkins 只會保留最近一次的 Javadoc,建置成功後先前的 Javadoc 會被蓋掉。
</div>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册