Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade and modularize app #75

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ada89d2
Add base service interface
GeorgSchneider Dec 13, 2022
f77cc7d
Add custody service interfaces
GeorgSchneider Dec 13, 2022
8ccd9d2
Implement custody service interfaces
GeorgSchneider Dec 13, 2022
25f95bb
Add interfaces for custody auto service
GeorgSchneider Dec 13, 2022
5db5674
Use custody services interfaces in UI
GeorgSchneider Dec 17, 2022
ffa3e8c
Add issuance interfaces
GeorgSchneider Dec 17, 2022
fb1d365
Add interfaces for listing
GeorgSchneider Dec 19, 2022
c5d8d90
Add auction and bidding service interfaces
GeorgSchneider Dec 19, 2022
8600614
Add interfaces for more services
GeorgSchneider Dec 21, 2022
ef3835b
Instrument.K -> InstrumentKey
GeorgSchneider Dec 21, 2022
5dad8f3
Add interfaces for settlement and structuring services
GeorgSchneider Dec 21, 2022
7d2adb4
Add interfaces for trading service
GeorgSchneider Dec 21, 2022
4c84a6d
SDK update
GeorgSchneider Dec 21, 2022
374058f
Add interfaces for dex service
GeorgSchneider Dec 21, 2022
363d185
Update UI for new service interfaces
GeorgSchneider Dec 21, 2022
b306fa1
Model side of Daml Finance 1.0 upgrade
GeorgSchneider Dec 22, 2022
736c53a
Fix up several rule placements
GeorgSchneider Dec 22, 2022
0573d7b
Fix service and rule placement, and trading and auction auth
GeorgSchneider Dec 22, 2022
abb8acf
Build separate packages
GeorgSchneider Jan 3, 2023
cc36dad
Remove log files
GeorgSchneider Jan 3, 2023
3760cc4
Fix up UI side for multi-package support
GeorgSchneider Jan 4, 2023
29da3e6
Align CircleCI config
GeorgSchneider Jan 7, 2023
fc6f4b6
Enable UI release
GeorgSchneider Jan 7, 2023
e7c3843
Fix UI build
GeorgSchneider Jan 7, 2023
ac80eee
Fix setup package
GeorgSchneider Jan 7, 2023
a271abc
Refactor scenarios (WIP)
GeorgSchneider Jan 18, 2023
655dde8
Party and scenario init in UI (WIP)
GeorgSchneider Jan 19, 2023
82f0980
Add scenario initialization
GeorgSchneider Jan 20, 2023
b41c734
Migrated remaining scenarios
GeorgSchneider Jan 20, 2023
6e9a403
Update UI packages
GeorgSchneider Jan 20, 2023
23e2d42
Add Daml Hub deployment scripts
GeorgSchneider Jan 21, 2023
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
58 changes: 41 additions & 17 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ commands:
command: |
set -euo pipefail

git log -n1 --format=%H nix shell.nix > /tmp/nix-cache-key
git log -n1 --format=%H nix shell.nix daml.yaml > /tmp/nix-cache-key
sudo mkdir /nix
sudo chown circleci /nix
>> $BASH_ENV echo 'export USER=circleci'
echo 'export USER=circleci' >> "$BASH_ENV"
- restore_cache:
keys:
- nix-{{ checksum "/tmp/nix-cache-key" }}
Expand Down Expand Up @@ -84,28 +84,40 @@ commands:
--run bash \<<'EOF'
set -euo pipefail

PACKAGES=(`ls package/main/daml/*/daml.yaml`)
for package in ${PACKAGES[@]}; do
PACKAGE=`echo ${package} | cut -f4 -d "/"`
VERSION=`yq e '.version' ${package}`
TAG="${PACKAGE}/${VERSION}"
echo "Processing package '${PACKAGE}' with tag '${TAG}'..."
while read PACKAGE_NAME PACKAGE_PATH
do
CONFIG="package/${PACKAGE_PATH}/daml.yaml"
VERSION=`yq e '.version' ${CONFIG}`
TAG="${PACKAGE_NAME}/${VERSION}"
echo "Processing package '${PACKAGE_NAME}' with tag '${TAG}'..."

if [[ `git tag -l ${TAG} | wc -l` -eq 0 ]]; then
DAR_PREFIX=`yq e '.name' ${package}`
DAR_PREFIX=`yq e '.name' ${CONFIG}`
DAR="${DAR_PREFIX}-${VERSION}.dar"
gpg --armor --detach-sign .dars/${DAR}

if [[ `echo $VERSION | grep ".99." | wc -l` -eq 0 ]]; then
gh release create ${TAG} .dars/${DAR}* --target ${CIRCLE_BRANCH} --notes "See release notes (insert link here) for further details."
if [[ `echo $VERSION | grep ".99." | wc -l` -eq 0 ]] ; then
gh release create ${TAG} .dars/${DAR}* \
--target ${CIRCLE_BRANCH} \
--title ${TAG} \
--notes "See [Daml Finance App readme](https://github.com/digital-asset/daml-finance-app#readme) for further details."
else
gh release create ${TAG} .dars/${DAR}* --target ${CIRCLE_BRANCH} --prerelease --notes "Development snapshot of package '${PACKAGE}'. Use at your own risk."
gh release create ${TAG} .dars/${DAR}* \
--prerelease \
--target ${CIRCLE_BRANCH} \
--title ${TAG} \
--notes "Development snapshot of package '${PACKAGE_NAME}'. Use at your own risk."
fi
echo -e "Successfully released package '${PACKAGE}' with tag '${TAG}'.\n"
echo -e "Successfully released package '${PACKAGE_NAME}' with tag '${TAG}'.\n"
else
echo -e "Tag '${TAG}' already exists for package '${PACKAGE}'; Ignoring.\n"
echo -e "Tag '${TAG}' already exists for package '${PACKAGE_NAME}'; Ignoring.\n"
fi
done
done < <(yq e '.local.packages
| to_entries
| map(.value.package)
| .[]
| select(.path == "main*")
| .name + " " + .path' package/packages.yaml)
EOF
run_release_ui:
description: "GitHub Release - currently ignored"
Expand All @@ -131,9 +143,16 @@ commands:
gpg --armor --detach-sign ${TAR}

if [[ `echo $VERSION | grep ".99." | wc -l` -eq 0 ]]; then
gh release create ${TAG} ${TAR}* --target ${CIRCLE_BRANCH} --notes "See release notes (insert link here) for further details."
gh release create ${TAG} ${TAR}* \
--target ${CIRCLE_BRANCH} \
--title ${TAG} \
--notes "See [Daml Finance App readme](https://github.com/digital-asset/daml-finance-app#readme) for further details."
else
gh release create ${TAG} ${TAR}* --target ${CIRCLE_BRANCH} --prerelease --notes "Development snapshot of the UI. Use at your own risk."
gh release create ${TAG} ${TAR}* \
--prerelease \
--target ${CIRCLE_BRANCH} \
--title ${TAG} \
--notes "Development snapshot of the UI. Use at your own risk."
fi
else
echo -e "Tag '${TAG}' already exists; Ignoring."
Expand All @@ -154,6 +173,10 @@ jobs:
name: Build source and packages
command:
make ci-build
- run:
name: Validate packages
command:
make ci-validate
- run:
name: Execute tests
command:
Expand All @@ -170,6 +193,7 @@ jobs:
- setup_nix
- import_gpg_key
- run_release
- run_release_ui

workflows:
version: 2
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/.dev
.daml
/log
log
.DS_Store
.lib

Expand All @@ -24,3 +24,4 @@ daml.js/
.dars/
lib/*
ui/src/parties.json
.cache/
212 changes: 187 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,38 +1,93 @@
SCRIPTS_DIR := scripts
UI := ui

.PHONY: build
build: install
daml build
daml codegen js
./$(SCRIPTS_DIR)/build.sh
# cd $(UI) && npm run build
##########################
# Project Source (./src) #
##########################

.PHONY: install
install:
./$(SCRIPTS_DIR)/get-dependencies.sh daml.yaml
cd $(UI) && npm install

.PHONY: clean
clean:
daml clean
./$(SCRIPTS_DIR)/remove-dependencies.sh daml.yaml
cd $(SCRIPTS_DIR) && ./clean.sh
rm -rf $(UI)/node_modules
rm -rf $(UI)/daml.js
rm -rf $(UI)/build
.PHONY: build
build: install
daml build

.PHONY: test
test: build
daml test

.PHONY: headers-check
headers-check:
./$(SCRIPTS_DIR)/dade-copyright-headers.py check
.PHONY: clean
clean:
-rm -rf .lib/
-rm -rf ui/build
-rm -rf ui/daml.js
daml clean

.PHONY: headers-update
headers-update:
./$(SCRIPTS_DIR)/dade-copyright-headers.py update
.PHONY: codegen
codegen:
daml codegen js -o ui/daml.js .dars/*.dar

.PHONY: setup
setup:
-rm -rf ui/daml.js
DAML_PROJECT=package/main/daml/Daml.Finance.App.Setup/ daml build
cp package/main/daml/Daml.Finance.App.Setup/.daml/dist/*.dar .dars/
daml codegen js -o ui/daml.js .dars/*.dar

.PHONY: build-ui
build-ui:
cd ui && npm run build

.PHONY: package
package: build-ui
./$(SCRIPTS_DIR)/package.sh

.PHONY: deploy
deploy:
./$(SCRIPTS_DIR)/deploy.sh

#########################
# Packages (./packages) #
#########################

.PHONY: clean-packages
clean-packages:
./$(SCRIPTS_DIR)/clean-packages.sh

.PHONY: build-packages
build-packages:
./$(SCRIPTS_DIR)/build-packages.sh

# .PHONY: build-java-packages
# build-java-packages: build-packages
# daml codegen java -o .dars/.java .dars/*

.PHONY: test-packages
test-packages: build-packages
./$(SCRIPTS_DIR)/test-packages.sh

.PHONY: validate-packages
validate-packages: build-packages
./$(SCRIPTS_DIR)/validate-packages.sh

# .PHONY: update-data-dependencies-packages
# update-data-dependencies-packages:
# packell data-dependencies update -f
# make headers-update

###############################
# Project Source and Packages #
###############################

.PHONY: build-all
build-all: build build-packages build-ui

.PHONY: test-all
test-all: test test-packages

.PHONY: clean-all
clean-all: clean clean-packages
# pipenv run make doc-clean

##################################
# CI #
Expand All @@ -44,19 +99,126 @@ headers-update:
ci-build:
@nix-shell \
--pure \
--run 'make build'
--run 'make build-all'

# .PHONY: ci-build-java
# ci-build-java:
# @nix-shell \
# --pure \
# --run 'daml codegen java -o .dars/.java .dars/*.dar'

# .PHONY: ci-build-js
# ci-build-js:
# @nix-shell \
# --pure \
# --run 'daml codegen js -o ui/daml.js .dars/*.dar'

.PHONY: ci-test
ci-test:
@nix-shell \
--pure \
--run 'daml test'
--run 'daml test; ./$(SCRIPTS_DIR)/test-packages.sh'

.PHONY: ci-validate
ci-validate:
@nix-shell \
--pure \
--run './$(SCRIPTS_DIR)/validate-packages.sh'

.PHONY: ci-docs
ci-docs: $(DAML_SDK_ROOT)
@nix-shell \
--pure \
--run 'pipenv run make doc-html'

.PHONY: ci-headers-check
ci-headers-check:
@nix-shell \
--pure \
--run './scripts/dade-copyright-headers.py check'

.PHONY: ci-assembly
ci-assembly:
@nix-shell \
--pure \
--run './docs/scripts/build-assembly.sh'

.PHONY: ci-data-dependencies
ci-data-dependencies:
@nix-shell \
--pure \
--run 'export LANG=C.UTF-8; packell data-dependencies validate'

.PHONY: ci-local
ci-local: clean ci-headers-check ci-build ci-test
ci-local: clean-all ci-headers-check ci-build ci-validate ci-test

#########
# Cache #
#########

.PHONY: clean-cache
clean-cache:
-rm -rf .cache

#####################
# Copyright headers #
#####################

.PHONY: headers-check
headers-check:
./scripts/dade-copyright-headers.py check

.PHONY: headers-update
headers-update:
./scripts/dade-copyright-headers.py update

############################
# Documentation Generation #
############################

DAML_SRC := $(shell find src/daml -name '*.daml')
SDK_VERSION := $(shell yq e '.sdk-version' daml.yaml)
DAML_ROOT := $(shell if [ -z ${DAML_HOME} ]; then echo ~/.daml; else echo ${DAML_HOME}; fi)

.PHONY: doc-code-json
doc-code-json: $(DAML_SRC)
daml damlc docs \
--output=docs/build/daml-finance.json \
--package-name=daml-finance \
--format Json \
$(DAML_SRC)

.PHONY: doc-code
doc-code: doc-code-json
daml damlc docs \
--output=docs/build/daml-finance-rst \
--input-format=json \
--format=Rst \
--exclude-instances=HasField,HasImplementation,HasFromInterface,HasToInterface,HasInterfaceView,HasExercise,HasExerciseGuarded,HasFromAnyChoice,HasToAnyChoice \
--drop-orphan-instances \
--template=docs/code-documentation-templates/base-rst-template.rst \
--index-template=docs/code-documentation-templates/base-rst-index-template.rst \
--base-url=https://docs.daml.com/daml/daml-finance \
--input-anchor=$(DAML_ROOT)/sdk/$(SDK_VERSION)/damlc/resources/daml-base-anchors.json \
docs/build/daml-finance.json

# Build doc theme
.PHONY: doc-theme
doc-theme:
cd docs/sphinx && ./build-doc-theme.sh

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?= -c "$(CONFDIR)" -W
SPHINXBUILD ?= sphinx-build
SOURCEDIR = docs/source
BUILDDIR = docs/build
CONFDIR = docs/sphinx

.PHONY: doc-html
doc-html: doc-theme doc-code
$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: doc-clean
doc-clean: Makefile
$(SPHINXBUILD) -M clean "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Loading