summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakozak2011-11-23 04:15:17 (EST)
committer Winston Prakash2011-12-01 20:47:07 (EST)
commit617fe7044b345d750d148c82524c2cb88a342606 (patch)
tree3e3c67690f7ff1ddd10686bbcc12611ddcc87d58
parentd46c980cd2b2f31dd4ba4ef507877a4e4b0efdd4 (diff)
downloadorg.eclipse.hudson.core-617fe7044b345d750d148c82524c2cb88a342606.zip
org.eclipse.hudson.core-617fe7044b345d750d148c82524c2cb88a342606.tar.gz
org.eclipse.hudson.core-617fe7044b345d750d148c82524c2cb88a342606.tar.bz2
Improves cobertura configuration.
Signed-off-by: Winston Prakash <winston.prakash@gmail.com>
-rw-r--r--hudson-core/pom.xml43
-rw-r--r--hudson-core/src/main/java/hudson/matrix/MatrixProject.java101
-rw-r--r--hudson-core/src/main/java/hudson/model/AbstractProject.java4
-rw-r--r--hudson-core/src/main/java/hudson/model/Project.java7
-rw-r--r--hudson-remoting/pom.xml11
-rw-r--r--hudson-service/pom.xml13
-rw-r--r--hudson-utils/pom.xml13
-rw-r--r--pom.xml37
8 files changed, 161 insertions, 68 deletions
diff --git a/hudson-core/pom.xml b/hudson-core/pom.xml
index b43d1f1..9a9f0a1 100644
--- a/hudson-core/pom.xml
+++ b/hudson-core/pom.xml
@@ -308,40 +308,15 @@
</profile>
<profile>
- <id>hudson</id>
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>cobertura-maven-plugin</artifactId>
- <version>${cobertura-maven-plugin.version}</version>
- <configuration>
- <check>
- <branchRate>80</branchRate>
- <lineRate>80</lineRate>
- <haltOnFailure>true</haltOnFailure>
- <totalBranchRate>80</totalBranchRate>
- <totalLineRate>80</totalLineRate>
- <packageLineRate>80</packageLineRate>
- <packageBranchRate>80</packageBranchRate>
- </check>
- <formats>
- <format>xml</format>
- </formats>
- </configuration>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>cobertura</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
+ <id>hudson</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
</profile>
</profiles>
diff --git a/hudson-core/src/main/java/hudson/matrix/MatrixProject.java b/hudson-core/src/main/java/hudson/matrix/MatrixProject.java
index 75ebfac..8c8e787 100644
--- a/hudson-core/src/main/java/hudson/matrix/MatrixProject.java
+++ b/hudson-core/src/main/java/hudson/matrix/MatrixProject.java
@@ -47,6 +47,7 @@ import hudson.tasks.Publisher;
import hudson.triggers.Trigger;
import hudson.util.CopyOnWriteMap;
import hudson.util.DescribableList;
+import hudson.util.DescribableListUtil;
import hudson.util.FormValidation;
import hudson.util.FormValidation.Kind;
import net.sf.json.JSONObject;
@@ -97,7 +98,7 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i
/**
* Configuration axes.
- * @deprecated as of 2.1.2, use #getAxes() and #setAxes() instead
+ * @deprecated as of 2.2.1, use #getAxes() and #setAxes() instead
*/
@Deprecated
private volatile AxisList axes = new AxisList();
@@ -107,26 +108,41 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i
* This can be null, which means "true".
* Package visible for the tests only.
*
- * @deprecated as of 2.1.2, use #getCombinationFilter() and #setCombinationFilter() instead
+ * @deprecated as of 2.2.0, use #getCombinationFilter() and #setCombinationFilter() instead
*/
@Deprecated
private volatile String combinationFilter;
/**
* List of active {@link Builder}s configured for this project.
+ *
+ * @deprecated as of 2.2.0
+ * don't use this field directly, logic was moved to {@link org.eclipse.hudson.api.model.IProjectProperty}.
+ * Use getter/setter for accessing to this field.
*/
+ @Deprecated
private DescribableList<Builder,Descriptor<Builder>> builders =
new DescribableList<Builder,Descriptor<Builder>>(this);
/**
* List of active {@link Publisher}s configured for this project.
+ *
+ * @deprecated as of 2.2.0
+ * don't use this field directly, logic was moved to {@link org.eclipse.hudson.api.model.IProjectProperty}.
+ * Use getter/setter for accessing to this field.
*/
+ @Deprecated
private DescribableList<Publisher,Descriptor<Publisher>> publishers =
new DescribableList<Publisher,Descriptor<Publisher>>(this);
/**
* List of active {@link BuildWrapper}s configured for this project.
+ *
+ * @deprecated as of 2.2.0
+ * don't use this field directly, logic was moved to {@link org.eclipse.hudson.api.model.IProjectProperty}.
+ * Use getter/setter for accessing to this field.
*/
+ @Deprecated
private DescribableList<BuildWrapper,Descriptor<BuildWrapper>> buildWrappers =
new DescribableList<BuildWrapper,Descriptor<BuildWrapper>>(this);
@@ -142,7 +158,7 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i
private transient /*final*/ Set<MatrixConfiguration> activeConfigurations = new LinkedHashSet<MatrixConfiguration>();
/**
- * @deprecated as of 2.2.0, use #isRunSequentially() and #setRunSequentially() instead
+ * @deprecated as of 2.2.1, use #isRunSequentially() and #setRunSequentially() instead
*/
@Deprecated
private boolean runSequentially;
@@ -150,21 +166,22 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i
/**
* Filter to select a number of combinations to build first
*
- * @deprecated as of 2.2.0, use #getTouchStoneCombinationFilter() and #setTouchStoneCombinationFilter() instead
+ * @deprecated as of 2.2.1, use #getTouchStoneCombinationFilter() and #setTouchStoneCombinationFilter() instead
*/
@Deprecated
private String touchStoneCombinationFilter;
/**
* Required result on the touchstone combinations, in order to
- * continue with the rest.
- * @deprecated as of 2.2.0, use #getTouchStoneResultCondition() and #setTouchStoneResultCondition() instead
+ * continue with the rest
+ *
+ * @deprecated as of 2.2.1, use #getTouchStoneResultCondition() and #setTouchStoneResultCondition() instead
*/
@Deprecated
private Result touchStoneResultCondition;
/**
- * @deprecated as of 2.2.0, use #getCustomWorkspace() and #setCustomWorkspace() instead
+ * @deprecated as of 2.2.1, use #getCustomWorkspace() and #setCustomWorkspace() instead
*/
@Deprecated
private String customWorkspace;
@@ -189,7 +206,6 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i
*/
public void setAxes(AxisList axes) throws IOException {
getAxesListProjectProperty(AXES_PROPERTY_NAME).setValue(axes);
- // TODO verify me
rebuildConfigurations();
save();
}
@@ -271,64 +287,74 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i
* @inheritDoc
*/
public List<Builder> getBuilders() {
- DescribableList<Builder,Descriptor<Builder>> buildersList = getBuildersList();
- return (buildersList != null ? buildersList.toList() : null);
+ return getBuildersList().toList();
}
- //TODO improve it
+ @SuppressWarnings("unchecked")
public DescribableList<Builder,Descriptor<Builder>> getBuildersList() {
- return !(builders == null /*|| builders.isEmpty()*/) ? builders
- : (hasCascadingProject() ? getCascadingProject().getBuildersList() : null);
+ return getDescribableListProjectProperty(BUILDERS_PROPERTY_NAME).getValue();
+ }
+
+
+ public void setBuilders(DescribableList<Builder,Descriptor<Builder>> builders) {
+ getDescribableListProjectProperty(BUILDERS_PROPERTY_NAME).setValue(builders);
}
/**
* @inheritDoc
*/
public Map<Descriptor<Publisher>,Publisher> getPublishers() {
- DescribableList<Publisher,Descriptor<Publisher>> publishersList = getPublishersList();
- return (publishersList != null ? publishersList.toMap() : null);
+ return getPublishersList().toMap();
}
/**
* @inheritDoc
*/
- //TODO improve it
- public DescribableList<Publisher,Descriptor<Publisher>> getPublishersList() {
- return !(publishers == null /*|| publishers.isEmpty()*/) ? publishers
- : (hasCascadingProject() ? getCascadingProject().getPublishersList() : null);
+ @SuppressWarnings("unchecked")
+ public DescribableList<Publisher, Descriptor<Publisher>> getPublishersList() {
+ return getDescribableListProjectProperty(PUBLISHERS_PROPERTY_NAME).getValue();
+ }
+
+ public void setPublishers(DescribableList<Publisher, Descriptor<Publisher>> publishers) {
+ getDescribableListProjectProperty(PUBLISHERS_PROPERTY_NAME).setValue(publishers);
}
/**
* @inheritDoc
*/
- //TODO improve it
+ @SuppressWarnings("unchecked")
public DescribableList<BuildWrapper, Descriptor<BuildWrapper>> getBuildWrappersList() {
- return !(buildWrappers == null /*|| buildWrappers.isEmpty()*/) ? buildWrappers
- : (hasCascadingProject() ? getCascadingProject().getBuildWrappersList() : null);
+ return getDescribableListProjectProperty(BUILD_WRAPPERS_PROPERTY_NAME).getValue();
}
/**
* @inheritDoc
*/
public Map<Descriptor<BuildWrapper>,BuildWrapper> getBuildWrappers() {
- DescribableList<BuildWrapper, Descriptor<BuildWrapper>> buildWrappersList = getBuildWrappersList();
- return (buildWrappersList != null ? buildWrappersList.toMap() : null);
+ return getBuildWrappersList().toMap();
}
+ public void setBuildWrappers(DescribableList<BuildWrapper, Descriptor<BuildWrapper>> buildWrappers) {
+ getDescribableListProjectProperty(BUILD_WRAPPERS_PROPERTY_NAME).setValue(buildWrappers);
+ }
+
+
@Override
protected void buildProjectProperties() throws IOException {
super.buildProjectProperties();
//Convert legacy properties to IProjectProperty logic
if (null != axes && null == getProperty(AXES_PROPERTY_NAME)) {
- setAxes(axes);
+ //we shouldn't rebuild the axis configuration
+ getAxesListProjectProperty(AXES_PROPERTY_NAME).setValue(axes);
axes = null;//Reset to null. No longer needed.
}
if (null != combinationFilter && null == getProperty(COMBINATION_FILTER_PROPERTY_NAME)) {
- setCombinationFilter(combinationFilter);
+ //we shouldn't rebuild the axis configuration
+ getStringProperty(COMBINATION_FILTER_PROPERTY_NAME).setValue(combinationFilter);
combinationFilter = null;//Reset to null. No longer needed.
}
if ( null == getProperty(RUN_SEQUENTIALLY_PROPERTY_NAME)) {
- setRunSequentially(runSequentially);
+ getBooleanProperty(RUN_SEQUENTIALLY_PROPERTY_NAME).setValue(runSequentially);
runSequentially = false;
}
if (null != touchStoneCombinationFilter && null == getProperty(TOUCH_STONE_COMBINATION_FILTER_PROPERTY_NAME)) {
@@ -343,6 +369,20 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i
setCustomWorkspace(customWorkspace);
customWorkspace = null;//Reset to null. No longer needed.
}
+ if (null == getProperty(BUILDERS_PROPERTY_NAME)) {
+ setBuilders(builders);
+ builders = null;
+ }
+ if (null == getProperty(BUILD_WRAPPERS_PROPERTY_NAME)) {
+ setBuildWrappers(buildWrappers);
+ buildWrappers = null;
+ }
+ if (null == getProperty(PUBLISHERS_PROPERTY_NAME)) {
+ setPublishers(publishers);
+ publishers = null;
+ }
+ save();
+ rebuildConfigurations();
}
@Override
@@ -676,9 +716,10 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i
setRunSequentially(json.has(RUN_SEQUENTIALLY_PROPERTY_NAME));
- getBuildWrappersList().rebuild(req, json, BuildWrappers.getFor(this));
- getBuildersList().rebuildHetero(req, json, Builder.all(), "builder");
- getPublishersList().rebuild(req, json, BuildStepDescriptor.filter(Publisher.all(),this.getClass()));
+ setBuildWrappers(DescribableListUtil.buildFromJson(this, req, json, BuildWrappers.getFor(this)));
+ setBuilders(DescribableListUtil.buildFromHetero(this, req, json, "builder", Builder.all()));
+ setPublishers(DescribableListUtil.buildFromJson(this, req, json,
+ BuildStepDescriptor.filter(Publisher.all(), this.getClass())));
rebuildConfigurations();
}
diff --git a/hudson-core/src/main/java/hudson/model/AbstractProject.java b/hudson-core/src/main/java/hudson/model/AbstractProject.java
index fd8d47f..e61b772 100644
--- a/hudson-core/src/main/java/hudson/model/AbstractProject.java
+++ b/hudson-core/src/main/java/hudson/model/AbstractProject.java
@@ -129,6 +129,10 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
public static final String CUSTOM_WORKSPACE_PROPERTY_NAME = "customWorkspace";
public static final String JDK_PROPERTY_NAME = "jdk";
public static final String PROPERTY_NAME_SEPARATOR = ";";
+ public static final String BUILDERS_PROPERTY_NAME = "builders";
+ public static final String BUILD_WRAPPERS_PROPERTY_NAME = "buildWrappers";
+ public static final String PUBLISHERS_PROPERTY_NAME = "publishers";
+
/**
* {@link SCM} associated with the project.
diff --git a/hudson-core/src/main/java/hudson/model/Project.java b/hudson-core/src/main/java/hudson/model/Project.java
index 0906d5d..a4e4571 100644
--- a/hudson-core/src/main/java/hudson/model/Project.java
+++ b/hudson-core/src/main/java/hudson/model/Project.java
@@ -53,10 +53,6 @@ public abstract class Project<P extends Project<P,B>,B extends Build<P,B>>
extends AbstractProject<P, B>
implements SCMedItem, Saveable, ProjectWithMaven, BuildableItemWithBuildWrappers, IProject {
- public static final String BUILDERS_PROPERTY_NAME = "builders";
- public static final String BUILD_WRAPPERS_PROPERTY_NAME = "buildWrappers";
- public static final String PUBLISHERS_PROPERTY_NAME = "publishers";
-
/**
* List of active {@link Builder}s configured for this project.
*
@@ -64,6 +60,7 @@ public abstract class Project<P extends Project<P,B>,B extends Build<P,B>>
* don't use this field directly, logic was moved to {@link org.eclipse.hudson.api.model.IProjectProperty}.
* Use getter/setter for accessing to this field.
*/
+ @Deprecated
private DescribableList<Builder, Descriptor<Builder>> builders =
new DescribableList<Builder, Descriptor<Builder>>(this);
@@ -74,6 +71,7 @@ public abstract class Project<P extends Project<P,B>,B extends Build<P,B>>
* don't use this field directly, logic was moved to {@link org.eclipse.hudson.api.model.IProjectProperty}.
* Use getter/setter for accessing to this field.
*/
+ @Deprecated
private DescribableList<Publisher, Descriptor<Publisher>> publishers =
new DescribableList<Publisher, Descriptor<Publisher>>(this);
@@ -84,6 +82,7 @@ public abstract class Project<P extends Project<P,B>,B extends Build<P,B>>
* don't use this field directly, logic was moved to {@link org.eclipse.hudson.api.model.IProjectProperty}.
* Use getter/setter for accessing to this field.
*/
+ @Deprecated
private DescribableList<BuildWrapper, Descriptor<BuildWrapper>> buildWrappers =
new DescribableList<BuildWrapper, Descriptor<BuildWrapper>>(this);
diff --git a/hudson-remoting/pom.xml b/hudson-remoting/pom.xml
index 859f686..5e188cd 100644
--- a/hudson-remoting/pom.xml
+++ b/hudson-remoting/pom.xml
@@ -144,5 +144,16 @@
<build.version>${project.version}</build.version>
</properties>
</profile>
+ <profile>
+ <id>hudson</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
diff --git a/hudson-service/pom.xml b/hudson-service/pom.xml
index 789ce33..cbf456c 100644
--- a/hudson-service/pom.xml
+++ b/hudson-service/pom.xml
@@ -56,4 +56,17 @@
</plugins>
</build>
+ <profiles>
+ <profile>
+ <id>hudson</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
diff --git a/hudson-utils/pom.xml b/hudson-utils/pom.xml
index b48d7eb..afb5628 100644
--- a/hudson-utils/pom.xml
+++ b/hudson-utils/pom.xml
@@ -76,4 +76,17 @@
</dependency>
</dependencies>
+ <profiles>
+ <profile>
+ <id>hudson</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
diff --git a/pom.xml b/pom.xml
index b78695d..3694dc8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -722,6 +722,43 @@
<hudson.sign.storepass>hudson</hudson.sign.storepass>
</properties>
</profile>
+
+ <profile>
+ <id>hudson</id>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ <version>${cobertura-maven-plugin.version}</version>
+ <configuration>
+ <check>
+ <branchRate>80</branchRate>
+ <lineRate>80</lineRate>
+ <haltOnFailure>true</haltOnFailure>
+ <totalBranchRate>80</totalBranchRate>
+ <totalLineRate>80</totalLineRate>
+ <packageLineRate>80</packageLineRate>
+ <packageBranchRate>80</packageBranchRate>
+ </check>
+ <formats>
+ <format>xml</format>
+ </formats>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>cobertura</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+ </profile>
</profiles>
</project>