Modified:
trunk/src/main/java/com/google/ant/extensions/SourceRepo.java
trunk/src/main/java/com/google/ant/extensions/tasks/DrillTask.java
trunk/src/main/java/com/google/ant/extensions/types/Module.java
trunk/src/main/java/com/google/ant/extensions/types/Modules.java
trunk/src/main/java/com/google/ant/extensions/types/Resolver.java
Log:
* Pre-register all of the modules into the source repo, so that
module.getDependencies can return the deps that not yet in the source repo
--____________--
M src/main/java/com/google/ant/extensions/types/Resolver.java
M src/main/java/com/google/ant/extensions/types/Module.java
M src/main/java/com/google/ant/extensions/types/Modules.java
M src/main/java/com/google/ant/extensions/tasks/DrillTask.java
M src/main/java/com/google/ant/extensions/SourceRepo.java
Modified: trunk/src/main/java/com/google/ant/extensions/SourceRepo.java
==============================================================================
--- trunk/src/main/java/com/google/ant/extensions/SourceRepo.java (original)
+++ trunk/src/main/java/com/google/ant/extensions/SourceRepo.java Tue Sep
9 07:29:50 2008
@@ -28,6 +28,9 @@
if (fantBase == null && project != null) {
fantBase = project.getProperty("fant.etc.dir");
}
+ if (fantBase == null && project != null) {
+ fantBase = project.getProperty("ant.home") + "/etc/fant";
+ }
if (fantBase != null) {
System.setProperty("FANT_HOME", fantBase);
} else {
Modified: trunk/src/main/java/com/google/ant/extensions/tasks/DrillTask.java
==============================================================================
--- trunk/src/main/java/com/google/ant/extensions/tasks/DrillTask.java
(original)
+++ trunk/src/main/java/com/google/ant/extensions/tasks/DrillTask.java Tue
Sep 9 07:29:50 2008
@@ -126,7 +126,7 @@
handleOutput("Scanning for projects...");
handleOutput("Build order:");
for (Module m : ms) {
- handleOutput(" " + m.getName());
+ handleOutput(" " + m.getNiceName());
}
handleOutput("\n
----------------------------------------------------------------------------\n");
}
@@ -144,7 +144,7 @@
int max = 65;
StringBuffer sb = new StringBuffer();
for (Module m : builds) {
- String line = m.getName();
+ String line = m.getNiceName();
String elapseString =
DateUtils.formatElapsedTime(m.getElapsed());
String dots = getDots(line.length() + elapseString.length());
Modified: trunk/src/main/java/com/google/ant/extensions/types/Module.java
==============================================================================
--- trunk/src/main/java/com/google/ant/extensions/types/Module.java
(original)
+++ trunk/src/main/java/com/google/ant/extensions/types/Module.java Tue
Sep 9 07:29:50 2008
@@ -36,6 +36,8 @@
private Project moduleProject;
+ private String niceName;
+
public void setBuilddep(boolean b) {
this.builddep = b;
}
@@ -64,6 +66,14 @@
return this.name;
}
+ public String getNiceName() {
+ return this.niceName;
+ }
+
+ public void setNiceName(String nn) {
+ this.niceName = nn;
+ }
+
public String toString() {
return name;
}
@@ -91,6 +101,7 @@
m.setBasedir(new File(stoken.nextToken()).getAbsolutePath());
m.setBuildfile(stoken.nextToken());
m.setName(stoken.nextToken());
+ m.setNiceName(m.getName());
return m;
}
@@ -120,7 +131,7 @@
}
}
if (moduleProject.getName() != null) {
- setName(moduleProject.getName());
+ setNiceName(moduleProject.getName());
}
if (getBasedir() == null) {
@@ -156,6 +167,9 @@
}
public void selfRegister() {
+ if (moduleProject == null) {
+ initModuleProject();
+ }
new SourceRepo(this.moduleProject).add(this);
}
Modified: trunk/src/main/java/com/google/ant/extensions/types/Modules.java
==============================================================================
--- trunk/src/main/java/com/google/ant/extensions/types/Modules.java
(original)
+++ trunk/src/main/java/com/google/ant/extensions/types/Modules.java Tue
Sep 9 07:29:50 2008
@@ -10,6 +10,7 @@
import com.google.ant.extensions.SourceRepo;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.DataType;
+import org.apache.tools.ant.BuildException;
public class Modules extends DataType {
private String id;
@@ -61,6 +62,18 @@
List<Module> builds = new ArrayList<Module>();
SourceRepo repo = new SourceRepo(getProject());
+ // Register first, to help the resolver to get all the
dependencies of the modules
+ for (Iterator iter = modules.iterator(); iter.hasNext();) {
+ Module module = (Module) iter.next();
+ File moduleBase = new File(getProject().getBaseDir(),
module.getName());
+ if (!moduleBase.exists()) {
+ continue;
+ }
+ module.setBasedir(moduleBase.getAbsolutePath());
+ module.selfRegister();
+ }
+
+
for (Iterator iter = modules.iterator(); iter.hasNext();) {
Module module = (Module) iter.next();
boolean hasSubModules = hasSubModules(module);
@@ -71,6 +84,8 @@
File moduleBase = new File(getProject().getBaseDir(),
module.getName());
module.setBasedir(moduleBase.getAbsolutePath());
+ System.out.println("ModuleBase: " + moduleBase);
+
if (!hasSubModules && !module.hasBuildFile()) {
String msg = "Can not find the " + module.getBuildfile()
+ " file under the module:" + module.getName();
@@ -80,6 +95,7 @@
loadModuleName(repo, module);
if (builddep) {
Collection<Module> deps = module.getDependencies();
+ System.out.println("Module:" + module.getName() + " " +
deps);
for (Module m : deps) {
if (!builds.contains(m)) {
builds.add(m);
@@ -106,6 +122,7 @@
for (Module module : builds) {
module.selfRegister();
}
+
return builds;
}
Modified: trunk/src/main/java/com/google/ant/extensions/types/Resolver.java
==============================================================================
--- trunk/src/main/java/com/google/ant/extensions/types/Resolver.java
(original)
+++ trunk/src/main/java/com/google/ant/extensions/types/Resolver.java Tue
Sep 9 07:29:50 2008
@@ -15,7 +15,7 @@
Collection<Module> toRemove = new ArrayList<Module>();
for (Module module : modules) {
- //System.out.println("*** " + module +
module.getDependencies());
+ System.out.println("*** " + module + module.getDependencies());
if (!depModulesMap.containsKey(module)) {
Collection<Module> depModules = new ArrayList<Module>();
depModules.addAll(module.getDependencies());
@@ -38,8 +38,8 @@
}
}
- //System.out.println("to remove: " + toRemove);
- //System.out.println("results: " + results);
+ System.out.println("to remove: " + toRemove);
+ System.out.println("results: " + results);
if (lastResultsCount == results.size()) {
checkCycleDependencies(modules);