diff --git a/core/src/main/java/hudson/matrix/Axis.java b/core/src/main/java/hudson/matrix/Axis.java index 02992b884cc72fdcbae480fe6400c783d307ed5e..b30ad9e2d59ff146fad965940540fa2961ee62ce 100644 --- a/core/src/main/java/hudson/matrix/Axis.java +++ b/core/src/main/java/hudson/matrix/Axis.java @@ -1,14 +1,12 @@ package hudson.matrix; import hudson.Util; +import org.kohsuke.stapler.StaplerRequest; -import java.util.List; -import java.util.Collections; -import java.util.Iterator; import java.util.ArrayList; import java.util.Enumeration; - -import org.kohsuke.stapler.StaplerRequest; +import java.util.Iterator; +import java.util.List; /** * Configuration axis. @@ -35,7 +33,9 @@ public final class Axis implements Comparable, Iterable { public Axis(String name, List values) { this.name = name; - this.values = Collections.unmodifiableList(values); + this.values = new ArrayList(values); + if(values.isEmpty()) + throw new IllegalArgumentException(); // bug in the code } public Iterator iterator() { @@ -76,6 +76,8 @@ public final class Axis implements Comparable, Iterable { if(paramName.startsWith(prefix)) values.add(paramName.substring(prefix.length())); } + if(values.isEmpty()) + return null; return new Axis(name,values); } } diff --git a/core/src/main/java/hudson/matrix/AxisList.java b/core/src/main/java/hudson/matrix/AxisList.java index 7e6008bb2632cdb5ba2d25c712d191ed8f2ba1fa..4f15ba316b7a10ac9dd52d9fb567d309217ec866 100644 --- a/core/src/main/java/hudson/matrix/AxisList.java +++ b/core/src/main/java/hudson/matrix/AxisList.java @@ -24,7 +24,12 @@ public class AxisList extends ArrayList { } return null; } - + + + public boolean add(Axis axis) { + return axis!=null && super.add(axis); + } + /** * List up all the possible combinations of this list. */ @@ -50,7 +55,7 @@ public class AxisList extends ArrayList { public Combination next() { String[] data = new String[size()]; - int x = counter; + int x = counter++; for( int i=0; i { public Combination(AxisList axisList, List values) { for(int i=0; i { } public Combination(Map keyValuePairs) { - super(keyValuePairs); + super.putAll(keyValuePairs); } /** @@ -40,6 +41,7 @@ public final class Combination extends TreeMap { if(buf.length()>0) buf.append(','); buf.append(e.getKey()).append('=').append(e.getValue()); } + if(buf.length()==0) buf.append("default"); // special case to avoid 0-length name. return buf.toString(); } @@ -47,6 +49,9 @@ public final class Combination extends TreeMap { * Reverse operation of {@link #toString()}. */ public static Combination fromString(String id) { + if(id.equals("default")) + return new Combination(Collections.emptyMap()); + Map m = new HashMap(); StringTokenizer tokens = new StringTokenizer(id, ","); while(tokens.hasMoreTokens()) { diff --git a/core/src/main/java/hudson/matrix/MatrixBuild.java b/core/src/main/java/hudson/matrix/MatrixBuild.java index 47fd0d017c5a390de0f6339ba0529e9367336d45..bf4174b9b8b3249f1fa6d58620992b2a0a3e1a19 100644 --- a/core/src/main/java/hudson/matrix/MatrixBuild.java +++ b/core/src/main/java/hudson/matrix/MatrixBuild.java @@ -6,6 +6,8 @@ import hudson.model.Result; import java.io.IOException; import java.io.PrintStream; +import java.io.File; +import java.util.Calendar; /** * @author Kohsuke Kawaguchi @@ -15,6 +17,14 @@ public class MatrixBuild extends AbstractBuild { super(job); } + public MatrixBuild(MatrixProject job, Calendar timestamp) { + super(job, timestamp); + } + + public MatrixBuild(MatrixProject project, File buildDir) throws IOException { + super(project, buildDir); + } + @Override public void run() { run(new RunnerImpl()); diff --git a/core/src/main/java/hudson/matrix/MatrixConfiguration.java b/core/src/main/java/hudson/matrix/MatrixConfiguration.java index 04a010dc43fc4660e4e6a6acdadcf0c7fbbb50aa..5ff7252854e9bbaec926b5c70f11d80149525bb4 100644 --- a/core/src/main/java/hudson/matrix/MatrixConfiguration.java +++ b/core/src/main/java/hudson/matrix/MatrixConfiguration.java @@ -1,24 +1,29 @@ package hudson.matrix; import hudson.FilePath; -import hudson.model.AbstractProject; +import hudson.tasks.Builder; +import hudson.tasks.Publisher; +import hudson.tasks.BuildWrapper; import hudson.model.DependencyGraph; import hudson.model.Hudson; -import hudson.model.Node; -import hudson.model.SCMedItem; -import hudson.model.JDK; import hudson.model.Item; import hudson.model.ItemGroup; +import hudson.model.JDK; import hudson.model.Label; +import hudson.model.Node; +import hudson.model.Project; +import hudson.model.SCMedItem; +import hudson.model.Descriptor; import java.io.IOException; +import java.util.Map; /** * One configuration of {@link MatrixProject}. * * @author Kohsuke Kawaguchi */ -public class MatrixConfiguration extends AbstractProject implements SCMedItem { +public class MatrixConfiguration extends Project implements SCMedItem { /** * The actual value combination. */ @@ -74,6 +79,29 @@ public class MatrixConfiguration extends AbstractProject, Builder> getBuilders() { + return getParent().getBuilders(); + } + + @Override + public Map, Publisher> getPublishers() { + return getParent().getPublishers(); + } + + @Override + public Map, BuildWrapper> getBuildWrappers() { + return getParent().getBuildWrappers(); + } + + @Override + public Publisher getPublisher(Descriptor descriptor) { + return getParent().getPublisher(descriptor); + } + /** * JDK cannot be set on {@link MatrixConfiguration} because * it's controlled by {@link MatrixProject}. diff --git a/core/src/main/java/hudson/matrix/MatrixProject.java b/core/src/main/java/hudson/matrix/MatrixProject.java index e75f9ebd9ba309420637dac694623a0224ba106e..15d6bb10f759fc24324d430135189756c7759d83 100644 --- a/core/src/main/java/hudson/matrix/MatrixProject.java +++ b/core/src/main/java/hudson/matrix/MatrixProject.java @@ -1,6 +1,11 @@ package hudson.matrix; import hudson.FilePath; +import hudson.tasks.Builder; +import hudson.tasks.Publisher; +import hudson.tasks.BuildWrapper; +import hudson.tasks.BuildWrappers; +import hudson.tasks.BuildStep; import hudson.model.AbstractProject; import hudson.model.DependencyGraph; import hudson.model.Descriptor.FormException; @@ -15,6 +20,7 @@ import hudson.model.Node; import hudson.model.SCMedItem; import hudson.model.TopLevelItem; import hudson.model.TopLevelItemDescriptor; +import hudson.model.Descriptor; import hudson.util.CopyOnWriteMap; import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.StaplerResponse; @@ -28,6 +34,8 @@ import java.util.HashSet; import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; +import java.util.List; +import java.util.Vector; /** * @author Kohsuke Kawaguchi @@ -40,6 +48,21 @@ public class MatrixProject extends AbstractProject im */ private volatile AxisList axes = new AxisList(); + /** + * List of active {@link Builder}s configured for this project. + */ + private volatile List builders = new Vector(); + + /** + * List of active {@link Publisher}s configured for this project. + */ + private volatile List publishers = new Vector(); + + /** + * List of active {@link BuildWrapper}s configured for this project. + */ + private volatile List buildWrappers = new Vector(); + /** * All {@link MatrixConfiguration}s, keyed by their {@link MatrixConfiguration#getName() names}. */ @@ -58,7 +81,14 @@ public class MatrixProject extends AbstractProject im super.onLoad(parent,name); Collections.sort(axes); // perhaps the file was edited on disk and the sort order might have been broken - configurations = ItemGroupMixIn.loadChildren(this,getConfigurationsDir(), KEYED_BY_NAME); + rebuildConfigurations(); + } + + /** + * Rebuilds the {@link #configurations} list and {@link #activeConfigurations}. + */ + private void rebuildConfigurations() { + configurations = ItemGroupMixIn.loadChildren(this,getConfigurationsDir(), KEYED_BY_NAME); // find all active configurations Set active = new LinkedHashSet(); @@ -145,6 +175,26 @@ public class MatrixProject extends AbstractProject im return r; } + public Map,Builder> getBuilders() { + return Descriptor.toMap(builders); + } + + public Map,Publisher> getPublishers() { + return Descriptor.toMap(publishers); + } + + public Map,BuildWrapper> getBuildWrappers() { + return Descriptor.toMap(buildWrappers); + } + + public Publisher getPublisher(Descriptor descriptor) { + for (Publisher p : publishers) { + if(p.getDescriptor()==descriptor) + return p; + } + return null; + } + @Override public FilePath getWorkspace() { Node node = getLastBuiltOn(); @@ -176,6 +226,12 @@ public class MatrixProject extends AbstractProject im newAxes.add(Axis.parsePrefixed(req,"jdk")); newAxes.add(Axis.parsePrefixed(req,"label")); this.axes = newAxes; + + buildWrappers = buildDescribable(req, BuildWrappers.WRAPPERS, "wrapper"); + builders = buildDescribable(req, BuildStep.BUILDERS, "builder"); + publishers = buildDescribable(req, BuildStep.PUBLISHERS, "publisher"); + + rebuildConfigurations(); } public DescriptorImpl getDescriptor() { diff --git a/core/src/main/java/hudson/matrix/MatrixRun.java b/core/src/main/java/hudson/matrix/MatrixRun.java index ef990a042046cd70e5b95bcccc9b2edb4db09d52..280e6e58f8ec086e88e80238cbf1f59817496935 100644 --- a/core/src/main/java/hudson/matrix/MatrixRun.java +++ b/core/src/main/java/hudson/matrix/MatrixRun.java @@ -1,31 +1,26 @@ package hudson.matrix; -import hudson.model.AbstractBuild; +import hudson.model.Build; -import java.io.IOException; import java.io.File; -import java.util.Calendar; +import java.io.IOException; /** * Execution of {@link MatrixConfiguration}. * * @author Kohsuke Kawaguchi */ -public class MatrixRun extends AbstractBuild { +public class MatrixRun extends Build { public MatrixRun(MatrixConfiguration job) throws IOException { super(job); } - public MatrixRun(MatrixConfiguration job, Calendar timestamp) { - super(job, timestamp); - } - public MatrixRun(MatrixConfiguration project, File buildDir) throws IOException { super(project, buildDir); } - public void run() { - // TODO - throw new UnsupportedOperationException(); + @Override + public MatrixConfiguration getParent() {// don't know why, but javac wants this + return super.getParent(); } } diff --git a/core/src/main/java/hudson/maven/MavenModuleSetBuild.java b/core/src/main/java/hudson/maven/MavenModuleSetBuild.java index baee8149f42a5a69d9ea3a80848e072c83d6d8cb..4b0978a15ca25d382f7946f71b17a51651f8ce8b 100644 --- a/core/src/main/java/hudson/maven/MavenModuleSetBuild.java +++ b/core/src/main/java/hudson/maven/MavenModuleSetBuild.java @@ -48,7 +48,7 @@ public final class MavenModuleSetBuild extends AbstractBuild,R extends A } catch (IllegalAccessException e) { throw new Error(e); } catch (InvocationTargetException e) { - throw new Error(e); + throw handleInvocationTargetException(e); } catch (NoSuchMethodException e) { throw new Error(e); } } + private IOException handleInvocationTargetException(InvocationTargetException e) { + Throwable t = e.getTargetException(); + if(t instanceof Error) throw (Error)t; + if(t instanceof RuntimeException) throw (RuntimeException)t; + if(t instanceof IOException) return (IOException)t; + throw new Error(t); + } + /** * Loads an existing build record from disk. */ @@ -304,7 +312,7 @@ public abstract class AbstractProject

,R extends A } catch (IllegalAccessException e) { throw new Error(e); } catch (InvocationTargetException e) { - throw new Error(e); + throw handleInvocationTargetException(e); } catch (NoSuchMethodException e) { throw new Error(e); } @@ -589,21 +597,22 @@ public abstract class AbstractProject

,R extends A for (Trigger t : triggers) t.stop(); - buildDescribable(req, Triggers.getApplicableTriggers(this), triggers, "trigger"); + triggers = buildDescribable(req, Triggers.getApplicableTriggers(this), "trigger"); for (Trigger t : triggers) t.start(this,true); } - protected final > void buildDescribable(StaplerRequest req, List> descriptors, List result, String prefix) + protected final > List buildDescribable(StaplerRequest req, List> descriptors, String prefix) throws FormException { - result.clear(); + List r = new Vector(); for( int i=0; i< descriptors.size(); i++ ) { if(req.getParameter(prefix +i)!=null) { T instance = descriptors.get(i).newInstance(req); - result.add(instance); + r.add(instance); } } + return r; } /** diff --git a/core/src/main/java/hudson/model/Build.java b/core/src/main/java/hudson/model/Build.java index 84175a19320e3b2cf1dcf648b63450d18f2ad91e..15226df2f193ce70ed68015532bc301f7a10a6e6 100644 --- a/core/src/main/java/hudson/model/Build.java +++ b/core/src/main/java/hudson/model/Build.java @@ -5,36 +5,34 @@ import hudson.tasks.BuildWrapper; import hudson.tasks.BuildWrapper.Environment; import hudson.tasks.Builder; import hudson.tasks.Publisher; -import hudson.tasks.test.AbstractTestResultAction; import hudson.triggers.SCMTrigger; +import org.kohsuke.stapler.StaplerRequest; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; -import java.util.Calendar; - -import org.kohsuke.stapler.StaplerRequest; /** * A build of a {@link Project}. * * @author Kohsuke Kawaguchi */ -public final class Build extends AbstractBuild { +public abstract class Build

,B extends Build> + extends AbstractBuild { /** * Creates a new build. */ - Build(Project project) throws IOException { + protected Build(P project) throws IOException { super(project); } /** * Loads a build from a log file. */ - Build(Project project, File buildDir) throws IOException { + protected Build(P project, File buildDir) throws IOException { super(project,buildDir); } diff --git a/core/src/main/java/hudson/model/FreeStyleBuild.java b/core/src/main/java/hudson/model/FreeStyleBuild.java new file mode 100644 index 0000000000000000000000000000000000000000..96206d73d5da2fce62977f82bb1b4f93205d4acf --- /dev/null +++ b/core/src/main/java/hudson/model/FreeStyleBuild.java @@ -0,0 +1,17 @@ +package hudson.model; + +import java.io.IOException; +import java.io.File; + +/** + * @author Kohsuke Kawaguchi + */ +public class FreeStyleBuild extends Build { + public FreeStyleBuild(FreeStyleProject project) throws IOException { + super(project); + } + + public FreeStyleBuild(FreeStyleProject project, File buildDir) throws IOException { + super(project, buildDir); + } +} diff --git a/core/src/main/java/hudson/model/FreeStyleProject.java b/core/src/main/java/hudson/model/FreeStyleProject.java new file mode 100644 index 0000000000000000000000000000000000000000..0f67e9a4f3de3a2fff554f90559cbf5c972f6959 --- /dev/null +++ b/core/src/main/java/hudson/model/FreeStyleProject.java @@ -0,0 +1,52 @@ +package hudson.model; + +import hudson.FilePath; + +/** + * Free-style software project. + * + * @author Kohsuke Kawaguchi + */ +public class FreeStyleProject extends Project implements TopLevelItem { + + public FreeStyleProject(Hudson parent, String name) { + super(parent, name); + } + + @Override + protected Class getBuildClass() { + return FreeStyleBuild.class; + } + + @Override + public Hudson getParent() { + return Hudson.getInstance(); + } + + @Override + public FilePath getWorkspace() { + Node node = getLastBuiltOn(); + if(node==null) node = getParent(); + return node.getWorkspaceFor(this); + } + + public DescriptorImpl getDescriptor() { + return DESCRIPTOR; + } + + public static final DescriptorImpl DESCRIPTOR = new DescriptorImpl(); + + public static final class DescriptorImpl extends TopLevelItemDescriptor { + private DescriptorImpl() { + super(FreeStyleProject.class); + } + + public String getDisplayName() { + return "Build a free-style software project"; + } + + public FreeStyleProject newInstance(String name) { + return new FreeStyleProject(Hudson.getInstance(),name); + } + } +} diff --git a/core/src/main/java/hudson/model/Items.java b/core/src/main/java/hudson/model/Items.java index 609e0a8c221930db48a71fce2e898742bf551686..a78fced274e62caf8697b59638bf6ab802133470 100644 --- a/core/src/main/java/hudson/model/Items.java +++ b/core/src/main/java/hudson/model/Items.java @@ -3,6 +3,7 @@ package hudson.model; import com.thoughtworks.xstream.XStream; import hudson.XmlFile; import hudson.matrix.MatrixProject; +import hudson.matrix.MatrixConfiguration; import hudson.maven.MavenModule; import hudson.maven.MavenModuleSet; import hudson.util.XStream2; @@ -24,7 +25,7 @@ public class Items { * List of all installed {@link TopLevelItem} types. */ public static final List LIST = Descriptor.toList( - Project.DESCRIPTOR, + FreeStyleProject.DESCRIPTOR, MavenModuleSet.DESCRIPTOR, ExternalJob.DESCRIPTOR ); @@ -102,7 +103,7 @@ public class Items { public static final XStream XSTREAM = new XStream2(); static { - XSTREAM.alias("project",Project.class); + XSTREAM.alias("project",FreeStyleProject.class); XSTREAM.alias("maven2", MavenModule.class); XSTREAM.alias("maven2-module-set", MavenModule.class); @@ -110,5 +111,6 @@ public class Items { if(System.getProperty("Matrix")!=null) LIST.add(MatrixProject.DESCRIPTOR); XSTREAM.alias("matrix-project",MatrixProject.class); + XSTREAM.alias("matrix-config",MatrixConfiguration.class); } } diff --git a/core/src/main/java/hudson/model/Project.java b/core/src/main/java/hudson/model/Project.java index d3bf7d250001d95d8a52b011d77558032499f06b..88433e162bc11d6287e38d8cc4cf7eaea0f2c0b0 100644 --- a/core/src/main/java/hudson/model/Project.java +++ b/core/src/main/java/hudson/model/Project.java @@ -1,6 +1,5 @@ package hudson.model; -import hudson.FilePath; import hudson.model.Descriptor.FormException; import hudson.tasks.BuildStep; import hudson.tasks.BuildTrigger; @@ -28,27 +27,28 @@ import java.util.Vector; * * @author Kohsuke Kawaguchi */ -public class Project extends AbstractProject implements TopLevelItem, SCMedItem { +public abstract class Project

,B extends Build> + extends AbstractProject implements SCMedItem { /** * List of active {@link Builder}s configured for this project. */ - private List builders = new Vector(); + private volatile List builders = new Vector(); /** * List of active {@link Publisher}s configured for this project. */ - private List publishers = new Vector(); + private volatile List publishers = new Vector(); /** * List of active {@link BuildWrapper}s configured for this project. */ - private List buildWrappers = new Vector(); + private volatile List buildWrappers = new Vector(); /** * Creates a new project. */ - public Project(Hudson parent,String name) { + public Project(ItemGroup parent,String name) { super(parent,name); } @@ -66,32 +66,15 @@ public class Project extends AbstractProject implements TopLevelI return this; } - @Override - public Hudson getParent() { - return Hudson.getInstance(); - } - - @Override - public FilePath getWorkspace() { - Node node = getLastBuiltOn(); - if(node==null) node = getParent(); - return node.getWorkspaceFor(this); - } - - @Override - protected Class getBuildClass() { - return Build.class; - } - - public synchronized Map,Builder> getBuilders() { + public Map,Builder> getBuilders() { return Descriptor.toMap(builders); } - public synchronized Map,Publisher> getPublishers() { + public Map,Publisher> getPublishers() { return Descriptor.toMap(publishers); } - public synchronized Map,BuildWrapper> getBuildWrappers() { + public Map,BuildWrapper> getBuildWrappers() { return Descriptor.toMap(buildWrappers); } @@ -150,9 +133,9 @@ public class Project extends AbstractProject implements TopLevelI req.setCharacterEncoding("UTF-8"); - buildDescribable(req, BuildWrappers.WRAPPERS, buildWrappers, "wrapper"); - buildDescribable(req, BuildStep.BUILDERS, builders, "builder"); - buildDescribable(req, BuildStep.PUBLISHERS, publishers, "publisher"); + buildWrappers = buildDescribable(req, BuildWrappers.WRAPPERS, "wrapper"); + builders = buildDescribable(req, BuildStep.BUILDERS, "builder"); + publishers = buildDescribable(req, BuildStep.PUBLISHERS, "publisher"); updateTransientActions(); } @@ -205,8 +188,8 @@ public class Project extends AbstractProject implements TopLevelI private void updateTransientActions() { synchronized(transientActions) { transientActions.clear(); - for (JobProperty p : properties) { - Action a = p.getJobAction(this); + for (JobProperty p : properties) { + Action a = p.getJobAction((P)this); if(a!=null) transientActions.add(a); } @@ -244,24 +227,4 @@ public class Project extends AbstractProject implements TopLevelI */ @Deprecated private transient String slave; - - public DescriptorImpl getDescriptor() { - return DESCRIPTOR; - } - - public static final DescriptorImpl DESCRIPTOR = new DescriptorImpl(); - - public static final class DescriptorImpl extends TopLevelItemDescriptor { - private DescriptorImpl() { - super(Project.class); - } - - public String getDisplayName() { - return "Build a free-style software project"; - } - - public Project newInstance(String name) { - return new Project(Hudson.getInstance(),name); - } - } } \ No newline at end of file diff --git a/core/src/main/java/hudson/model/Run.java b/core/src/main/java/hudson/model/Run.java index 6ffb05ad8daeb0afaa200dcfccd7de23574208e8..e7a58a15b7ed6eb92c966a3ed538f2943987883a 100644 --- a/core/src/main/java/hudson/model/Run.java +++ b/core/src/main/java/hudson/model/Run.java @@ -8,6 +8,8 @@ import hudson.FilePath; import hudson.Util; import static hudson.Util.combine; import hudson.XmlFile; +import hudson.matrix.MatrixBuild; +import hudson.matrix.MatrixRun; import hudson.tasks.BuildStep; import hudson.tasks.LogRotator; import hudson.tasks.test.AbstractTestResultAction; @@ -839,7 +841,9 @@ public abstract class Run ,RunT extends Run build, Launcher launcher, BuildListener listener) throws InterruptedException { Project proj = build.getProject(); ArgumentListBuilder args = new ArgumentListBuilder(); diff --git a/core/src/main/java/hudson/tasks/ArtifactArchiver.java b/core/src/main/java/hudson/tasks/ArtifactArchiver.java index 1a15db0f7e3e2bb7cac15fefab0bf10ff4395398..a96d1a9de414ad0d9aa9b924a365fb8220350317 100644 --- a/core/src/main/java/hudson/tasks/ArtifactArchiver.java +++ b/core/src/main/java/hudson/tasks/ArtifactArchiver.java @@ -55,8 +55,8 @@ public class ArtifactArchiver extends Publisher { return latestOnly; } - public boolean perform(Build build, Launcher launcher, BuildListener listener) throws InterruptedException { - Project p = build.getProject(); + public boolean perform(Build build, Launcher launcher, BuildListener listener) throws InterruptedException { + Project p = build.getProject(); File dir = build.getArtifactsDir(); dir.mkdirs(); @@ -70,7 +70,7 @@ public class ArtifactArchiver extends Publisher { } if(latestOnly) { - Build b = p.getLastSuccessfulBuild(); + Build b = p.getLastSuccessfulBuild(); if(b!=null) { while(true) { b = b.getPreviousBuild(); diff --git a/core/src/main/java/hudson/tasks/BuildStep.java b/core/src/main/java/hudson/tasks/BuildStep.java index f6c3335afabfce303ad186749625c27f98ea28ab..6c4fe8986b42951f5b4839664fbbbd96a225fb9f 100644 --- a/core/src/main/java/hudson/tasks/BuildStep.java +++ b/core/src/main/java/hudson/tasks/BuildStep.java @@ -41,7 +41,7 @@ public interface BuildStep { * true if the build can continue, false if there was an error * and the build needs to be aborted. */ - boolean prebuild( Build build, BuildListener listener ); + boolean prebuild( Build build, BuildListener listener ); /** * Runs the step over the given build and reports the progress to the listener. @@ -67,7 +67,7 @@ public interface BuildStep { * provide a better error message, if it can do so, so that users have better * understanding on why it failed. */ - boolean perform(Build build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException; + boolean perform(Build build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException; /** * Returns an action object if this {@link BuildStep} has an action @@ -84,7 +84,7 @@ public interface BuildStep { * @return * null if there's no action to be contributed. */ - Action getProjectAction(Project project); + Action getProjectAction(Project project); /** * List of all installed builders. diff --git a/core/src/main/java/hudson/tasks/CommandInterpreter.java b/core/src/main/java/hudson/tasks/CommandInterpreter.java index 438f9a965f0a148283686a6ce4775568948a1d21..42539d82251b40ceec0be3b10700cc381562def8 100644 --- a/core/src/main/java/hudson/tasks/CommandInterpreter.java +++ b/core/src/main/java/hudson/tasks/CommandInterpreter.java @@ -28,7 +28,7 @@ public abstract class CommandInterpreter extends Builder { return command; } - public boolean perform(Build build, Launcher launcher, BuildListener listener) throws InterruptedException { + public boolean perform(Build build, Launcher launcher, BuildListener listener) throws InterruptedException { Project proj = build.getProject(); FilePath ws = proj.getWorkspace(); FilePath script=null; diff --git a/core/src/main/java/hudson/tasks/Fingerprinter.java b/core/src/main/java/hudson/tasks/Fingerprinter.java index f3ded13e6e2d2b86f6ee776dfc42613f68b48f57..e13426fb70b41ab924670f53dbf5ef410c41c9d0 100644 --- a/core/src/main/java/hudson/tasks/Fingerprinter.java +++ b/core/src/main/java/hudson/tasks/Fingerprinter.java @@ -68,7 +68,7 @@ public class Fingerprinter extends Publisher implements Serializable { return recordBuildArtifacts; } - public boolean perform(Build build, Launcher launcher, BuildListener listener) throws InterruptedException { + public boolean perform(Build build, Launcher launcher, BuildListener listener) throws InterruptedException { try { listener.getLogger().println("Recording fingerprints"); @@ -100,7 +100,7 @@ public class Fingerprinter extends Publisher implements Serializable { return true; } - private void record(Build build, BuildListener listener, Map record, final String targets) throws IOException, InterruptedException { + private void record(Build build, BuildListener listener, Map record, final String targets) throws IOException, InterruptedException { final class Record implements Serializable { final boolean produced; final String relativePath; diff --git a/core/src/main/java/hudson/tasks/JavadocArchiver.java b/core/src/main/java/hudson/tasks/JavadocArchiver.java index 23349bc72d2191aa68b5836d5f6c8186cee5d808..6abf64b482e8a94e52c691961e7f06711f49fc57 100644 --- a/core/src/main/java/hudson/tasks/JavadocArchiver.java +++ b/core/src/main/java/hudson/tasks/JavadocArchiver.java @@ -46,7 +46,7 @@ public class JavadocArchiver extends Publisher { return new File(project.getRootDir(),"javadoc"); } - public boolean perform(Build build, Launcher launcher, BuildListener listener) throws InterruptedException { + public boolean perform(Build build, Launcher launcher, BuildListener listener) throws InterruptedException { listener.getLogger().println("Publishing Javadoc"); FilePath javadoc = build.getParent().getWorkspace().child(javadocDir); diff --git a/core/src/main/java/hudson/tasks/Mailer.java b/core/src/main/java/hudson/tasks/Mailer.java index bfc411f24307169227a20e2d402884aab53e34ef..fd9b6d45c4e6f6f11a41c7d6cb8bfc7aab3a68d1 100644 --- a/core/src/main/java/hudson/tasks/Mailer.java +++ b/core/src/main/java/hudson/tasks/Mailer.java @@ -63,12 +63,16 @@ public class Mailer extends Publisher { private transient boolean failureOnly; public boolean perform(Build build, Launcher launcher, BuildListener listener) throws InterruptedException { + return _perform(build,launcher,listener); + } + + public

,B extends Build> boolean _perform(B build, Launcher launcher, BuildListener listener) throws InterruptedException { if(debug) listener.getLogger().println("Running mailer"); - return new MailSender(recipients,dontNotifyEveryUnstableBuild,sendToIndividuals) { + return new MailSender(recipients,dontNotifyEveryUnstableBuild,sendToIndividuals) { /** Check whether a path (/-separated) will be archived. */ @Override - public boolean artifactMatches(String path, Build build) { + public boolean artifactMatches(String path, B build) { ArtifactArchiver aa = (ArtifactArchiver) build.getProject().getPublishers().get(ArtifactArchiver.DESCRIPTOR); if (aa == null) { LOGGER.finer("No ArtifactArchiver found"); diff --git a/core/src/main/java/hudson/tasks/Maven.java b/core/src/main/java/hudson/tasks/Maven.java index ae07baae882fb3c0d8af821e3ac5b33fb6d756a7..651c31acf0d058140282f62615d1365e73d07464 100644 --- a/core/src/main/java/hudson/tasks/Maven.java +++ b/core/src/main/java/hudson/tasks/Maven.java @@ -106,7 +106,7 @@ public class Maven extends Builder { } } - public boolean perform(Build build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException { + public boolean perform(Build build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException { Project proj = build.getProject(); int startIndex = 0; diff --git a/core/src/main/resources/hudson/matrix/MatrixProject/configure-entries.jelly b/core/src/main/resources/hudson/matrix/MatrixProject/configure-entries.jelly index 9ff79ecddf2daf4e562978ccffe232e141140f0a..e24da9bd1cf5b46944549e4927b7f061f8572403 100644 --- a/core/src/main/resources/hudson/matrix/MatrixProject/configure-entries.jelly +++ b/core/src/main/resources/hudson/matrix/MatrixProject/configure-entries.jelly @@ -57,5 +57,12 @@ + + + + diff --git a/core/src/main/resources/hudson/model/Project/newJobDetail.jelly b/core/src/main/resources/hudson/model/FreeStyleProject/newJobDetail.jelly similarity index 100% rename from core/src/main/resources/hudson/model/Project/newJobDetail.jelly rename to core/src/main/resources/hudson/model/FreeStyleProject/newJobDetail.jelly