Build option to package

Afonso
Tue, 07 Mar 2023 17:11:32 +0000
App Development

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.yaml as 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

2 posts - 2 participants