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
|
/*
* Master Gradle build script
*
* Depends on bndPlugin property set by settings.gradle.
* and bnd_* values from gradle.properties.
*/
import aQute.lib.io.IO
if (JavaVersion.current().isJava9Compatible()) {
ext.jpmsOptions = [
'--illegal-access=warn',
'--add-opens=java.base/java.lang=ALL-UNNAMED',
'--add-opens=java.base/java.lang.invoke=ALL-UNNAMED',
'--add-opens=java.base/java.lang.reflect=ALL-UNNAMED',
'--add-opens=java.base/java.io=ALL-UNNAMED',
'--add-opens=java.base/java.net=ALL-UNNAMED',
'--add-opens=java.base/java.nio=ALL-UNNAMED',
'--add-opens=java.base/java.util=ALL-UNNAMED',
'--add-opens=java.base/java.util.jar=ALL-UNNAMED',
'--add-opens=java.base/java.util.regex=ALL-UNNAMED',
'--add-opens=java.base/java.util.zip=ALL-UNNAMED',
'--add-opens=java.base/sun.nio.ch=ALL-UNNAMED',
'--add-opens=java.base/sun.net.www.protocol.file=ALL-UNNAMED',
'--add-opens=java.base/sun.net.www.protocol.ftp=ALL-UNNAMED',
'--add-opens=java.base/sun.net.www.protocol.http=ALL-UNNAMED',
'--add-opens=java.base/sun.net.www.protocol.https=ALL-UNNAMED',
'--add-opens=java.base/sun.net.www.protocol.jar=ALL-UNNAMED',
'--add-opens=java.base/sun.net.www.protocol.jrt=ALL-UNNAMED'
]
}
/* Configure the subprojects */
subprojects {
if (plugins.hasPlugin('biz.aQute.bnd')) {
group bnd('-groupid')
version bnd('base.version')
tasks.withType(JavaCompile) {
options.compilerArgs.add('-Xlint:unchecked')
}
javadoc {
options.tags = [
'Immutable:t:',
'ThreadSafe:t:',
'NotThreadSafe:t:',
'GuardedBy:mf:"Guarded By:"'
]
}
test {
testLogging {
exceptionFormat 'full'
}
if (!logger.isInfoEnabled()) {
def stdOut = [:]
def stdErr = [:]
onOutput { descriptor, event ->
if (event.destination == TestOutputEvent.Destination.StdErr) {
stdErr.get(descriptor, []).add(event)
} else {
stdOut.get(descriptor, []).add(event)
}
}
afterTest { descriptor, result ->
def stdErrEvents = stdErr.remove(descriptor)
def stdOutEvents = stdOut.remove(descriptor)
if (result.resultType == TestResult.ResultType.FAILURE) {
if (stdErrEvents && !stdErrEvents.empty) {
logger.lifecycle('\n{} > {} STANDARD_ERROR', descriptor.className, descriptor.name)
stdErrEvents.each { event ->
logger.lifecycle(' {}', event.message.trim())
}
}
if (stdOutEvents && !stdOutEvents.empty) {
logger.lifecycle('\n{} > {} STANDARD_OUT', descriptor.className, descriptor.name)
stdOutEvents.each { event ->
logger.lifecycle(' {}', event.message.trim())
}
}
}
}
}
if (JavaVersion.current().isJava9Compatible()) {
jvmArgs jpmsOptions
environment 'JAVA_OPTS': jpmsOptions.join(' ')
}
inputs.files(fileTree(project.projectDir) {
include 'testresources/', 'testdata/'
exclude {
def f = it.file
if (f.directory && f.list().length == 0) {
return true
}
try {
return "git check-ignore ${f}".execute().waitFor() == 0
} catch (Exception e) {
return false
}
}
}).withPropertyName('testFolders')
if (System.properties['maven.repo.local']) {
systemProperty 'maven.repo.local', IO.getFile(gradle.startParameter.currentDir, System.properties['maven.repo.local'])
}
}
}
}
wrapper {
jarFile = rootProject.file('.gradle-wrapper/gradle-wrapper.jar')
}
task buildscriptDependencies {
doLast {
println "bnd_plugin: ${bnd_plugin}"
println "bnd_repourl: ${bnd_repourl}"
println buildscript.configurations.classpath.asPath
}
}
|