From 5dc8bac11b463f5925291cec2373dc94bfafba2b Mon Sep 17 00:00:00 2001 From: Jennifer Bell Date: Mon, 18 Nov 2024 10:09:43 -0500 Subject: [PATCH] refactor 2 --- packages/cacti-copm-test/Makefile | 18 ++++++++++-------- packages/cacti-plugin-copm-corda/Makefile | 8 ++++++-- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/packages/cacti-copm-test/Makefile b/packages/cacti-copm-test/Makefile index b94ecc9087..d7cd5e4deb 100644 --- a/packages/cacti-copm-test/Makefile +++ b/packages/cacti-copm-test/Makefile @@ -154,18 +154,20 @@ PATH := $(PATH):$(WORKSPACE)/protoc/bin # SETUP - run once -fabric-setup: +common-setup: + cd $(WORKSPACE)/weaver/core/relay && make build-images-local + + +fabric-setup: common-setup cd $(WORKSPACE)/weaver/common/protos-js && make build rm -Rf $(WORKSPACE)/weaver/sdks/fabric/interoperation-node-sdk/build cd $(WORKSPACE)/weaver/sdks/fabric/interoperation-node-sdk && make build-local cd $(WORKSPACE)/weaver/core/identity-management/iin-agent && make build-local build-image-local cd $(WORKSPACE)/weaver/samples/fabric/fabric-cli && make build-local + cd $(WORKSPACE)/weaver/core/drivers/fabric-driver && make build-image-local -corda-setup: - cd $(WORKSPACE)/weaver/common/protos-java-kt && make build - cd $(WORKSPACE)/weaver/core/network/corda-interop-app && make build-local - cd $(WORKSPACE)/weaver/sdks/corda && make build - cd $(WORKSPACE)/weaver/samples/corda/corda-simple-application && make build-local +corda-setup: common-setup + cd $(WORKSPACE)/weaver/core/drivers/corda-driver && make build-image-local stop-network: cd $(WORKSPACE)/weaver/tests/network-setups/fabric/dev && make stop-network1 stop-network2 PROFILE=2-nodes @@ -191,7 +193,7 @@ docker stop `docker container ls -a -q -f ancestor=$(1) | xargs` || true docker rm `docker container ls -a -q -f ancestor=$(1) | xargs` || true endef -clean-network: +clean-network: stop-network $(foreach image,$(DOCKER_IMAGES),$(call stop_docker,$(image))) cd $(WORKSPACE)/weaver/tests/network-setups/fabric/dev && make clean || true docker volume prune -f @@ -206,4 +208,4 @@ clean-network: fi docker volume rm `docker volume ls | grep -v NAME | sed -e 's/local //g' | grep -v vscode | xargs` || true cd $(WORKSPACE)/weaver/tests/network-setups/corda && make clean || true - rm $(COPM_TARGET_DIR)/*/*network-up.txt || true + rm $(COPM_TARGET_DIR)/*txt || true diff --git a/packages/cacti-plugin-copm-corda/Makefile b/packages/cacti-plugin-copm-corda/Makefile index eb64c2dd88..4a64805848 100644 --- a/packages/cacti-plugin-copm-corda/Makefile +++ b/packages/cacti-plugin-copm-corda/Makefile @@ -2,7 +2,7 @@ WORKSPACE ?= $(shell realpath `pwd`/../../) # file targets are used as placeholders to ensure that steps are only run once COPM_TARGET_DIR=$(WORKSPACE)/packages/cacti-copm-test/target -CORDA_SETUP_TARGET=$(COPM_TARGET_DIR)/corda-setup.txt +SETUP_TARGET=$(COPM_TARGET_DIR)/corda-setup.txt LOCK_NETWORK=$(COPM_TARGET_DIR)/corda-lock-network-up.txt PLEDGE_NETWORK=$(COPM_TARGET_DIR)/corda-pledge-network-up.txt @@ -45,7 +45,9 @@ docker-image: localdeps: $(LOCALDEPS) -setup: localdeps docker-image +$(SETUP_TARGET): localdeps docker-image + cd $(WORKSPACE)/packages/cacti-copm-test && make corda-setup + touch $(SETUP_TARGET) $(PLEDGE_NETWORK): setup cd $(WORKSPACE)/packages/cacti-copm-test && \ @@ -61,6 +63,8 @@ pledge-network: $(PLEDGE_NETWORK) lock-network: $(LOCK_NETWORK) +setup: $(SETUP_TARGET) + clean-network: cd $(WORKSPACE)/packages/cacti-copm-test && make clean-network