-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
131 lines (114 loc) · 3.79 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
plugins {
id "io.spring.dependency-management" version "1.0.6.RELEASE"
id "com.github.johnrengelman.shadow" version "4.0.2"
id "application"
id "groovy"
}
version "0.1"
group "codes.recursive"
mainClassName = "codes.recursive.Application"
sourceCompatibility = 1.8
targetCompatibility = 1.8
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://jcenter.bintray.com" }
}
task myRun(type: JavaExec){
classpath sourceSets.main.runtimeClasspath
main = mainClassName
systemProperties = System.properties
}
dependencyManagement {
imports {
mavenBom 'io.micronaut:micronaut-bom:1.1.0.RC2'
}
}
configurations {
// for dependencies that are needed for development only
developmentOnly
}
dependencies {
compile "org.codehaus.groovy:groovy-sql:2.5.6"
compile "org.codehaus.groovy:groovy-json:2.5.6"
compile "io.micronaut:micronaut-http-client"
compile "io.micronaut:micronaut-http-server-netty"
compile "io.micronaut:micronaut-runtime-groovy"
compile "io.micronaut:micronaut-validation"
implementation fileTree(dir: 'libs', include: ['*.jar'])
compileOnly "io.micronaut:micronaut-inject-groovy"
runtime "ch.qos.logback:logback-classic:1.2.3"
testAnnotationProcessor "io.micronaut:micronaut-inject-java"
testCompile("org.spockframework:spock-core") {
exclude group: "org.codehaus.groovy", module: "groovy-all"
}
testCompile "io.micronaut:micronaut-inject-groovy"
testCompile "io.micronaut.test:micronaut-test-spock:1.0.1"
testCompile "org.junit.jupiter:junit-jupiter-api"
testCompile "io.micronaut.test:micronaut-test-junit5"
testRuntime "org.junit.jupiter:junit-jupiter-engine"
}
// uses built-in Copy
task copyLibs(type: Copy) {
from configurations.runtime
into 'build/libs/libs'
}
task copyLocalLibs(type: Copy) {
from 'libs/'
into 'build/libs/libs'
}
task copyWallet(type: Copy) {
from '../../misc/atp/wallet_BARNEVENTS/'
into 'build/wallet'
}
task copyResources(type:Copy) {
from "build-resource"
into "build"
doLast {
// fix dockerfile/k8s yaml
def d = new File( 'build/Dockerfile' )
def dfile = d.text.replaceAll('\\$\\{project.artifactId\\}', project.name)
dfile = dfile.replaceAll("COPY ${project.name}", "COPY libs/${project.name}")
d.write(dfile)
def a = new File( 'build/app.yaml' )
def afile = a.text.replaceAll('\\$\\{project.artifactId\\}', project.name)
a.write(afile)
def allJar = new File( 'build/barn-automation-service-micronaut-groovy-0.1-all.jar')
}
}
shadowJar {
mergeServiceFiles()
}
run.classpath += configurations.developmentOnly
test.classpath += configurations.developmentOnly
run.jvmArgs('-noverify', '-XX:TieredStopAtLevel=1', '-Dcom.sun.management.jmxremote')
// use JUnit 5 platform
test {
useJUnitPlatform()
}
tasks.withType(GroovyCompile) {
groovyOptions.forkOptions.jvmArgs.add('-Dgroovy.parameters=true')
}
jar {
def libs = configurations.runtime.files.collect { "libs/$it.name" }
new File('libs/').eachFile { libs << "libs/$it.name" }
archiveName = "${project.name}.jar"
manifest {
attributes ('Main-Class': "${mainClassName}",
'Class-Path': libs.join(' ')
)
}
}
clean {
// don't delete .oci dir
delete = [] //clear out existing files to delete
delete 'build/wallet', 'build/classes', 'build/distributions', 'build/libs', 'build/resources', 'build/scripts', 'build/scriptsShadow', 'build/tmp', 'build/app.yaml', 'build/Dockerfile', 'build/secret.yaml'
}
assemble.dependsOn copyLibs
assemble.dependsOn copyLocalLibs
assemble.dependsOn copyWallet
assemble.dependsOn copyResources