digital-asset / daml

The Daml smart contract language
https://www.digitalasset.com/developers
Other
802 stars 204 forks source link

Feature request: daml assistant function to list a project dependencies #9554

Open leonidr-da opened 3 years ago

leonidr-da commented 3 years ago

To facilitate interactions with build system, it would be nice if we had a function like daml dependencies or daml damlc list that would do something similar to

#! /usr/bin/env bash
set -euo pipefail

# $1 is the project directory
deps="$(yq -r --arg project_dir "$1" '.dependencies[] | select(endswith(".dar")) | $project_dir + "/" + .' $1/daml.yaml)"
[ -n "${deps}" ] && realpath -m --relative-to="${PWD}" ${deps}

# TODO - this should be using the source field from daml.yaml
echo "${1}/daml.yaml"
find "${1}" -name '*.daml' -not -path '*/.daml*'

yq here is a jq for Yaml.

cocreature commented 3 years ago

How exactly do you expect to use this in a build system? I’d like to avoid an A B problem so rather than just solving this particular issue, I’d like to understand the usecase.

leonidr-da commented 3 years ago

A build system would call this to track all of a dar's dependencies. Then the build system would know what it should watch for changes.