diff --git a/core/src/main/java/hudson/model/AbstractProject.java b/core/src/main/java/hudson/model/AbstractProject.java
index 1188f82da3..80b3ea0f3c 100644
--- a/core/src/main/java/hudson/model/AbstractProject.java
+++ b/core/src/main/java/hudson/model/AbstractProject.java
@@ -147,6 +147,12 @@ public abstract class AbstractProject
,R extends A
*/
protected volatile boolean disabled;
+ /**
+ * True to keep builds of this project in queue when upstream projects are
+ * building. False by default to keep from breaking existing behavior.
+ */
+ protected volatile boolean blockBuildWhenUpstreamBuilding = false;
+
/**
* Identifies {@link JDK} to be used.
* Null if no explicit configuration is required.
@@ -411,6 +417,10 @@ public abstract class AbstractProject
,R extends A
return true;
}
+ public boolean blockBuildWhenUpstreamBuilding() {
+ return blockBuildWhenUpstreamBuilding;
+ }
+
public boolean isDisabled() {
return disabled;
}
@@ -818,20 +828,58 @@ public abstract class AbstractProject
,R extends A
*
*
* A project must be blocked if its own previous build is in progress,
- * but derived classes can also check other conditions.
+ * or if the blockBuildWhenUpstreamBuilding option is true and an upstream
+ * project is building, but derived classes can also check other conditions.
*/
public boolean isBuildBlocked() {
- return isBuilding() && !isConcurrentBuild();
+ boolean blocked = isBuilding() && !isConcurrentBuild();
+ if (!blocked && blockBuildWhenUpstreamBuilding) {
+ AbstractProject bup = getBuildingUpstream();
+ if(bup!=null) {
+ return true;
+ }
+ }
+ return blocked;
+
}
public String getWhyBlocked() {
- AbstractBuild, ?> build = getLastBuild();
- Executor e = build.getExecutor();
- String eta="";
- if(e!=null)
- eta = Messages.AbstractProject_ETA(e.getEstimatedRemainingTime());
- int lbn = build.getNumber();
- return Messages.AbstractProject_BuildInProgress(lbn,eta);
+ if (isBuilding() && !isConcurrentBuild()) {
+ AbstractBuild, ?> build = getLastBuild();
+ Executor e = build.getExecutor();
+ String eta="";
+ if(e!=null)
+ eta = Messages.AbstractProject_ETA(e.getEstimatedRemainingTime());
+ int lbn = build.getNumber();
+ return Messages.AbstractProject_BuildInProgress(lbn,eta);
+ }
+ else {
+ AbstractProject bup = getBuildingUpstream();
+ String projectName = "";
+ if(bup!=null) {
+ projectName = bup.getName();
+ }
+ return Messages.AbstractProject_UpstreamBuildInProgress(projectName);
+ }
+ }
+
+
+ /**
+ * Returns the project if any of the upstream project (or itself) is either
+ * building or is in the queue.
+ *
+ * This means eventually there will be an automatic triggering of
+ * the given project (provided that all builds went smoothly.)
+ */
+ protected AbstractProject getBuildingUpstream() {
+ DependencyGraph graph = Hudson.getInstance().getDependencyGraph();
+ Set tups = graph.getTransitiveUpstream(this);
+ tups.add(this);
+ for (AbstractProject tup : tups) {
+ if(tup!=this && (tup.isBuilding() || tup.isInQueue()))
+ return tup;
+ }
+ return null;
}
public final long getEstimatedDuration() {
diff --git a/core/src/main/resources/hudson/model/AbstractItem/configure-common.jelly b/core/src/main/resources/hudson/model/AbstractItem/configure-common.jelly
index af70c252df..1498ac246d 100644
--- a/core/src/main/resources/hudson/model/AbstractItem/configure-common.jelly
+++ b/core/src/main/resources/hudson/model/AbstractItem/configure-common.jelly
@@ -66,6 +66,7 @@ THE SOFTWARE.
+
diff --git a/core/src/main/resources/hudson/model/Messages.properties b/core/src/main/resources/hudson/model/Messages.properties
index 9d04101085..364bbc0d27 100644
--- a/core/src/main/resources/hudson/model/Messages.properties
+++ b/core/src/main/resources/hudson/model/Messages.properties
@@ -28,6 +28,7 @@ AbstractProject.NewBuildForWorkspace=Scheduling a new build to get a workspace.
AbstractProject.Pronoun=Project
AbstractProject.Aborted=Aborted
AbstractProject.BuildInProgress=Build #{0} is already in progress{1}
+AbstractProject.UpstreamBuildInProgress=Upstream project {0} is already building.
AbstractProject.Disabled=Build disabled
AbstractProject.ETA=\ (ETA:{0})
AbstractProject.NoSCM=No SCM
diff --git a/core/src/main/resources/lib/hudson/project/config-blockWhenUpstreamBuilding.jelly b/core/src/main/resources/lib/hudson/project/config-blockWhenUpstreamBuilding.jelly
new file mode 100644
index 0000000000..d6ef66e07c
--- /dev/null
+++ b/core/src/main/resources/lib/hudson/project/config-blockWhenUpstreamBuilding.jelly
@@ -0,0 +1,29 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/core/src/main/resources/lib/hudson/project/config-blockWhenUpstreamBuilding_ja.properties b/core/src/main/resources/lib/hudson/project/config-blockWhenUpstreamBuilding_ja.properties
new file mode 100644
index 0000000000..96f513edae
--- /dev/null
+++ b/core/src/main/resources/lib/hudson/project/config-blockWhenUpstreamBuilding_ja.properties
@@ -0,0 +1,23 @@
+# The MIT License
+#
+# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Seiji Sogabe
+#
+# 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.
+
+Block\ build\ when\ upstream\ project\ is\ building=\u4F9D\u5B58\u3059\u308B\u30D3\u30EB\u30C9\u304C\u30D3\u30EB\u30C9\u4E2D\u306E\u5834\u5408\u306F\u30D3\u30EB\u30C9\u3057\u306A\u3044
diff --git a/maven-plugin/src/main/java/hudson/maven/AbstractMavenProject.java b/maven-plugin/src/main/java/hudson/maven/AbstractMavenProject.java
index 50a45e4fbc..3fc645dbef 100644
--- a/maven-plugin/src/main/java/hudson/maven/AbstractMavenProject.java
+++ b/maven-plugin/src/main/java/hudson/maven/AbstractMavenProject.java
@@ -80,60 +80,6 @@ public abstract class AbstractMavenProject,R exte
}
}
- // Switching this back to default to false.
- private boolean blockBuildWhenUpstreamBuilding = false;
-
protected abstract void addTransientActionsFromBuild(R lastBuild, Set added);
- @Override
- public boolean isBuildBlocked() {
- boolean blocked = super.isBuildBlocked();
- if (!blocked && blockBuildWhenUpstreamBuilding) {
- AbstractProject bup = getBuildingUpstream();
- if(bup!=null) {
- return true;
- }
- }
- return blocked;
- }
-
- public String getWhyBlocked() {
- if (super.isBuildBlocked()) {
- return super.getWhyBlocked();
- } else {
- AbstractProject bup = getBuildingUpstream();
- String projectName = "";
- if(bup!=null) {
- projectName = bup.getName();
- }
- return "Upstream project is building: " + projectName;
- }
- }
-
- /**
- * Returns the project if any of the upstream project (or itself) is either
- * building or is in the queue.
- *
- * This means eventually there will be an automatic triggering of
- * the given project (provided that all builds went smoothly.)
- */
- private AbstractProject getBuildingUpstream() {
- DependencyGraph graph = Hudson.getInstance().getDependencyGraph();
- Set tups = graph.getTransitiveUpstream(this);
- tups.add(this);
- for (AbstractProject tup : tups) {
- if(tup!=this && (tup.isBuilding() || tup.isInQueue()))
- return tup;
- }
- return null;
- }
-
- public boolean blockBuildWhenUpstreamBuilding() {
- return blockBuildWhenUpstreamBuilding;
- }
-
- protected void submit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, FormException {
- super.submit(req,rsp);
- blockBuildWhenUpstreamBuilding = req.hasParameter("maven.blockBuildWhenUpstreamBuilding");
- }
}
diff --git a/maven-plugin/src/main/resources/hudson/maven/MavenModuleSet/configure-entries.jelly b/maven-plugin/src/main/resources/hudson/maven/MavenModuleSet/configure-entries.jelly
index acffe9e2bc..88178ef9d4 100644
--- a/maven-plugin/src/main/resources/hudson/maven/MavenModuleSet/configure-entries.jelly
+++ b/maven-plugin/src/main/resources/hudson/maven/MavenModuleSet/configure-entries.jelly
@@ -84,8 +84,6 @@ THE SOFTWARE.
checked="${!it.aggregatorStyleBuild}" />
-
diff --git a/maven-plugin/src/main/resources/hudson/maven/MavenModuleSet/configure-entries_ja.properties b/maven-plugin/src/main/resources/hudson/maven/MavenModuleSet/configure-entries_ja.properties
index 0ea45fd537..15acc27857 100644
--- a/maven-plugin/src/main/resources/hudson/maven/MavenModuleSet/configure-entries_ja.properties
+++ b/maven-plugin/src/main/resources/hudson/maven/MavenModuleSet/configure-entries_ja.properties
@@ -32,4 +32,4 @@ Build\ modules\ in\ parallel=\u30E2\u30B8\u30E5\u30FC\u30EB\u3092\u500B\u5225\u3
Use\ private\ Maven\ repository=\u5C02\u7528\u306EMaven\u30EA\u30DD\u30B8\u30C8\u30EA\u3092\u4F7F\u7528
Build\ Settings=\u30D3\u30EB\u30C9\u8A2D\u5B9A
Build\ whenever\ a\ SNAPSHOT\ dependency\ is\ built=\u4F9D\u5B58\u3059\u308B\u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\u304C\u30D3\u30EB\u30C9\u3055\u308C\u305F\u3068\u304D\u306B\u30D3\u30EB\u30C9
-Block\ build\ when\ dependency\ building=\u4F9D\u5B58\u3059\u308B\u30D3\u30EB\u30C9\u304C\u30D3\u30EB\u30C9\u4E2D\u306E\u5834\u5408\u306F\u30D3\u30EB\u30C9\u3057\u306A\u3044
+
diff --git a/maven-plugin/src/main/webapp/block-upstream-building.html b/war/resources/help/project-config/block-upstream-building.html
similarity index 100%
rename from maven-plugin/src/main/webapp/block-upstream-building.html
rename to war/resources/help/project-config/block-upstream-building.html
diff --git a/maven-plugin/src/main/webapp/block-upstream-building_ja.html b/war/resources/help/project-config/block-upstream-building_ja.html
similarity index 100%
rename from maven-plugin/src/main/webapp/block-upstream-building_ja.html
rename to war/resources/help/project-config/block-upstream-building_ja.html