forked from DIDman/DRman
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
124 lines (105 loc) · 3.13 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
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}/.drman/bin"
ext.installSrcDir = "${userHome}/.drman/src"
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.drmanBuildVersion = "${config.drmanVersion}+${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: [
DRMAN_VERSION: drmanBuildVersion,
DRMAN_NAMESPACE: config.drmanNamespace,
DRMAN_CANDIDATE_BRANCH: config.candidateBranch,
DRMAN_CANDIDATE_REPO_VERSION: config.candidateRepoVersion,
DRMAN_CANDIDATES_API: config.candidatesApi
]
)
}
tasks.test.configure {
dependsOn(prepareScripts)
testLogging.exceptionFormat = FULL
}
task assembleArchive(type: Zip, dependsOn: prepareScripts) {
//archiveAppendix = 'cli'
archiveVersion = drmanBuildVersion
from('build/scripts')
include('*.sh*')
}
tasks.assemble.configure {
dependsOn(assembleArchive)
}
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('drman-init.sh')
}
task installModules(type: Copy, dependsOn: [cleanInstallModules, prepareScripts]) {
from('build/scripts')
into(installSrcDir)
include('drman-*.sh')
exclude('drman-init.sh')
}
task install(dependsOn: [installInit, installModules])
bintray {
user = System.getenv('BINTRAY_USERNAME')
key = System.getenv('BINTRAY_API_KEY')
publish = true
filesSpec {
from('build/distributions')
into('.')
}
pkg {
repo = 'generic'
name = 'DRman'
userOrg = 'DIDman'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/DIDman/DRman.git'
version {
name = drmanBuildVersion
desc = 'Binary zip distribution of DRMAN bash client.'
released = new Date()
}
}
}