Skip to content

Commit

Permalink
Allow for supplying contracts version due to removal of semver plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
rpatel-figure committed Jun 30, 2022
1 parent f6b9e9a commit 5d56ba4
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions dc.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
#!/bin/bash

while getopts 'p: c' OPTION; do
while getopts 'p:v:c' OPTION; do
case "$OPTION" in
p)
PATH_TO_CONTRACTS="$OPTARG"
echo "Path to contracts you wish to publish: $OPTARG"
;;
v)
CONTRACTS_VERSION="$OPTARG"
echo "Version you wish to publish the contracts as: $OPTARG"
;;
c)
SETUP_SMART_CONTRACT=true
echo "Running setup with smart contracts."
;;
?)
echo "script usage: $(basename \$0) [-p <path to p8e contracts directory>]" >&2
echo "script usage: $(basename \$0) [-p <path to p8e contracts directory> -v <version to publish contracts as>]" >&2
exit 1
;;
esac
Expand Down Expand Up @@ -54,18 +58,24 @@ function up {
function publish() {
if [ -z ${PATH_TO_CONTRACTS+x} ]; then
echo "Provide a valid path to the contracts directory you wish to publish using the -p argument."
exit
exit 1
fi

if [ -z ${CONTRACTS_VERSION} ]; then
echo "Provide a valid version string you wish to publish the contracts as using the -v argument."
exit 1
fi

source ./service/docker/bootstrap.env
export FULL_PATH=$(realpath $PATH_TO_CONTRACTS)

if [[ -d "$FULL_PATH" ]]; then
pushd $PATH_TO_CONTRACTS > /dev/null
./gradlew p8eClean p8eCheck p8eBootstrap --info && ./gradlew publishToMavenLocal -xsignMavenPublication --info
./gradlew p8eClean p8eCheck p8eBootstrap --info && ./gradlew publishToMavenLocal -Pversion="$CONTRACTS_VERSION" -xsignMavenPublication --info
popd > /dev/null
else
echo "Invalid path. Provide a valid path to the contracts directory you wish to publish."
exit 1
fi
}

Expand All @@ -82,7 +92,7 @@ function bounce {
function build_classification() {
if [ -z ${PATH_TO_CONTRACTS+x} ]; then
echo "Provide a valid path to the smart contracts directory you wish to store on provenance using the -p argument."
exit
exit 1
fi

export FULL_PATH=$(realpath $PATH_TO_CONTRACTS)
Expand All @@ -95,6 +105,7 @@ function build_classification() {
cp $PATH_TO_CONTRACTS/artifacts/asset_classification_smart_contract.wasm service/docker/prov-init/contracts/asset_classification_smart_contract.wasm
else
echo "Invalid path. Provide a valid path to the contracts directory you wish to publish."
exit 1
fi
}

Expand Down

0 comments on commit 5d56ba4

Please sign in to comment.