forked from testcontainers/testcontainers-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
122 lines (103 loc) · 3.62 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
plugins {
id 'com.gradle.build-scan' version '2.4.2'
id 'io.franzbecker.gradle-lombok' version '3.1.0'
id 'nebula.provided-base' version '3.0.3'
id 'com.github.johnrengelman.shadow' version '5.1.0'
id "com.jfrog.bintray" version "1.8.4" apply false
}
subprojects {
apply plugin: 'nebula.provided-base'
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'io.franzbecker.gradle-lombok'
apply plugin: 'com.github.johnrengelman.shadow'
group = "org.testcontainers"
sourceCompatibility = 1.8
targetCompatibility = 1.8
compileJava.options.encoding = 'UTF-8'
compileTestJava.options.encoding = 'UTF-8'
lombok {
version = '1.18.8'
}
task delombok(type: io.franzbecker.gradle.lombok.task.DelombokTask) {
def outputDir = file("$buildDir/delombok")
outputs.dir(outputDir)
for (srcDir in project.sourceSets.main.java.srcDirs) {
inputs.dir(srcDir)
args(srcDir, "-d", outputDir)
}
}
delombok.onlyIf {
project.sourceSets.main.java.srcDirs.find { it.exists() }
}
repositories {
jcenter()
mavenCentral()
}
// specific modules should be excluded from publication
if ( ! ["test-support", "jdbc-test", "docs-examples"].contains(it.name) ) {
apply from: "$rootDir/gradle/publishing.gradle"
apply from: "$rootDir/gradle/bintray.gradle"
project.tasks.sourceJar.from(delombok)
publishing {
publications {
mavenJava(MavenPublication) { publication ->
artifacts.removeAll { it.classifier == null }
artifact project.tasks.shadowJar
}
}
}
task release(dependsOn: bintrayUpload)
}
test {
defaultCharacterEncoding = "UTF-8"
testLogging {
displayGranularity 1
showStackTraces = true
exceptionFormat = 'full'
events "STARTED", "PASSED", "FAILED", "SKIPPED"
}
}
// Ensure that Javadoc generation is always tested
check.dependsOn(javadoc)
javadoc {
dependsOn delombok
source = delombok.outputs
}
shadowJar {
configurations = []
classifier = null
doFirst {
// See https://github.com/johnrengelman/shadow/blob/5.0.0/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/tasks/ConfigureShadowRelocation.groovy
Set<String> packages = []
// Always read from core's configurations
for (configuration in tasks.getByPath(":testcontainers:shadowJar").configurations) {
for (jar in configuration.files) {
def jf = new java.util.jar.JarFile(jar)
for (entry in jf.entries()) {
def name = entry.name
if (name.endsWith(".class")) {
packages.add(name.substring(0, name.lastIndexOf('/')))
}
}
jf.close()
}
}
for (pkg in packages) {
pkg = pkg.replaceAll('/', '.')
if (pkg.startsWith("com.github.dockerjava.")) {
// Keep docker-java's package inside the final jar
continue;
}
tasks.shadowJar.relocate(pkg, "org.testcontainers.shaded.${pkg}")
}
}
}
dependencies {
testCompile 'ch.qos.logback:logback-classic:1.2.3'
}
}
buildScan {
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
termsOfServiceAgree = 'yes'
}