1+ import org.apache.tools.ant.filters.ReplaceTokens
12import org.gradle.api.tasks.testing.logging.TestExceptionFormat
23import org.gradle.api.tasks.testing.logging.TestLogEvent
34
45plugins {
56 id ' com.jfrog.bintray' version ' 1.8.4'
6- id ' com.github.johnrengelman.shadow' version ' 2.0.2 '
7- id ' com.github.kt3k.coveralls' version ' 2.8.2 '
8- id ' com.marklogic.ml-gradle' version ' 3.15.1 '
7+ id ' com.github.johnrengelman.shadow' version ' 5. 2.0'
8+ id ' com.github.kt3k.coveralls' version ' 2.9.0 '
9+ id ' com.marklogic.ml-gradle' version ' 3.17.0 '
910 id ' io.github.ddimtirov.codacy' version ' 0.1.0'
10- id ' org.sonarqube' version ' 2.6.2 '
11+ id ' org.sonarqube' version ' 2.8 '
1112 id ' eclipse'
1213 id ' idea'
1314 id ' jacoco'
@@ -16,8 +17,6 @@ plugins {
1617}
1718
1819ext {
19- externalsortinginjavaVersion = ' 0.3.1'
20-
2120 // we don't need a REST server, only an XCC server
2221 mlAppDeployer. getCommands(). remove(mlAppDeployer. getCommand(' DeployRestApiServersCommand' ))
2322 mlAppConfig {
@@ -40,6 +39,10 @@ repositories {
4039}
4140
4241sourceSets {
42+ test {
43+ // adding main resources from build dir, in order to load HTML with tokens replaced
44+ resources. srcDir sourceSets. main. output. resourcesDir
45+ }
4346 integrationTest {
4447 java {
4548 compileClasspath + = main. output + test. output
@@ -68,32 +71,47 @@ configurations {
6871}
6972
7073dependencies {
71- compile ' com.marklogic:marklogic-xcc:9.0.9'
72- // we bundle the externalsortinginjava classes with the corb distro as a fat jar
73- compileOnly " com.google.code.externalsortinginjava:externalsortinginjava:$externalsortinginjavaVersion "
74- shadow " com.google.code.externalsortinginjava:externalsortinginjava:$externalsortinginjavaVersion "
75- testCompile " com.google.code.externalsortinginjava:externalsortinginjava:$externalsortinginjavaVersion "
76- testCompile group : ' junit' , name : ' junit' , version : ' 4.12'
77- testCompile ' org.jasypt:jasypt:1.9.2'
78- testCompile ' com.github.stefanbirkner:system-rules:1.17.1' // facilitates tests for methods that invoke System.exit
74+ compile ' com.marklogic:marklogic-xcc:10.0.3'
75+ // JavaScript libraries are bundled in a fat jar for the UI
76+ shadow " org.webjars:angularjs:$angularVersion "
77+ compile " org.webjars:angularjs:$angularVersion "
78+ shadow " org.webjars:bootstrap:$bootstrapVersion "
79+ compile " org.webjars:bootstrap:$bootstrapVersion "
80+ shadow " org.webjars:jquery:$jqueryVersion "
81+ compile " org.webjars:jquery:$jqueryVersion "
82+ // externalsortinginjava classes with the corb distro in a fat jar
83+ shadow " com.google.code.externalsortinginjava:externalsortinginjava:$externalsortinginjavaVersion "
84+ compile " com.google.code.externalsortinginjava:externalsortinginjava:$externalsortinginjavaVersion "
85+ testCompile group : ' junit' , name : ' junit' , version : ' 4.13'
86+ testCompile ' org.jasypt:jasypt:1.9.3'
87+ testCompile ' com.github.stefanbirkner:system-rules:1.19.0' // facilitates tests for methods that invoke System.exit
7988 testCompile ' org.mockito:mockito-all:1.10.19'
8089}
8190
8291test {
83- testLogging {
84- events TestLogEvent . STARTED ,TestLogEvent . PASSED
85- }
8692 // we will run Integration and Performance tests in separate tasks
8793 exclude ' **/*IT.class'
8894 exclude ' **/*PT.class'
8995}
9096
97+ // perform token replacement in HTML for JavaScript library version paths
98+ processResources {
99+ with copySpec {
100+ from (' src/main/resources/web' ) {
101+ include ' *.html'
102+ }
103+ into (' web' )
104+ filter(ReplaceTokens , tokens : [ANGULAR_VERSION : angularVersion, BOOTSTRAP_VERSION : bootstrapVersion, JQUERY_VERSION : jqueryVersion])
105+ }
106+ }
107+
91108// disabling, because we want to incorporate externalsortingjava in uber jar and use as the artifact
92109jar. enabled = false
93110shadowJar {
94111 configurations = [project. configurations. compile, project. configurations. shadow]
95112 dependencies {
96113 include(dependency(" com.google.code.externalsortinginjava:externalsortinginjava:$externalsortinginjavaVersion " ))
114+ include(dependency(' org.webjars:.*' ))
97115 }
98116 // generate same name as the jar task would
99117 archiveName = " ${ baseName} -${ version} .${ extension} "
@@ -132,15 +150,12 @@ jacocoTestReport {
132150}
133151
134152task integrationTest (type : Test , dependsOn : test) {
135- testClassesDir = sourceSets. integrationTest. output. classesDir
153+ testClassesDirs = sourceSets. integrationTest. output. classesDirs
136154 classpath = sourceSets. integrationTest. runtimeClasspath
137155 filter {
138156 // include all integration tests
139157 includeTestsMatching " *IT"
140158 }
141- testLogging {
142- events TestLogEvent . STARTED ,TestLogEvent . PASSED
143- }
144159 // If you want to ensure that integration tests are run every time when you invoke
145160 // this task, uncomment the following line.
146161 // outputs.upToDateWhen { false }
@@ -159,15 +174,12 @@ task integrationTestReport(type: JacocoReport) {
159174}
160175
161176task performanceTest (type : Test ) {
162- testClassesDir = sourceSets. performanceTest. output. classesDir
177+ testClassesDirs = sourceSets. performanceTest. output. classesDirs
163178 classpath = sourceSets. performanceTest. runtimeClasspath
164179 filter {
165180 // include all performance tests
166181 includeTestsMatching " *PT"
167182 }
168- testLogging {
169- events TestLogEvent . STARTED ,TestLogEvent . PASSED
170- }
171183
172184 // If you want to ensure that performance tests are run every time when you invoke
173185 // this task, uncomment the following line.
@@ -190,8 +202,7 @@ tasks.withType(Test) {
190202 reports. html. destination = file(" ${ reporting.baseDir} /${ name} " )
191203 testLogging {
192204 // set options for log level LIFECYCLE
193- events TestLogEvent . PASSED ,
194- TestLogEvent . FAILED ,
205+ events TestLogEvent . FAILED ,
195206 TestLogEvent . SKIPPED ,
196207 TestLogEvent . STANDARD_OUT
197208 showExceptions true
@@ -201,8 +212,7 @@ tasks.withType(Test) {
201212
202213 // set options for log level DEBUG and INFO
203214 debug {
204- events TestLogEvent . PASSED ,
205- TestLogEvent . FAILED ,
215+ events TestLogEvent . FAILED ,
206216 TestLogEvent . SKIPPED ,
207217 TestLogEvent . STANDARD_OUT ,
208218 TestLogEvent . STANDARD_ERROR
0 commit comments