Permalink
Browse files

updated Gant snapshot that doesn't output the verbose task informatio…

…n but still outputs Ant logging
  • Loading branch information...
1 parent 07bc700 commit d3728870fb67af7a50e9cbdfb0c0cb5a5e836bb3 @graemerocher graemerocher committed Mar 29, 2010
Binary file not shown.
@@ -34,7 +34,7 @@ includeTargets << grailsScript("_GrailsSettings")
classpathSet = false
includePluginJarsOnClasspath = true
-target(classpath: "Sets the Grails classpath") {
+target(name:'classpath', description: "Sets the Grails classpath", prehook:null, posthook:null) {
setClasspath()
}
@@ -487,6 +487,21 @@ private int callPluginOrGrailsScript(String scriptName) {
// Prep the binding with important variables.
initBinding(binding);
+ final Closure doNothingClosure = new Closure(this) {
+ private static final long serialVersionUID = 1L;
+ @Override
+ public Object call(Object arguments) {
+ return null; // do nothing
+ }
+ @Override
+ public Object call() {
+ return null;
+ }
+ @Override
+ public Object call(Object[] args) {
+ return null;
+ }
+ };
// First try to load the script from its file. If there is no
// file, then attempt to load it as a pre-compiled script. If
@@ -512,9 +527,7 @@ private int callPluginOrGrailsScript(String scriptName) {
gant.setUseCache(true);
gant.setCacheDirectory(scriptCacheDir);
gant.loadScript(scriptFile);
-
- // Invoke the default target.
- return gant.processTargets().intValue();
+ return executeWithGantInstance(gant, doNothingClosure);
}
// If there are multiple scripts to choose from and we
@@ -543,9 +556,7 @@ private int callPluginOrGrailsScript(String scriptName) {
// Set up the script to call.
Gant gant = new Gant(binding, classLoader);
gant.loadScript((File) potentialScripts.get(number - 1));
-
- // Invoke the default target.
- return gant.processTargets().intValue();
+ return executeWithGantInstance(gant, doNothingClosure);
}
out.println("Running pre-compiled script");
@@ -568,9 +579,18 @@ private int callPluginOrGrailsScript(String scriptName) {
}
}
}
- return gant.processTargets().intValue();
+ return executeWithGantInstance(gant, doNothingClosure);
}
+ private int executeWithGantInstance(Gant gant,
+ final Closure doNothingClosure) {
+ gant.prepareTargets();
+ gant.setAllPerTargetPostHooks(doNothingClosure);
+ gant.setAllPerTargetPreHooks(doNothingClosure);
+ // Invoke the default target.
+ return gant.executeTargets().intValue();
+ }
+
private boolean isGrailsProject() {
return new File(settings.getBaseDir(), "grails-app").exists();
}

0 comments on commit d372887

Please sign in to comment.