2019-04-04 11:33:38 +03:00
[![DAML logo ](daml-logo.png )](https://www.daml.com)
2019-04-05 23:43:18 +03:00
[![Build Status ](https://dev.azure.com/digitalasset/daml/_apis/build/status/digital-asset.daml?branchName=master&jobName=Linux&label=linux )](https://dev.azure.com/digitalasset/daml/_build/latest?definitionId=4& branchName=master) [![Build Status ](https://dev.azure.com/digitalasset/daml/_apis/build/status/digital-asset.daml?branchName=master&jobName=macOS&label=macOS )](https://dev.azure.com/digitalasset/daml/_build/latest?definitionId=4& branchName=master)
2019-04-06 03:48:32 +03:00
[![License ](https://img.shields.io/badge/License-Apache%202.0-blue.svg )](https://github.com/digital-asset/daml/blob/master/LICENSE)
2019-04-05 23:43:18 +03:00
2019-04-12 20:16:15 +03:00
[![Download SDK ](https://api.bintray.com/packages/digitalassetsdk/DigitalAssetSDK/sdk/images/download.svg )](https://docs.daml.com/getting-started/installation.html)
2019-04-04 11:33:38 +03:00
Copyright 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
# Welcome to the DAML repository!
2019-04-05 17:35:22 +03:00
This repository hosts all code for the [DAML smart contract language and SDK ](https://daml.com/ ), originally created by
[Digital Asset ](https://www.digitalasset.com ). DAML is an open-source smart contract language for building future-proof distributed applications on a safe, privacy-aware runtime. The DAML SDK is a set of tools to help you develop applications based on DAML.
2019-04-04 11:33:38 +03:00
## To start using DAML
2019-04-04 19:04:12 +03:00
To download DAML, follow [the installation instructions on docs.daml.com ](https://docs.daml.com/getting-started/installation.html ).
To try out using it, follow the [quickstart guide ](https://docs.daml.com/getting-started/quickstart.html ).
2019-04-04 11:33:38 +03:00
2019-04-04 19:04:12 +03:00
If you have questions about how to use DAML or how to build DAML-based solutions, please ask
them on [StackOverflow using the `daml` tag ](https://stackoverflow.com/tags/daml ).
2019-04-04 11:33:38 +03:00
2019-04-05 17:35:22 +03:00
## To start contributing to the DAML SDK
2019-04-04 11:33:38 +03:00
2019-04-05 17:35:22 +03:00
We warmly welcome [contributions ](./CONTRIBUTING.md ). To get set up for contributing to the SDK, follow these instructions:
2019-04-04 11:33:38 +03:00
2019-04-04 19:04:12 +03:00
### 1. Clone this repository
2019-04-04 13:04:36 +03:00
`git clone git@github.com:digital-asset/daml.git` .
2019-04-04 11:33:38 +03:00
2019-04-04 19:04:12 +03:00
### 2. Set up the DA Development Environment ("`dev-env`")
`dev-env` provides dependencies required during the build phase, like Java, Bazel, and Python
for some tooling scripts. The code itself is built using Bazel.
#### Set up `dev-env` on Linux or macOS
2019-04-04 11:33:38 +03:00
2019-04-05 15:40:15 +03:00
1. Use `cd daml` to switch into the new `daml` repository you just cloned
2. Install Nix by running: `bash <(curl https://nixos.org/nix/install)`
3. Enter `dev-env` by running: `eval "$(dev-env/bin/dade assist)"`
2019-04-04 19:04:12 +03:00
If you don't want to enter `dev-env` manually each time using `eval "$(dev-env/bin/dade assist)"` ,
you can also install [direnv ](https://direnv.net ). This repo already provides a `.envrc`
file, with an option to add more in a `.envrc.private` file.
#### Set up `dev-env` on Windows
We're working on Windows support (for both end users and developers), but it's not ready yet.
[Sign up ](https://hub.daml.com/sdk/windows ) to be notified when it is available.
2019-04-04 11:33:38 +03:00
2019-04-04 19:04:12 +03:00
### 3. Build the source code
2019-04-04 11:33:38 +03:00
2019-04-04 19:04:12 +03:00
Run `bazel build //...`
2019-04-04 11:33:38 +03:00
2019-04-04 23:18:06 +03:00
This builds the code, and will likely take an hour or more.
2019-04-04 11:33:38 +03:00
2019-04-04 19:04:12 +03:00
Now you've built, rebuilding the code after a change will be much faster because Bazel caches
unchanged build artefacts. To read more about Bazel and how to use it, see [the Bazel site ](https://bazel.build ).
2019-04-04 11:33:38 +03:00
2019-04-04 23:18:06 +03:00
To run the tests, run `bazel test //...`
2019-04-04 11:33:38 +03:00
2019-04-04 19:04:12 +03:00
### 4. Contribute!
2019-04-04 11:33:38 +03:00
2019-04-04 19:04:12 +03:00
If you are looking for ideas on how to contribute, please browse our
[issues ](https://github.com/digital-asset/daml/issues ).
2019-04-04 11:33:38 +03:00
### Caching: build speed and disk space considerations
2019-04-04 19:04:12 +03:00
Bazel has a lot of nice properties, but they come at the cost of frequently rebuilding "the world".
To make that bearable, we make extensive use of caching. Most artifacts should be cached in our CDN,
which is configured in `.bazelrc` in this project.
2019-04-04 11:33:38 +03:00
2019-04-04 19:04:12 +03:00
However, even then, you may end up spending a lot of time (and bandwidth!) downloading artifacts from
the CDN. To alleviate that, by default, our build will create a subfolder `.bazel-cache` in this
project and keep an on-disk cache. **This can take about 10GB** at the time of writing.
2019-04-04 11:33:38 +03:00
2019-04-04 19:04:12 +03:00
To disable the disk cache, remove the following lines:
2019-04-04 11:33:38 +03:00
```
build:linux --disk_cache=.bazel-cache
build:darwin --disk_cache=.bazel-cache
```
from the `.bazelrc` file.
2019-04-04 19:04:12 +03:00
If you work with multiple copies of this repository, you can point all of them to the same disk cache
by overwriting these configs in either a `.bazelrc.local` file in each copy, or a `~/.bazelrc` file
in your home directory.