Skip to content
Permalink
Browse files
Merge branch 'master' into JENKINS-18048
Conflicts:
	core/src/main/java/hudson/triggers/SCMTrigger.java
  • Loading branch information
daniel-beck committed Jun 28, 2014
2 parents e937b09 + 0bfab57 commit 8ec206fcd9e7cf222cc54aa4cc37295a4699ba35
Showing with 4,878 additions and 5,873 deletions.
  1. +10 −4 BUILDING.TXT
  2. +1 −1 README.md
  3. +204 −4,708 changelog.html
  4. +1 −1 cli/pom.xml
  5. +5 −5 core/pom.xml
  6. +32 −8 core/src/main/java/hudson/ClassicPluginStrategy.java
  7. +18 −0 core/src/main/java/hudson/FilePath.java
  8. +88 −1 core/src/main/java/hudson/Launcher.java
  9. +18 −5 core/src/main/java/hudson/PluginManager.java
  10. +8 −2 core/src/main/java/hudson/PluginStrategy.java
  11. +1 −1 core/src/main/java/hudson/PluginWrapper.java
  12. +122 −66 core/src/main/java/hudson/Util.java
  13. +68 −0 core/src/main/java/hudson/cli/AddJobToViewCommand.java
  14. +14 −3 core/src/main/java/hudson/cli/BuildCommand.java
  15. +3 −0 core/src/main/java/hudson/cli/InstallToolCommand.java
  16. +68 −0 core/src/main/java/hudson/cli/RemoveJobFromViewCommand.java
  17. +5 −5 core/src/main/java/hudson/fsp/WorkspaceSnapshotSCM.java
  18. +1 −1 core/src/main/java/hudson/lifecycle/UnixLifecycle.java
  19. +2 −1 core/src/main/java/hudson/lifecycle/WindowsServiceLifecycle.java
  20. +51 −10 core/src/main/java/hudson/model/AbstractBuild.java
  21. +3 −3 core/src/main/java/hudson/model/AbstractCIBase.java
  22. +33 −3 core/src/main/java/hudson/model/AbstractItem.java
  23. +19 −13 core/src/main/java/hudson/model/AbstractProject.java
  24. +17 −8 core/src/main/java/hudson/model/Api.java
  25. +21 −5 core/src/main/java/hudson/model/AsyncPeriodicWork.java
  26. +5 −0 core/src/main/java/hudson/model/BooleanParameterValue.java
  27. +5 −4 core/src/main/java/hudson/model/Build.java
  28. +32 −12 core/src/main/java/hudson/model/Cause.java
  29. +10 −10 core/src/main/java/hudson/model/CauseAction.java
  30. +15 −5 core/src/main/java/hudson/model/Computer.java
  31. +16 −1 core/src/main/java/hudson/model/DescriptorVisibilityFilter.java
  32. +79 −0 core/src/main/java/hudson/model/DirectlyModifiableView.java
  33. +8 −7 core/src/main/java/hudson/model/EnvironmentContributor.java
  34. +16 −4 core/src/main/java/hudson/model/Executor.java
  35. +12 −1 core/src/main/java/hudson/model/FileParameterValue.java
  36. +30 −30 core/src/main/java/hudson/model/Items.java
  37. +11 −4 core/src/main/java/hudson/model/Job.java
  38. +5 −0 core/src/main/java/hudson/model/JobParameterValue.java
  39. +51 −11 core/src/main/java/hudson/model/ListView.java
  40. +1 −1 core/src/main/java/hudson/model/Node.java
  41. +6 −1 core/src/main/java/hudson/model/ParameterDefinition.java
  42. +10 −0 core/src/main/java/hudson/model/ParameterValue.java
  43. +28 −8 core/src/main/java/hudson/model/ParametersAction.java
  44. +5 −1 core/src/main/java/hudson/model/ParametersDefinitionProperty.java
  45. +22 −1 core/src/main/java/hudson/model/Project.java
  46. +16 −0 core/src/main/java/hudson/model/Queue.java
  47. +160 −131 core/src/main/java/hudson/model/Run.java
  48. +30 −5 core/src/main/java/hudson/model/RunParameterValue.java
  49. +2 −5 core/src/main/java/hudson/model/SCMedItem.java
  50. +6 −2 core/src/main/java/hudson/model/StringParameterValue.java
  51. +11 −2 core/src/main/java/hudson/model/UpdateCenter.java
  52. +107 −22 core/src/main/java/hudson/model/User.java
  53. +1 −0 core/src/main/java/hudson/model/WorkspaceCleanupThread.java
  54. +61 −11 core/src/main/java/hudson/model/listeners/SCMListener.java
  55. +1 −0 core/src/main/java/hudson/model/listeners/SCMPollListener.java
  56. +5 −1 core/src/main/java/hudson/model/queue/CauseOfBlockage.java
  57. +5 −1 core/src/main/java/hudson/node_monitors/DiskSpaceMonitor.java
  58. +5 −1 core/src/main/java/hudson/node_monitors/TemporarySpaceMonitor.java
  59. +24 −3 core/src/main/java/hudson/scm/AbstractScmTagAction.java
  60. +11 −1 core/src/main/java/hudson/scm/AutoBrowserHolder.java
  61. +21 −8 core/src/main/java/hudson/scm/ChangeLogAnnotator.java
  62. +20 −5 core/src/main/java/hudson/scm/ChangeLogParser.java
  63. +45 −5 core/src/main/java/hudson/scm/ChangeLogSet.java
  64. +9 −3 core/src/main/java/hudson/scm/EmptyChangeLogSet.java
  65. +2 −2 core/src/main/java/hudson/scm/NullChangeLogParser.java
  66. +14 −14 core/src/main/java/hudson/scm/NullSCM.java
  67. +170 −63 core/src/main/java/hudson/scm/SCM.java
  68. +24 −10 core/src/main/java/hudson/scm/SCMDescriptor.java
  69. +6 −5 core/src/main/java/hudson/security/ACL.java
  70. +4 −3 core/src/main/java/hudson/security/AccessControlled.java
  71. +18 −14 core/src/main/java/hudson/security/AuthorizationStrategy.java
  72. +6 −5 core/src/main/java/hudson/security/GlobalSecurityConfiguration.java
  73. +22 −18 core/src/main/java/hudson/security/Permission.java
  74. +29 −1 core/src/main/java/hudson/security/SecurityRealm.java
  75. +6 −1 core/src/main/java/hudson/slaves/AbstractCloudComputer.java
  76. +7 −3 core/src/main/java/hudson/slaves/CloudRetentionStrategy.java
  77. +9 −2 core/src/main/java/hudson/slaves/CommandLauncher.java
  78. +15 −0 core/src/main/java/hudson/slaves/ComputerListener.java
  79. +3 −1 core/src/main/java/hudson/slaves/NodeProperty.java
  80. +2 −1 core/src/main/java/hudson/slaves/NodeSpecific.java
  81. +4 −1 core/src/main/java/hudson/slaves/OfflineCause.java
  82. +6 −2 core/src/main/java/hudson/slaves/RetentionStrategy.java
  83. +13 −4 core/src/main/java/hudson/slaves/SlaveComputer.java
  84. +56 −6 core/src/main/java/hudson/tasks/ArtifactArchiver.java
  85. +1 −3 core/src/main/java/hudson/tasks/BuildTrigger.java
  86. +1 −1 core/src/main/java/hudson/tasks/junit/CaseResult.java
  87. +4 −0 core/src/main/java/hudson/tools/InstallerTranslator.java
  88. +2 −1 core/src/main/java/hudson/tools/ToolInstallation.java
  89. +95 −44 core/src/main/java/hudson/triggers/SCMTrigger.java
  90. +2 −1 core/src/main/java/hudson/util/jna/GNUCLibrary.java
  91. +1 −1 core/src/main/java/jenkins/model/GlobalProjectNamingStrategyConfiguration.java
  92. +305 −0 core/src/main/java/jenkins/model/IdStrategy.java
  93. +35 −0 core/src/main/java/jenkins/model/IdStrategyDescriptor.java
  94. +36 −26 core/src/main/java/jenkins/model/Jenkins.java
  95. +37 −10 core/src/main/java/jenkins/model/PeepholePermalink.java
  96. +4 −2 core/src/main/java/jenkins/security/LastGrantedAuthoritiesProperty.java
  97. +5 −7 core/src/main/java/jenkins/security/SecurityListener.java
  98. +1 −1 core/src/main/java/jenkins/slaves/restarter/JnlpSlaveRestarterInstaller.java
  99. +148 −0 core/src/main/java/jenkins/triggers/SCMTriggerItem.java
  100. +70 −5 core/src/main/java/jenkins/util/ProgressiveRendering.java
  101. +4 −3 core/src/main/resources/hudson/PluginManager/table.properties
  102. +4 −0 core/src/main/resources/hudson/cli/Messages.properties
  103. +1 −1 core/src/main/resources/hudson/diagnosis/HudsonHomeDiskUsageMonitor/index.jelly
  104. +2 −20 core/src/main/resources/hudson/model/AbstractBuild/tasks.jelly
  105. +1 −1 core/src/main/resources/hudson/model/AbstractProject/changes.jelly
  106. +36 −14 core/src/main/resources/hudson/model/Api/index.jelly
  107. +1 −1 core/src/main/resources/hudson/model/Computer/builds.jelly
  108. +1 −1 core/src/main/resources/hudson/model/Computer/sidepanel_pt_BR.properties
  109. +2 −2 core/src/main/resources/hudson/model/Label/sidepanel_pt_BR.properties
  110. +1 −1 core/src/main/resources/hudson/model/ListView/configure-entries.jelly
  111. +2 −2 core/src/main/resources/hudson/model/LoadStatistics/main_pt_BR.properties
  112. +2 −0 core/src/main/resources/hudson/model/Messages.properties
  113. +43 −0 core/src/main/resources/hudson/model/ModifiableItemGroup/_api.jelly
  114. +1 −1 core/src/main/resources/hudson/model/User/builds.jelly
  115. +1 −1 core/src/main/resources/hudson/model/View/ajaxBuildQueue.jelly
  116. +4 −3 core/src/main/resources/hudson/model/View/builds.jelly
  117. +16 −5 core/src/main/resources/hudson/model/queue/CauseOfBlockage/BecauseLabelIsOffline/summary.jelly
  118. +2 −1 core/src/main/resources/hudson/model/queue/CauseOfBlockage/BecauseLabelIsOffline/summary.properties
  119. +5 −3 core/src/main/resources/hudson/scm/SCM/project-changes.jelly
  120. +2 −2 core/src/main/resources/hudson/security/GlobalSecurityConfiguration/index.groovy
  121. +0 −1 core/src/main/resources/hudson/security/HudsonPrivateSecurityRealm/Details/config.jelly
  122. +2 −2 core/src/main/resources/hudson/slaves/ComputerLauncher/main.jelly
  123. +1 −1 core/src/main/resources/hudson/slaves/DumbSlave/configure-entries.jelly
  124. +1 −1 core/src/main/resources/hudson/slaves/DumbSlave/configure-entries_da.properties
  125. +1 −1 core/src/main/resources/hudson/slaves/DumbSlave/configure-entries_de.properties
  126. +1 −1 core/src/main/resources/hudson/slaves/DumbSlave/configure-entries_es.properties
  127. +1 −1 core/src/main/resources/hudson/slaves/DumbSlave/configure-entries_fr.properties
  128. +1 −1 core/src/main/resources/hudson/slaves/DumbSlave/configure-entries_hu.properties
  129. +1 −1 core/src/main/resources/hudson/slaves/DumbSlave/configure-entries_ja.properties
  130. +1 −1 core/src/main/resources/hudson/slaves/DumbSlave/configure-entries_lv.properties
  131. +1 −1 core/src/main/resources/hudson/slaves/DumbSlave/configure-entries_pl.properties
  132. +1 −1 core/src/main/resources/hudson/slaves/DumbSlave/configure-entries_pt_BR.properties
  133. +1 −1 core/src/main/resources/hudson/slaves/DumbSlave/configure-entries_ru.properties
  134. +1 −1 core/src/main/resources/hudson/slaves/DumbSlave/configure-entries_zh_CN.properties
  135. +1 −1 core/src/main/resources/hudson/slaves/DumbSlave/configure-entries_zh_TW.properties
  136. +6 −0 core/src/main/resources/hudson/tasks/ArtifactArchiver/config.jelly
  137. +3 −1 core/src/main/resources/hudson/tasks/ArtifactArchiver/config.properties
  138. +6 −3 core/src/main/resources/hudson/tasks/ArtifactArchiver/config_fr.properties
  139. +38 −0 core/src/main/resources/hudson/tasks/ArtifactArchiver/help-defaultExcludes.groovy
  140. +6 −20 ...mbSlave/configure-entries_tr.properties → tasks/ArtifactArchiver/help-defaultExcludes.properties}
  141. +24 −0 core/src/main/resources/hudson/tasks/ArtifactArchiver/help-defaultExcludes_fr.properties
  142. +3 −3 core/src/main/resources/hudson/tasks/BuildTrigger/config.jelly
  143. +2 −2 core/src/main/resources/hudson/tasks/LogRotator/config_de.properties
  144. +11 −16 core/src/main/resources/hudson/tasks/Maven/help.jelly
  145. +9 −0 core/src/main/resources/hudson/tasks/Maven/help.properties
  146. +0 −24 core/src/main/resources/hudson/tasks/Maven/help_de.jelly
  147. +10 −0 core/src/main/resources/hudson/tasks/Maven/help_de.properties
  148. +0 −26 core/src/main/resources/hudson/tasks/Maven/help_fr.jelly
  149. +12 −0 core/src/main/resources/hudson/tasks/Maven/help_fr.properties
  150. +0 −22 core/src/main/resources/hudson/tasks/Maven/help_ja.jelly
  151. +8 −0 core/src/main/resources/hudson/tasks/Maven/help_ja.properties
  152. +0 −22 core/src/main/resources/hudson/tasks/Maven/help_pt_BR.jelly
  153. +8 −0 core/src/main/resources/hudson/tasks/Maven/help_pt_BR.properties
  154. +0 −24 core/src/main/resources/hudson/tasks/Maven/help_ru.jelly
  155. +10 −0 core/src/main/resources/hudson/tasks/Maven/help_ru.properties
  156. +0 −22 core/src/main/resources/hudson/tasks/Maven/help_tr.jelly
  157. +8 −0 core/src/main/resources/hudson/tasks/Maven/help_tr.properties
  158. +0 −21 core/src/main/resources/hudson/tasks/Maven/help_zh_TW.jelly
  159. +7 −0 core/src/main/resources/hudson/tasks/Maven/help_zh_TW.properties
  160. +1 −0 core/src/main/resources/hudson/tasks/Messages.properties
  161. +2 −1 core/src/main/resources/hudson/tasks/Shell/config.groovy
  162. +2 −0 core/src/main/resources/hudson/triggers/Messages_fr.properties
  163. +2 −2 core/src/main/resources/hudson/triggers/SCMTrigger/BuildAction/index.jelly
  164. +1 −1 core/src/main/resources/hudson/triggers/SCMTrigger/SCMAction/index.jelly
  165. +1 −1 core/src/main/resources/hudson/triggers/SCMTrigger/SCMTriggerCause/description.jelly
  166. +1 −5 core/src/main/resources/hudson/triggers/SCMTrigger/global.jelly
  167. +1 −1 core/src/main/resources/hudson/util/AWTProblem/index.properties
  168. +1 −1 core/src/main/resources/jenkins/diagnosis/HsErrPidList/index.jelly
  169. +1 −1 core/src/main/resources/jenkins/management/Messages_pt_BR.properties
  170. +31 −0 core/src/main/resources/jenkins/model/Jenkins/MasterComputer/_api.jelly
  171. +1 −14 core/src/main/resources/jenkins/model/Jenkins/_api.jelly
  172. +4 −0 core/src/main/resources/jenkins/model/Messages.properties
  173. +3 −15 core/src/main/resources/jenkins/security/ApiTokenProperty/config.groovy
  174. +3 −3 core/src/main/resources/jenkins/triggers/ReverseBuildTrigger/config.jelly
  175. +1 −1 core/src/main/resources/jenkins/widgets/BuildQueueWidget/index.groovy
  176. +2 −1 core/src/main/resources/lib/form/hetero-list.jelly
  177. +1 −0 core/src/main/resources/lib/form/radio.jelly
  178. +2 −2 core/src/main/resources/lib/form/repeatableDeleteButton.jelly
  179. +2 −1 core/src/main/resources/lib/form/section_.css
  180. +2 −2 core/src/main/resources/lib/form/submit.jelly
  181. +4 −7 core/src/main/resources/lib/hudson/buildListTable.jelly
  182. +1 −1 core/src/main/resources/lib/hudson/executors.jelly
  183. +40 −0 core/src/main/resources/lib/hudson/project/console-link.jelly
  184. +13 −2 core/src/main/resources/lib/hudson/queue.jelly
  185. +1 −0 core/src/main/resources/lib/hudson/queue.properties
  186. +1 −1 core/src/main/resources/lib/layout/layout.jelly
  187. +1 −0 core/src/test/java/hudson/cli/ListJobsCommandTest.java
  188. +41 −0 core/src/test/java/hudson/model/ParametersActionTest.java
  189. +62 −0 core/src/test/java/hudson/model/RunParameterValueTest.java
  190. +1 −0 core/src/test/java/jenkins/model/PeepholePermalinkTest.java
  191. +60 −0 debian/debian/changelog
  192. +0 −5 note.txt
  193. +18 −5 plugins/pom.xml
  194. +4 −4 pom.xml
  195. +2 −0 rpm/SOURCES/jenkins.init.in
  196. +18 −0 rpm/SOURCES/jenkins.sysconfig.in
  197. +3 −3 rpm/SPECS/jenkins.spec
  198. +4 −4 test/pom.xml
  199. +10 −0 test/src/main/java/org/jvnet/hudson/test/FakeChangeLogSCM.java
  200. +6 −3 test/src/main/java/org/jvnet/hudson/test/JenkinsRule.java
  201. +103 −0 test/src/main/java/org/jvnet/hudson/test/RestartableJenkinsRule.java
  202. +93 −5 test/src/test/groovy/hudson/cli/BuildCommandTest.groovy
  203. +10 −0 test/src/test/groovy/hudson/model/AbstractProjectTest.groovy
  204. +80 −54 test/src/test/java/hudson/PluginManagerTest.java
  205. +129 −0 test/src/test/java/hudson/ProcStarterTest.java
  206. +117 −0 test/src/test/java/hudson/cli/ViewManipulationTest.java
  207. +203 −0 test/src/test/java/hudson/model/DirectlyModifiableViewTest.java
  208. +59 −0 test/src/test/java/hudson/model/ItemsTest.java
  209. +1 −0 test/src/test/java/hudson/model/ListViewTest.java
  210. +13 −2 test/src/test/java/hudson/model/MyViewTest.java
  211. +36 −5 test/src/test/java/hudson/model/ProjectTest.java
  212. +53 −0 test/src/test/java/hudson/model/UserTest.java
  213. +72 −0 test/src/test/java/hudson/tasks/ArtifactArchiverTest.java
  214. +63 −0 test/src/test/java/hudson/tools/InstallerTranslatorTest.java
  215. +20 −0 test/src/test/java/jenkins/model/JenkinsTest.java
  216. +19 −0 test/src/test/java/jenkins/triggers/ReverseBuildTriggerTest.java
  217. +74 −0 test/src/test/java/jenkins/widgets/BuildListTableTest.java
  218. +1 −1 war/images/makeFlash.sh
  219. +1 −1 war/pom.xml
  220. +155 −3 war/src/main/webapp/css/style.css
  221. +2 −0 war/src/main/webapp/scripts/hudson-behavior.js
  222. +8 −2 war/src/main/webapp/scripts/yui/button/button-debug.js
  223. +11 −10 war/src/main/webapp/scripts/yui/button/button-min.js
@@ -1,6 +1,12 @@
If you want simply to have the jenkins.war as fast as possible (without test execution), just use :
mvn clean install -pl war -am -DskipTests
the war will be in war/target/jenkins.war (you can play with it)
If you want simply to have the jenkins.war as fast as possible (without test
execution), run:

mvn clean install -pl war -am -DskipTests

The WAR file will be in war/target/jenkins.war (you can play with it)
You can deactivate test-harness execution with -Dskip-test-harness
Have Fun !!

For more information on building Jenkins, visit
https://wiki.jenkins-ci.org/display/JENKINS/Building+Jenkins

Have Fun !!
@@ -6,7 +6,7 @@ Copyright © 2004–, Kohsuke Kawaguchi, Sun Microsystems, Inc., and a number of

About
-----
In a nutshell Jenkins CI is the leading open-source continuous integration server. Built with Java, it provides over 300 plugins to support building and testing virtually any project.
In a nutshell Jenkins CI is the leading open-source continuous integration server. Built with Java, it provides over 930 plugins to support building and testing virtually any project.

Downloads
---------

Large diffs are not rendered by default.

@@ -5,7 +5,7 @@
<parent>
<artifactId>pom</artifactId>
<groupId>org.jenkins-ci.main</groupId>
<version>1.564-SNAPSHOT</version>
<version>1.571-SNAPSHOT</version>
</parent>

<artifactId>cli</artifactId>
@@ -29,7 +29,7 @@ THE SOFTWARE.
<parent>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>pom</artifactId>
<version>1.564-SNAPSHOT</version>
<version>1.571-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@@ -42,7 +42,7 @@ THE SOFTWARE.

<properties>
<staplerFork>true</staplerFork>
<stapler.version>1.224</stapler.version>
<stapler.version>1.227</stapler.version>
<spring.version>2.5.6.SEC03</spring.version>
<groovy.version>1.8.9</groovy.version>
</properties>
@@ -112,7 +112,7 @@ THE SOFTWARE.
<dependency>
<groupId>org.jenkins-ci</groupId>
<artifactId>trilead-ssh2</artifactId>
<version>build217-jenkins-3</version>
<version>build217-jenkins-5</version>
</dependency>
<dependency>
<groupId>org.kohsuke.stapler</groupId>
@@ -479,12 +479,12 @@ THE SOFTWARE.
<dependency>
<groupId>org.jvnet.winp</groupId>
<artifactId>winp</artifactId>
<version>1.19</version>
<version>1.20</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci</groupId>
<artifactId>memory-monitor</artifactId>
<version>1.7</version>
<version>1.8</version>
</dependency>
<dependency><!-- StAX implementation. See HUDSON-2547. -->
<groupId>org.codehaus.woodstox</groupId>
@@ -66,6 +66,7 @@
import java.util.List;
import java.util.Vector;
import java.util.jar.Attributes;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -92,15 +93,26 @@ public ClassicPluginStrategy(PluginManager pluginManager) {
this.pluginManager = pluginManager;
}

public PluginWrapper createPluginWrapper(File archive) throws IOException {
final Manifest manifest;
URL baseResourceURL;
@Override public String getShortName(File archive) throws IOException {
Manifest manifest;
if (isLinked(archive)) {
manifest = loadLinkedManifest(archive);
} else {
JarFile jf = new JarFile(archive, false);
try {
manifest = jf.getManifest();
} finally {
jf.close();
}
}
return PluginWrapper.computeShortName(manifest, archive);
}

File expandDir = null;
// if .hpi, this is the directory where war is expanded
private static boolean isLinked(File archive) {
return archive.getName().endsWith(".hpl") || archive.getName().endsWith(".jpl");
}

boolean isLinked = archive.getName().endsWith(".hpl") || archive.getName().endsWith(".jpl");
if (isLinked) {
private static Manifest loadLinkedManifest(File archive) throws IOException {
// resolve the .hpl file to the location of the manifest file
final String firstLine = IOUtils.readFirstLine(new FileInputStream(archive), "UTF-8");
if (firstLine.startsWith("Manifest-Version:")) {
@@ -112,12 +124,24 @@ public PluginWrapper createPluginWrapper(File archive) throws IOException {
// then parse manifest
FileInputStream in = new FileInputStream(archive);
try {
manifest = new Manifest(in);
return new Manifest(in);
} catch (IOException e) {
throw new IOException("Failed to load " + archive, e);
} finally {
in.close();
}
}

@Override public PluginWrapper createPluginWrapper(File archive) throws IOException {
final Manifest manifest;
URL baseResourceURL;

File expandDir = null;
// if .hpi, this is the directory where war is expanded

boolean isLinked = isLinked(archive);
if (isLinked) {
manifest = loadLinkedManifest(archive);
} else {
if (archive.isDirectory()) {// already expanded
expandDir = archive;
@@ -30,6 +30,7 @@
import hudson.Launcher.LocalLauncher;
import hudson.Launcher.RemoteLauncher;
import hudson.model.AbstractProject;
import hudson.model.Computer;
import hudson.model.Item;
import hudson.model.TaskListener;
import hudson.org.apache.tools.tar.TarInputStream;
@@ -69,6 +70,7 @@
import org.apache.tools.zip.ZipFile;
import org.kohsuke.stapler.Stapler;

import javax.annotation.CheckForNull;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileFilter;
@@ -1056,6 +1058,22 @@ public VirtualFile toVirtualFile() {
return VirtualFile.forFilePath(this);
}

/**
* If this {@link FilePath} represents a file on a particular {@link Computer}, return it.
* Otherwise null.
*/
public @CheckForNull Computer toComputer() {
Jenkins j = Jenkins.getInstance();
if (j != null) {
for (Computer c : j.getComputers()) {
if (getChannel()==c.getChannel()) {
return c;
}
}
}
return null;
}

/**
* Creates this directory.
*/
@@ -300,8 +300,13 @@ public ProcStarter envs(String... overrides) {
return this;
}

/**
* Gets a list of environment variables to be set.
* Returns an empty array if envs field has not been initialized.
* @return If initialized, returns a copy of internal envs array. Otherwise - a new empty array.
*/
public String[] envs() {
return envs.clone();
return envs != null ? envs.clone() : new String[0];
}

/**
@@ -972,6 +977,88 @@ public OutputStream getStdin() {
}
}
}

/**
* A launcher which delegates to a provided inner launcher.
* Allows subclasses to only implement methods they want to override.
* Originally, this launcher has been implemented in
* <a href="https://wiki.jenkins-ci.org/display/JENKINS/Custom+Tools+Plugin">
* Custom Tools Plugin</a>.
*
* @author rcampbell
* @author Oleg Nenashev, Synopsys Inc.
* @since TODO: define version
*/
public static class DecoratedLauncher extends Launcher {

private Launcher inner = null;

public DecoratedLauncher(Launcher inner) {
super(inner);
this.inner = inner;
}

@Override
public Proc launch(ProcStarter starter) throws IOException {
return inner.launch(starter);
}

@Override
public Channel launchChannel(String[] cmd, OutputStream out,
FilePath workDir, Map<String, String> envVars) throws IOException,
InterruptedException {
return inner.launchChannel(cmd, out, workDir, envVars);
}

@Override
public void kill(Map<String, String> modelEnvVars) throws IOException,
InterruptedException {
inner.kill(modelEnvVars);
}

@Override
public boolean isUnix() {
return inner.isUnix();
}

@Override
public Proc launch(String[] cmd, boolean[] mask, String[] env, InputStream in, OutputStream out, FilePath workDir) throws IOException {
return inner.launch(cmd, mask, env, in, out, workDir);
}

@Override
public Computer getComputer() {
return inner.getComputer();
}

@Override
public TaskListener getListener() {
return inner.getListener();
}

@Override
public String toString() {
return super.toString() + "; decorates " + inner.toString();
}

@Override
public VirtualChannel getChannel() {
return inner.getChannel();
}

@Override
public Proc launch(String[] cmd, String[] env, InputStream in, OutputStream out, FilePath workDir) throws IOException {
return inner.launch(cmd, env, in, out, workDir);
}

/**
* Gets nested launcher.
* @return Inner launcher
*/
public Launcher getInner() {
return inner;
}
}

public static class IOTriplet implements Serializable {
InputStream stdout,stderr;
@@ -412,11 +412,21 @@ private boolean containsHpiJpi(Collection<String> bundledPlugins, String name) {
*/
public void dynamicLoad(File arc) throws IOException, InterruptedException, RestartRequiredException {
LOGGER.info("Attempting to dynamic load "+arc);
final PluginWrapper p = strategy.createPluginWrapper(arc);
String sn = p.getShortName();
PluginWrapper p = null;
String sn;
try {
sn = strategy.getShortName(arc);
} catch (AbstractMethodError x) {
LOGGER.log(WARNING, "JENKINS-12753 fix not active: {0}", x.getMessage());
p = strategy.createPluginWrapper(arc);
sn = p.getShortName();
}
if (getPlugin(sn)!=null)
throw new RestartRequiredException(Messages._PluginManager_PluginIsAlreadyInstalled_RestartRequired(sn));

if (p == null) {
p = strategy.createPluginWrapper(arc);
}
if (p.supportsDynamicLoad()== YesNoMaybe.NO)
throw new RestartRequiredException(Messages._PluginManager_PluginDoesntSupportDynamicLoad_RestartRequired(sn));

@@ -442,10 +452,11 @@ public void dynamicLoad(File arc) throws IOException, InterruptedException, Rest

// run initializers in the added plugin
Reactor r = new Reactor(InitMilestone.ordering());
r.addAll(new InitializerFinder(p.classLoader) {
final ClassLoader loader = p.classLoader;
r.addAll(new InitializerFinder(loader) {
@Override
protected boolean filter(Method e) {
return e.getDeclaringClass().getClassLoader()!=p.classLoader || super.filter(e);
return e.getDeclaringClass().getClassLoader() != loader || super.filter(e);
}
}.discoverTasks(r));
try {
@@ -721,7 +732,9 @@ public void doInstall(StaplerRequest req, StaplerResponse rsp) throws IOExceptio
String pluginName = n.substring(0, index);
String siteName = n.substring(index + 1);
UpdateSite updateSite = Jenkins.getInstance().getUpdateCenter().getById(siteName);
if (siteName != null) {
if (updateSite == null) {
throw new Failure("No such update center: " + siteName);
} else {
UpdateSite.Plugin plugin = updateSite.getPlugin(pluginName);
if (plugin != null) {
if (p != null) {
@@ -24,11 +24,10 @@
package hudson;

import hudson.model.Hudson;
import jenkins.model.Jenkins;

import java.io.File;
import java.io.IOException;
import java.util.List;
import javax.annotation.Nonnull;

/**
* Pluggability point for how to create {@link PluginWrapper}.
@@ -50,6 +49,13 @@
PluginWrapper createPluginWrapper(File archive)
throws IOException;

/**
* Finds the plugin name without actually unpacking anything {@link #createPluginWrapper} would.
* Needed by {@link PluginManager#dynamicLoad} to decide whether such a plugin is already installed.
* @return the {@link PluginWrapper#getShortName}
*/
@Nonnull String getShortName(File archive) throws IOException;

/**
* Loads the plugin and starts it.
*
@@ -238,7 +238,7 @@ public URL getIndexPage() {
return idx != null && idx.toString().contains(shortName) ? idx : null;
}

private String computeShortName(Manifest manifest, File archive) {
static String computeShortName(Manifest manifest, File archive) {
// use the name captured in the manifest, as often plugins
// depend on the specific short name in its URLs.
String n = manifest.getMainAttributes().getValue("Short-Name");

0 comments on commit 8ec206f

Please sign in to comment.