forked from nreese/enhanced_tilemap
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
275 lines (226 loc) · 8.44 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
///////////////////////////////////////////////////
// //
// Dependency Details //
// //
///////////////////////////////////////////////////
buildscript {
repositories {
maven {
url "https://artifactory.siren.io/artifactory/m2/"
}
}
}
plugins {
id "base"
id "idea"
id "nebula.node" version "1.3.1"
id "nebula.gulp" version "1.3.1"
id "nebula.grunt" version "1.3.1"
}
apply from: "$rootDir/gradle/utils/repository.gradle"
apply from: "$rootDir/gradle/utils/loadPackageJson.gradle"
// This disables publication of gradle metadata to the artifactory
// The metadata is published as SHA-512 which is unsupported and we don't need it anyway
// https://docs.gradle.org/6.0.1/userguide/publishing_gradle_module_metadata.html#sub:disabling-gmm-publication
tasks.withType(GenerateModuleMetadata) {
enabled = false
}
def packageJson = loadPackageJson()
///////////////////////////////////////////////////
// //
// Project Details //
// //
///////////////////////////////////////////////////
group = 'solutions.siren'
version project.hasProperty('customVersion') && customVersion ? customVersion : packageJson.version
def investigateVersion = (project.hasProperty('customInvestigateVersion') && project.customInvestigateVersion?.trim()) ? customInvestigateVersion : version
///////////////////////////////////////////////////
// //
// Install Kibi //
// //
///////////////////////////////////////////////////
/**
* Define the kibi source artifact dependency
*/
configurations {
kibi
}
dependencies {
kibi "solutions.siren:investigate-core:${investigateVersion}:sources@zip"
}
/**
* Task to download locally the kibi dependency
*/
task downloadKibi(type: Copy) {
from configurations.kibi
into new File(buildDir, 'dependencies')
rename { name ->
println "THE NAME ${name}"
def artifact = configurations.kibi.resolvedConfiguration.resolvedArtifacts.find { it.file.name == name }
"${artifact.name}.${artifact.extension}"
}
}
/**
* Task to unzip kibi
*/
task extractKibi(type: Copy, dependsOn: [downloadKibi]) {
from { zipTree(new File(downloadKibi.destinationDir, "investigate-core.zip")) }
into new File(buildDir, 'investigate-core')
includeEmptyDirs = false
}
/**
* Task to execute the `npmInstall` gradle's task from the kibi distribution
*/
task npmInstallKibi(type: NpmTask, dependsOn: [extractKibi]) {
def kibiInstallDir = new File(extractKibi.destinationDir, "investigate-core-${investigateVersion}-sources")
execOverrides {
it.workingDir = kibiInstallDir
}
setArgs( ['ci'] )
}
/**
* Main task to install Kibi locally
*/
task installKibi(dependsOn: [downloadKibi, extractKibi, npmInstallKibi]) {}
///////////////////////////////////////////////////
// //
// Node //
// //
///////////////////////////////////////////////////
node {
// Version of node to use.
version = nodeVersion
// Base URL for fetching node distributions (change if you have a mirror).
distBaseUrl = 'https://nodejs.org/dist'
// If true, it will download node using above parameters.
// If false, it will try to use globally installed node.
download = false
// Set the work directory for unpacking node
workDir = file("${buildDir}/nodejs")
// Set the work directory where node_modules should be located
nodeModulesDir = file("${projectDir}")
npmInstallCommand = 'ci'
}
///////////////////////////////////////////////////
// //
// Package //
// //
///////////////////////////////////////////////////
task gulpPackage(dependsOn: ['gulp_package']) {
doLast {}
}
// run npm install
gulp_package.dependsOn 'npmCi'
///////////////////////////////////////////////////
// //
// Install Grunt Globally //
// //
///////////////////////////////////////////////////
task installGruntGlobally(type: NpmTask) {
args = ['install', '-g', 'grunt']
}
///////////////////////////////////////////////////
// //
// Install Packages //
// //
///////////////////////////////////////////////////
task preNpmCi(type: NpmTask, dependsOn: [installGruntGlobally]) {
execOverrides {
it.workingDir = projectDir
}
setArgs( ['ci'] )
}
task npmCi(type: Delete, dependsOn: [preNpmCi]) {
delete "${projectDir}/node_modules/.bin/npm", "${projectDir}/node_modules/npm"
}
///////////////////////////////////////////////////
// //
// Dev //
// //
///////////////////////////////////////////////////
task gulpDev(type: GulpTask) {
args = ["dev"]
if (project.hasProperty('kibiHomePath')) {
args << "--kibanahomepath=${kibiHomePath}"
}
else {
dependsOn installKibi
args << "--kibanahomepath=${new File(extractKibi.destinationDir, "investigate-core-${investigateVersion}-sources").getAbsolutePath()}"
}
}
// run npm install
gulpDev.dependsOn 'npmCi'
// run gulp install
gulpDev.dependsOn 'installGulp'
// makes that grunt is installed
gulpDev.dependsOn 'installGruntGlobally'
gulpDev.dependsOn 'installGrunt'
installGrunt.mustRunAfter 'installGruntGlobally'
///////////////////////////////////////////////////
// //
// Test //
// //
///////////////////////////////////////////////////
task gulpTest(type: GulpTask) {
args = ["test"]
if (project.hasProperty('kibiHomePath')) {
args << "--kibanahomepath=${kibiHomePath}"
}
else {
dependsOn installKibi
args << "--kibanahomepath=${new File(extractKibi.destinationDir, "investigate-core-${investigateVersion}-sources").getAbsolutePath()}"
}
}
// run npm install
gulpTest.dependsOn 'npmCi'
///////////////////////////////////////////////////
// //
// Test Dev //
// //
///////////////////////////////////////////////////
task gulpTestDev(type: GulpTask) {
args = ["testdev"]
if (project.hasProperty('kibiHomePath')) {
args << "--kibanahomepath=${kibiHomePath}"
}
else {
dependsOn installKibi
args << "--kibanahomepath=${new File(extractKibi.destinationDir, "investigate-core-${investigateVersion}-sources").getAbsolutePath()}"
}
}
// run npm install
gulpTestDev.dependsOn 'npmCi'
///////////////////////////////////////////////////
// //
// Clean //
// //
///////////////////////////////////////////////////
// Extends clean task to clean the node_modules directory
clean {
doLast {
def nodeModulesDir = file("${projectDir}/node_modules")
if (nodeModulesDir.exists()) {
println "=== Cleaning node modules directory: ${nodeModulesDir} ==="
nodeModulesDir.deleteDir()
}
}
}
// Executes the Gulp's clean task
gulp_clean.dependsOn 'npmCi'
clean.dependsOn 'gulp_clean'
///////////////////////////////////////////////////
// //
// Publishing //
// //
///////////////////////////////////////////////////
publishing {
repositories getArtifactoryRepository()
publications {
zipDist(MavenPublication) {
artifact(new File("${projectDir}/target/gulp", "${packageJson.name}.zip"))
groupId project.group
artifactId "kibi-enhanced-tilemap"
version project.version
}
}
}