Skip to content
Discussions/App Development/Importing different versions of the same package failsForum ↗

Importing different versions of the same package fails

App Development3 posts420 views2 likesLast activity May 2020
ME
meetOP
May 2020

I’m trying to use the --package build option as per the documentation here to upgrade a contract from one version of a dar to a different version (same package, module and template names).
Hence I have 3 separate projects for this -

  1. PrimerV1 (that builds to Primer-0.0.1.dar)
  2. PrimerV2 (that builds to Primer-0.0.2.dar)
  3. UpgradePrimer (build fails)

Upon executing a daml build on project UpgradePrimer, I get the following error -

Compiling Primer to a DAR.
File:     
Hidden:   no
Range:    1:0-100001:0
Source:   compiler
Severity: DsError
Message: 
  <command line>: cannot satisfy --package Primer-0.0.2 with (Assets.AssetTypes as V2.AssetTypes,
  Managers.CoinManager as V2.Managers)
  (use -v for more information)
ERROR: Creation of DAR file failed.

The daml.yaml for project UpgradePrimer looks like the following -

sdk-version: 1.0.0
name: UpgradePrimer
source: daml
parties:
  - Alice
  - Bob
version: 0.0.1
dependencies:
  - daml-prim
  - daml-stdlib
  - daml-script
build-options:
  - '--package'
  - 'Primer-0.0.1 with (Assets.AssetTypes as V1.AssetTypes, Managers.CoinManager as V1.Managers)'
  - '--package'
  - 'Primer-0.0.2 with (Assets.AssetTypes as V2.AssetTypes, Managers.CoinManager as V2.Managers)'
sandbox-options:
  - --wall-clock-time

The daml.yaml for project PrimerV1 looks like the following -

sdk-version: 1.0.0
name: Primer
source: daml
parties:
  - Alice
  - Bob
version: 0.0.1
dependencies:
  - daml-prim
  - daml-stdlib
  - daml-script
sandbox-options:
  - --wall-clock-time

The daml.yaml for project PrimerV2 looks like the following -

sdk-version: 1.0.0
name: Primer
source: daml
parties:
  - Alice
  - Bob
version: 0.0.2
dependencies:
  - daml-prim
  - daml-stdlib
  - daml-script
sandbox-options:
  - --wall-clock-time
GA
Gary_Verhaegen
May 2020

I still have no idea what I am doing, but it seems to me that you never tell daml where to find those DAR files. Looking at an example, it seems like you should add the path to Primer1.dar and Primer2.dar in your data-dependencies.

ME
meet
May 2020

Thanks @Gary_Verhaegen - adding a data-dependencies tag with the paths to the 2 dars worked for me.

← Back to Discussions