I have a simple, yet non obvious requirement to a build process on SCONS.
I need to enter the following command:
scons release [version]
Expected results
What this should do is:
- Activate a target called release.
- Capture the parameter passed soon after the release parameter.
- As part of the target, execute a function. If the parameter passed after the release targed is valid, call another targed.
- If it is not valid, interrupt the workflow and show an error message.
Problem
I have no idea how to set this up
My current hypothesis would be:
- Create a custom builder with two actions.
- First action should be a python function that somehow would be able to stop the process in case its logic so decides.
- Second action should be invoking the default builder, because if the first action decides it is ok to go ahead, the default builder should be executed.
- Create a target pointing to this custom builder called release.
What I need to do is kind of create a workflow where some logic is executed as part of a target and decides if another one should or should not be executed.
But I don't know if it is doable the way I am thinking, and I miss some knowledge I don't know where to get:
- The "release" target is not an input file. It is instead a trigger to execut a workflow composed of different actions. How do I tell SCONS that "release" parameter is not a file?
- How do I capture the next parameter typed soon after the "release" parameter? This is the release number and shall be used by the "release" target to validate stuff. Pseldocode would be:
def releaseTarget(wantedRelease):
if wantedTarget == "":
interruptHere()
- How do I interrupt the workflow, so as to prevent the next action from being executed?
- How do I chain the default action as the next action in the workflow?
I would like some pointers on where I should start looking for this kind of functionality on scons.
question from:
https://stackoverflow.com/questions/65859394/how-to-put-validation-logic-as-dependency-on-scons-target 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…