提交 ad01761e 编写于 作者: K kohsuke

Project/Build are made abstract and their concrete counterparts are now called...

Project/Build are made abstract and their concrete counterparts are now called FreeStyleProject/Build.
The data files should be still compatible, but need to test thoroughly before the next release.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@3527 71c3de6d-444a-0410-be80-ed276b4c234a
上级 5fc63229
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<Axis>, Iterable<String> {
public Axis(String name, List<String> values) {
this.name = name;
this.values = Collections.unmodifiableList(values);
this.values = new ArrayList<String>(values);
if(values.isEmpty())
throw new IllegalArgumentException(); // bug in the code
}
public Iterator<String> iterator() {
......@@ -76,6 +76,8 @@ public final class Axis implements Comparable<Axis>, Iterable<String> {
if(paramName.startsWith(prefix))
values.add(paramName.substring(prefix.length()));
}
if(values.isEmpty())
return null;
return new Axis(name,values);
}
}
......@@ -24,7 +24,12 @@ public class AxisList extends ArrayList<Axis> {
}
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<Axis> {
public Combination next() {
String[] data = new String[size()];
int x = counter;
int x = counter++;
for( int i=0; i<data.length; i++) {
data[i] = get(i).value(x/base[i]);
x %= base[i];
......
......@@ -6,6 +6,7 @@ import java.util.Map;
import java.util.TreeMap;
import java.util.StringTokenizer;
import java.util.HashMap;
import java.util.Collections;
/**
* A particular combination of {@link Axis} values.
......@@ -19,7 +20,7 @@ public final class Combination extends TreeMap<String,String> {
public Combination(AxisList axisList, List<String> values) {
for(int i=0; i<axisList.size(); i++)
put(axisList.get(i).name,values.get(i));
super.put(axisList.get(i).name,values.get(i));
}
public Combination(AxisList axisList,String... values) {
......@@ -27,7 +28,7 @@ public final class Combination extends TreeMap<String,String> {
}
public Combination(Map<String,String> keyValuePairs) {
super(keyValuePairs);
super.putAll(keyValuePairs);
}
/**
......@@ -40,6 +41,7 @@ public final class Combination extends TreeMap<String,String> {
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<String,String> {
* Reverse operation of {@link #toString()}.
*/
public static Combination fromString(String id) {
if(id.equals("default"))
return new Combination(Collections.<String,String>emptyMap());
Map<String,String> m = new HashMap<String,String>();
StringTokenizer tokens = new StringTokenizer(id, ",");
while(tokens.hasMoreTokens()) {
......
......@@ -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<MatrixProject,MatrixBuild> {
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());
......
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<MatrixConfiguration,MatrixRun> implements SCMedItem {
public class MatrixConfiguration extends Project<MatrixConfiguration,MatrixRun> implements SCMedItem {
/**
* The actual value combination.
*/
......@@ -74,6 +79,29 @@ public class MatrixConfiguration extends AbstractProject<MatrixConfiguration,Mat
return Hudson.getInstance().getJDK(combination.get("jdk"));
}
//
// inherit build setting from the parent project
//
@Override
public Map<Descriptor<Builder>, Builder> getBuilders() {
return getParent().getBuilders();
}
@Override
public Map<Descriptor<Publisher>, Publisher> getPublishers() {
return getParent().getPublishers();
}
@Override
public Map<Descriptor<BuildWrapper>, BuildWrapper> getBuildWrappers() {
return getParent().getBuildWrappers();
}
@Override
public Publisher getPublisher(Descriptor<Publisher> descriptor) {
return getParent().getPublisher(descriptor);
}
/**
* JDK cannot be set on {@link MatrixConfiguration} because
* it's controlled by {@link MatrixProject}.
......
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<MatrixProject,MatrixBuild> im
*/
private volatile AxisList axes = new AxisList();
/**
* List of active {@link Builder}s configured for this project.
*/
private volatile List<Builder> builders = new Vector<Builder>();
/**
* List of active {@link Publisher}s configured for this project.
*/
private volatile List<Publisher> publishers = new Vector<Publisher>();
/**
* List of active {@link BuildWrapper}s configured for this project.
*/
private volatile List<BuildWrapper> buildWrappers = new Vector<BuildWrapper>();
/**
* All {@link MatrixConfiguration}s, keyed by their {@link MatrixConfiguration#getName() names}.
*/
......@@ -58,7 +81,14 @@ public class MatrixProject extends AbstractProject<MatrixProject,MatrixBuild> 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.<String,MatrixConfiguration>loadChildren(this,getConfigurationsDir(), KEYED_BY_NAME);
rebuildConfigurations();
}
/**
* Rebuilds the {@link #configurations} list and {@link #activeConfigurations}.
*/
private void rebuildConfigurations() {
configurations = ItemGroupMixIn.<String, MatrixConfiguration>loadChildren(this,getConfigurationsDir(), KEYED_BY_NAME);
// find all active configurations
Set<MatrixConfiguration> active = new LinkedHashSet<MatrixConfiguration>();
......@@ -145,6 +175,26 @@ public class MatrixProject extends AbstractProject<MatrixProject,MatrixBuild> im
return r;
}
public Map<Descriptor<Builder>,Builder> getBuilders() {
return Descriptor.toMap(builders);
}
public Map<Descriptor<Publisher>,Publisher> getPublishers() {
return Descriptor.toMap(publishers);
}
public Map<Descriptor<BuildWrapper>,BuildWrapper> getBuildWrappers() {
return Descriptor.toMap(buildWrappers);
}
public Publisher getPublisher(Descriptor<Publisher> 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<MatrixProject,MatrixBuild> 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() {
......
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<MatrixConfiguration,MatrixRun> {
public class MatrixRun extends Build<MatrixConfiguration,MatrixRun> {
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();
}
}
......@@ -48,7 +48,7 @@ public final class MavenModuleSetBuild extends AbstractBuild<MavenModuleSet,Mave
super(job);
}
MavenModuleSetBuild(MavenModuleSet project, File buildDir) throws IOException {
public MavenModuleSetBuild(MavenModuleSet project, File buildDir) throws IOException {
super(project, buildDir);
}
......
......@@ -287,12 +287,20 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,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<P extends AbstractProject<P,R>,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<P extends AbstractProject<P,R>,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 <T extends Describable<T>> void buildDescribable(StaplerRequest req, List<? extends Descriptor<T>> descriptors, List<T> result, String prefix)
protected final <T extends Describable<T>> List<T> buildDescribable(StaplerRequest req, List<? extends Descriptor<T>> descriptors, String prefix)
throws FormException {
result.clear();
List<T> r = new Vector<T>();
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;
}
/**
......
......@@ -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<Project,Build> {
public abstract class Build <P extends Project<P,B>,B extends Build<P,B>>
extends AbstractBuild<P,B> {
/**
* 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);
}
......
package hudson.model;
import java.io.IOException;
import java.io.File;
/**
* @author Kohsuke Kawaguchi
*/
public class FreeStyleBuild extends Build<FreeStyleProject,FreeStyleBuild> {
public FreeStyleBuild(FreeStyleProject project) throws IOException {
super(project);
}
public FreeStyleBuild(FreeStyleProject project, File buildDir) throws IOException {
super(project, buildDir);
}
}
package hudson.model;
import hudson.FilePath;
/**
* Free-style software project.
*
* @author Kohsuke Kawaguchi
*/
public class FreeStyleProject extends Project<FreeStyleProject,FreeStyleBuild> implements TopLevelItem {
public FreeStyleProject(Hudson parent, String name) {
super(parent, name);
}
@Override
protected Class<FreeStyleBuild> 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);
}
}
}
......@@ -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<TopLevelItemDescriptor> 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);
}
}
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<Project,Build> implements TopLevelItem, SCMedItem {
public abstract class Project<P extends Project<P,B>,B extends Build<P,B>>
extends AbstractProject<P,B> implements SCMedItem {
/**
* List of active {@link Builder}s configured for this project.
*/
private List<Builder> builders = new Vector<Builder>();
private volatile List<Builder> builders = new Vector<Builder>();
/**
* List of active {@link Publisher}s configured for this project.
*/
private List<Publisher> publishers = new Vector<Publisher>();
private volatile List<Publisher> publishers = new Vector<Publisher>();
/**
* List of active {@link BuildWrapper}s configured for this project.
*/
private List<BuildWrapper> buildWrappers = new Vector<BuildWrapper>();
private volatile List<BuildWrapper> buildWrappers = new Vector<BuildWrapper>();
/**
* 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<Project,Build> 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<Build> getBuildClass() {
return Build.class;
}
public synchronized Map<Descriptor<Builder>,Builder> getBuilders() {
public Map<Descriptor<Builder>,Builder> getBuilders() {
return Descriptor.toMap(builders);
}
public synchronized Map<Descriptor<Publisher>,Publisher> getPublishers() {
public Map<Descriptor<Publisher>,Publisher> getPublishers() {
return Descriptor.toMap(publishers);
}
public synchronized Map<Descriptor<BuildWrapper>,BuildWrapper> getBuildWrappers() {
public Map<Descriptor<BuildWrapper>,BuildWrapper> getBuildWrappers() {
return Descriptor.toMap(buildWrappers);
}
......@@ -150,9 +133,9 @@ public class Project extends AbstractProject<Project,Build> 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<Project,Build> implements TopLevelI
private void updateTransientActions() {
synchronized(transientActions) {
transientActions.clear();
for (JobProperty<? super Project> p : properties) {
Action a = p.getJobAction(this);
for (JobProperty<? super P> p : properties) {
Action a = p.getJobAction((P)this);
if(a!=null)
transientActions.add(a);
}
......@@ -244,24 +227,4 @@ public class Project extends AbstractProject<Project,Build> 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
......@@ -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 <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
private static final XStream XSTREAM = new XStream2();
static {
XSTREAM.alias("build",Build.class);
XSTREAM.alias("build",FreeStyleBuild.class);
XSTREAM.alias("matrix-build",MatrixBuild.class);
XSTREAM.alias("matrix-run",MatrixRun.class);
XSTREAM.registerConverter(Result.conv);
}
......
......@@ -7,11 +7,11 @@ import hudson.model.Build;
import hudson.model.BuildListener;
import hudson.model.Descriptor;
import hudson.model.Project;
import hudson.util.FormFieldValidator;
import hudson.util.ArgumentListBuilder;
import hudson.util.FormFieldValidator;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.DataBoundConstructor;
import javax.servlet.ServletException;
import java.io.File;
......@@ -68,7 +68,7 @@ public class Ant extends Builder {
return antOpts;
}
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();
ArgumentListBuilder args = new ArgumentListBuilder();
......
......@@ -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();
......
......@@ -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.
......
......@@ -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;
......
......@@ -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<String,String> record, final String targets) throws IOException, InterruptedException {
private void record(Build<?,?> build, BuildListener listener, Map<String,String> record, final String targets) throws IOException, InterruptedException {
final class Record implements Serializable {
final boolean produced;
final String relativePath;
......
......@@ -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);
......
......@@ -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 <P extends Project<P,B>,B extends Build<P,B>> boolean _perform(B build, Launcher launcher, BuildListener listener) throws InterruptedException {
if(debug)
listener.getLogger().println("Running mailer");
return new MailSender<Project,Build>(recipients,dontNotifyEveryUnstableBuild,sendToIndividuals) {
return new MailSender<P,B>(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");
......
......@@ -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;
......
......@@ -57,5 +57,12 @@
</f:optionalBlock>
</j:if>
<!-- build config pane -->
<j:getStatic var="builders" className="hudson.tasks.BuildStep" field="BUILDERS" />
<f:descriptorList title="Build"
descriptors="${builders}"
instances="${it.builders}"
varName="builder" />
</f:section>
</j:jelly>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册