This repository has been archived by the owner on Oct 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
build.gradle
261 lines (213 loc) · 7.84 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
///////////////////////////////////////////////////
// //
// Dependency Details //
// //
///////////////////////////////////////////////////
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.moowork.gradle:gradle-node-plugin:1.1.1"
classpath 'org.ajoberstar:gradle-git:1.6.0'
}
}
apply plugin: "idea"
apply plugin: "base"
apply plugin: 'com.moowork.gulp'
apply plugin: 'com.moowork.grunt'
apply plugin: 'com.moowork.node'
apply plugin: 'org.ajoberstar.grgit'
apply plugin: 'maven-publish'
apply from: "$rootDir/gradle/utils/repository.gradle"
apply from: "$rootDir/gradle/utils/loadPackageJson.gradle"
import org.ajoberstar.grgit.Grgit
def packageJson = loadPackageJson()
///////////////////////////////////////////////////
// //
// Project Details //
// //
///////////////////////////////////////////////////
group = 'solutions.siren'
version = customRadarVersion ?: packageJson.version
///////////////////////////////////////////////////
// //
// Install Kibi //
// //
///////////////////////////////////////////////////
/**
* Define the kibi source artifact dependency
*/
configurations {
kibi
}
dependencies {
kibi "solutions.siren:investigate-core:${project.version}:sources@zip"
}
/**
* Task to download locally the kibi dependency
*/
task downloadKibi(type: Copy) {
from configurations.kibi
into new File(buildDir, 'dependencies')
rename { 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')
}
/**
* Task to execute the `npmInstall` gradle's task from the kibi distribution
*/
task npmInstallKibi(type: GradleBuild, dependsOn: [extractKibi]) {
dir new File(extractKibi.destinationDir, "investigate-core-${project.version}-sources")
tasks = ['npmInstall']
}
/**
* 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 = true
// Set the work directory for unpacking node
workDir = file("${buildDir}/nodejs")
// Set the work directory where node_modules should be located
nodeModulesDir = file("${projectDir}")
}
///////////////////////////////////////////////////
// //
// Package //
// //
///////////////////////////////////////////////////
task gulpPackage(dependsOn: ['gulp_package']) << {}
// run npm install
gulp_package.dependsOn 'npmInstall'
// run gulp install
gulp_package.dependsOn 'installGulp'
///////////////////////////////////////////////////
// //
// Install Grunt Globally //
// //
///////////////////////////////////////////////////
task installGruntGlobally(type: NpmTask) {
args = ['install', '-g', 'grunt']
}
///////////////////////////////////////////////////
// //
// 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-${project.version}-sources").getAbsolutePath()}"
}
}
// run npm install
gulpDev.dependsOn 'npmInstall'
// 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-${project.version}-sources").getAbsolutePath()}"
}
}
// run npm install
gulpTest.dependsOn 'npmInstall'
// run gulp install
gulpTest.dependsOn 'installGulp'
// makes that grunt is installed
gulpTest.dependsOn 'installGruntGlobally'
gulpTest.dependsOn 'installGrunt'
installGrunt.mustRunAfter 'installGruntGlobally'
///////////////////////////////////////////////////
// //
// 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-${project.version}-sources").getAbsolutePath()}"
}
}
// run npm install
gulpTestDev.dependsOn 'npmInstall'
// run gulp install
gulpTestDev.dependsOn 'installGulp'
// makes that grunt is installed
gulpTestDev.dependsOn 'installGruntGlobally'
gulpTestDev.dependsOn 'installGrunt'
installGrunt.mustRunAfter 'installGruntGlobally'
///////////////////////////////////////////////////
// //
// Clean //
// //
///////////////////////////////////////////////////
// Extends clean task to clean the node_modules directory
clean << {
def nodeModulesDir = file("${projectDir}/node_modules")
if (nodeModulesDir.exists()) {
println "=== Cleaning node modules directory: ${nodeModulesDir} ==="
nodeModulesDir.deleteDir()
}
}
// Executes the Gulp's clean task
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-radar-vis"
version project.version
}
}
}