forked from sdkman/sdkman-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
115 lines (94 loc) · 2.83 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
import org.apache.tools.ant.filters.*
buildscript {
repositories {
jcenter()
}
}
apply plugin: 'groovy'
apply plugin: 'idea'
apply plugin: 'eclipse'
defaultTasks 'clean', 'prepareTestScripts', 'prepareScripts', 'prepareServer', 'prepareTemplates', 'assembleArchive', 'test'
def userHome = System.getProperty('user.home')
ext.installBinDir = "${userHome}/.gvm/bin"
ext.installSrcDir = "${userHome}/.gvm/src"
ext.defaultGvmVersion = '1.0.0-SNAPSHOT'
loadConfiguration()
repositories {
jcenter()
}
dependencies {
compile 'org.codehaus.groovy:groovy:2.3.5'
compile 'org.codehaus.groovy:groovy-templates:2.3.5'
testCompile 'junit:junit:4.11'
testCompile 'info.cukes:cucumber-groovy:1.1.5'
testCompile 'info.cukes:cucumber-junit:1.1.5'
testCompile 'org.spockframework:spock-core:0.7-groovy-2.0'
testCompile 'com.github.tomakehurst:wiremock:1.46'
}
test.testLogging.exceptionFormat = 'full'
def loadConfiguration() {
def environment = hasProperty('env') ? env : 'local'
ext.environment = environment
println "Environment is set to: $environment"
def configFile = file('config.groovy')
def config = new ConfigSlurper(environment).parse(configFile.toURL())
ext.config = config
}
task prepareTemplates(type: Copy) {
from "src/main/templates"
into "build/templates"
include "*.gtpl"
}
task prepareServer(type: Copy){
from 'src/main/vertx'
into 'build/server'
include 'server.groovy'
filter(ReplaceTokens, tokens: [GVM_VERSION:config.gvmVersion ?: defaultGvmVersion, VERTX_VERSION:config.vertxVersion])
}
task prepareTestScripts(type: Copy) {
from 'src/main/bash'
into 'build/testScripts'
include '**/*'
filter(ReplaceTokens, tokens:
[
GVM_VERSION : "x.y.z",
GVM_SERVICE : config.gvmService,
GVM_BROADCAST_SERVICE: config.gvmBroadcastService
]
)
}
task prepareScripts(type: Copy) {
from 'src/main/bash'
into 'build/scripts'
include '**/*'
filter(ReplaceTokens, tokens:
[
GVM_VERSION : config.gvmVersion ?: defaultGvmVersion,
GVM_SERVICE : config.gvmService,
GVM_BROADCAST_SERVICE: config.gvmBroadcastService
]
)
}
task assembleArchive(type: Zip) {
classifier = 'scripts'
from "build/scripts"
include "gvm*"
}
task cleanInstallInit(type: Delete) {
delete installBinDir
}
task cleanInstallModules(type: Delete) {
delete installSrcDir
}
task installInit(type: Copy, dependsOn: [cleanInstallInit, prepareScripts]) {
from "build/scripts"
into installBinDir
include "gvm-init.sh"
}
task installModules(type: Copy, dependsOn: [cleanInstallModules, prepareScripts]) {
from "build/scripts"
into installSrcDir
include "gvm-*.sh"
exclude "gvm-init.sh"
}
task install(dependsOn: [installInit, installModules])