Hello. I have bunch of files that I need to process in similar way. To accomplish that, I use extend and pass file name using env. Like this
[tasks.zip-all]
dependencies = ["zip-a", "zip-b"]
[tasks.zip-a]
extend = "zip"
env.ASSET_NAME = "a"
[tasks.zip-b]
extend = "zip"
env.ASSET_NAME = "b"
[tasks.zip]
command = "zip"
args = ["${ASSET_NAME}.zip", "${ASSET_NAME}.txt"]
condition = { files_modified = { input = ["${ASSET_NAME}.txt"], output = ["${ASSET_NAME}.zip"] } }
However, it seems that env.ASSET_NAME = "a" is evaluated after condition and propagates to the next task, which results in unexpected behavior:
$ ls
a.txt a.zip b.txt Makefile.toml
$ makers zip-all
[cargo-make] INFO - makers 0.37.24
[cargo-make] INFO -
[cargo-make] INFO - Build File: Makefile.toml
[cargo-make] INFO - Task: zip-all
[cargo-make] INFO - Profile: development
[cargo-make] INFO - Execute Command: "zip" "a.zip" "a.txt"
updating: a.txt (stored 0%)
[cargo-make] INFO - Skipping Task: zip-b
[cargo-make] INFO - Build Done in 0.22 seconds.
Having to write similar looking condition to every file tedious very fast and is very prone to small but hard to detect mistakes. Is there any other way to make extended condition to depend on envvar or some other kind of variable?
Hello. I have bunch of files that I need to process in similar way. To accomplish that, I use extend and pass file name using env. Like this
However, it seems that
env.ASSET_NAME = "a"is evaluated after condition and propagates to the next task, which results in unexpected behavior:Having to write similar looking condition to every file tedious very fast and is very prone to small but hard to detect mistakes. Is there any other way to make extended condition to depend on envvar or some other kind of variable?