Skip to content

Allow variable expansion in the dst of installed files in the bin section #6818

@gridbugs

Description

@gridbugs

Desired Behavior

At the moment dune doesn't permit variable expansion in the dst of installed files in the bin section. See if it's possible to lift this limitation.

E.g.:

(install
  (section bin)
  (files (foobar.txt as "%{env:FOO=foobar}/foo.txt")))

According to this test

them could cause a dependency cycle (also, most of them make no sense in [dst] anyway).
this is due to a dependency cycle.

In #6764 a dependency cycle between enumerating the local binaries in a project (installed in the bin section) and populating the artifacts database was broken. This change initially caused the above test to start failing as variable expansion in the dst position started working, but we explicitly forced the check to be performed to maintain the same behaviour. This forcing is done via this (https://github.com/gridbugs/dune/blob/cff5052e2162d9a1a223f96ef19b1ac34555c0c5/src/dune_rules/main.ml#L59) call to Super_context.all_init_deferred.

See if it's possible to remove the limitation on variable expansion in the dst of files in the bin section of the install stanza. It might be as simple as only forcing the checks in older versions of dune.

Example

(install
  (section bin)
  (files (foobar.txt as "%{env:FOO=foobar}/foo.txt")))

This should cause the file foobar.txt to be installed in bin/$FOO/foo.txt with FOO defaulting to "foobar".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions