Build option to package
- AfonsoOP 1
Greetings everyone,
I am working on a project where we need to use two different packages that contain two clashing namespaces (let’s call them x-0.0.1 and x-0.0.2).In order to differentiate between both I am using the build-option on our
daml.yamlas demonstrated here:build-options: - '--package' - 'x-0.0.1 with (Asset.Operator.Role as From.Asset.Operator.Role)' - '--package' - 'x-0.0.2 with (Asset.Operator.Role as To.Asset.Operator.Role)'The issue with the following approach is that, for every module I want to import I have to declare a build option similar to the above. For instance, if I wanted to add a asset service as an import, I would do:
build-options: - '--package' - 'x-0.0.1 with (Asset.Operator.Role as From.Asset.Operator.Role)' - '--package' - 'x-0.0.2 with (Asset.Operator.Role as To.Asset.Operator.Role)' - '--package' - 'x-0.0.1 with (Asset.Operator.Role as From.Asset.Service.Role)' - '--package' - 'x-0.0.2 with (Asset.Operator.Role as To.Asset.Service.Role)'Eventually, this results in a very complex daml.yaml file because of all of these build-options. I therefore wonder, if it is possible to achieve the same result in a more elegant way (for instance, an approach that would allow me to import every module within Asset. namespace.
Thank you for your attention
- a_putkov
You can use module-prefixes field in daml.yaml file to assign a prefix to all modules in a package. See the bottom of this page in the documentation.
E.g. the following entry in daml.yaml filemodule-prefixes: x-0.0.1: From x-0.0.2: Toallows you to import modules from x-0.0.1 and x-0.0.2 using
import qualified From.Asset.Operator.Role import qualified To.Asset.Operator.Role import qualified From.Asset.Service.Role import qualified To.Asset.Service.Role