Closed NathanTP closed 4 years ago
config_changed()
also accepts a dict as parameter.
You can think of the key in dictionary as being the unique ID
you are looking for.
@NathanTP thanks for writing about your project. If you feel like it would be welcome addition to our "success stories" in docs
Bug Description
The config_changed() helper object stores the config under a static name. This means that tasks can only have one instance of config_changed() in their uptodate list. This is easy to reproduce:
task_works() will be built the first time, and will be up to date after that. task_breaks() will never be up to date (the db will have 'b' in '_config_changed', so 'a' won't match).
This issue is caused by line 70 in tools.py.
Proposed Fix
I have fixed this in my project by locally redefining config_changed to assign a unique ID to each config_changed object. In my solution, the unique ID is simply the order in which it was added to the uptodate list:
I'm not sure if this is robust to all the use cases (it's working for me so far).
Environment
Background
For the interested, I'm using doit as the underlying dependency management framework in the FireMarshal workload management tool. Tasks are generated from user-provided configurations along with some base distributions. This config_changed() thing is an issue for me because I always include one config_changed() dependency (for GCC version) and I want the task generators to be able to define their own (e.g. to check if some submodule git revision has changed).