forked from sdkman/sdkman-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
140 lines (118 loc) · 3.42 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
132
133
134
135
136
137
138
139
140
import org.apache.tools.ant.filters.ReplaceTokens
import static org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
plugins {
id('groovy')
id('com.jfrog.bintray') version '1.8.4'
}
String userHome = System.getProperty('user.home')
ext.installBinDir = "${userHome}/.sdkman/bin"
ext.installSrcDir = "${userHome}/.sdkman/src"
ext.installContribDir = "${userHome}/.sdkman/contrib"
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.toURI().toURL())
ext.config = config
}
loadConfiguration()
ext.buildNumber = System.getenv('TRAVIS_BUILD_NUMBER') ?: '0'
ext.sdkmanCliBuildVersion = "${config.sdkmanCliVersion}+${buildNumber}".toString()
repositories.jcenter()
dependencies {
testImplementation('com.github.tomakehurst:wiremock:2.25.1') {
exclude(module: 'junit')
}
testImplementation('io.cucumber:cucumber-groovy:4.7.1')
testImplementation('io.cucumber:cucumber-junit:4.7.4')
testImplementation('io.cucumber:gherkin:5.2.0')
testImplementation('junit:junit:4.13')
testImplementation('org.codehaus.groovy:groovy:2.4.19')
testImplementation('org.codehaus.groovy:groovy-json:2.4.19')
testImplementation('org.codehaus.groovy:groovy-templates:2.4.19')
testImplementation('org.slf4j:slf4j-api:1.7.30')
testImplementation('org.slf4j:slf4j-simple:1.7.30')
testImplementation('org.spockframework:spock-core:1.3-groovy-2.4') {
exclude(module: 'groovy-all')
}
}
task prepareScripts(type: Copy) {
from('src/main/bash')
into('build/scripts')
include('**/*')
filter(
ReplaceTokens,
tokens: [
SDKMAN_VERSION : sdkmanCliBuildVersion,
SDKMAN_CANDIDATES_API: config.candidatesApi
]
)
}
task prepareContrib(type: Copy) {
from('contrib')
into('build/contrib')
}
tasks.test.configure {
dependsOn(prepareScripts)
testLogging.exceptionFormat = FULL
}
task assembleArchive(type: Zip, dependsOn: [prepareScripts, prepareContrib]) {
archiveAppendix = 'cli'
archiveVersion = sdkmanCliBuildVersion
from('build/scripts') {
include('*.sh*')
}
from('build') {
include('contrib/**')
}
}
tasks.assemble.configure {
dependsOn(assembleArchive)
}
task cleanInstallInit(type: Delete) {
delete(installBinDir)
}
task cleanContribInit(type: Delete) {
delete(installContribDir)
}
task cleanInstallModules(type: Delete) {
delete(installSrcDir)
}
task installContrib(type: Copy, dependsOn: [cleanContribInit, prepareContrib]) {
from('build/contrib')
into(installContribDir)
}
task installInit(type: Copy, dependsOn: [cleanInstallInit, prepareScripts]) {
from('build/scripts')
into(installBinDir)
include('sdkman-init.sh')
}
task installModules(type: Copy, dependsOn: [cleanInstallModules, prepareScripts]) {
from('build/scripts')
into(installSrcDir)
include('sdkman-*.sh')
exclude('sdkman-init.sh')
}
task install(dependsOn: [installInit, installContrib, installModules])
bintray {
user = System.getenv('BINTRAY_USERNAME')
key = System.getenv('BINTRAY_API_KEY')
publish = true
filesSpec {
from('build/distributions')
into('.')
}
pkg {
repo = 'generic'
name = 'sdkman-cli'
userOrg = 'sdkman'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/sdkman/sdkman-cli.git'
version {
name = sdkmanCliBuildVersion
desc = 'Binary zip distribution of SDKMAN bash client.'
released = new Date()
}
}
}