-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathbuild.gradle
50 lines (39 loc) · 1.49 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
plugins {
id 'groovy'
id 'application'
// Shadow jar plugin for creating the uberjar
id 'com.github.johnrengelman.shadow' version '7.0.0'
}
mainClassName = "muddler.App"
repositories {
jcenter()
}
dependencies {
implementation 'org.apache.groovy:groovy-all:4.0.3'
}
// this feels like a lot to not repeat the version, but by Jove I'm doing it anyway!
task generateGroovy(type: Copy) {
def templateContext = [version: project.version]
inputs.properties templateContext // for gradle up-to-date check
from "src/template/groovy/"
into "$buildDir/generated/groovy"
expand templateContext
}
// add the generated files to the srcDir and ensure they're generated before compileGroovy
sourceSets.main.groovy.srcDir "$buildDir/generated/groovy"
compileGroovy.dependsOn generateGroovy
task dockerImage(type:Exec, dependsOn: ['clean', 'shadowJar']) {
commandLine 'docker', 'build', '-t', "demonnic/muddler:$version", '.'
}
task dockerTest(type:Exec, dependsOn: ['clean', 'shadowJar']) {
commandLine 'docker', 'build', '-t', "demonnic/muddler:test", '.'
}
task dockerLatest(type:Exec, dependsOn: ['clean', 'shadowJar']) {
commandLine 'docker', 'build', '-t', "demonnic/muddler:latest", '.'
}
task mpackage(type:Exec, dependsOn: ['clean', 'shadowJar']) {
def jar = "../build/libs/muddle-$version-all.jar"
workingDir = "./mpackage"
commandLine 'java', '-jar', jar
}
task muddle(dependsOn: ['clean', 'shadowDistZip', 'shadowDistTar', 'dockerImage', 'dockerLatest', 'dockerTest', 'mpackage'])