Skip to content
CCPEDIAby Unity Nodes
App Development

Handling external `*.dar`s in CI

2 posts245 views1 likesLast activity Feb 2022

  1. LucianoOP

    More of a survey than a question, but I’m interested to hear how devs are handling external *.dar dependencies, particularly wrt to CI and build process.

    I’ve locally got a lib/ folder and I symlink or drop *.dar files which are daml.yaml dependencies in there.

    However, this doesn’t work for our CI on github, because those files don’t exist. They need to be fetched from somewhere.

    I would rather avoid checking-in the *.dar files into the source tree.

  2. Richard_Kapolnai 1

    In some refapps, we fetch the code and build them in the make command:

    github.com

    digital-asset/ex-bond-issuance/blob/9a68bce68e0da516dce586c2b6c914497a2776c4/Makefile#L27

          
            
    1. install-python-dependencies:
    2. cd scripts && pipenv sync
    3. ### DARS ###
    4. .PHONY: build-dars
    5. build-dars: $(MODELS_DAR) $(TRIGGERS_DAR)
    6. DAML_SRC=$(shell find src/ -name '*.daml')
    7. $(FINLIB_DAR):
    8. scripts/getfinlib.py $(SDK_VERSION)
    9. $(MODELS_DAR): $(DAML_SRC) daml.yaml $(FINLIB_DAR)
    10. daml build --output $@
    11. TRIGGERS_DAML_SRC=$(shell find triggers/src/ -name '*.daml')
    12. $(TRIGGERS_DAR): $(TRIGGERS_DAML_SRC) triggers/daml.yaml $(MODELS_DAR)
    13. cd triggers && daml build --output ../$@
    github.com

    digital-asset/ex-bond-issuance/blob/9a68bce68e0da516dce586c2b6c914497a2776c4/scripts/getfinlib.py

    #!/usr/bin/env python3
    #
    # Copyright (c) 2019, Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
    # SPDX-License-Identifier: Apache-2.0
    #
    
    # Produces dar file `target/finlib-master-sdk-{daml_sdk_version}.dar' by fetching the source and building it.
    # Arguments: daml_sdk_version
    
    import logging
    from io import BytesIO
    from os import environ, getcwd, path, chdir, chmod, mkdir
    from subprocess import call
    from sys import argv
    from tempfile import mkdtemp
    from zipfile import ZipFile
    from shutil import copyfile
    
    # based on 'Cheat Sheet: Writing Python 2-3 compatible code'
    # from https://python-future.org/compatible_idioms.html
    
    This file has been truncated. show original