Skip to content

Commit

Permalink
Fail when a data-dependency fails to compile (digital-asset#4219)
Browse files Browse the repository at this point in the history
* Fail when a data-dependency fails to compile

Previously, we emitted errors but just kept on going which sometimes
kinda works but is certainly not the right thing to do.

Now we just crash and abort compilation.

changelog_begin
changelog_end

* why is windows

* undo crap
  • Loading branch information
cocreature authored and mergify[bot] committed Jan 27, 2020
1 parent 40292c2 commit 3245a7b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion compiler/damlc/lib/DA/Cli/Damlc/Packaging.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module DA.Cli.Damlc.Packaging

import qualified "zip" Codec.Archive.Zip as Zip
import qualified "zip-archive" Codec.Archive.Zip as ZipArchive
import Control.Exception.Extra
import Control.Lens (toListOf)
import Control.Monad.Extra
import Control.Monad.IO.Class
Expand Down Expand Up @@ -230,13 +231,15 @@ generateAndInstallIfaceFiles dalf src opts workDir dbPath projectPackageDatabase
]
}

_ <- withDamlIdeState opts' loggerH diagnosticsLogger $ \ide ->
res <- withDamlIdeState opts' loggerH diagnosticsLogger $ \ide ->
runAction ide $
-- Setting ifDir to . means that the interface files will end up directly next to
-- the source files which is what we want here.
writeIfacesAndHie
(toNormalizedFilePath ".")
[fp | (fp, _content) <- src']
when (isNothing res) $
errorIO $ "Failed to compile interface for data-dependency: " <> unitIdStr
-- write the conf file and refresh the package cache
(cfPath, cfBs) <-
mkConfFile
Expand Down

0 comments on commit 3245a7b

Please sign in to comment.