|
| 1 | +apply plugin: 'com.github.johnrengelman.shadow' |
| 2 | + |
| 3 | +description = "Testcontainers Core" |
| 4 | + |
| 5 | +publishing { |
| 6 | + publications { |
| 7 | + mavenJava(MavenPublication) { publication -> |
| 8 | + artifacts.removeAll { it.classifier == null } |
| 9 | + artifact project.tasks.shadowJar |
| 10 | + } |
| 11 | + } |
| 12 | +} |
| 13 | + |
| 14 | +sourceSets { |
| 15 | + jarFileTest |
| 16 | +} |
| 17 | + |
| 18 | +idea.module.testSourceDirs += sourceSets.jarFileTest.allSource.srcDirs |
| 19 | + |
| 20 | +configurations { |
| 21 | + shaded |
| 22 | + [runtime, compileOnly, testCompile]*.extendsFrom shaded |
| 23 | +} |
| 24 | + |
| 25 | +shadowJar { |
| 26 | + configurations = [project.configurations.shaded] |
| 27 | + classifier = null |
| 28 | + |
| 29 | + mergeServiceFiles() |
| 30 | + |
| 31 | + [ |
| 32 | + 'META-INF/io.netty.versions.properties', |
| 33 | + 'META-INF/NOTICE', |
| 34 | + 'META-INF/NOTICE.txt', |
| 35 | + 'META-INF/LICENSE', |
| 36 | + 'META-INF/LICENSE.txt', |
| 37 | + 'META-INF/DEPENDENCIES', |
| 38 | + 'META-INF/maven/', |
| 39 | + 'META-INF/services/README.md', |
| 40 | + 'META-INF/services/com.fasterxml.jackson.core.*', |
| 41 | + 'META-INF/services/com.github.dockerjava.api.command.*', |
| 42 | + 'META-INF/services/javax.ws.rs.ext.*', |
| 43 | + 'META-INF/services/org.glassfish.hk2.extension.*', |
| 44 | + 'META-INF/services/org.jvnet.hk2.external.generator.*', |
| 45 | + 'META-INF/services/org.glassfish.jersey.internal.spi.*', |
| 46 | + 'mozilla/public-suffix-list.txt', |
| 47 | + ].each { exclude(it) } |
| 48 | + |
| 49 | + relocate('META-INF/native/libnetty', 'META-INF/native/liborg-testcontainers-shaded-netty') |
| 50 | + |
| 51 | + [ |
| 52 | + "org.apache.http", |
| 53 | + "org.apache.commons.lang", |
| 54 | + "org.glassfish", |
| 55 | + "org.aopalliance", |
| 56 | + "org.jvnet", |
| 57 | + "javax.annotation", |
| 58 | + "javax.inject", |
| 59 | + "javax.ws.rs", |
| 60 | + "com.fasterxml.jackson", |
| 61 | + "jersey.repackaged", |
| 62 | + "com.google", |
| 63 | + "io.netty", |
| 64 | + "org.bouncycastle", |
| 65 | + "org.newsclub", |
| 66 | + "org.zeroturnaround" |
| 67 | + ].each { relocate(it, "org.testcontainers.shaded.$it") } |
| 68 | + |
| 69 | + dependencies { |
| 70 | + include(dependency('org.apache.httpcomponents:.*')) |
| 71 | + include(dependency('org.glassfish.*:.*')) |
| 72 | + include(dependency('org.aopalliance.*:.*')) |
| 73 | + include(dependency('javax.ws.rs:.*')) |
| 74 | + include(dependency('com.fasterxml.*:.*')) |
| 75 | + include(dependency('com.github.docker-java:.*')) |
| 76 | + include(dependency('com.google.guava:.*')) |
| 77 | + include(dependency('io.netty:.*')) |
| 78 | + include(dependency('org.bouncycastle:.*')) |
| 79 | + include(dependency('org.newsclub.*:.*')) |
| 80 | + include(dependency('org.zeroturnaround:zt-exec')) |
| 81 | + include(dependency('commons-lang:commons-lang')) |
| 82 | + } |
| 83 | +} |
| 84 | + |
| 85 | +task jarFileTest(type: Test) { |
| 86 | + testClassesDirs = sourceSets.jarFileTest.output.classesDirs |
| 87 | + classpath = sourceSets.jarFileTest.runtimeClasspath |
| 88 | + |
| 89 | + systemProperty("jarFile", shadowJar.outputs.files.singleFile) |
| 90 | + |
| 91 | + dependsOn(shadowJar) |
| 92 | +} |
| 93 | +project.tasks.check.dependsOn(jarFileTest) |
| 94 | + |
| 95 | +dependencies { |
| 96 | + compile 'junit:junit:4.12' |
| 97 | + compile 'org.slf4j:slf4j-api:1.7.25' |
| 98 | + compile 'org.slf4j:slf4j-ext:1.7.25' |
| 99 | + compile 'org.jetbrains:annotations:15.0' |
| 100 | + compile 'javax.annotation:javax.annotation-api:1.3.1' |
| 101 | + compile 'com.google.code.findbugs:jsr305:3.0.2' |
| 102 | + compile 'org.apache.commons:commons-compress:1.15' |
| 103 | + // Added for JDK9 compatibility since it's missing this package |
| 104 | + compile 'javax.xml.bind:jaxb-api:2.3.0' |
| 105 | + compile 'org.rnorth.duct-tape:duct-tape:1.0.6' |
| 106 | + compile 'org.rnorth.visible-assertions:visible-assertions:2.1.0' |
| 107 | + |
| 108 | + shaded ('com.github.docker-java:docker-java:3.0.12') { |
| 109 | + exclude(group: 'org.glassfish.jersey.core') |
| 110 | + exclude(group: 'org.glassfish.jersey.connectors') |
| 111 | + exclude(group: 'log4j') |
| 112 | + exclude(group: 'com.google.code.findbug') |
| 113 | + } |
| 114 | + shaded 'javax.ws.rs:javax.ws.rs-api:2.0.1' |
| 115 | + shaded 'org.rnorth:tcp-unix-socket-proxy:1.0.1' |
| 116 | + shaded 'org.zeroturnaround:zt-exec:1.8' |
| 117 | + shaded 'commons-lang:commons-lang:2.6' |
| 118 | + // docker-java uses SslConfigurator from jersey-common for TLS |
| 119 | + shaded ('org.glassfish.jersey.core:jersey-common:2.23.1') { |
| 120 | + // SslConfigurator doesn't use classes from dependencies |
| 121 | + exclude(module: '*') |
| 122 | + } |
| 123 | + |
| 124 | + testCompile 'redis.clients:jedis:2.8.0' |
| 125 | + testCompile 'com.rabbitmq:amqp-client:3.5.3' |
| 126 | + testCompile 'org.mongodb:mongo-java-driver:3.0.2' |
| 127 | + testCompile ('org.mockito:mockito-core:1.10.19') { |
| 128 | + exclude(module: 'hamcrest-core') |
| 129 | + } |
| 130 | + // Synthetic JAR used for MountableFileTest and DirectoryTarResourceTest |
| 131 | + testCompile files('testlib/repo/fakejar/fakejar/0/fakejar-0.jar') |
| 132 | + |
| 133 | + jarFileTestCompileOnly 'org.projectlombok:lombok:1.16.20' |
| 134 | + jarFileTestCompile 'junit:junit:4.12' |
| 135 | + jarFileTestCompile 'org.assertj:assertj-core:3.8.0' |
| 136 | + jarFileTestCompile 'org.ow2.asm:asm-debug-all:5.2' |
| 137 | +} |
0 commit comments