Skip to content

Commit

Permalink
Extracted indy-run.gradle plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
voddan committed Aug 9, 2018
1 parent d2f6fdd commit 9b54b70
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 23 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ buildscript {
ext.quasar_version = '0.7.9'
ext.junit_version = '4.12'
ext.kotlin_version = '1.2.30'
ext.indy_version = "1.5.0"

repositories {
jcenter()
Expand Down
4 changes: 3 additions & 1 deletion cordapp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ publishing {
from components.java
}
}
}
}

apply from: "$rootDir/indy-run.gradle"
11 changes: 10 additions & 1 deletion indy-utils/docker.gradle → docker.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
buildscript {
ext.docker_plugin_version = "0.19.2"

repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "gradle.plugin.com.palantir.gradle.docker:gradle-docker:0.19.2"
classpath "gradle.plugin.com.palantir.gradle.docker:gradle-docker:$docker_plugin_version"
}
}

Expand All @@ -14,6 +16,13 @@ apply plugin: com.palantir.gradle.docker.DockerRunPlugin

ext.dockerRunTask = tasks.find {it.name == "dockerRun"}

task dockerStopRun {
doLast {
dockerStop.execute()
dockerRunTask.execute()
}
}

static def dockerExists(String containerName) {
def result = "docker inspect $containerName".execute()
return result.waitFor() == 0
Expand Down
24 changes: 24 additions & 0 deletions indy-run.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apply from: "$rootDir/docker.gradle"

def indy_version = project.ext.has('indy_version') ? ext.indy_version : "1.5.0"
def indy_pool_folder_name = '.indy_client/'
def indy_pool_docker_name = 'indy-cordapp.indy-pool'

dockerRun {
name indy_pool_docker_name
image "teamblockchain/indy-pool:$indy_version"
ports '9701:9701','9702:9702','9703:9703','9704:9704','9705:9705','9706:9706','9707:9707','9708:9708'
daemonize true
clean true
}

task cleanDefaultPool(type: Delete) {
def home = System.getProperty("user.home")
delete("$home/$indy_pool_folder_name")
}

test.dependsOn(dockerStopRun)
test.dependsOn(cleanDefaultPool)

clean.dependsOn(dockerStop)
clean.dependsOn(cleanDefaultPool)
22 changes: 1 addition & 21 deletions indy-utils/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
apply from: 'docker.gradle'

ext.indy_version = "1.5.0"

dependencies {
compile group: 'org.hyperledger', name: 'indy', version: "$indy_version"
compile "$corda_release_group:corda-core:$corda_release_version"
Expand All @@ -12,20 +8,4 @@ dependencies {
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.21'
}

dockerRun {
name "indy-cordapp.indy-pool"
image "teamblockchain/indy-pool:$indy_version"
ports '9701:9701','9702:9702','9703:9703','9704:9704','9705:9705','9706:9706','9707:9707','9708:9708'
daemonize true
clean true
}

test.dependsOn(dockerRunTask)
clean.dependsOn(dockerStop)

task cleanDefaultPool(type: Delete) {
def home = System.getProperty("user.home")
delete("$home/.indy_client/")
}

clean.dependsOn(cleanDefaultPool)
apply from: "$rootDir/indy-run.gradle"

0 comments on commit 9b54b70

Please sign in to comment.