diff --git a/changelog.html b/changelog.html index 40e3bd9ece..dca432205f 100644 --- a/changelog.html +++ b/changelog.html @@ -77,6 +77,8 @@ Upcoming changes
  • Support self restart on Mac OS X 10.6 and onward (issue 7537) +
  • + Added "about Jenkins" screen that shows the 3rd party license acknowledgement. diff --git a/core/pom.xml b/core/pom.xml index 923e4692f7..1864c989ac 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -225,6 +225,13 @@ THE SOFTWARE. + + com.cloudbees + maven-license-plugin + + target/classes/META-INF/licenses.xml + + @@ -348,9 +355,9 @@ THE SOFTWARE. ${project.version} - org.jvnet.hudson + org.jenkins-ci crypto-util - 1.0 + 1.1 org.jvnet.hudson @@ -438,11 +445,6 @@ THE SOFTWARE. localizer 1.10 - - org.kohsuke - graph-layouter - 1.0 - antlr antlr @@ -685,9 +687,9 @@ THE SOFTWARE. 1.14 - org.jvnet.hudson + org.jenkins-ci memory-monitor - 1.3 + 1.4 com.octo.captcha @@ -778,17 +780,17 @@ THE SOFTWARE. net.java.sezpoz sezpoz - 1.7 + 1.9 - org.jvnet.hudson + org.jenkins-ci jinterop-wmi - 1.0 + 1.1 - org.jvnet.hudson + org.jenkins-ci windows-remote-command - 1.0 + 1.3 org.kohsuke.metainf-services diff --git a/core/src/main/java/hudson/AboutJenkins.java b/core/src/main/java/hudson/AboutJenkins.java new file mode 100644 index 0000000000..e8136e1f5d --- /dev/null +++ b/core/src/main/java/hudson/AboutJenkins.java @@ -0,0 +1,30 @@ +package hudson; + +import hudson.model.ManagementLink; + +/** + * Show "About Jenkins" link. + * + * @author Kohsuke Kawaguchi + */ +@Extension +public class AboutJenkins extends ManagementLink { + @Override + public String getIconFileName() { + return "help.png"; + } + + @Override + public String getUrlName() { + return "about"; + } + + public String getDisplayName() { + return Messages.AboutJenkins_DisplayName(); + } + + @Override + public String getDescription() { + return Messages.AboutJenkins_Description(); + } +} diff --git a/core/src/main/java/hudson/PluginWrapper.java b/core/src/main/java/hudson/PluginWrapper.java index 55e038bb93..168edc426b 100644 --- a/core/src/main/java/hudson/PluginWrapper.java +++ b/core/src/main/java/hudson/PluginWrapper.java @@ -397,6 +397,15 @@ public class PluginWrapper implements Comparable { return manifest.getMainAttributes().getValue("Plugin-Class"); } + public boolean hasLicensesXml() { + try { + new URL(baseResourceURL,"WEB-INF/licenses.xml").openStream().close(); + return true; + } catch (IOException e) { + return false; + } + } + /** * Makes sure that all the dependencies exist, and then accept optional dependencies * as real dependencies. diff --git a/core/src/main/java/hudson/model/DependencyGraph.java b/core/src/main/java/hudson/model/DependencyGraph.java index 615332e6ab..890454e91e 100644 --- a/core/src/main/java/hudson/model/DependencyGraph.java +++ b/core/src/main/java/hudson/model/DependencyGraph.java @@ -28,14 +28,7 @@ import hudson.security.ACL; import hudson.security.NotSerilizableSecurityContext; import org.acegisecurity.context.SecurityContext; import org.acegisecurity.context.SecurityContextHolder; -import org.kohsuke.stapler.StaplerRequest; -import org.kohsuke.stapler.StaplerResponse; -import org.kohsuke.graph_layouter.Layout; -import org.kohsuke.graph_layouter.Navigator; -import org.kohsuke.graph_layouter.Direction; -import javax.servlet.ServletOutputStream; -import javax.imageio.ImageIO; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -49,17 +42,6 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.Stack; -import java.io.IOException; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Rectangle; -import java.awt.Graphics2D; -import java.awt.Color; -import java.awt.Point; -import java.awt.HeadlessException; -import java.awt.FontMetrics; -import java.awt.geom.AffineTransform; -import java.awt.image.BufferedImage; /** * Maintains the build dependencies between {@link AbstractProject}s @@ -319,97 +301,97 @@ public final class DependencyGraph implements Comparator { return Collections.unmodifiableMap(m); } - /** - * Experimental visualization of project dependencies. - */ - public void doGraph( StaplerRequest req, StaplerResponse rsp ) throws IOException { - // Require admin permission for now (avoid exposing project names with restricted permissions) - Hudson.getInstance().checkPermission(Hudson.ADMINISTER); - try { - - // creates a dummy graphics just so that we can measure font metrics - BufferedImage emptyImage = new BufferedImage(1,1, BufferedImage.TYPE_INT_RGB ); - Graphics2D graphics = emptyImage.createGraphics(); - graphics.setFont(FONT); - final FontMetrics fontMetrics = graphics.getFontMetrics(); - - // TODO: timestamp check - Layout layout = new Layout(new Navigator() { - public Collection vertices() { - // only include projects that have some dependency - List r = new ArrayList(); - for (AbstractProject p : Hudson.getInstance().getAllItems(AbstractProject.class)) { - if(!getDownstream(p).isEmpty() || !getUpstream(p).isEmpty()) - r.add(p); - } - return r; - } - - public Collection edge(AbstractProject p) { - return getDownstream(p); - } - - public Dimension getSize(AbstractProject p) { - int w = fontMetrics.stringWidth(p.getDisplayName()) + MARGIN*2; - return new Dimension(w, fontMetrics.getHeight() + MARGIN*2); - } - }, Direction.LEFTRIGHT); - - Rectangle area = layout.calcDrawingArea(); - area.grow(4,4); // give it a bit of margin - BufferedImage image = new BufferedImage(area.width, area.height, BufferedImage.TYPE_INT_RGB ); - Graphics2D g2 = image.createGraphics(); - g2.setTransform(AffineTransform.getTranslateInstance(-area.x,-area.y)); - g2.setPaint(Color.WHITE); - g2.fill(area); - g2.setFont(FONT); - - g2.setPaint(Color.BLACK); - for( AbstractProject p : layout.vertices() ) { - final Point sp = center(layout.vertex(p)); - - for (AbstractProject q : layout.edges(p)) { - Point cur=sp; - for( Point pt : layout.edge(p,q) ) { - g2.drawLine(cur.x, cur.y, pt.x, pt.y); - cur=pt; - } - - final Point ep = center(layout.vertex(q)); - g2.drawLine(cur.x, cur.y, ep.x, ep.y); - } - } - - int diff = fontMetrics.getAscent()+fontMetrics.getLeading()/2; - - for( AbstractProject p : layout.vertices() ) { - Rectangle r = layout.vertex(p); - g2.setPaint(Color.WHITE); - g2.fillRect(r.x, r.y, r.width, r.height); - g2.setPaint(Color.BLACK); - g2.drawRect(r.x, r.y, r.width, r.height); - g2.drawString(p.getDisplayName(), r.x+MARGIN, r.y+MARGIN+ diff); - } - - rsp.setContentType("image/png"); - ServletOutputStream os = rsp.getOutputStream(); - ImageIO.write(image, "PNG", os); - os.close(); - } catch(HeadlessException e) { - // not available. send out error message - rsp.sendRedirect2(req.getContextPath()+"/images/headless.png"); - } - } - - private Point center(Rectangle r) { - return new Point(r.x+r.width/2,r.y+r.height/2); - } - - private static final Font FONT = new Font("TimesRoman", Font.PLAIN, 10); - /** - * Margins between the project name and its bounding box. - */ - private static final int MARGIN = 4; +// /** +// * Experimental visualization of project dependencies. +// */ +// public void doGraph( StaplerRequest req, StaplerResponse rsp ) throws IOException { +// // Require admin permission for now (avoid exposing project names with restricted permissions) +// Hudson.getInstance().checkPermission(Hudson.ADMINISTER); +// try { +// +// // creates a dummy graphics just so that we can measure font metrics +// BufferedImage emptyImage = new BufferedImage(1,1, BufferedImage.TYPE_INT_RGB ); +// Graphics2D graphics = emptyImage.createGraphics(); +// graphics.setFont(FONT); +// final FontMetrics fontMetrics = graphics.getFontMetrics(); +// +// // TODO: timestamp check +// Layout layout = new Layout(new Navigator() { +// public Collection vertices() { +// // only include projects that have some dependency +// List r = new ArrayList(); +// for (AbstractProject p : Hudson.getInstance().getAllItems(AbstractProject.class)) { +// if(!getDownstream(p).isEmpty() || !getUpstream(p).isEmpty()) +// r.add(p); +// } +// return r; +// } +// +// public Collection edge(AbstractProject p) { +// return getDownstream(p); +// } +// +// public Dimension getSize(AbstractProject p) { +// int w = fontMetrics.stringWidth(p.getDisplayName()) + MARGIN*2; +// return new Dimension(w, fontMetrics.getHeight() + MARGIN*2); +// } +// }, Direction.LEFTRIGHT); +// +// Rectangle area = layout.calcDrawingArea(); +// area.grow(4,4); // give it a bit of margin +// BufferedImage image = new BufferedImage(area.width, area.height, BufferedImage.TYPE_INT_RGB ); +// Graphics2D g2 = image.createGraphics(); +// g2.setTransform(AffineTransform.getTranslateInstance(-area.x,-area.y)); +// g2.setPaint(Color.WHITE); +// g2.fill(area); +// g2.setFont(FONT); +// +// g2.setPaint(Color.BLACK); +// for( AbstractProject p : layout.vertices() ) { +// final Point sp = center(layout.vertex(p)); +// +// for (AbstractProject q : layout.edges(p)) { +// Point cur=sp; +// for( Point pt : layout.edge(p,q) ) { +// g2.drawLine(cur.x, cur.y, pt.x, pt.y); +// cur=pt; +// } +// +// final Point ep = center(layout.vertex(q)); +// g2.drawLine(cur.x, cur.y, ep.x, ep.y); +// } +// } +// +// int diff = fontMetrics.getAscent()+fontMetrics.getLeading()/2; +// +// for( AbstractProject p : layout.vertices() ) { +// Rectangle r = layout.vertex(p); +// g2.setPaint(Color.WHITE); +// g2.fillRect(r.x, r.y, r.width, r.height); +// g2.setPaint(Color.BLACK); +// g2.drawRect(r.x, r.y, r.width, r.height); +// g2.drawString(p.getDisplayName(), r.x+MARGIN, r.y+MARGIN+ diff); +// } +// +// rsp.setContentType("image/png"); +// ServletOutputStream os = rsp.getOutputStream(); +// ImageIO.write(image, "PNG", os); +// os.close(); +// } catch(HeadlessException e) { +// // not available. send out error message +// rsp.sendRedirect2(req.getContextPath()+"/images/headless.png"); +// } +// } +// +// private Point center(Rectangle r) { +// return new Point(r.x+r.width/2,r.y+r.height/2); +// } +// +// private static final Font FONT = new Font("TimesRoman", Font.PLAIN, 10); +// /** +// * Margins between the project name and its bounding box. +// */ +// private static final int MARGIN = 4; private static final Comparator NAME_COMPARATOR = new Comparator() { diff --git a/core/src/main/resources/hudson/AboutJenkins/index.jelly b/core/src/main/resources/hudson/AboutJenkins/index.jelly new file mode 100644 index 0000000000..2e3fb75453 --- /dev/null +++ b/core/src/main/resources/hudson/AboutJenkins/index.jelly @@ -0,0 +1,43 @@ + + + + + + + +

    ${%about(app.VERSION)}

    +

    + ${%blurb} +

    + +

    + ${%dependencies} +

    + + + +
    +
    +
    diff --git a/core/src/main/resources/hudson/AboutJenkins/index.properties b/core/src/main/resources/hudson/AboutJenkins/index.properties new file mode 100644 index 0000000000..4f677ba18d --- /dev/null +++ b/core/src/main/resources/hudson/AboutJenkins/index.properties @@ -0,0 +1,4 @@ +about=About Jenkins {0} +blurb=Jenkins is a community-developed open-source continuous integration server. + +dependencies=Jenkins depends on the following 3rd party libraries. \ No newline at end of file diff --git a/core/src/main/resources/hudson/Messages.properties b/core/src/main/resources/hudson/Messages.properties index c0d3d797b5..c4edc3a6d9 100644 --- a/core/src/main/resources/hudson/Messages.properties +++ b/core/src/main/resources/hudson/Messages.properties @@ -50,3 +50,5 @@ Util.pastTime={0} FilePath.TildaDoesntWork=''~'' is only supported in a Unix shell and nowhere else. PluginManager.DisplayName=Plugin Manager +AboutJenkins.DisplayName=About Jenkins +AboutJenkins.Description=See the version and license information diff --git a/core/src/main/resources/hudson/PluginManager/installed.jelly b/core/src/main/resources/hudson/PluginManager/installed.jelly index 17b5453dd0..1bc311a098 100644 --- a/core/src/main/resources/hudson/PluginManager/installed.jelly +++ b/core/src/main/resources/hudson/PluginManager/installed.jelly @@ -67,7 +67,9 @@ THE SOFTWARE. - ${p.version} + + ${p.version} + diff --git a/core/src/main/resources/hudson/PluginWrapper/3rdPartyLicenses.jelly b/core/src/main/resources/hudson/PluginWrapper/3rdPartyLicenses.jelly new file mode 100644 index 0000000000..1c6e4fa397 --- /dev/null +++ b/core/src/main/resources/hudson/PluginWrapper/3rdPartyLicenses.jelly @@ -0,0 +1,44 @@ + + + + + + +

    ${%about(it.longName+' '+it.version)}

    + +

    ${%3rd Party Dependencies}

    + + + + + + +

    ${%No information recorded}

    +
    +
    +
    +
    +
    +
    diff --git a/core/src/main/resources/hudson/PluginWrapper/3rdPartyLicenses.properties b/core/src/main/resources/hudson/PluginWrapper/3rdPartyLicenses.properties new file mode 100644 index 0000000000..d01c4dc500 --- /dev/null +++ b/core/src/main/resources/hudson/PluginWrapper/3rdPartyLicenses.properties @@ -0,0 +1 @@ +about=About {0} \ No newline at end of file diff --git a/core/src/main/resources/lib/hudson/3rdPartyLicenses.jelly b/core/src/main/resources/lib/hudson/3rdPartyLicenses.jelly new file mode 100644 index 0000000000..4279924160 --- /dev/null +++ b/core/src/main/resources/lib/hudson/3rdPartyLicenses.jelly @@ -0,0 +1,57 @@ + + + + + + + + + + + + + +
    ${%Name}${%Maven ID}${%License}
    +
    + + + + ${attrs.name} + + + ${attrs.groupId}:${attrs.artifactId}:${attrs.version} + + + + + + + + + ${attrs.name}
    +
    +
    + +
    diff --git a/licenseCompleter.groovy b/licenseCompleter.groovy new file mode 100644 index 0000000000..1d2b550e23 --- /dev/null +++ b/licenseCompleter.groovy @@ -0,0 +1,103 @@ +/* + This script auguments the missing license information in our dependencies. +*/ +complete { + // license constants + def apacheLicense = license("The Apache Software License, Version 2.0","http://www.apache.org/licenses/LICENSE-2.0.txt") + def cddl = license("CDDL","http://www.sun.com/cddl/") + def lgpl = license("LGPL 2.1","http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html") + def mitLicense = license("MIT License","http://www.opensource.org/licenses/mit-license.php") + def jenkinsLicense = license("MIT License","http://jenkins-ci.org/mit-license") + + + match("asm:*") { + rewriteLicense([], license("BSD License","http://asm.ow2.org/license.html")) + } + + // Apache components + // logkit is a part of Avalon + match(["org.apache.ant:*","commons-jelly:*","log4j:*","avalon-framework:*","logkit:logkit","oro:oro","org.jvnet.hudson:commons-jelly","org.jvnet.hudson:commons-jelly-tags-define","slide:slide-webdavlib"]) { + rewriteLicense([], apacheLicense) + } + + // GlassFish components are dual-licensed between CDDL and GPL+Classpath Exception + // we elect to take them under CDDL. + match(["javax.mail:*","org.jvnet.hudson:activation","org.jvnet:tiger-types","javax.servlet:jstl"]) { + rewriteLicense([], cddl) + } + + match("antlr:*") { + rewriteLicense([], license("BSD License","http://www.antlr.org/license.html")) + } + + match("jaxen:jaxen") { + rewriteLicense([], license("BSD License","http://jaxen.codehaus.org/license.html")) + } + + match("args4j:args4j") { + rewriteLicense([], mitLicense) + } + + match("*:dom4j") { + rewriteLicense([],license("BSD License","http://dom4j.sourceforge.net/dom4j-1.6.1/license.html")) + } + + match(["org.codehaus.groovy:*"]) { + // see http://groovy.codehaus.org/License+Information + // see http://jmdns.sourceforge.net/license.html + rewriteLicense([],apacheLicense) + } + + match("*:stapler-adjunct-timeline") { + rewriteLicense([],license("BSD License","http://simile.mit.edu/license.html")) + } + + match("*:txw2") { + // see http://java.net/projects/jaxb/sources/version2/content/trunk/txw2/license.txt?rev=3611 + rewriteLicense([],cddl) + } + + match(["org.kohsuke.jinterop:j-interop","org.kohsuke.jinterop:j-interopdeps"]) { + rewriteLicense([],license("LGPL v3","http://www.j-interop.org/license.html")) + } + + // these are our own modules that have license in the trunk but not in these released versions + // as we upgrade them, we should just pick up the license info from POM + match(["org.jenkins-ci.modules:instance-identity","org.jvnet.hudson:task-reactor","org.jvnet.hudson:annotation-indexer","*:jinterop-wmi","*:maven2.1-interceptor","*:hudson-maven-embedder"]) { + rewriteLicense([],jenkinsLicense) + } + + match("*:jna") { + rewriteLicense([],lgpl) + } + + match(["org.jvnet.localizer:localizer","*:trilead-putty-extension"]) { + // see http://java.net/projects/localizer + // see http://java.net/projects/trilead-putty-extension/ + rewriteLicense([],mitLicense); + } + + match("org.codehaus.plexus:plexus-interactivity-api") { + rewriteLicense([],mitLicense) + } + + match("de.zeigermann.xml:xml-im-exporter:1.1") { + rewriteLicense([],license("BSD License","http://xml-im-exporter.cvs.sourceforge.net/viewvc/xml-im-exporter/xml-im-exporter/Copying.txt?revision=1.3&view=markup")) + } + + match("*:sezpoz") { + // GPL-phobia people react to "GPL" strongly, so accept sezpoz under CDDL + rewriteLicense([license("CDDL or GPL 2 with Classpath Exception",null)],cddl); + } + + + + + // + // Choose from multi-licensed modules + //========================================================================== + + match("*:jna-posix") { + accept("GNU Lesser General Public License Version 2.1") + } +} diff --git a/maven-plugin/pom.xml b/maven-plugin/pom.xml index 95c8ad6f44..ad92a68812 100644 --- a/maven-plugin/pom.xml +++ b/maven-plugin/pom.xml @@ -241,7 +241,7 @@ THE SOFTWARE. org.jenkins-ci.lib lib-jenkins-maven-artifact-manager - 1.1 + 1.2 commons-io @@ -343,13 +343,20 @@ THE SOFTWARE. generate - + Messages.properties target/generated-sources/localizer + + com.cloudbees + maven-license-plugin + + target/${project.artifactId}/WEB-INF/licenses.xml + + org.jvnet.maven-antrun-extended-plugin maven-antrun-extended-plugin diff --git a/plugins/pom.xml b/plugins/pom.xml index c91fa29e72..a79b6d66e0 100644 --- a/plugins/pom.xml +++ b/plugins/pom.xml @@ -192,6 +192,50 @@ + + com.cloudbees + maven-license-plugin + 1.1 + + + + process + + compile + + + target/${project.artifactId}/WEB-INF/licenses.xml + + if (e.value.packaging=="hpi") + plugins.add(e.key.id) + } + + // filter out dependencies that don't belong to this plugin + models.entrySet().removeAll(models.entrySet().findAll { e -> + def a = e.key; + + if (a.dependencyTrail.size()>0 && plugins.contains(a.dependencyTrail[1])) + return true; // ignore transitive dependencies through other plugins + + // if the dependency goes through jenkins core, we don't need to bundle it in the war + // because jenkins-core comes in the scope, I think this is a bug in Maven that it puts such + // dependencies into the artifact list. + if (a.dependencyTrail.find { trail -> trail.contains(":hudson-core:") || trail.contains(":jenkins-core:") }) + return true; + + return false; + }) + } + ]]> + + + + diff --git a/pom.xml b/pom.xml index 6d13ac74fb..c001d496dd 100644 --- a/pom.xml +++ b/pom.xml @@ -162,6 +162,23 @@ THE SOFTWARE. access-modifier-checker 1.0 + + com.cloudbees + maven-license-plugin + 1.1 + + + + process + + compile + + true + + + + + diff --git a/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java b/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java index cdada4869e..7690c7a08b 100644 --- a/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java +++ b/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java @@ -130,14 +130,7 @@ import java.util.List; import java.util.Locale; import java.util.Set; import java.util.UUID; -import java.util.concurrent.Callable; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.concurrent.SynchronousQueue; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; +import java.util.concurrent.*; import java.util.jar.Manifest; import java.util.logging.Filter; import java.util.logging.Level; @@ -451,7 +444,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { SocketConnector connector = new SocketConnector(); connector.setHeaderBufferSize(12*1024); // use a bigger buffer as Stapler traces can get pretty large on deeply nested URL - server.setThreadPool(new ThreadPoolImpl(new ThreadPoolExecutor(1, 10, 10L, TimeUnit.SECONDS, new SynchronousQueue(),new ThreadFactory() { + server.setThreadPool(new ThreadPoolImpl(new ThreadPoolExecutor(10, 10, 10L, TimeUnit.SECONDS, new LinkedBlockingQueue(),new ThreadFactory() { public Thread newThread(Runnable r) { Thread t = new Thread(r); t.setName("Jetty Thread Pool"); @@ -695,11 +688,14 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { */ public DumbSlave createSlave(String labels, EnvVars env) throws Exception { synchronized (hudson) { - // this synchronization block is so that we don't end up adding the same slave name more than once. - int sz = hudson.getNodes().size(); + return createSlave("slave" + sz,labels,env); + } + } - DumbSlave slave = new DumbSlave("slave" + sz, "dummy", + public DumbSlave createSlave(String nodeName, String labels, EnvVars env) throws Exception { + synchronized (hudson) { + DumbSlave slave = new DumbSlave(nodeName, "dummy", createTmpDir().getPath(), "1", Mode.NORMAL, labels==null?"":labels, createComputerLauncher(env), RetentionStrategy.NOOP, Collections.EMPTY_LIST); hudson.addNode(slave); return slave;