From 5f509ec6cb6967239476521466410161f55eaa1c Mon Sep 17 00:00:00 2001 From: Patrick Date: Wed, 14 Apr 2021 09:12:23 +0800 Subject: [PATCH] resolves #1 added support for different version of Corda 4. added multi-build process automation. --- README.md | 1 + automation.sh | 31 +++++++++++++++++++++++++------ docs/developer-guide.md | 11 +++++++++++ 3 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 docs/developer-guide.md diff --git a/README.md b/README.md index 9679811..f821bf6 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,7 @@ productive with Cordaptor. * Understand how to [configure](./docs/configuration.md) Cordaptor * Learn how to [create extensions](./docs/extensions.md) for Cordaptor * Stay tuned to updates in the [development blog](https://medium.com/b180tech) +* If you are developing for the Cordaptor [developer guide](./docs/developer-guide.md) ## Getting support diff --git a/automation.sh b/automation.sh index 58b1243..144038c 100644 --- a/automation.sh +++ b/automation.sh @@ -1,11 +1,26 @@ #Get list of configurations in Configurations file -configurations=$(ls configurations) +configurations=("4.5" "4.6" "4.7") -for configuration in $configurations; do +for configuration in "${configurations[@]}"; do + + #If-Else statement to check tag the platform version based on corda version + if [ "$configuration" == "4.5" ]; then + platform_version=7; + elif [ "$configuration" == "4.6" ]; then + platform_version=8; + elif [ "$configuration" == "4.7" ]; then + platform_version=9; + fi + + #Replaces version of Corda in gradle.properties file + sed -i "/corda_core_release_version/c\corda_core_release_version=$configuration" ./gradle.properties + sed -i "/corda_release_version/c\corda_release_version=$configuration" ./gradle.properties + sed -i "/cordaptor_version/c\cordaptor_version=0.2.0-corda$configuration-SNAPSHOT" ./gradle.properties + + #Replaces target and minimum platform version in build.gradle under reference-cordapp project + sed -i "/targetPlatformVersion/c\ \ttargetPlatformVersion $platform_version" ./reference-cordapp/build.gradle + sed -i "/minimumPlatformVersion/c\ \tminimumPlatformVersion $platform_version" ./reference-cordapp/build.gradle - #Import configurations from the configurations folder to the root build directory - cp configurations/"$configuration"gradle.properties gradle.properties - cp configurations/"$configuration"buildFile reference-cordapp/build.gradle #Build with imported configurations ./gradlew build @@ -14,7 +29,11 @@ for configuration in $configurations; do ./gradlew --stop #Gradle task to create and push docker image of current Corda Version - ./gradlew :tar:dockerPush + if [ "$1" == "dockerPush" ]; then + ./gradlew :tar:dockerPush + else + ./gradlew :tar:docker + fi #Task for getting cordaptor embedded jar and test results ./gradlew automatedResults diff --git a/docs/developer-guide.md b/docs/developer-guide.md new file mode 100644 index 0000000..bf73daa --- /dev/null +++ b/docs/developer-guide.md @@ -0,0 +1,11 @@ +# Developer Guide + +## Automated Building (Corda version 4.5-4.7) + +By using the included `automation.sh` file in the root directory you could automatically build and test the Cordaptor through Corda versions 4.5 to 4.7 +(This could be changed by changing the `configurations` variable found inside the `automation.sh` file). +The `dockerPush` argument could be added which enables the shell scripts ability to push the docker build directly to the remote repository. +### Example +``` +./automation.sh dockerPush +```