I need to keep a control value (possibly inside a file), in order to decide whether to execute a task or not.
I’m coming from here: Ant: How can I subtract two properties (containing timestamps)?
What I want to do, is to check if the control value is equal to a period (mmYY). If it is equal, nothing will be done, but if they are not, the control value should be updated.
For example:
<task dosomethingifcontrolvaluediffers>
control value is 0000
(calculated) property is: 0110
Then, control value should now be 0110.
</task>
I was thinking of keeping the value in a separate file, and if rewriting is neccessary, then truncate the file and updating, but
1) Cant find a way to do this
2) Dont know how.
3) scripting ? Would be my favorite choice, but dont know howto in js.
Any thoughts?
Thanks in advance.
Should be done outside of Ant. Write a script in whatever language you know (bash, Python, JavaScript, etc.) that does the calculation, does the check, and calls Ant using that value as a parameter if needed.
Ant’s not intended to be a scripting language. People get into trouble when they try to make it so.