digital-asset / daml

The Daml smart contract language
https://www.digitalasset.com/developers
796 stars 201 forks source link

Incremental compilation breaks package exports #3562

Open nikolai-cherkezishvili-da opened 4 years ago

nikolai-cherkezishvili-da commented 4 years ago

*.hi files are missing from dar file when building with --incremental=yes

With incremental compilation

daml damlc build --incremental yes
Compiling trig2 to a DAR.
Created .daml/dist/trig2-0.0.1.dar.

zipinfo .daml/dist/trig2-0.0.1.dar
Archive:  .daml/dist/trig2-0.0.1.dar
Zip file size: 302516 bytes, number of entries: 6
-rw----     4.6 fat      515 bx defN 19-Nov-20 03:58 META-INF/MANIFEST.MF
-rw----     4.6 fat   913301 bx defN 19-Nov-20 03:58 trig2-0.0.1-09414989a3eb2a159f9271f766e5c1457b01c8b3d7cdc3bfc5276b1e3ee0ac79/daml-prim.dalf
-rw----     4.6 fat  1062415 bx defN 19-Nov-20 03:58 trig2-0.0.1-09414989a3eb2a159f9271f766e5c1457b01c8b3d7cdc3bfc5276b1e3ee0ac79/daml-stdlib-0.13.36.dalf
-rw----     4.6 fat      436 bx defN 19-Nov-20 03:58 trig2-0.0.1-09414989a3eb2a159f9271f766e5c1457b01c8b3d7cdc3bfc5276b1e3ee0ac79/data/trig2-0.0.1.conf
-rw----     4.6 fat      765 bx defN 19-Nov-20 03:58 trig2-0.0.1-09414989a3eb2a159f9271f766e5c1457b01c8b3d7cdc3bfc5276b1e3ee0ac79/Main.daml
-rw----     4.6 fat    34369 bx defN 19-Nov-20 03:58 trig2-0.0.1-09414989a3eb2a159f9271f766e5c1457b01c8b3d7cdc3bfc5276b1e3ee0ac79/trig2-0.0.1.dalf
6 files, 2011801 bytes uncompressed, 300916 bytes compressed:  85.1%

Without incremental compilation

daml damlc build --incremental no
Compiling trig2 to a DAR.
^[[ACreated .daml/dist/trig2-0.0.1.dar.

zipinfo .daml/dist/trig2-0.0.1.dar
Archive:  .daml/dist/trig2-0.0.1.dar
Zip file size: 309855 bytes, number of entries: 8
-rw----     4.6 fat      515 bx defN 19-Nov-20 03:59 META-INF/MANIFEST.MF
-rw----     4.6 fat   913301 bx defN 19-Nov-20 03:59 trig2-0.0.1-09414989a3eb2a159f9271f766e5c1457b01c8b3d7cdc3bfc5276b1e3ee0ac79/daml-prim.dalf
-rw----     4.6 fat  1062415 bx defN 19-Nov-20 03:59 trig2-0.0.1-09414989a3eb2a159f9271f766e5c1457b01c8b3d7cdc3bfc5276b1e3ee0ac79/daml-stdlib-0.13.36.dalf
-rw----     4.6 fat      436 bx defN 19-Nov-20 03:59 trig2-0.0.1-09414989a3eb2a159f9271f766e5c1457b01c8b3d7cdc3bfc5276b1e3ee0ac79/data/trig2-0.0.1.conf
-rw----     4.6 fat      765 bx defN 19-Nov-20 03:59 trig2-0.0.1-09414989a3eb2a159f9271f766e5c1457b01c8b3d7cdc3bfc5276b1e3ee0ac79/Main.daml
-rw----     4.6 fat     9909 bx defN 19-Nov-20 03:59 trig2-0.0.1-09414989a3eb2a159f9271f766e5c1457b01c8b3d7cdc3bfc5276b1e3ee0ac79/Main.hi
-rw----     4.6 fat    20281 bx defN 19-Nov-20 03:59 trig2-0.0.1-09414989a3eb2a159f9271f766e5c1457b01c8b3d7cdc3bfc5276b1e3ee0ac79/Main.hie
-rw----     4.6 fat    34369 bx defN 19-Nov-20 03:59 trig2-0.0.1-09414989a3eb2a159f9271f766e5c1457b01c8b3d7cdc3bfc5276b1e3ee0ac79/trig2-0.0.1.dalf
8 files, 2041991 bytes uncompressed, 307717 bytes compressed:  85.0%
nikolai-cherkezishvili-da commented 4 years ago

Seems to be linked with https://github.com/digital-asset/daml/issues/3135

jberthold-da commented 4 years ago

Not linked to #3135, and not fixed yet. I have set up a small example of a package chain where package2 depends on package1, and which uses a directory: source: src/ in daml.yaml. The problem with the missing files is, the resulting package dar file cannot be used as a dependency of another package. If package1 is compiled with --incremental=yes (whether there was an old build or not), the dar file cannot be used as a dependency. When building package2 with a dependency on the package1 dar, the compiler complains

File:     src/Package2File.daml
Hidden:   no
Range:    5:0-5:19
Source:   typecheck
Severity: DsError
Message: 
  src/Package2File.daml:5:1: error:
  Could not find module ‘Package1File’
  There are files missing in the ‘package1-0.0.1000’ package,
  try running 'ghc-pkg check'.
  Use -v (or `:set -v` in ghci) to see a list of the files searched for.
cocreature commented 4 years ago

@jberthold-da why did you close this?

jberthold-da commented 4 years ago

Sorry, my bad, wrong button.