From dff9f17ac635a89bf33ae84747bce7a1eb250f96 Mon Sep 17 00:00:00 2001 From: moritzkiefer-da <45630097+moritzkiefer-da@users.noreply.github.com> Date: Mon, 15 Apr 2019 14:47:59 +0200 Subject: [PATCH] Remove damli completely (#481) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The only command that we still had in damli which afaik isn’t something anyone uses (and if it is, we should move it do damlc). --- BAZEL-haskell.md | 7 -- BAZEL.md | 2 +- BUILD | 15 ---- daml-foundations/daml-ghc/README.md | 2 +- daml-foundations/daml-tools/README.md | 9 +-- .../daml-tools/da-hs-daml-cli/DA/Cli/Damlc.hs | 4 +- .../DA/Cli/{Damli => Damlc}/Base.hs | 2 +- .../DA/Cli/{Damli => Damlc}/BuildInfo.hs | 2 +- .../Cli/{Damli => Damlc}/Command/Damldoc.hs | 4 +- .../daml-tools/da-hs-daml-cli/DA/Cli/Damli.hs | 37 ---------- .../da-hs-daml-cli/DA/Cli/Damli/Command/LF.hs | 72 ------------------- .../daml-tools/da-hs-daml-cli/README.md | 5 +- .../daml-tools/da-hs-damli-app/BUILD.bazel | 34 --------- .../daml-tools/da-hs-damli-app/LICENSE | 3 - .../daml-tools/da-hs-damli-app/README.md | 4 -- .../daml-tools/da-hs-damli-app/src/Main.hs | 9 --- .../language-server-tests/src/connection.ts | 2 +- daml-lf/tests/daml-lf-test.sh | 4 +- daml-lf/tests/scenario/test.sh | 4 +- .../navigator/test/runner/HeadDamli.scala | 8 +-- rules_daml/BUILD.bazel | 6 -- 21 files changed, 19 insertions(+), 216 deletions(-) rename daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/{Damli => Damlc}/Base.hs (93%) rename daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/{Damli => Damlc}/BuildInfo.hs (93%) rename daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/{Damli => Damlc}/Command/Damldoc.hs (97%) delete mode 100644 daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damli.hs delete mode 100644 daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damli/Command/LF.hs delete mode 100644 daml-foundations/daml-tools/da-hs-damli-app/BUILD.bazel delete mode 100644 daml-foundations/daml-tools/da-hs-damli-app/LICENSE delete mode 100644 daml-foundations/daml-tools/da-hs-damli-app/README.md delete mode 100644 daml-foundations/daml-tools/da-hs-damli-app/src/Main.hs diff --git a/BAZEL-haskell.md b/BAZEL-haskell.md index bba6001f0da..cce056ab384 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 6ba0c28956d..05acb25898f 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 38383e7fd1e..41bc7c13784 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 c7b234c1be8..c6656a02e21 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 4afadeda41d..a95a875b825 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 a8f04f2c31b..2af9578819f 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 dfde22ac868..5e32eb30a56 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 c18ee7fa222..8af24e91f1b 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 bece04a1852..a3da1b5e206 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 8ea93f9e4e0..00000000000 --- 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 6496ee6cebe..00000000000 --- 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 1a63ddf8b07..0751468ebd8 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 238e5e4b72f..00000000000 --- 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 6d026fe7be8..00000000000 --- 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 64d03b8b157..00000000000 --- 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 93cf398938a..00000000000 --- 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 e1e3fea3810..5621ce4fb83 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 8029f6ca829..948666552ff 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 a89dd376cb3..8cf2dc83231 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 3f827f3ce34..5060d573eb7 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 73b299b1a87..1a272c9de9c 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",