Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs-main/appdev/modules/m3-building-packaging.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ data-dependencies:

Note the use of `data-dependencies` instead of the previously covered `dependencies` field, the latter is reserved for `daml-prim`, `daml-stdlib`, and the optional testing library daml-script. Once added to the `daml.yaml`, modules from the dependency .dar can be imported from the modules of this package. In the event of collision between module names, either with this package or other dependencies, see module-prefixes.

In addition to using DARs already on your local file system, you can also depend on DARs available from a remote OCI repository while building your Daml project -- see the [Remote Dars](/appdev/modules/m5-environment-c#onfiguration#remote-dars) section for further guidance and examples.
In addition to using DARs already on your local file system, you can also depend on DARs from a remote OCI or git source -- see [Remote Dars](/appdev/modules/m5-environment-configuration#remote-dars).

When depending on .dar files from packages listed in the `multi-package.yaml`, calling `dpm build` and `dpm build --all` will build the relevant packages in the correct order for you.

Expand Down
80 changes: 80 additions & 0 deletions docs-main/appdev/modules/m5-environment-configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,86 @@ dpm update

See the docs section on [Publishing Dars](/sdks-tools/cli-tools/dpm#publishing-dars-to-an-oci) to learn how to publish your own `oci://` dars

#### Git Dars

<Note>
Support for git DAR dependencies is unreleased.
</Note>

You can depend on a `.dar` stored in a public git repository. Git is another remote source, like OCI. Put the location under `dependencies` or `data-dependencies`.

The canonical form is:

```
git:<host>/<repo>#<ref>?path=<path/inside/the/repo.dar>
```

- `<ref>` is a branch, a tag, or a commit SHA.
- `?path=` is required, relative to the repo root, and must end in `.dar`.
- A trailing `.git` on the repo is optional.
- HTTPS only. SSH clone URLs are not supported. The repository must be public.

You can add a dependency using `dpm add dar`:
```shell
dpm add dar --data-dependencies 'git:example.com/my/dars#1.2.3?path=my-package-1.2.3.dar'
```

Resulting `daml.yaml`
``` yaml
# daml.yaml
data-dependencies:
- git:example.com/my/dars#82a5467ac5bf4ed78415dee71f7af587a9e7a8f5?path=my-package-1.2.3.dar
```

`dpm add dar` and `dpm install` rewrite a branch or tag `<ref>` to a commit SHA. You can pass `--dependencies` instead of `--data-dependencies`.

For a GitHub release asset:

```
git:github.com/example/my-dars?release=1.2.3&asset=my-package-1.2.3.dar
```

`?release=` is supported on `github.com` only. Omit `&asset=` to expand the entry into one line per `.dar` on that release. On other hosts, use `#<ref>?path=` instead. Release lines are not rewritten to a commit SHA.

You can write the same information as a mapping. `dpm install` pins it using the canonical one-liner:

```yaml
data-dependencies:
- git:
url: example.com/my/dars
ref: 1.2.3
path: my-package-1.2.3.dar
```

or, for a GitHub release:

```yaml
data-dependencies:
- git:
url: github.com/example/my-dars
release: 1.2.3
# asset: my-package-1.2.3.dar # optional
```

To reuse one repository URL for several DARs, name it under `artifact-locations` and refer to it as `@alias`. The alias is only the repo URL; `#ref` and `?path=` stay on the dependency line. After `dpm install`, the alias is replaced by a full `git:` line.

```yaml
artifact-locations:
"@my-dars":
url: git:example.com/my/dars

data-dependencies:
- "@my-dars#1.2.3?path=my-package-1.2.3.dar"
```

`dpm add dar` also accepts a browser `raw`/`blob` URL to a `.dar` and writes the canonical line into `daml.yaml`. Do not paste a browser URL into `daml.yaml` yourself.

```shell
dpm add dar --data-dependencies 'https://github.com/example/my-dars/raw/refs/tags/1.2.3/my-package-1.2.3.dar'
```

See [Building and Packaging](/appdev/modules/m3-building-packaging#how-to-depend-on-daml-packages) for `dependencies` vs `data-dependencies`.

## Next Steps

- [Deployment Progression](/appdev/modules/m5-deployment-progression) — Environment differences and promotion checklist
Expand Down
6 changes: 5 additions & 1 deletion docs-main/sdks-tools/cli-tools/dpm.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ dpm add component <oci-uri>
Use `dpm add dar` to add or update a DAR in your project. You must specify whether the DAR is a dependency or a data-dependency:

```shell
dpm add dar <oci-uri> <--dependencies | --data-dependencies>
dpm add dar <oci-uri|git-uri> <--dependencies | --data-dependencies>
```

| Option | Description |
Expand All @@ -537,6 +537,10 @@ dpm add dar <oci-uri> <--dependencies | --data-dependencies>

{/* COPIED_END */}

`dpm add dar` also accepts a browser `https://` URL to a `.dar` (`raw` or `blob`). It writes a `git:` line into `daml.yaml`. See [Remote Dars](/appdev/modules/m5-environment-configuration#remote-dars) for the `daml.yaml` forms.

`dpm update --check` verifies that git dependencies are installed and match the commit pins in `daml.yaml`.

## Publishing

### Publishing Components to an OCI Repository
Expand Down