Gant

Allow global hooks to turn off Ant-like messages for all targets

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.8.0
  • Fix Version/s: 1.9.2
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    0

Description

See GANT-90 item 2.

The following test should not produce any per target output

globalPreHook = []
globalPostHook = []

target(test: 'my test') {
}

Activity

Hide
Russel Winder added a comment - - edited

Currently the global hooks and the per-target hooks are different and independent lists. I think they should perhaps stay that way rather than create a complex interdependencies, the rules for which will always annoy someone.

This implies that what is needed is a global way of managing the per-target tests. Currently the verbosity level is the only tool available. This is changed by setting the org.codehaus.gant.GantState.verbosity variable. However the system is somewhat silly in that you also need to explicitly transfer this to the AntBuilder instance:

import org.codehaus.gant.GantState

GantState.verbosity = GantState.SILENT
ant.logger.setMessageOutputLevel ( GantState.verbosity ) 

target ( sayHello : '' ) { println 'Hello'  }

target ( hello : 'Say hello.' ) { sayHello ( ) }

setDefaultTarget ( hello )

If manipulating the verbosity level is what this issue is about then the job of work is actually to make the setting of the verbosity level easier – both in Gant scripts and in the Gant source itself.

Show
Russel Winder added a comment - - edited Currently the global hooks and the per-target hooks are different and independent lists. I think they should perhaps stay that way rather than create a complex interdependencies, the rules for which will always annoy someone. This implies that what is needed is a global way of managing the per-target tests. Currently the verbosity level is the only tool available. This is changed by setting the org.codehaus.gant.GantState.verbosity variable. However the system is somewhat silly in that you also need to explicitly transfer this to the AntBuilder instance:
import org.codehaus.gant.GantState

GantState.verbosity = GantState.SILENT
ant.logger.setMessageOutputLevel ( GantState.verbosity ) 

target ( sayHello : '' ) { println 'Hello'  }

target ( hello : 'Say hello.' ) { sayHello ( ) }

setDefaultTarget ( hello )
If manipulating the verbosity level is what this issue is about then the job of work is actually to make the setting of the verbosity level easier – both in Gant scripts and in the Gant source itself.
Hide
Bob Swift added a comment -

The trouble is that I want all the usual ant logging, just want to control the begin and end messaging.

Show
Bob Swift added a comment - The trouble is that I want all the usual ant logging, just want to control the begin and end messaging.
Hide
Russel Winder added a comment -

OK, that militates in favour of special global operations on the hooks.

If the targets registered themselves with a central list of targets then we could have functions that iterated over all the targets doing things to them.

This might lead to interesting alternatives to the global / per-target hook split as it is now.

Show
Russel Winder added a comment - OK, that militates in favour of special global operations on the hooks. If the targets registered themselves with a central list of targets then we could have functions that iterated over all the targets doing things to them. This might lead to interesting alternatives to the global / per-target hook split as it is now.
Hide
Bob Swift added a comment -

Russel, I have a related question regarding a different use. If I have a Gant binding, how can I set the set the verbosity level? It relates to your comment above:

If manipulating the verbosity level is what this issue is about then the job of work is actually to make the setting of the verbosity level easier in both in Gant scripts and in the Gant source itself.

Show
Bob Swift added a comment - Russel, I have a related question regarding a different use. If I have a Gant binding, how can I set the set the verbosity level? It relates to your comment above:
If manipulating the verbosity level is what this issue is about then the job of work is actually to make the setting of the verbosity level easier in both in Gant scripts and in the Gant source itself.
Hide
Russel Winder added a comment -

The verbosity level is held separately in the GantState as a global static and also in the Ant project associated with the GantBuilder instance. This separation is a hang over and needs refactoring so that the verbosity is held only in the GantBuilder instance. Currently there is no simple API for dealing with all this: originally there was just the global variable and that was fairly straightforward both within Gant and from a script. With the current set up everything is messy.

Alternative one is to set up a proper property system in GantState. Alternative two is to have proper accessors in GantBuilder. Making the way of manipulating things the same for both Gant internals and scripts is probably the best goal.

Show
Russel Winder added a comment - The verbosity level is held separately in the GantState as a global static and also in the Ant project associated with the GantBuilder instance. This separation is a hang over and needs refactoring so that the verbosity is held only in the GantBuilder instance. Currently there is no simple API for dealing with all this: originally there was just the global variable and that was fairly straightforward both within Gant and from a script. With the current set up everything is messy. Alternative one is to set up a proper property system in GantState. Alternative two is to have proper accessors in GantBuilder. Making the way of manipulating things the same for both Gant internals and scripts is probably the best goal.
Hide
Russel Winder added a comment -

It is believed that solving GANT-117 and releasing Gant 1.9.2 has in fact dealt with this issue.

Show
Russel Winder added a comment - It is believed that solving GANT-117 and releasing Gant 1.9.2 has in fact dealt with this issue.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: