-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
env override and makefile extending #523
Comments
feels like a bug. i will check it out. |
@x37v this is now fixed in the 0.32.14 dev branch |
@sagiegurari that did it! thanks so much! |
Not sure if this is a regression or a different bug, but I'm experiencing a bug that seems similar when running [env]
TARGET = "hello"
CHK = "${CARGO_MAKE_CURRENT_TASK_INITIAL_MAKEFILE_DIRECTORY}"
TARGET_FILE = "${CARGO_MAKE_CURRENT_TASK_INITIAL_MAKEFILE_DIRECTORY}/${TARGET}.json"
[tasks.print-env]
script = [
# prints "TARGET=hello"
"echo TARGET=${TARGET}",
# prints "TARGET_FILE=${CARGO_MAKE_CURRENT_TASK_INITIAL_MAKEFILE_DIRECTORY}/hello.json"
"echo TARGET_FILE=${TARGET_FILE}",
# prints "CHK=${CARGO_MAKE_CURRENT_TASK_INITIAL_MAKEFILE_DIRECTORY}"
"echo CHK=${CHK}",
# prints "CARGO_MAKE_CURRENT_TASK_INITIAL_MAKEFILE_DIRECTORY=/this/path/is/correct"
"echo CARGO_MAKE_CURRENT_TASK_INITIAL_MAKEFILE_DIRECTORY=${CARGO_MAKE_CURRENT_TASK_INITIAL_MAKEFILE_DIRECTORY}",
] |
@cdmistman try the following: [tasks.print-env]
script = [
# prints "TARGET=hello"
"echo TARGET=${TARGET}",
# prints "TARGET_FILE=${CARGO_MAKE_CURRENT_TASK_INITIAL_MAKEFILE_DIRECTORY}/hello.json"
"echo TARGET_FILE=${TARGET_FILE}",
# prints "CHK=${CARGO_MAKE_CURRENT_TASK_INITIAL_MAKEFILE_DIRECTORY}"
"echo CHK=${CHK}",
# prints "CARGO_MAKE_CURRENT_TASK_INITIAL_MAKEFILE_DIRECTORY=/this/path/is/correct"
"echo CARGO_MAKE_CURRENT_TASK_INITIAL_MAKEFILE_DIRECTORY=${CARGO_MAKE_CURRENT_TASK_INITIAL_MAKEFILE_DIRECTORY}",
]
[tasks.print-env.env]
TARGET = "hello"
CHK = "${CARGO_MAKE_CURRENT_TASK_INITIAL_MAKEFILE_DIRECTORY}"
TARGET_FILE = "${CARGO_MAKE_CURRENT_TASK_INITIAL_MAKEFILE_DIRECTORY}/${TARGET}.json" The issue is that you are setting up global env vars based on other env vars that are defined a bit later. |
Gotcha, can the docs be fixed in that case? Under https://github.com/sagiegurari/cargo-make#usage-env-vars-loading-order, it's suggested that env vars such as |
Although I would have a preference for some of these variables to be set before visiting the |
you could create a task to define the env vars you need and have it as a dependency. as for the docs, I'll clarify it more. thanks for the feedback. |
ah yes that makes sense! thank you! :) |
I'm using
cargo make 0.32.13
I have 2 Makefile.toml files
The first one defines
And the 2nd one extends the first
when I run
cargo make echo
in the directory with the extended makefile, I see:PACKAGE_INSTALL_DIR: ${PACKAGE_NAME}/externals/
if I remove the
[env]
section from extended makefile I see:PACKAGE_INSTALL_DIR: foo/externals/
If i keep it removed and run
PACKAGE_NAME=bar cargo make echo
i see:PACKAGE_INSTALL_DIR: bar/externals/
So, maybe this is just a bug or am I messing something up? Is there a better way to do this? Basically, I have a variety of options in the base makefile that I'd like to be able to customize, names, paths, etc.
The text was updated successfully, but these errors were encountered: