Index: antsrc/org/netbeans/nbbuild/ModuleListParser.java
===================================================================
RCS file: /cvs/nbbuild/antsrc/org/netbeans/nbbuild/ModuleListParser.java,v
--- antsrc/org/netbeans/nbbuild/ModuleListParser.java 30 Jun 2006 21:07:42 -0000 1.32
+++ antsrc/org/netbeans/nbbuild/ModuleListParser.java 12 Jul 2006 13:00:52 -0000
@@ -562,18 +562,27 @@
throw new IOException("You must declare either or for an external module in " + new File((String) properties.get("basedir")));
}
// If scan.binaries property is set or it runs from tests we scan binaries otherwise sources.
- if (properties.get("scan.binaries") != null ||
- properties.get("xtest.home") != null && properties.get("xtest.testtype") != null) {
+ boolean xtest = properties.get("xtest.home") != null && properties.get("xtest.testtype") != null;
+ if (properties.get("scan.binaries") != null || xtest) {
entries = scanBinaries(properties, project);
// module itself has to be added because it doesn't have to be in binaries
- Entry e = scanStandaloneSource(properties, project);
- entries.put(e.getCnb(), e);
+ Entry e = scanStandaloneSource(properties, project);
+ // xtest gets module jar and cluster from binaries
+ if (e.clusterName == null && xtest) {
+ Entry oldEntry = (Entry) entries.get(e.getCnb());
+ if (oldEntry != null) {
+ e = new Entry(e.getCnb(),oldEntry.getJar(),
+ e.getClassPathExtensions(),e.sourceLocation,
+ e.netbeansOrgPath,e.buildPrerequisites,
+ oldEntry.getClusterName());
+ }
+ }
+ entries.put(e.getCnb(), e);
} else {
entries = scanNetBeansOrgSources(new File(nball), properties, project);
}
}
}
-
/**
* Find all entries in this list.
* @return a set of all known entries
Index: antsrc/org/netbeans/nbbuild/ParseProjectXml.java
===================================================================
RCS file: /cvs/nbbuild/antsrc/org/netbeans/nbbuild/ParseProjectXml.java,v
--- antsrc/org/netbeans/nbbuild/ParseProjectXml.java 30 Jun 2006 21:07:43 -0000 1.41
+++ antsrc/org/netbeans/nbbuild/ParseProjectXml.java 14 Jul 2006 16:50:16 -0000
@@ -28,10 +28,13 @@
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.jar.Attributes;
@@ -189,6 +192,70 @@
classPathExtensionsProperty = s;
}
+ // test distribution path
+ public static String testDistLocation;
+
+ public static class TestType {
+ private String name;
+ private String folder;
+ private String runtimeCP;
+ private String compileCP;
+
+ public TestType() {}
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getFolder() {
+ return folder;
+ }
+
+ public void setFolder(String folder) {
+ this.folder = folder;
+ }
+
+ public String getRuntimeCP() {
+ return runtimeCP;
+ }
+
+ public void setRuntimeCP(String runtimeCP) {
+ this.runtimeCP = runtimeCP;
+ }
+
+ public String getCompileCP() {
+ return compileCP;
+ }
+
+ public void setCompileCP(String compileCP) {
+ this.compileCP = compileCP;
+ }
+
+ }
+ List /**/ testTypes = new LinkedList();
+
+ public void addTestType(TestType testType) {
+ testTypes.add(testType);
+ }
+ public void add(TestType testType) {
+ testTypes.add(testType);
+ }
+
+
+ private TestType getTestType(String name) {
+ for (int i = 0 ; i < testTypes.size() ; i++) {
+ TestType testType = (TestType) testTypes.get(i);
+ if (testType.getName().equals(name)) {
+ return testType;
+ }
+ }
+ return null;
+ }
+
+
private void define(String prop, String val) {
log("Setting " + prop + "=" + val, Project.MSG_VERBOSE);
String old = getProject().getProperty(prop);
@@ -198,6 +265,7 @@
getProject().setNewProperty(prop, val);
}
+
public void execute() throws BuildException {
try {
if (getProjectFile() == null) {
@@ -276,7 +344,10 @@
}
ModuleListParser modules = null;
Dep[] deps = null;
- if (moduleDependenciesProperty != null || moduleClassPathProperty != null || moduleRunClassPathProperty != null) {
+ if (moduleDependenciesProperty != null ||
+ moduleClassPathProperty != null ||
+ moduleRunClassPathProperty != null ||
+ testTypes.size() > 0) {
String nball = getProject().getProperty("nb_all");
Hashtable properties = getProject().getProperties();
properties.put("project", project.getAbsolutePath());
@@ -348,6 +419,36 @@
define(classPathExtensionsProperty, val);
}
}
+
+ // Test dependecies
+ //
+ if (modules != null) {
+ String testDistLocation = getProject().getProperty(TestDeps.TEST_DIST_VAR);
+ if (testDistLocation == null) {
+ testDistLocation = "${" + TestDeps.TEST_DIST_VAR + "}";
+ }
+ ParseProjectXml.testDistLocation = testDistLocation;
+
+ TestDeps testDepss[] = getTestDeps(pDoc,modules,getCodeNameBase(pDoc));
+ for (int tdIt = 0 ; tdIt < testDepss.length ; tdIt++) {
+ TestDeps td = testDepss[tdIt];
+ // unit tests
+ TestType testType = getTestType(td.testtype);
+ if (testType!= null ) {
+ if (testType.getFolder() != null) {
+ define (testType.getFolder(),td.getTestFolder());
+ }
+ if (testType.getCompileCP() != null) {
+
+ define(testType.getCompileCP(),td.getCompileClassPath());
+ }
+ if (testType.getRuntimeCP() != null) {
+ define(testType.getRuntimeCP(),td.getRuntimeClassPath());
+ }
+
+ }
+ }
+ }
} catch (BuildException e) {
throw e;
} catch (Exception e) {
@@ -737,7 +838,149 @@
}
return module.getJar();
}
-
+
+ final class TestDeps {
+ public static final String UNIT = "unit";
+ public static final String QA_FUNCTIONAL = "qa-functional";
+ // unit, qa-functional, performance
+ final String testtype;
+ // all dependecies for the testtype
+ final List /**/ dependencies = new ArrayList();
+ // code name base of tested module
+ final String cnb;
+ final ModuleListParser modulesParser;
+
+ public static final String TEST_DIST_VAR = "test.dist.dir";
+ public TestDeps(String testtype,String cnb,ModuleListParser modulesParser) {
+ assert modulesParser != null;
+ this.testtype = testtype;
+ this.cnb = cnb;
+ this.modulesParser = modulesParser;
+ }
+
+ public List/**/ getFiles(boolean compile) {
+ List/**/ files = new ArrayList();
+ for (int dIt = 0 ; dIt < dependencies.size() ; dIt++) {
+ files.addAll(((TestDep)dependencies.get(dIt)).getFiles(compile));
+ }
+ return files;
+ }
+ public void addDepenency(TestDep dep) {
+ dependencies.add(dep);
+ }
+
+ private String getTestFolder() {
+ ModuleListParser.Entry entry = modulesParser.findByCodeNameBase(cnb);
+ String sep = File.separator;
+
+ String cluster = entry.getClusterName();
+ if (cluster == null) {
+ // no cluster name is specified for standalone or module in module suite
+ cluster = "cluster";
+ }
+ return ParseProjectXml.testDistLocation + sep + testtype + sep + entry.getClusterName() + sep + cnb.replace('.','-');
+ }
+
+ String getCompileClassPath() {
+ return getPath(getFiles(true));
+ }
+ private String getPath(List/**/ files) {
+ StringBuffer path = new StringBuffer();
+ Set/**/ filesSet = new HashSet();
+ for (int fIt = 0 ; fIt < files.size() ; fIt++) {
+ String filePath = (String)files.get(fIt);
+ if (!filesSet.contains(filePath)) {
+ if (path.length() > 0) {
+ path.append(File.pathSeparatorChar);
+ }
+ filesSet.add(filePath);
+ path.append(filePath);
+ }
+ }
+ return path.toString();
+ }
+
+ String getRuntimeClassPath() {
+ return getPath(getFiles(false));
+ }
+
+
+ }
+ /** Test dependency for module and type
+ */
+ final class TestDep {
+ final ModuleListParser modulesParser;
+ // code name base
+ final String cnb;
+ // dependencies on tests of modules
+ final boolean recursive;
+ final boolean test;
+ // runtime classpath
+ final boolean compile;
+ TestDeps testDeps;
+
+ TestDep (String cnb,ModuleListParser modules, boolean recursive,boolean test, boolean compile,TestDeps testDeps) {
+ this.modulesParser = modules;
+ this.cnb = cnb;
+ this.recursive = recursive;
+ this.test = test;
+ this.testDeps = testDeps;
+ this.compile = compile;
+ }
+ /* get modules dependecies
+ */
+ List/**/ getModules() {
+ List /**/ entries = new ArrayList();
+ if (!test) {
+ if (recursive ) {
+ Map/**/ entriesMap = new HashMap();
+ addRecursiveModules(cnb,entriesMap);
+ entries.addAll(entriesMap.values());
+ } else {
+ entries.add(modulesParser.findByCodeNameBase(cnb));
+ }
+ }
+ return entries;
+
+ }
+
+ private void addRecursiveModules(String cnd, Map entriesMap) {
+ if (!entriesMap.containsKey(cnd)) {
+ ModuleListParser.Entry entry = modulesParser.findByCodeNameBase(cnd);
+ entriesMap.put(cnd,entry);
+ String cnds[] = entry.getBuildPrerequisites();
+ // cnds can be null
+ if (cnds != null) {
+ for (int i = 0 ; i < cnds.length ; i++) {
+ addRecursiveModules(cnds[i],entriesMap);
+ }
+ }
+ }
+ }
+ List/**/ getFiles(boolean compile) {
+ List/**/ files = new ArrayList();
+ if (!compile || ( compile && this.compile)) {
+ List /**/ modules = getModules();
+ for (int mIt = 0 ; mIt
+
+
+
+
+
+
+
-
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
@@ -321,10 +354,11 @@
-
+
+
@@ -346,8 +380,101 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Must select some files in the IDE or set javac.includes
@@ -378,13 +505,12 @@
-
-
+
+
-
@@ -580,5 +706,9 @@
-
+
+
+
+
Index: templates/projectized.xml
===================================================================
RCS file: /cvs/nbbuild/templates/projectized.xml,v
--- templates/projectized.xml 30 Jun 2006 21:07:48 -0000 1.80
+++ templates/projectized.xml 14 Jul 2006 16:45:12 -0000
@@ -28,17 +28,27 @@
+
+ project="."
+ publicpackagesproperty="public.packages"
+ friendsproperty="friends"
+ javadocpackagesproperty="module.javadoc.packages"
+ moduledependenciesproperty="module.dependencies"
+ moduleclasspathproperty="module.classpath"
+ publicpackagejardir="${public.package.jar.dir}"
+ modulerunclasspathproperty="module.run.classpath"
+ domainproperty="nbm.domain"
+ classpathextensionsproperty="class.path.extensions">
+
+
+
Index: default.xml
===================================================================
RCS file: /cvs/nbbuild/default.xml,v
--- default.xml 30 Jun 2006 21:07:38 -0000 1.24
+++ default.xml 14 Jul 2006 16:45:13 -0000
@@ -76,6 +76,12 @@
+
+