2018-02-05 11:42:20 +00:00
|
|
|
import java.nio.charset.StandardCharsets
|
|
|
|
import java.nio.file.Files
|
|
|
|
|
|
|
|
|
2017-10-25 15:40:21 +00:00
|
|
|
buildscript {
|
2018-02-05 11:42:20 +00:00
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
}
|
|
|
|
dependencies {
|
2018-02-07 12:16:16 +00:00
|
|
|
classpath "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion"
|
|
|
|
classpath "io.spring.gradle:dependency-management-plugin:1.0.4.RELEASE"
|
|
|
|
classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlin_version"
|
2018-02-05 11:42:20 +00:00
|
|
|
classpath 'com.bmuschko:gradle-docker-plugin:3.2.1'
|
|
|
|
classpath "org.yaml:snakeyaml:1.19"
|
|
|
|
}
|
2017-10-25 15:40:21 +00:00
|
|
|
}
|
|
|
|
|
2018-02-05 11:42:20 +00:00
|
|
|
import org.yaml.snakeyaml.DumperOptions
|
|
|
|
|
|
|
|
|
2017-10-30 16:51:38 +00:00
|
|
|
plugins {
|
2018-02-05 11:42:20 +00:00
|
|
|
id 'com.craigburke.client-dependencies' version '1.4.0'
|
2017-10-30 16:51:38 +00:00
|
|
|
}
|
|
|
|
|
2018-02-05 11:42:20 +00:00
|
|
|
group = "${parent.group}.irs-demo"
|
|
|
|
|
2017-10-30 16:51:38 +00:00
|
|
|
clientDependencies {
|
2017-12-15 15:29:54 +00:00
|
|
|
registry 'realBower', type:'bower', url:'https://registry.bower.io'
|
|
|
|
realBower {
|
|
|
|
"angular"("1.5.8")
|
|
|
|
"jquery"("^3.0.0")
|
|
|
|
"angular-route"("1.5.8")
|
|
|
|
"lodash"("^4.13.1")
|
|
|
|
"angular-fcsa-number"("^1.5.3")
|
|
|
|
"jquery.maskedinput"("^1.4.1")
|
|
|
|
"requirejs"("^2.2.0")
|
|
|
|
"semantic-ui"("^2.2.2", into: "semantic")
|
|
|
|
}
|
2017-10-30 16:51:38 +00:00
|
|
|
|
2017-12-15 15:29:54 +00:00
|
|
|
// put the JS dependencies into src directory so it can easily be referenced
|
|
|
|
// from HTML files in webapp frontend, useful for testing/development
|
|
|
|
// Note that this dir is added to .gitignore
|
|
|
|
installDir = 'src/main/resources/static/js/bower_components'
|
2017-10-30 16:51:38 +00:00
|
|
|
}
|
|
|
|
|
2017-10-25 15:40:21 +00:00
|
|
|
// Spring Boot plugin adds a numerous hardcoded dependencies in the version much lower then Corda expects
|
|
|
|
// causing the problems in runtime. Those can be changed by manipulating above properties
|
|
|
|
// See https://github.com/spring-gradle-plugins/dependency-management-plugin/blob/master/README.md#changing-the-value-of-a-version-property
|
|
|
|
ext['artemis.version'] = "$artemis_version"
|
|
|
|
ext['hibernate.version'] = "$hibernate_version"
|
2018-02-07 12:16:16 +00:00
|
|
|
ext['jackson.version'] = "$jackson_version"
|
2017-10-25 15:40:21 +00:00
|
|
|
|
|
|
|
apply plugin: 'kotlin'
|
|
|
|
apply plugin: 'kotlin-spring'
|
|
|
|
apply plugin: 'eclipse'
|
|
|
|
apply plugin: 'org.springframework.boot'
|
|
|
|
apply plugin: 'project-report'
|
|
|
|
apply plugin: 'application'
|
|
|
|
|
2017-12-15 15:29:54 +00:00
|
|
|
configurations {
|
|
|
|
demoArtifacts.extendsFrom testRuntime
|
|
|
|
}
|
|
|
|
|
2017-10-25 15:40:21 +00:00
|
|
|
dependencies {
|
2017-12-15 15:29:54 +00:00
|
|
|
compile('org.springframework.boot:spring-boot-starter-web') {
|
|
|
|
exclude module: "spring-boot-starter-logging"
|
|
|
|
exclude module: "logback-classic"
|
|
|
|
}
|
2018-02-06 13:32:13 +00:00
|
|
|
compile("com.fasterxml.jackson.module:jackson-module-kotlin:$jackson_version")
|
2017-12-15 15:29:54 +00:00
|
|
|
compile project(":client:rpc")
|
|
|
|
compile project(":client:jackson")
|
|
|
|
compile project(":test-utils")
|
|
|
|
compile project(path: ":samples:irs-demo:cordapp", configuration: "demoArtifacts")
|
2018-10-30 14:01:20 +00:00
|
|
|
|
|
|
|
// JOpt: for command line flags.
|
|
|
|
compile "net.sf.jopt-simple:jopt-simple:$jopt_simple_version"
|
|
|
|
|
2017-12-15 15:29:54 +00:00
|
|
|
testCompile('org.springframework.boot:spring-boot-starter-test') {
|
|
|
|
exclude module: "spring-boot-starter-logging"
|
|
|
|
exclude module: "logback-classic"
|
|
|
|
}
|
2017-10-25 15:40:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
jar {
|
2017-12-15 15:29:54 +00:00
|
|
|
from sourceSets.test.output
|
|
|
|
dependsOn clientInstall
|
2017-10-25 15:40:21 +00:00
|
|
|
}
|
|
|
|
|
2018-02-05 11:42:20 +00:00
|
|
|
def docker_dir = file("$project.buildDir/docker")
|
|
|
|
|
2017-10-25 15:40:21 +00:00
|
|
|
task deployWebapps(type: Copy, dependsOn: ['jar', 'bootRepackage']) {
|
2017-12-15 15:29:54 +00:00
|
|
|
ext.webappDir = file("build/webapps")
|
|
|
|
|
|
|
|
from(jar.outputs)
|
|
|
|
from("src/test/resources/scripts/") {
|
|
|
|
filter { it
|
|
|
|
.replace('#JAR_PATH#', jar.archiveName)
|
|
|
|
.replace('#DIR#', ext.webappDir.getAbsolutePath())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
into ext.webappDir
|
|
|
|
}
|
|
|
|
|
|
|
|
task demoJar(type: Jar) {
|
|
|
|
classifier "test"
|
|
|
|
from sourceSets.test.output
|
|
|
|
}
|
2017-10-25 15:40:21 +00:00
|
|
|
|
2017-12-15 15:29:54 +00:00
|
|
|
artifacts {
|
|
|
|
demoArtifacts demoJar
|
2018-02-05 11:42:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
task createDockerfile(type: com.bmuschko.gradle.docker.tasks.image.Dockerfile, dependsOn: [bootRepackage]) {
|
|
|
|
destFile = file("$docker_dir/Dockerfile")
|
|
|
|
|
|
|
|
from 'azul/zulu-openjdk-alpine:8u152'
|
|
|
|
copyFile jar.archiveName, "/opt/irs/web/"
|
|
|
|
workingDir "/opt/irs/web/"
|
|
|
|
defaultCommand "sh", "-c", "java -Dcorda.host=\$CORDA_HOST -jar ${jar.archiveName}"
|
|
|
|
}
|
|
|
|
|
|
|
|
task prepareDockerDir(type: Copy, dependsOn: [bootRepackage, createDockerfile]) {
|
|
|
|
from jar
|
|
|
|
into docker_dir
|
|
|
|
}
|
|
|
|
|
|
|
|
task generateDockerCompose(dependsOn: [prepareDockerDir]) {
|
|
|
|
|
|
|
|
def outFile = new File(project.buildDir, "docker-compose.yml")
|
|
|
|
|
|
|
|
ext['dockerComposePath'] = outFile
|
|
|
|
|
|
|
|
doLast {
|
|
|
|
def dockerComposeObject = [
|
|
|
|
"version": "3",
|
|
|
|
"services": [
|
|
|
|
"web-a": [
|
|
|
|
"build": "$docker_dir".toString(),
|
|
|
|
"environment": [
|
|
|
|
"CORDA_HOST": "bank-a:10003"
|
|
|
|
],
|
|
|
|
"ports": ["8080"]
|
|
|
|
],
|
|
|
|
"web-b": [
|
|
|
|
"build": "$docker_dir".toString(),
|
|
|
|
"environment": [
|
|
|
|
"CORDA_HOST": "bank-b:10003"
|
|
|
|
],
|
|
|
|
"ports": ["8080"]
|
|
|
|
]
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
def options = new org.yaml.snakeyaml.DumperOptions()
|
|
|
|
options.indent = 2
|
|
|
|
options.defaultFlowStyle = DumperOptions.FlowStyle.BLOCK
|
|
|
|
|
|
|
|
def dockerComposeContent = new org.yaml.snakeyaml.Yaml(options).dump(dockerComposeObject)
|
|
|
|
|
|
|
|
Files.write(outFile.toPath(), dockerComposeContent.getBytes(StandardCharsets.UTF_8))
|
|
|
|
}
|
|
|
|
|
|
|
|
outputs.file(outFile)
|
2017-10-25 15:40:21 +00:00
|
|
|
}
|