Documentation Index
Fetch the complete documentation index at: https://docs.canton.network/llms.txt
Use this file to discover all available pages before exploring further.
The Daml Compiler
At the core of the Daml toolchain lies the Daml Compiler, also known asdamlc. Its primary usage is to compile Daml source code, which defines smart contracts and their behaviours, into a lower-level language called Daml-LF, which Canton participants can evaluate in order to run those smart contracts.
We recommend running the compiler via DPM (i.e. through dpm build), or alternatively, by calling damlc directly. When compiling code, the Daml Compiler goes through the following stages:
- The input
.damlfiles are type-checked (i.e. it is verified if they are well-formed or not) - The type-checked
`.damlcode is transformed to Daml-LF. - The produced Daml-LF is packaged together with its dependencies and their metadata into a
.darfile, which essentially is an archive of Daml-LF files with metadata.
dpm build are stored in a .daml directory, local to the project in which dpm build was run. They can be cleaned using dpm clean.
The Daml Compiler also offers testing functionality. It can be invoked either by first calling dpm build to obtain a .dar which is then used in a call to daml-script (i.e. dpm script), or by calling glos-daml-test (i.e. dpm test) directly.
Build & test flags
These flags are available for both--build as well as --test.
-
-h,--helpPrints option information when called on the commandline. -
--package-root ARGDPM-specific option. Path to the root of aglos-daml-packagecontainingdaml.yaml. Using this option, you set the package to build/test. You should prefer theDAML_PACKAGEenvironment variable over this option. Seedpm-configurationfor more details. -
--project-root ARGDPM-specific option.project-rootis deprecated, please use--package-root. Path to the root of aglos-daml-packagecontainingdaml.yaml. You should prefer theDAML_PACKAGEenvironment variable over this option. Seedpm-configurationfor more details. -
--include INCLUDE-PATHPath to an additional source directory to be included. -
--package-db LOC-OF-PACKAGE-DBUseglos-package-databasein the given location. -
--access-token-file PATHDeprecated command**, use DPM-specific instead Path to the token-file for ledger authorization. -
--shake-profiling PROFILING-REPORTDirectory forglos-shake-profiling-reports. -
--jobs THREADSThe number of threads to run in parallel. When-jis not passed, 1 thread is used. If-jis passed, the number of threads defaults to the number of processors. Use--jobs=Nto explicitely set the number of threads toN. Note that the output is not deterministic for > 1 job. -
--debugSet log level toDEBUG. -
--log-level ARGSet log level. Possible values areDEBUG,INFO,WARNING,ERROR. -
--detail LEVELDetail level of the pretty printed output (default: 0). A higher level of detail will pretty print more information from for exampledamlc inspectas well as printing source file locations. Seeglos-damlc-detail-level. -
--ghc-option OPTIONOptions to pass to the underlying GHC. -
-p,--test-pattern PATTERNOnly scripts with names containing the given pattern will be executed. -
--typecheck-upgrades ARGTypecheck upgrades. Can be set to “yes”, “no” or “auto” to select the default (True). -
--upgrades UPGRADE_DARSet DAR to upgrade>. -
-W ARGTurn an error into a warning with-W<name>or-Wwarn=<name>or-Wno-error=<name>. Turn a warning into an error with-Werror=<name>. Disable warnings and errors with-Wno-<name>. Available names are:deprecated-exceptionscrypto-text-is-alphaupgrade-interfacesupgrade-exceptionsupgrade-dependency-metadataupgraded-template-expression-changedupgraded-choice-expression-changedcould-not-extract-upgraded-expressionunused-dependencyupgrades-own-dependencytemplate-interface-depends-on-daml-scripttemplate-has-new-interface-instance
-
--ignore-data-deps-visibility ARGIgnore explicit exports onglos-data-dependencies, and instead allow importing of all definitions from thatglos-daml-package(this was the default behaviour before Daml 2.10). Can be set to “yes”, “no” or “auto” to select the default (False).
Build flags
- All build & test flags described above.
-
-o,--output FILEOptional output file (defaults to<PACKAGE-NAME>.dar). -
--incremental ARGEnableglos-incremental-builds. Can be set to “yes”, “no” or “auto” to select the default (False). -
--init-package-db ARGInitializeglos-package-database. Can be set to “yes”, “no” or “auto” to select the default (True). -
--enable-multi-package ARGEnable/disable multi-package.yaml support (enabled by default). Can be set to “yes”, “no” or “auto” to select the default (True). -
--allBuild all packages in multi-package.yaml. -
--no-cacheDisables cache checking, rebuilding all dependencies. -
--multi-package-path FILEPath to the multi-package.yaml file.
Test flags
- All build & test flags described above.
-
--filesOnly run test declarations in the specified files. -
--allRun tests in currentglos-daml-packageas well as dependencies -
--load-coverage-onlyDon’t run any tests. Only loadglos-daml-test-coverageresults from files and write the aggregate to a single file. -
--show-coverageShow detailed testglos-daml-test-coverage. -
--colorColored test results> -
--junit FILENAMEFilename of JUnit output file. This file contains the test output in the de-facto standard for test output, JUnit XML file format. See https://github.com/testmoapp/junitxml. -
--package-name PACKAGE-NAMECreate package artifacts for the given package name. -
--table-output ARGFilename to which table should be output. Used to render the table view of Daml Studio, but usable on the cli as well. -
--transactions-output ARGFilename to which the transaction list should be output. Used to render the transaction view of Daml Studio, but usable on the cli as well. -
--load-coverage ARGFile to read priorglos-daml-test-coverageresults from. Can be specified more than once. -
--save-coverage ARGFile to write final aggregatedglos-daml-test-coverageresults to. -
--coverage-ignore-choice ARGRemove choices matching a regex from theglos-daml-test-coveragereport. The full name of a local choice takes the format<module>:<template name>:<choice name>, preceded by<package id>:for nonlocal packages.
Test flags
-
-h,--helpPrints option information when called on the commandline. -
--package-root ARGDPM-specific option. Path to the root of aglos-daml-packagecontainingdaml.yaml. Using this option, you set the package to clean. You should prefer theDAML_PACKAGEenvironment variable over this option. Seedpm-configurationfor more details. -
--project-root ARGDPM-specific option.project-rootis deprecated, please use--package-root. Path to the root of aglos-daml-packagecontainingdaml.yaml. You should prefer theDAML_PACKAGEenvironment variable over this option. Seedpm-configurationfor more details. -
--multi-package-path FILEPath to the multi-package.yaml file. -
--allClean all packages in multi-package.yaml.