forked from sdkman/sdkman-cli
/
build.gradle
102 lines (81 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
import org.apache.tools.ant.filters.*
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 {
mavenCentral()
}
dependencies {
compile group: 'org.codehaus.groovy', name: 'groovy', version: '2.1.7'
compile group: 'org.codehaus.groovy', name: 'groovy-templates', version: '2.1.7'
compile group: 'org.vert-x', name: 'vertx-core', version: '1.3.0.final'
compile group: 'org.vert-x', name: 'vertx-lang-groovy', version: '1.3.0.final'
testCompile group: 'junit', name: 'junit', version: '4.11'
testCompile group: 'info.cukes', name: 'cucumber-groovy', version: '1.1.5'
testCompile group: 'info.cukes', name: 'cucumber-junit', version: '1.1.5'
testCompile group: 'org.spockframework', name: 'spock-core', version: '0.7-groovy-2.0'
}
test.testLogging.exceptionFormat = 'full'
task wrapper(type: Wrapper) {
gradleVersion = '1.9-rc-2'
}
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/groovy'
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])
}
task prepareScripts(type: Copy) {
from 'src/main/bash'
into 'build/scripts'
include '**/*'
filter(ReplaceTokens, tokens: [GVM_VERSION:config.gvmVersion ?: defaultGvmVersion, GVM_SERVICE:config.gvmService])
}
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])