Skip to content

executables: Allow any vars in enabled_if for executables#14860

Open
punchagan wants to merge 1 commit into
ocaml:mainfrom
punchagan:fix-14789
Open

executables: Allow any vars in enabled_if for executables#14860
punchagan wants to merge 1 commit into
ocaml:mainfrom
punchagan:fix-14789

Conversation

@punchagan
Copy link
Copy Markdown
Collaborator

@punchagan punchagan commented Jun 2, 2026

We allow any vars in enabled_if within the library stanza, but only
common_vars within the executable stanza. This commit fixes that and
allows any vars within the executable stanza too.

Closes #14789

@punchagan
Copy link
Copy Markdown
Collaborator Author

This PR is stacked on top of #14848

@punchagan punchagan marked this pull request as ready for review June 2, 2026 13:49
Comment thread src/dune_rules/stanzas/executables.ml Outdated
@punchagan punchagan force-pushed the fix-14789 branch 2 times, most recently from 23f275c to 6bac50b Compare June 2, 2026 18:23
Comment thread src/dune_rules/stanzas/executables.ml Outdated
Copy link
Copy Markdown
Collaborator

@Alizter Alizter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mostly looks good. Of course, with allowing any variable to appear in enabled_if the impact of the change is quite wide as we would be allowing the user to write more nonsense if we are not careful. I need to go through the variables that we have and think a little in case any of them don't make sense.

We allow any vars in enabled_if within the library stanza, but only
common_vars within the executable stanza. This commit fixes that and
allows any vars within the executable stanza too. The dune lang version
would need to be bumped for this to work, though.

Signed-off-by: Puneeth Chaganti <punchagan@muse-amuse.in>
@rgrinberg
Copy link
Copy Markdown
Member

@punchagan can you scan the code base for other places where we limit the variables in this way? If we're going to lift this restriction, it's best to do it everywhere all at once rather than drip feeding it by stanza.

@Alizter Not sure what you mean by writing nonsense. If a variable cannot be substituted, then either the cycle checker will complain or we will have no value to substitute for it.

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 this pull request may close these issues.

Buggy enabled_if for executable

3 participants