[gant-scm] [10434] gant/trunk/src/main/groovy/gant: Change the final message from being written explicitly to being handled by execution of a hook.

View: New views
1 Messages — Rating Filter:   Alert me  

[gant-scm] [10434] gant/trunk/src/main/groovy/gant: Change the final message from being written explicitly to being handled by execution of a hook.

by russel-9 :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
[10434] gant/trunk/src/main/groovy/gant: Change the final message from being written explicitly to being handled by execution of a hook.
Revision
10434
Author
russel
Date
2009-10-18 15:33:59 -0500 (Sun, 18 Oct 2009)

Log Message

Change the final message from being written explicitly to being handled by execution of a hook.

Modified Paths

Diff

Modified: gant/trunk/src/main/groovy/gant/Gant.groovy (10433 => 10434)

--- gant/trunk/src/main/groovy/gant/Gant.groovy	2009-10-18 19:32:02 UTC (rev 10433)
+++ gant/trunk/src/main/groovy/gant/Gant.groovy	2009-10-18 20:33:59 UTC (rev 10434)
@@ -620,10 +620,10 @@
     def gant = new Gant ( )
     def returnValue = gant.processArgs ( args )
     if ( outputBuildTime ) {
-      def elapseTime = ( System.nanoTime ( ) - startTime ) / 1e9
-      def project = gant.binding.ant.project
-      project.log ( '\nBUILD ' + ( returnValue == 0 ? 'SUCCESSFUL' : 'FAILED' ) )
-      project.log ( 'Total time: ' + renderTimeInterval ( elapseTime ) )
+      def terminateHook = gant.binding.getVariable ( 'terminateHook' )
+      if ( ( terminateHook != null ) && ( terminateHook instanceof Closure ) ) {
+        terminateHook.call ( returnValue , renderTimeInterval ( ( System.nanoTime ( ) - startTime ) / 1e9 ) )
+      }
     }
     System.exit ( returnValue )
   }

Modified: gant/trunk/src/main/groovy/org/codehaus/gant/GantBinding.groovy (10433 => 10434)

--- gant/trunk/src/main/groovy/org/codehaus/gant/GantBinding.groovy	2009-10-18 19:32:02 UTC (rev 10433)
+++ gant/trunk/src/main/groovy/org/codehaus/gant/GantBinding.groovy	2009-10-18 20:33:59 UTC (rev 10434)
@@ -111,6 +111,10 @@
     super.setVariable ( 'includeTool' , new IncludeTool ( this ) )
     super.setVariable ( 'globalPreHook' , null )
     super.setVariable ( 'globalPostHook' , null )
+    super.setVariable ( 'terminateHook' , { int returnValue , String elapseTime ->
+        owner.ant.project.log ( '\nBUILD ' + ( returnValue == 0 ? 'SUCCESSFUL' : 'FAILED' ) )
+        owner.ant.project.log ( 'Total time: ' + elapseTime )
+      } )
     super.setVariable ( 'target' , { Map<String, String> map , Closure closure ->
         def targetName = ''
         def targetDescription = ''


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email