-
Notifications
You must be signed in to change notification settings - Fork 476
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
Allow duplicate recipes #1095
Allow duplicate recipes #1095
Conversation
Thanks for the PR and the thoughtful comments! I'm not opposed to a setting. A few comments:
|
Thanks for the quick response and feedback! Went through and made the suggested changes. Was able to implement the duplicate overriding from within the analyzer relatively cleanly (after reading the settings). Not sure I added the integration test to the right spot, but put one into Also added quick documentation to the Readme (but unsure if I missed other spots). Any feedback/suggestions are welcome (even small nits). Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Added a few comments.
tests/misc.rs
Outdated
test! { | ||
name: allow_duplicate_recipes, | ||
justfile: "b:\n echo foo\nb:\n echo bar\nset allow-duplicate-recipes", | ||
args: ("b"), | ||
stdout: "bar\n", | ||
stderr: "echo bar\n", | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I try not to add new tests to misc.rs
, since it's way too long as is. You can create a new file, tests/allow_duplicate_recipes.rs
and put the test in there. Also, I try not to add new macro-based tests, i.e., using the test!
macro. Check out one of the struct-based tests that uses Test::new
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to new file as suggested.
Co-authored-by: Casey Rodarmor <casey@rodarmor.com>
I think I addressed your comments. As an extra thought however just noting that I know that would be more work (and go back to pulling in config options into the analyzer which I tried to avoid... but would keep it behind the feature flag). Also because the only other code effected would be in the json dump code that is also unstable, we wouldn't need to pass the settings around everywhere. (Perhaps the tricky part would be documenting it clearly in the README). @casey I don't mean to delay a feature I asked for I guess only want to make sure we bolt on new features wisely -- especially with 1.0 around the corner. I'm fine either merging or doing the work to only allow this when |
Good thought! I'm actually not too worried. It wouldn't be hard to just soft-deprecate the current setting name, at the same time as we introduce an alias. I'm also on the fence about #166 anyways. Regarding 1.0, I actually think that anything that we want to change in the future can be introduced in a backwards compatible way with settings. And, if eventually there are a bunch of settings that we want to make the default, we can do so with something like Rust's edition system, where you would put something like So I'm fine including this as is and worrying about it later if we want to change it. |
There was a clippy error, but it was simple so I went ahead and fixed it. Looks good! |
I just published 0.11.1, which includes this change. |
Hey there @casey first off just wanted to thank you for an awesome tool. I personally love using it in all my projects.
This is meant to address the allowing duplicate recipes via a setting. This should help partially resolve the conversation in how to override recipes when using
justprep
.I know this conversation was a while ago, and your reasoning may have changed (I really want modules or recipes that can have prereqs from other files), but
justprep
is the closest we can get to having modular "dependencies" at the moment, and this is sort of the last piece that would help our workflows.Why I chose to use a setting rather than a cli flag: if there are duplicate recipes in the justfiles, they will not parse, rather than pass around the config flags everywhere it seemed logical to have that be a setting in the file (that if used in an older version will properly barf not knowing about the
allow-duplicates
setting.Some tradeoffs made: settings are parsed in order and duplicates are only allowed after the setting is used. I know this breaks the nice unordered property of justfiles generally, but the compromise seemed fair while I was there.
It looks like this now:
and without the
set allow-duplicates
line will error as normal:Open to any feedback (both on approach and code) -- or if you want to go a different direction entirely at this point it would be understandable too.
I can also write up the docs as needed, but didn't want to go overboard until got your general approval to refine more