This repository has been archived by the owner on Nov 1, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
65 lines (52 loc) · 1.52 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
import org.apache.tools.ant.filters.*
buildscript {
repositories {
jcenter()
}
}
apply plugin: 'groovy'
apply plugin: 'idea'
apply plugin: 'eclipse'
defaultTasks 'clean', 'prepareServer', 'prepareTemplates'
ext.defaultSdkManVersion = '1.0-SNAPSHOT'
loadConfiguration()
repositories {
jcenter()
}
dependencies {
compile 'org.codehaus.groovy:groovy:2.4.5'
compile 'org.codehaus.groovy:groovy-templates:2.4.5'
compile 'org.codehaus.groovy:groovy-json:2.4.5'
compile 'org.vert-x:vertx-lang-groovy:1.3.1.final'
}
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 prepareScripts(type: Copy) {
from 'src/main/scripts'
into 'build/scripts'
include '*.sh'
filter(ReplaceTokens, tokens:
[
SDKMAN_VERSION : config.sdkmanVersion ?: defaultSdkManVersion,
SDKMAN_SERVICE : config.sdkmanService
]
)
}
task prepareTemplates(type: Copy) {
from "src/main/templates"
into "build/templates"
include "*.gtpl", "*.txt"
}
task prepareServer(type: Copy){
from 'src/main/groovy'
into 'build/server'
include 'server.groovy'
filter(ReplaceTokens, tokens: [SDKMAN_VERSION:config.sdkmanVersion ?: defaultSdkManVersion])
}
assemble.dependsOn prepareTemplates, prepareScripts, prepareServer