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

(subdir ...) stanzas do not work in included dune files #3668

Closed
nojb opened this issue Aug 2, 2020 · 5 comments
Closed

(subdir ...) stanzas do not work in included dune files #3668

nojb opened this issue Aug 2, 2020 · 5 comments
Milestone

Comments

@nojb
Copy link
Collaborator

nojb commented Aug 2, 2020

To reproduce:

$ cat >dune-project <<EOF
> (lang dune 2.5)
> EOF
$ cat >dune <<EOF
> (include dune.inc)
> EOF
$ cat >dune.inc <<EOF
> (subdir a (rule (alias foo) (action (echo Hello))))
> EOF
$ mkdir -p a
$ dune build @foo
File "dune.inc", line 1, characters 2-8:
1 |  (subdir a (rule (alias foo) (action (echo Hello))))
      ^^^^^^
Error: Unknown constructor subdir
@nojb
Copy link
Collaborator Author

nojb commented Aug 2, 2020

Looking at how subdir is implemented, I understand that allowing this would complicate matters, since the subdir stanzas are interpreted before evaluating any rule.

On the other hand, this feature is useful in generated dune files specifically, so it would nice to support this if not too difficult.

@nojb
Copy link
Collaborator Author

nojb commented Aug 2, 2020

One way to do it could be to process (include ...) stanzas before (or at the same time as) (subdir ...).

@ghost
Copy link

ghost commented Aug 3, 2020

That seems reasonable

@rgrinberg rgrinberg added this to the 2.7 milestone Aug 7, 2020
@rgrinberg
Copy link
Member

It works now.

@vsiles
Copy link
Contributor

vsiles commented Nov 22, 2022

@rgrinberg FYI it doesn't work easier with tuareg mode files like https://github.com/facebook/hhvm/blob/master/hphp/hack/src/hhi/dune

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

No branches or pull requests

3 participants