diff --git a/BAZEL-haskell.md b/BAZEL-haskell.md index bba6001f0d..cce056ab38 100644 --- a/BAZEL-haskell.md +++ b/BAZEL-haskell.md @@ -182,13 +182,6 @@ bring the macros `haskell_toolchain`, `haskell_import`, `haskell_cc_import` and Lastly, there are some aliases defined here. For example, ``` -alias( - name = "damli", - actual = "//daml-foundations/daml-tools/da-hs-damli-app:damli" -) -``` -and -``` alias( name = "damlc", actual = "//daml-foundations/daml-tools/da-hs-damlc-app" diff --git a/BAZEL.md b/BAZEL.md index 6ba0c28956..05acb25898 100644 --- a/BAZEL.md +++ b/BAZEL.md @@ -894,7 +894,7 @@ describe the individual attributes. ``` daml( name = "it-daml", - # The main DAML file. This file will be passed to damli. + # The main DAML file. This file will be passed to damlc. main_src = "src/it/resources/TestAll.daml", # Other DAML files that may be imported by the main DAML file. srcs = glob(["src/it/resources/**/*.daml"]), diff --git a/BUILD b/BUILD index 38383e7fd1..41bc7c1378 100644 --- a/BUILD +++ b/BUILD @@ -128,21 +128,6 @@ genrule( # Common aliases # -alias( - name = "damli", - actual = "//daml-foundations/daml-tools/da-hs-damli-app:damli", -) - -alias( - name = "damli@ghci", - actual = "//daml-foundations/daml-tools/da-hs-damli-app:damli@ghci", -) - -alias( - name = "damli-dist", - actual = "//daml-foundations/daml-tools/da-hs-damli-app:dist", -) - alias( name = "damlc", actual = "//daml-foundations/daml-tools/da-hs-damlc-app:da-hs-damlc-app", diff --git a/daml-foundations/daml-ghc/README.md b/daml-foundations/daml-ghc/README.md index c7b234c1be..c6656a02e2 100644 --- a/daml-foundations/daml-ghc/README.md +++ b/daml-foundations/daml-ghc/README.md @@ -153,7 +153,7 @@ installation of the packages for type checking. Currently a package database is provided together with the `damlc` Bazel rule and `bazel run damlc` loads this database by default. This package database is also shipped together with -`da-hs-damli-app.tar.gz` and `da-hs-damlc-app.tar.gz` for the SDK and the platform and is contained +`da-hs-damlc-app.tar.gz` for the SDK and the platform and is contained in the directory `resources/package-db/gen/`. ### Building the package database diff --git a/daml-foundations/daml-tools/README.md b/daml-foundations/daml-tools/README.md index 4afadeda41..a95a875b82 100644 --- a/daml-foundations/daml-tools/README.md +++ b/daml-foundations/daml-tools/README.md @@ -5,9 +5,8 @@ are linked where available. ## DAML Command Line Interface -* `da-hs-daml-cli` is the Haskell library behind `damli` and `damlc` +* `da-hs-daml-cli` is the Haskell library behind `damlc` * `da-hs-damlc-app` provides `damlc` -* `da-hs-damli-app` provides `damli` * `damlc-jar:damlc.jar` packages up `damlc` for distribution inside a jar. You can execute these directly with just @@ -16,12 +15,6 @@ You can execute these directly with just $ bazel run damlc -- ``` -or - -``` -$ bazel run damli -- -``` - due to the brief aliases specified in the `BUILD` file in the root of our repository. diff --git a/daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damlc.hs b/daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damlc.hs index a8f04f2c31..2af9578819 100644 --- a/daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damlc.hs +++ b/daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damlc.hs @@ -14,8 +14,8 @@ import qualified Control.Monad.Managed as Managed import qualified "cryptonite" Crypto.Hash as Crypto import Codec.Archive.Zip import qualified Da.DamlLf as PLF -import DA.Cli.Damli.BuildInfo -import DA.Cli.Damli.Command.Damldoc (cmdDamlDoc) +import DA.Cli.Damlc.BuildInfo +import DA.Cli.Damlc.Command.Damldoc (cmdDamlDoc) import DA.Cli.Options import DA.Cli.Output import DA.Cli.Args diff --git a/daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damli/Base.hs b/daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damlc/Base.hs similarity index 93% rename from daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damli/Base.hs rename to daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damlc/Base.hs index dfde22ac86..5e32eb30a5 100644 --- a/daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damli/Base.hs +++ b/daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damlc/Base.hs @@ -1,7 +1,7 @@ -- Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. -- SPDX-License-Identifier: Apache-2.0 -module DA.Cli.Damli.Base +module DA.Cli.Damlc.Base ( module DA.Cli.Options , module DA.Cli.Output , module DA.Prelude diff --git a/daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damli/BuildInfo.hs b/daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damlc/BuildInfo.hs similarity index 93% rename from daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damli/BuildInfo.hs rename to daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damlc/BuildInfo.hs index c18ee7fa22..8af24e91f1 100644 --- a/daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damli/BuildInfo.hs +++ b/daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damlc/BuildInfo.hs @@ -3,7 +3,7 @@ {-# LANGUAGE OverloadedStrings #-} -module DA.Cli.Damli.BuildInfo +module DA.Cli.Damlc.BuildInfo ( buildInfo ) where diff --git a/daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damli/Command/Damldoc.hs b/daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damlc/Command/Damldoc.hs similarity index 97% rename from daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damli/Command/Damldoc.hs rename to daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damlc/Command/Damldoc.hs index bece04a185..a3da1b5e20 100644 --- a/daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damli/Command/Damldoc.hs +++ b/daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damlc/Command/Damldoc.hs @@ -3,9 +3,9 @@ {-# LANGUAGE OverloadedStrings #-} -module DA.Cli.Damli.Command.Damldoc(cmdDamlDoc, cmdRenderDoc) where +module DA.Cli.Damlc.Command.Damldoc(cmdDamlDoc, cmdRenderDoc) where -import DA.Cli.Damli.Base(Command) +import DA.Cli.Damlc.Base(Command) import DA.Cli.Options import DA.Daml.GHC.Damldoc.Driver diff --git a/daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damli.hs b/daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damli.hs deleted file mode 100644 index 8ea93f9e4e..0000000000 --- a/daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damli.hs +++ /dev/null @@ -1,37 +0,0 @@ --- Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. --- SPDX-License-Identifier: Apache-2.0 - -{-# LANGUAGE MultiWayIf #-} -{-# LANGUAGE NoImplicitPrelude #-} -{-# LANGUAGE OverloadedStrings #-} - --- | Main entry-point of DAML-interpreter. -module DA.Cli.Damli - ( run - ) where - - -import Control.Monad.Except -import DA.Cli.Damli.Base -import DA.Cli.Damli.BuildInfo -import DA.Cli.Damli.Command.LF -import Options.Applicative -import qualified Text.PrettyPrint.ANSI.Leijen as PP - -options :: Parser Command -options = - flag' (PP.putDoc buildInfo) (short 'v' <> long "version" <> help "Show version information") - <|> - subparser cmdRoundtripLF1 - -parserInfo :: ParserInfo Command -parserInfo = - info (helper <*> options) - ( fullDesc - <> progDesc "Invoke the DAML interpreter. Use -h for help." - <> headerDoc (Just buildInfo) - ) - -run :: IO () -run = do - join $ execParser parserInfo diff --git a/daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damli/Command/LF.hs b/daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damli/Command/LF.hs deleted file mode 100644 index 6496ee6ceb..0000000000 --- a/daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damli/Command/LF.hs +++ /dev/null @@ -1,72 +0,0 @@ --- Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. --- SPDX-License-Identifier: Apache-2.0 - -{-# LANGUAGE OverloadedStrings #-} - -module DA.Cli.Damli.Command.LF - ( cmdRoundtripLF1 - ) where - -import Control.Monad.Except -import DA.Cli.Damli.Base -import qualified DA.Daml.LF.Ast as LF -import qualified DA.Daml.LF.Proto3.Archive as Archive -import qualified DA.Daml.LF.TypeChecker as LF -import qualified Data.Text as T -import qualified DA.Pretty -import qualified Data.ByteString as BS -import Options.Applicative - -------------------------------------------------------------------------- --- Command specs -------------------------------------------------------------------------- - -cmdRoundtripLF1 :: Mod CommandFields Command -cmdRoundtripLF1 = - command "roundtrip-lf-v1" - $ info (helper <*> cmd) - $ progDesc "Load a DAML-LF v1 archive, type-check it and dump it again, verifying that output matches." - <> fullDesc - where - cmd = execRoundtripLF1 <$> lfTypeCheckOpt <*> inputFileOpt <*> outputFileOpt - -lfTypeCheckOpt :: Parser Bool -lfTypeCheckOpt = - not <$> switch (long "unsafe" <> short 'u' <> help "Skip DAML-LF type checker") - -------------------------------------------------------------------------- --- Implementation -------------------------------------------------------------------------- - -loadLFPackage :: FilePath -> IO (LF.Package, BS.ByteString) -loadLFPackage inFile = do - -- Load, checksum and decode the LF package - bytes <- BS.readFile inFile - - (_pkgId, package) <- errorOnLeft "Cannot decode header" $ Archive.decodeArchive bytes - return (package, bytes) - where - errorOnLeft desc (Left x) = error (desc <> ":" <> show x) - errorOnLeft _ (Right x) = pure x - - -execRoundtripLF1 :: Bool -> FilePath -> FilePath -> Command -execRoundtripLF1 _check inFile outFile = do - (package, bytes) <- loadLFPackage inFile - -- Type-check - case LF.checkPackage [] package of - Left err -> do - error $ T.unpack $ "Type-check failed:\n" <> DA.Pretty.renderPretty err - Right () -> - pure () - - -- Encode the package - let bytes' = Archive.encodeArchive package - - -- And finally verify that the resulting bytes match. - when (bytes /= bytes') $ do - write bytes' - error $ "Resulting output differs. Dumped output to " <> outFile - where - write | outFile == "-" = BS.putStr - | otherwise = BS.writeFile outFile diff --git a/daml-foundations/daml-tools/da-hs-daml-cli/README.md b/daml-foundations/daml-tools/da-hs-daml-cli/README.md index 1a63ddf8b0..0751468ebd 100644 --- a/daml-foundations/daml-tools/da-hs-daml-cli/README.md +++ b/daml-foundations/daml-tools/da-hs-daml-cli/README.md @@ -1,5 +1,2 @@ This package defines the DAML cli utilities, -and specifically `damli`, which is meant for -internal use and offers a variety of commands -including various debugging ones, and `damlc`, -which is what we will ship as the DAML compiler. +specifically `damlc`. diff --git a/daml-foundations/daml-tools/da-hs-damli-app/BUILD.bazel b/daml-foundations/daml-tools/da-hs-damli-app/BUILD.bazel deleted file mode 100644 index 238e5e4b72..0000000000 --- a/daml-foundations/daml-tools/da-hs-damli-app/BUILD.bazel +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -load("//bazel_tools:haskell.bzl", "da_haskell_binary") -load("//bazel_tools:packaging/packaging.bzl", "package_app") - -da_haskell_binary( - name = "damli", - srcs = ["src/Main.hs"], - data = [ - "//compiler/scenario-service/server:scenario_service_jar", - "//daml-foundations/daml-ghc/package-database:package-db", - ], - hazel_deps = [ - "base", - ], - linkstatic = True, - src_strip_prefix = "src", - visibility = ["//visibility:public"], - deps = [ - "//daml-foundations/daml-tools/da-hs-daml-cli", - ], -) - -package_app( - name = "dist", - binary = ":damli", - resources = [ - "//compiler/scenario-service/server:scenario_service_jar", - "//daml-foundations/daml-ghc/package-database:package-db", - ], - tags = ["no-cache"], - visibility = ["//visibility:public"], -) diff --git a/daml-foundations/daml-tools/da-hs-damli-app/LICENSE b/daml-foundations/daml-tools/da-hs-damli-app/LICENSE deleted file mode 100644 index 6d026fe7be..0000000000 --- a/daml-foundations/daml-tools/da-hs-damli-app/LICENSE +++ /dev/null @@ -1,3 +0,0 @@ -Copyright (c) 2017 Digital Asset - -All rights reserved. diff --git a/daml-foundations/daml-tools/da-hs-damli-app/README.md b/daml-foundations/daml-tools/da-hs-damli-app/README.md deleted file mode 100644 index 64d03b8b15..0000000000 --- a/daml-foundations/daml-tools/da-hs-damli-app/README.md +++ /dev/null @@ -1,4 +0,0 @@ -This is a shim to `da-hs-daml-cli`. It exists only -for historical reasons and should be removed once -we change the build system. See readme for that -package. diff --git a/daml-foundations/daml-tools/da-hs-damli-app/src/Main.hs b/daml-foundations/daml-tools/da-hs-damli-app/src/Main.hs deleted file mode 100644 index 93cf398938..0000000000 --- a/daml-foundations/daml-tools/da-hs-damli-app/src/Main.hs +++ /dev/null @@ -1,9 +0,0 @@ --- Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. --- SPDX-License-Identifier: Apache-2.0 - -module Main (main) where - -import qualified DA.Cli.Damli as Damli - -main :: IO () -main = Damli.run diff --git a/daml-foundations/daml-tools/language-server-tests/src/connection.ts b/daml-foundations/daml-tools/language-server-tests/src/connection.ts index e1e3fea381..5621ce4fb8 100644 --- a/daml-foundations/daml-tools/language-server-tests/src/connection.ts +++ b/daml-foundations/daml-tools/language-server-tests/src/connection.ts @@ -62,7 +62,7 @@ export class DamlConnection { this.connection.trace(Trace.Verbose, new ConsoleTracer()); } else { - // drain stderr in order to not block damli. + // drain stderr in order to not block damlc. this.process.stderr.on('readable', () => { this.process.stderr.read() }); } diff --git a/daml-lf/tests/daml-lf-test.sh b/daml-lf/tests/daml-lf-test.sh index 8029f6ca82..948666552f 100755 --- a/daml-lf/tests/daml-lf-test.sh +++ b/daml-lf/tests/daml-lf-test.sh @@ -5,7 +5,7 @@ set -eu DAML_LF_REPL=$1 -DAMLI=$2 +DAMLC=$2 MAIN=$3 TMPDIR=$(mktemp -d) @@ -19,7 +19,7 @@ case "${MAIN##*.}" in $DAML_LF_REPL testAll "$MAIN" ;; daml) - $DAMLI export-lf-v1 "$MAIN" -o $TMPDIR/out.dalf + $DAMLC export-lf-v1 "$MAIN" -o $TMPDIR/out.dalf $DAML_LF_REPL testAll $TMPDIR/out.dalf ;; *) diff --git a/daml-lf/tests/scenario/test.sh b/daml-lf/tests/scenario/test.sh index a89dd376cb..8cf2dc8323 100755 --- a/daml-lf/tests/scenario/test.sh +++ b/daml-lf/tests/scenario/test.sh @@ -11,7 +11,7 @@ set -eu export LC_ALL="en_US.UTF-8" REPL=$1 -DAMLI=$2 +DAMLC=$2 TESTMAIN=$3 TESTDIR="$(dirname $TESTMAIN)" TESTDALF="$TESTDIR/Main.dalf" @@ -21,7 +21,7 @@ TARGET="1.3" REGEX_HIDE_HASHES="s,@[a-z0-9]{8},@XXXXXXXX,g" -$DAMLI compile --debug --target $TARGET $TESTMAIN -o $TESTDALF +$DAMLC compile --debug --target $TARGET $TESTMAIN -o $TESTDALF $REPL test Test:run $TESTDALF $GHC_PRIM_DALF | sed '1d' | sed -E "$REGEX_HIDE_HASHES" > ${TESTDIR}/ACTUAL.ledger diff --git a/navigator/integration-test/src/main/scala/com/digitalasset/navigator/test/runner/HeadDamli.scala b/navigator/integration-test/src/main/scala/com/digitalasset/navigator/test/runner/HeadDamli.scala index 3f827f3ce3..5060d573eb 100644 --- a/navigator/integration-test/src/main/scala/com/digitalasset/navigator/test/runner/HeadDamli.scala +++ b/navigator/integration-test/src/main/scala/com/digitalasset/navigator/test/runner/HeadDamli.scala @@ -10,9 +10,9 @@ import scala.sys.error import scala.sys.process.Process /** - * Run the HEAD version of damli from source, to create a DAR file from a DAML file. + * Run the HEAD version of damlc from source, to create a DAR file from a DAML file. */ -object HeadDamli { +object HeadDamlc { private val packageName = "Test" def run(damlPath: String): (File, Unit => Unit) = { @@ -27,10 +27,10 @@ object HeadDamli { // DAML -> DAR val exitCode = Process( - s"bazel run damli -- package $damlPath $packageName --output ${darFile.getAbsolutePath}").! + s"bazel run damlc -- package $damlPath $packageName --output ${darFile.getAbsolutePath}").! if (exitCode != 0) { shutdown(()) - error(s"Dar packager: error while running DAMLI package for $damlPath: exit code $exitCode") + error(s"Dar packager: error while running damlc package for $damlPath: exit code $exitCode") } (darFile, shutdown) diff --git a/rules_daml/BUILD.bazel b/rules_daml/BUILD.bazel index 73b299b1a8..1a272c9de9 100644 --- a/rules_daml/BUILD.bazel +++ b/rules_daml/BUILD.bazel @@ -10,12 +10,6 @@ exports_files( load("@io_bazel_rules_scala//scala:scala.bzl", "scala_binary") load("//rules_daml:daml.bzl", "daml_sandbox_version") -alias( - name = "damli", - actual = "//daml-foundations/daml-tools/da-hs-damli-app:damli", - visibility = ["//visibility:public"], -) - alias( name = "codegen", actual = "//language-support/scala/codegen:codegen-main",