/
build.gradle
236 lines (194 loc) · 7.63 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
plugins {
id 'net.saliman.properties' version '1.4.6'
id 'java'
id 'maven-publish'
id 'com.jfrog.bintray' version '1.7.2'
id 'com.marklogic.ml-gradle' version '3.2.1'
id 'com.moowork.node' version '1.1.1'
}
repositories {
jcenter()
maven { url 'http://repo.spring.io/milestone' }
maven { url 'https://developer.marklogic.com/maven2/' }
}
group = 'com.marklogic'
sourceCompatibility = 1.8
targetCompatibility = 1.8
ext.junit4Version = '4.12'
ext.junitVintageVersion = '4.12.0-RC3'
ext.junitPlatformVersion = '1.0.0-RC3'
ext.junitJupiterVersion = '5.0.0-RC3'
dependencies {
compile 'com.marklogic:marklogic-client-api:4.0.2'
compile 'com.marklogic:mlcp-util:0.3.0'
compile 'com.marklogic:ml-app-deployer:3.2.0'
compile 'commons-io:commons-io:2.4'
compile 'org.apache.commons:commons-text:1.1'
// JUnit Jupiter API and TestEngine implementation
testCompile "org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}"
testRuntime "org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}"
testCompile "org.junit.platform:junit-platform-runner:${junitPlatformVersion}"
// If you also want to support JUnit 3 and JUnit 4 tests
testCompile "junit:junit:${junit4Version}"
testRuntime "org.junit.vintage:junit-vintage-engine:${junitVintageVersion}"
// Only needed to run tests in an (IntelliJ) IDE(A) that bundles an older version
testRuntime "org.junit.platform:junit-platform-launcher:${junitPlatformVersion}"
testCompile 'xmlunit:xmlunit:1.3'
testCompile 'org.skyscreamer:jsonassert:1.5.0'
testCompile 'org.hamcrest:hamcrest-junit:2.0.0.0'
testCompile 'org.easymock:easymock:3.4'
testCompile 'ch.qos.logback:logback-classic:1.1.11'
testCompile("com.marklogic:mlcp-util:0.3.0")
testCompile("com.marklogic:mlcp:9.0.3") {
exclude group: 'org.apache.avro', module: 'avro-tools'
}
}
node {
// Version of node to use.
version = '8.4.0'
// // Version of npm to use.
npmVersion = '5.4.2'
download = true
// Set the work directory for unpacking node
workDir = file("${project.buildDir}/nodejs")
// Set the work directory where node_modules should be located
nodeModulesDir = file("${project.projectDir}/src/trace-ui")
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task cleanUI(type: Delete) {
delete 'src/main/resources/ml-modules/root/trace-ui'
}
task npmInstallUI(type: NpmTask) {
args = ['install']
dependsOn tasks.cleanUI
}
task buildUI(type: NpmTask) {
args = ['run', 'build.prod']
dependsOn tasks.npmInstallUI
}
task copyUIAssets(type: Copy) {
from 'src/trace-ui/dist'
into 'src/main/resources/ml-modules/root/trace-ui'
dependsOn tasks.buildUI
}
processResources {
filesMatching("**/version.properties") {
expand(project: project)
}
}
if (!(
gradle.startParameter.taskNames*.toLowerCase().contains("bootrun") ||
gradle.startParameter.taskNames*.toLowerCase().contains("test") ||
gradle.startParameter.taskNames*.toLowerCase().contains("publishplugins") ||
gradle.startParameter.taskNames*.toLowerCase().contains("publishtomavenlocal") ||
gradle.startParameter.taskNames*.toLowerCase().contains("bintrayupload") ||
gradle.startParameter.taskNames*.toLowerCase().contains("javadoc") ||
project.hasProperty('skipui')
)
) {
processResources.dependsOn copyUIAssets
}
tasks.clean.dependsOn cleanUI
javadoc {
options.overview = 'src/main/resources/overview.html'
}
Node pomCustomizations = new NodeBuilder(). project {
name 'marklogic-data-hub'
packaging 'jar'
textdescription 'Library for Creating an Operational Data Hub on MarkLogic'
url 'https://github.com/marklogic-community/marklogic-data-hub'
scm {
url 'git@github.com:marklogic/marklogic-data-hub.git'
connection 'scm:git@github.com:marklogic/marklogic-data-hub.git'
developerConnection 'scm:git@github.com:marklogic/marklogic-data-hub.git'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
name 'MarkLogic'
email 'java-sig@marklogic.com'
organization 'MarkLogic'
organizationUrl 'https://www.marklogic.com'
}
developer {
name 'MarkLogic Github Contributors'
email 'general@developer.marklogic.com'
organization 'Github Contributors'
organizationUrl 'https://github.com/marklogic-community/marklogic-data-hub/graphs/contributors'
}
}
}
publishing {
publications {
main(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
pom.withXml {
asNode().appendNode('description', pomCustomizations.textdescription.text())
asNode().append(pomCustomizations.developers)
asNode().append(pomCustomizations.name)
asNode().append(pomCustomizations.packaging)
asNode().append(pomCustomizations.url)
asNode().append(pomCustomizations.scm)
asNode().append(pomCustomizations.licenses)
}
}
}
}
bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
publications = ['main']
pkg {
repo = 'Maven'
name = project.name
userOrg = 'marklogic-community'
desc = pomCustomizations.textdescription.text()
licenses = ['Apache-2.0']
websiteUrl = pomCustomizations.url
vcsUrl = pomCustomizations.scm.url
issueTrackerUrl = 'https://github.com/marklogic-community/marklogic-data-hub/issues'
}
}
ext {
// mlAppConfig is an instance of com.marklogic.appdeployer.AppConfig
mlAppConfig {
moduleTokensPropertiesSources = new ArrayList<>()
// override some default values with our values
modulesDatabaseName = mlModulesDbName
triggersDatabaseName = mlTriggersDbName
schemasDatabaseName = mlSchemasDbName
restPort = Integer.parseInt(mlJobPort)
// Configure custom tokens for our json files
customTokens.put("%%mlStagingAppserverName%%", mlStagingAppserverName)
customTokens.put("%%mlStagingPort%%", mlStagingPort)
customTokens.put("%%mlStagingDbName%%", mlStagingDbName)
customTokens.put("%%mlFinalAppserverName%%", mlFinalAppserverName)
customTokens.put("%%mlFinalPort%%", mlFinalPort)
customTokens.put("%%mlFinalDbName%%", mlFinalDbName)
customTokens.put("%%mlTraceAppserverName%%", mlTraceAppserverName)
customTokens.put("%%mlTracePort%%", mlTracePort)
customTokens.put("%%mlTraceDbName%%", mlTraceDbName)
customTokens.put("%%mlJobAppserverName%%", mlJobAppserverName)
customTokens.put("%%mlJobPort%%", mlJobPort)
customTokens.put("%%mlJobDbName%%", mlJobDbName)
customTokens.put("%%mlModulesDbName%%", mlModulesDbName)
customTokens.put("%%mlTriggersDbName%%", mlTriggersDbName)
customTokens.put("%%mlSchemasDbName%%", mlSchemasDbName)
modulePaths = ["marklogic-data-hub/src/main/resources/ml-modules"]
mlModulePermissions = "rest-reader,read,rest-writer,insert,rest-writer,update,rest-extension-user,execute"
}
}