Skip to content
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

Importing many times the same justfile. #2436

Closed
gl-yziquel opened this issue Oct 21, 2024 · 4 comments · Fixed by #2437
Closed

Importing many times the same justfile. #2436

gl-yziquel opened this issue Oct 21, 2024 · 4 comments · Fixed by #2437

Comments

@gl-yziquel
Copy link
Contributor

Hi.

I am writing some multiple just fragments to handle some aspects of my build systems. Some of them, say A.just and B.just depend on another, C.just. Essentially, I'd like to write import "A.just" and/or import "B.just". When I import only one of them, it works fine: A.just is importing C.just, or B.just is importing C.just. No conflict. When I import both of them, the tasks in C.just conflict as they are declared twice, once for each import.

Ideally, there should be some "caching" mechanism that would allow the C.just file to be detected to be the same, and thus imported only once. No ?

@casey
Copy link
Owner

casey commented Oct 21, 2024

Thanks for opening an issue! You should be able to do set allow-duplicate-recipes, which will cause duplicate recipes to not be an error.

I'm going to leave this open though, since I think possibly we should just detect this and avoid throwing an error in the first place. If you're importing the same recipe from the same file, then there's really no problem with allowing it, since the two recipes are identical.

@gl-yziquel
Copy link
Contributor Author

Thanks for opening an issue! You should be able to do set allow-duplicate-recipes, which will cause duplicate recipes to not be an error.

In fact, that's what I'd like to avoid doing. This case (when the import is the same file) should, IMO, not be handled with an "override" mechanism like "set allow-duplicate-recipes" (which is what, by the way, I am currently doing to work around this issue). The reason being that I'd like, precisely, to bail out when genuine duplicate recipes appear.

In essence, I am turning off a safety mechanism to solve an issue that, IMO, should not exist in the first place.

(But there is no hurry: I can live with the "set allow-duplicate-recipes" workaround.)

@casey
Copy link
Owner

casey commented Oct 30, 2024

This is implemented in #2437! Just will now ignore duplicate imports, so no need for set allow-duplicate-recipes.

@gl-yziquel
Copy link
Contributor Author

gl-yziquel commented Oct 30, 2024

This is implemented in #2437! Just will now ignore duplicate imports, so no need for set allow-duplicate-recipes.

Thank you !

P.S.: I just checked. Works like a charm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants