diff --git a/atlasdb-cassandra/build.gradle b/atlasdb-cassandra/build.gradle index e2dab7e34d3..fba37c43607 100644 --- a/atlasdb-cassandra/build.gradle +++ b/atlasdb-cassandra/build.gradle @@ -1,6 +1,7 @@ apply from: "../gradle/publish-jars.gradle" apply plugin: 'org.inferred.processors' apply plugin: 'com.github.johnrengelman.shadow' +apply from: "../gradle/feign-shading.gradle" apply from: "../gradle/shared.gradle" @@ -65,6 +66,3 @@ shadowJar { include(dependency { false }) } } - -jar.dependsOn shadowJar -jar.onlyIf { false } diff --git a/atlasdb-cli-distribution/build.gradle b/atlasdb-cli-distribution/build.gradle index 27ac06b8185..03b58e1e3bb 100644 --- a/atlasdb-cli-distribution/build.gradle +++ b/atlasdb-cli-distribution/build.gradle @@ -2,6 +2,7 @@ apply plugin: 'com.palantir.sls-java-service-distribution' apply from: "../gradle/publish-dists.gradle" apply from: "../gradle/shared.gradle" +apply from: "../gradle/feign-shading.gradle" dependencies { runtime project(':atlasdb-cli') diff --git a/atlasdb-cli/build.gradle b/atlasdb-cli/build.gradle index 93734f745f1..ebbca10e127 100644 --- a/atlasdb-cli/build.gradle +++ b/atlasdb-cli/build.gradle @@ -1,11 +1,12 @@ +apply plugin: 'org.inferred.processors' + apply from: "../gradle/publish-jars.gradle" apply from: '../gradle/shared.gradle' - -apply plugin: 'org.inferred.processors' +apply from: "../gradle/feign-shading.gradle" dependencies { compile project(':atlasdb-cassandra') - compile project(path: ':atlasdb-dagger', configuration: 'shadow') + compile project(path: ':atlasdb-dagger', configuration: 'daggerShadow') compileOnly 'com.google.dagger:dagger' compile 'io.airlift:airline:0.7' diff --git a/atlasdb-client/build.gradle b/atlasdb-client/build.gradle index 9db482bf990..1d938a87b41 100644 --- a/atlasdb-client/build.gradle +++ b/atlasdb-client/build.gradle @@ -1,5 +1,6 @@ apply from: "../gradle/publish-jars.gradle" apply from: "../gradle/shared.gradle" +apply from: "../gradle/feign-shading.gradle" apply plugin: 'java' apply plugin: 'eclipse' @@ -22,6 +23,10 @@ task myTestJar(type: Jar) { configurations { testArtifacts + + explicitShadow + compile.extendsFrom(explicitShadow) + shadow.extendsFrom(explicitShadow) } artifacts { @@ -29,25 +34,27 @@ artifacts { } dependencies { - compile project(":atlasdb-commons") - compile project(":atlasdb-api") - compile project(":atlasdb-client-protobufs") - compile (group: 'com.googlecode.json-simple', name: 'json-simple') { + explicitShadow project(":atlasdb-commons") + explicitShadow project(":atlasdb-api") + explicitShadow project(":atlasdb-client-protobufs") + explicitShadow (group: 'com.googlecode.json-simple', name: 'json-simple') { exclude group: 'junit' } - compile group: "commons-lang", name: "commons-lang", version: libVersions.commons_lang - compile group: "org.xerial.snappy", name: "snappy-java", version: libVersions.snappy - compile group: "com.googlecode.protobuf-java-format", name: "protobuf-java-format", version: "1.2" - compile group: "com.google.protobuf", name: "protobuf-java", version: "2.6.0" + explicitShadow group: "commons-lang", name: "commons-lang", version: libVersions.commons_lang + explicitShadow group: "org.xerial.snappy", name: "snappy-java", version: libVersions.snappy + explicitShadow group: "com.googlecode.protobuf-java-format", name: "protobuf-java-format", version: "1.2" + explicitShadow group: "com.google.protobuf", name: "protobuf-java", version: "2.6.0" + explicitShadow group: 'com.fasterxml.jackson.core', name: 'jackson-databind' + explicitShadow group: 'com.fasterxml.jackson.core', name: 'jackson-core' + explicitShadow group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-guava' + explicitShadow group: 'com.palantir.remoting2', name: 'tracing' + explicitShadow group: 'com.palantir.tritium', name: 'tritium-lib' + + // Not needed at runtime in the shadow JAR, because we have shaded it away. compile group: 'com.netflix.feign', name: 'feign-jackson' compile (group: 'com.netflix.feign', name: 'feign-jaxrs') { exclude module: 'jsr311-api' } - compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind' - compile group: 'com.fasterxml.jackson.core', name: 'jackson-core' - compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-guava' - compile group: 'com.palantir.remoting2', name: 'tracing' - compile group: 'com.palantir.tritium', name: 'tritium-lib' testCompile group: 'junit', name: 'junit' testCompile group: 'org.mockito', name: 'mockito-core' diff --git a/atlasdb-config/build.gradle b/atlasdb-config/build.gradle index 7d8ad01df19..d6b379b4013 100644 --- a/atlasdb-config/build.gradle +++ b/atlasdb-config/build.gradle @@ -1,13 +1,45 @@ +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar + apply from: "../gradle/publish-jars.gradle" apply plugin: 'org.inferred.processors' apply plugin: 'com.github.johnrengelman.shadow' +apply from: "../gradle/feign-shading.gradle" apply from: "../gradle/shared.gradle" configurations { + /* + * The configurations below may be visualized as follows: + * + * +-------+ +--------------+ +------+ + * |compile+--+ +--+remotingShadow+---+ |shadow| + * +---+---+ | | +--------------+ | +----+-+ + * | | | | | + * +------+--+---------------+ | | + * | | | | | + * +----v--v-+ +--v-----v-----+ | + * |feignDeps| |explicitShadow<--+ + * +---------+ +--------------+ + * + * where we have an arrow from A to B if configuration A extends from B (i.e. A gets all dependencies of B). + * + * remotingShadow includes compile dependencies, except for remoting. It also includes the ALPN agent for HTTP/2. + * shadow includes compile dependencies, except for remoting and feign; it also includes the ALPN agent. + * + * Having shadow jar configurations extend from compile is not recommended + * (see https://github.com/johnrengelman/shadow/issues/142). + */ + + remotingShadow + explicitShadow compile.extendsFrom(explicitShadow) shadow.extendsFrom(explicitShadow) + remotingShadow.extendsFrom(explicitShadow) + + feignDeps + compile.extendsFrom(feignDeps) + remotingShadow.extendsFrom(feignDeps) } dependencies { @@ -19,12 +51,6 @@ dependencies { explicitShadow project(':leader-election-impl') explicitShadow project(':lock-impl') - explicitShadow group: 'com.netflix.feign', name: 'feign-jackson' - explicitShadow (group: 'com.netflix.feign', name: 'feign-jaxrs') { - exclude module: 'jsr311-api' - } - // versions below 8.10.0 have a bug where POST requests must have a body - explicitShadow group: 'com.netflix.feign', name: 'feign-okhttp' explicitShadow group: 'javax.validation', name: 'validation-api' explicitShadow group: 'com.palantir.config.crypto', name: 'encrypted-config-value-module' explicitShadow group: 'com.palantir.tritium', name: 'tritium-lib' @@ -36,9 +62,18 @@ dependencies { explicitShadow group: 'io.dropwizard', name: 'dropwizard-jackson' explicitShadow group: 'com.google.code.findbugs', name: 'annotations' + // Feign dependencies. + // versions below 8.10.0 have a bug where POST requests must have a body + feignDeps group: 'com.netflix.feign', name: 'feign-jackson' + feignDeps (group: 'com.netflix.feign', name: 'feign-jaxrs') { + exclude module: 'jsr311-api' + } + feignDeps group: 'com.netflix.feign', name: 'feign-okhttp' + // This is added so that AtlasDB clients can specify the javaAgent as a JVM argument to load jars needed for HTTP/2 // in the boot classpath shadow group: 'org.mortbay.jetty.alpn', name: 'jetty-alpn-agent', version: libVersions.jetty_alpn_agent + remotingShadow group: 'org.mortbay.jetty.alpn', name: 'jetty-alpn-agent', version: libVersions.jetty_alpn_agent processor group: 'org.immutables', name: 'value' processor 'com.google.auto.service:auto-service:1.0-rc2' @@ -66,5 +101,27 @@ shadowJar { } } -jar.dependsOn shadowJar -jar.onlyIf { false } // Prevents running the jar task directly. +// ONLY shade Remoting. For internal use. +task remotingShadowJar(type: ShadowJar) { + mergeServiceFiles() + classifier 'remotingShadow' + from sourceSets.main.output + configurations = [project.configurations.compile] + + relocate('com.palantir.remoting2.errors', 'com.palantir.atlasdb.shaded.com.palantir.remoting2.errors') + relocate('com.palantir.remoting2.ext.jackson', 'com.palantir.atlasdb.shaded.com.palantir.remoting2.ext.jackson') + + dependencies { + include(dependency(group: 'com.palantir.remoting2', name: 'error-handling')) + include(dependency(group: 'com.palantir.remoting2', name: 'jackson-support')) + } +} + +artifacts { + remotingShadow (tasks.remotingShadowJar.archivePath) { + builtBy remotingShadowJar + } +} + +jar.dependsOn remotingShadowJar +jar.onlyIf { false } diff --git a/atlasdb-console-distribution/build.gradle b/atlasdb-console-distribution/build.gradle index fea7f22c6b5..3a5015233bf 100644 --- a/atlasdb-console-distribution/build.gradle +++ b/atlasdb-console-distribution/build.gradle @@ -2,6 +2,7 @@ apply plugin: 'com.palantir.sls-java-service-distribution' apply from: "../gradle/publish-dists.gradle" apply from: "../gradle/shared.gradle" +apply from: "../gradle/feign-shading.gradle" dependencies { runtime project(':atlasdb-console') diff --git a/atlasdb-console/build.gradle b/atlasdb-console/build.gradle index f1dd12f12a4..ad1d5ce1e22 100644 --- a/atlasdb-console/build.gradle +++ b/atlasdb-console/build.gradle @@ -1,6 +1,8 @@ +apply plugin: 'groovy' + apply from: "../gradle/publish-jars.gradle" apply from: "../gradle/shared.gradle" -apply plugin: 'groovy' +apply from: "../gradle/feign-shading.gradle" dependencies { compile project(':atlasdb-service') diff --git a/atlasdb-dagger/build.gradle b/atlasdb-dagger/build.gradle index cb22a470f1c..3abbd5602b5 100644 --- a/atlasdb-dagger/build.gradle +++ b/atlasdb-dagger/build.gradle @@ -1,22 +1,30 @@ +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar + apply from: "../gradle/publish-jars.gradle" apply plugin: 'org.inferred.processors' apply plugin: 'com.github.johnrengelman.shadow' apply from: '../gradle/shared.gradle' +apply from: "../gradle/feign-shading.gradle" + +configurations { + daggerShadow +} dependencies { compile project(':atlasdb-service') compile group: 'com.google.dagger', name: 'dagger' processor(group: 'com.google.dagger', name: 'dagger-compiler') { - // We need to explicitly exclude these so that intellij does not label them as provided - if(gradle.startParameter.taskNames.contains('idea')) { - exclude group: 'com.google.dagger', module: 'dagger' - } + // We need to explicitly exclude these so that intellij does not label them as provided + if(gradle.startParameter.taskNames.contains('idea')) { + exclude group: 'com.google.dagger', module: 'dagger' + } } processor group: 'org.immutables', name: 'value' shadow project(':atlasdb-service') + daggerShadow project(':atlasdb-service') } shadowJar { @@ -30,5 +38,26 @@ shadowJar { } } -jar.dependsOn shadowJar +// ONLY shade Dagger. This is used in the AtlasDB CLI +task daggerShadowJar(type: ShadowJar) { + mergeServiceFiles() + classifier 'daggerShadow' + from sourceSets.main.output + configurations = [project.configurations.compile] + + relocate('dagger', 'com.palantir.atlasdb.shaded.dagger') + + // No need to explicitly exclude Feign because that is only added to the normal shadow jar task. + dependencies { + include dependency(group: 'com.google.dagger', name: 'dagger') + } +} + +artifacts { + daggerShadow (tasks.daggerShadowJar.archivePath) { + builtBy daggerShadowJar + } +} + +jar.dependsOn daggerShadowJar jar.onlyIf { false } diff --git a/atlasdb-dbkvs-tests/build.gradle b/atlasdb-dbkvs-tests/build.gradle index 4470fede234..03c2e2ed6ab 100644 --- a/atlasdb-dbkvs-tests/build.gradle +++ b/atlasdb-dbkvs-tests/build.gradle @@ -2,6 +2,7 @@ apply from: "../gradle/publish-jars.gradle" apply plugin: 'org.inferred.processors' apply from: "../gradle/shared.gradle" +apply from: "../gradle/feign-shading.gradle" dependencies { compile project(":atlasdb-dbkvs") diff --git a/atlasdb-dbkvs/build.gradle b/atlasdb-dbkvs/build.gradle index 273ba7305a2..43ad8ffd190 100644 --- a/atlasdb-dbkvs/build.gradle +++ b/atlasdb-dbkvs/build.gradle @@ -2,6 +2,7 @@ apply from: "../gradle/publish-jars.gradle" apply plugin: 'org.inferred.processors' apply from: "../gradle/shared.gradle" +apply from: "../gradle/feign-shading.gradle" dependencies { compile project(":atlasdb-api") @@ -12,7 +13,7 @@ dependencies { compile project(':commons-db') compile project(':commons-api') - testCompile project(':atlasdb-config') + testCompile project(path: ':atlasdb-config', configuration: 'remotingShadow') testCompile project(path: ":atlasdb-client", configuration: "testArtifacts") testCompile group: 'org.hamcrest', name: 'hamcrest-library' testCompile group: 'org.mockito', name: 'mockito-core' diff --git a/atlasdb-dropwizard-bundle/build.gradle b/atlasdb-dropwizard-bundle/build.gradle index fd7b312e35c..c87b62e4758 100644 --- a/atlasdb-dropwizard-bundle/build.gradle +++ b/atlasdb-dropwizard-bundle/build.gradle @@ -1,9 +1,10 @@ apply from: "../gradle/publish-jars.gradle" apply from: "../gradle/shared.gradle" +apply from: "../gradle/feign-shading.gradle" dependencies { compile project(':atlasdb-cli') - compile project(path: ':atlasdb-config', configuration: 'shadow') + compile project(path: ':atlasdb-config', configuration: 'remotingShadow') compile project(':atlasdb-console') compile group: 'io.dropwizard', name: 'dropwizard-core' diff --git a/atlasdb-ete-tests/build.gradle b/atlasdb-ete-tests/build.gradle index 6f3b481166c..bf6484ca923 100644 --- a/atlasdb-ete-tests/build.gradle +++ b/atlasdb-ete-tests/build.gradle @@ -4,6 +4,8 @@ apply from: "../gradle/shared.gradle" apply plugin: 'com.palantir.sls-java-service-distribution' apply plugin: 'org.inferred.processors' +apply from: "../gradle/feign-shading.gradle" + schemas = [ 'com.palantir.atlasdb.cas.CheckAndSetSchema' ] @@ -11,7 +13,7 @@ schemas = [ dependencies { compile project(':lock-impl') compile project(':leader-election-impl') - compile project(path: ':atlasdb-config', configuration: 'shadow') + compile project(path: ':atlasdb-config', configuration: 'remotingShadow') compile project(':atlasdb-dropwizard-bundle') compile project(':atlasdb-hikari') compile project(':atlasdb-rocksdb') diff --git a/atlasdb-hikari/build.gradle b/atlasdb-hikari/build.gradle index e5a383ce59a..682cc453097 100644 --- a/atlasdb-hikari/build.gradle +++ b/atlasdb-hikari/build.gradle @@ -2,6 +2,7 @@ apply from: "../gradle/publish-jars.gradle" apply plugin: "org.inferred.processors" apply from: "../gradle/shared.gradle" +apply from: "../gradle/feign-shading.gradle" dependencies { compile project(":atlasdb-jdbc") diff --git a/atlasdb-impl-shared/build.gradle b/atlasdb-impl-shared/build.gradle index 102e66b7a78..3a29ad22f40 100644 --- a/atlasdb-impl-shared/build.gradle +++ b/atlasdb-impl-shared/build.gradle @@ -2,6 +2,7 @@ apply from: "../gradle/publish-jars.gradle" apply plugin: 'org.inferred.processors' apply from: "../gradle/shared.gradle" +apply from: "../gradle/feign-shading.gradle" apply plugin: 'java' apply plugin: 'eclipse' diff --git a/atlasdb-jdbc/build.gradle b/atlasdb-jdbc/build.gradle index 97111d319a5..d2e0a7487a8 100644 --- a/atlasdb-jdbc/build.gradle +++ b/atlasdb-jdbc/build.gradle @@ -2,6 +2,7 @@ apply from: "../gradle/publish-jars.gradle" apply plugin: "org.inferred.processors" apply from: "../gradle/shared.gradle" +apply from: "../gradle/feign-shading.gradle" dependencies { compile project(":atlasdb-api") diff --git a/atlasdb-jepsen-tests/build.gradle b/atlasdb-jepsen-tests/build.gradle index 9f8a52e990b..a3aefac696f 100644 --- a/atlasdb-jepsen-tests/build.gradle +++ b/atlasdb-jepsen-tests/build.gradle @@ -1,5 +1,10 @@ +apply plugin: 'org.inferred.processors' +apply plugin: 'com.github.johnrengelman.shadow' +apply plugin: 'docker-compose' + apply from: "../gradle/publish-jars.gradle" apply from: "${rootProject.projectDir}/gradle/shared.gradle" +apply from: "../gradle/feign-shading.gradle" buildscript { repositories { @@ -10,10 +15,6 @@ buildscript { } } -apply plugin: 'org.inferred.processors' -apply plugin: 'com.github.johnrengelman.shadow' -apply plugin: 'docker-compose' - task runUnitTestsForPrintLogsInChronologicalOrderScript(type: Exec) { commandLine 'python', 'scripts/print_logs_in_chronological_order.py', '--tests-only' } @@ -25,7 +26,7 @@ jacocoTestReport { check.dependsOn runUnitTestsForPrintLogsInChronologicalOrderScript dependencies { - compile project(path: ':atlasdb-config', configuration: 'shadow') + compile project(path: ':atlasdb-config', configuration: 'remotingShadow') compile group: 'com.fasterxml.jackson.core', name: 'jackson-core' compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind' diff --git a/atlasdb-perf/build.gradle b/atlasdb-perf/build.gradle index eb8e91781e2..5c5e079f12f 100644 --- a/atlasdb-perf/build.gradle +++ b/atlasdb-perf/build.gradle @@ -2,6 +2,7 @@ apply from: "../gradle/publish-jars.gradle" apply plugin: 'org.inferred.processors' apply from: '../gradle/shared.gradle' +apply from: "../gradle/feign-shading.gradle" apply plugin: 'application' mainClassName = 'com.palantir.atlasdb.performance.cli.AtlasDbPerfCli' @@ -9,7 +10,7 @@ applicationName = 'atlasdb-perf' dependencies { compile project(':atlasdb-api') - compile project(':atlasdb-dagger') + compile project(path: ':atlasdb-dagger', configuration: 'daggerShadow') compile project(':atlasdb-dbkvs') compile project(':atlasdb-cassandra') diff --git a/atlasdb-perf/versions.lock b/atlasdb-perf/versions.lock index 91ee6c59753..d7d1d4e7bdd 100644 --- a/atlasdb-perf/versions.lock +++ b/atlasdb-perf/versions.lock @@ -160,7 +160,6 @@ "com.palantir.atlasdb:atlasdb-client-protobufs", "com.palantir.atlasdb:atlasdb-commons", "com.palantir.atlasdb:atlasdb-config", - "com.palantir.atlasdb:atlasdb-dagger", "com.palantir.atlasdb:atlasdb-dbkvs", "com.palantir.atlasdb:atlasdb-dbkvs-hikari", "com.palantir.atlasdb:atlasdb-impl-shared", @@ -197,12 +196,6 @@ "org.mpierce.metrics.reservoir:hdrhistogram-metrics-reservoir" ] }, - "com.google.dagger:dagger": { - "locked": "2.0.2", - "transitive": [ - "com.palantir.atlasdb:atlasdb-dagger" - ] - }, "com.google.guava:guava": { "locked": "18.0", "transitive": [ @@ -539,7 +532,6 @@ "com.palantir.atlasdb:atlasdb-client", "com.palantir.atlasdb:atlasdb-client-protobufs", "com.palantir.atlasdb:atlasdb-commons", - "com.palantir.atlasdb:atlasdb-dagger", "com.palantir.atlasdb:atlasdb-dbkvs", "com.palantir.atlasdb:atlasdb-dbkvs-hikari", "com.palantir.atlasdb:atlasdb-impl-shared", @@ -707,7 +699,6 @@ "javax.inject:javax.inject": { "locked": "1", "transitive": [ - "com.google.dagger:dagger", "com.palantir.atlasdb:atlasdb-service", "io.airlift:airline" ] @@ -1092,7 +1083,6 @@ "com.palantir.atlasdb:atlasdb-client-protobufs", "com.palantir.atlasdb:atlasdb-commons", "com.palantir.atlasdb:atlasdb-config", - "com.palantir.atlasdb:atlasdb-dagger", "com.palantir.atlasdb:atlasdb-dbkvs", "com.palantir.atlasdb:atlasdb-dbkvs-hikari", "com.palantir.atlasdb:atlasdb-impl-shared", @@ -1129,12 +1119,6 @@ "org.mpierce.metrics.reservoir:hdrhistogram-metrics-reservoir" ] }, - "com.google.dagger:dagger": { - "locked": "2.0.2", - "transitive": [ - "com.palantir.atlasdb:atlasdb-dagger" - ] - }, "com.google.guava:guava": { "locked": "18.0", "transitive": [ @@ -1471,7 +1455,6 @@ "com.palantir.atlasdb:atlasdb-client", "com.palantir.atlasdb:atlasdb-client-protobufs", "com.palantir.atlasdb:atlasdb-commons", - "com.palantir.atlasdb:atlasdb-dagger", "com.palantir.atlasdb:atlasdb-dbkvs", "com.palantir.atlasdb:atlasdb-dbkvs-hikari", "com.palantir.atlasdb:atlasdb-impl-shared", @@ -1639,7 +1622,6 @@ "javax.inject:javax.inject": { "locked": "1", "transitive": [ - "com.google.dagger:dagger", "com.palantir.atlasdb:atlasdb-service", "io.airlift:airline" ] diff --git a/atlasdb-rocksdb/build.gradle b/atlasdb-rocksdb/build.gradle index a59bae13002..d6425ef76e7 100644 --- a/atlasdb-rocksdb/build.gradle +++ b/atlasdb-rocksdb/build.gradle @@ -2,6 +2,7 @@ apply from: "../gradle/publish-jars.gradle" apply plugin: 'org.inferred.processors' apply from: "../gradle/shared.gradle" +apply from: "../gradle/feign-shading.gradle" dependencies { compile project(":atlasdb-api") diff --git a/atlasdb-service-server/build.gradle b/atlasdb-service-server/build.gradle index 823d5313265..5de218c3d70 100644 --- a/atlasdb-service-server/build.gradle +++ b/atlasdb-service-server/build.gradle @@ -1,5 +1,6 @@ apply from: "../gradle/publish-jars.gradle" apply from: "../gradle/shared.gradle" +apply from: "../gradle/feign-shading.gradle" apply plugin: 'application' mainClassName = 'com.palantir.atlasdb.server.AtlasDbServiceServer' @@ -9,7 +10,7 @@ dependencies { compile project(':atlasdb-service') compile project(':lock-impl') compile project(':leader-election-impl') - compile project(path: ':atlasdb-config', configuration: 'shadow') + compile project(path: ':atlasdb-config', configuration: 'remotingShadow') runtime project(':atlasdb-rocksdb') runtime project(':atlasdb-cassandra') diff --git a/atlasdb-service/build.gradle b/atlasdb-service/build.gradle index 51e34c2f0fd..5fd698bfaaf 100644 --- a/atlasdb-service/build.gradle +++ b/atlasdb-service/build.gradle @@ -1,10 +1,11 @@ apply from: "../gradle/publish-jars.gradle" apply from: "../gradle/shared.gradle" +apply from: "../gradle/feign-shading.gradle" dependencies { compile project(':lock-impl') compile project(':leader-election-impl') - compile project(path: ':atlasdb-config', configuration: 'shadow') + compile project(path: ':atlasdb-config', configuration: 'remotingShadow') compile 'javax.inject:javax.inject:1' testCompile group: 'org.mockito', name: 'mockito-core' diff --git a/atlasdb-tests-shared/build.gradle b/atlasdb-tests-shared/build.gradle index a98e491066c..a11ffe75726 100644 --- a/atlasdb-tests-shared/build.gradle +++ b/atlasdb-tests-shared/build.gradle @@ -1,5 +1,6 @@ apply from: "../gradle/publish-jars.gradle" apply from: "../gradle/shared.gradle" +apply from: "../gradle/feign-shading.gradle" schemas = [ 'com.palantir.atlasdb.schema.indexing.IndexTestSchema', diff --git a/docs/source/release_notes/release-notes.rst b/docs/source/release_notes/release-notes.rst index 09bb6ae2b5a..13b5283d47b 100644 --- a/docs/source/release_notes/release-notes.rst +++ b/docs/source/release_notes/release-notes.rst @@ -69,9 +69,13 @@ develop Previously the lock service could allow locks to be held past expiration, if they had a timeout shorter than the longest timeout in the expiration queue. (`Pull Request `__) - * - |devbreak| - - Switched from feign to openfeign and bumped version. - (`Pull Request `__) + * - |improved| |devbreak| + - AtlasDB has updated Feign to 8.17.0 and OkHttp to 3.4.1, following remoting2 in the `palantir/http-remoting `__ library. + Also, AtlasDB now shades Feign. + This was done to enable us to synchronize with remoting2 while limiting breaks for users of older versions of Feign, especially given an API break in Feign 8.16. + Users who previously relied on AtlasDB to pull in Feign may experience a compile break, and should explicitly pull Feign in on their own. + (`Pull Request 1 `__) and + (`Pull Request 2 `__) * - |improved| - The priority of logging on background sweep was increased from debug to info or warn. diff --git a/examples/profile-client/build.gradle b/examples/profile-client/build.gradle index 9d15ed18618..102c8ee60d1 100644 --- a/examples/profile-client/build.gradle +++ b/examples/profile-client/build.gradle @@ -7,9 +7,9 @@ schemas = [ group = 'com.palantir.atlasdb.examples' dependencies { - compile project(":atlasdb-client") + compile project(path: ":atlasdb-client", configuration: "shadow") compile project(":examples:profile-client-protobufs") - testCompile project(":atlasdb-config") + testCompile project(path: ":atlasdb-config", configuration: "shadow") testCompile group: 'org.hamcrest', name: 'hamcrest-library' } diff --git a/examples/profile-client/versions.lock b/examples/profile-client/versions.lock index 35e2268b8b6..f47a67897a2 100644 --- a/examples/profile-client/versions.lock +++ b/examples/profile-client/versions.lock @@ -27,7 +27,6 @@ "com.fasterxml.jackson.datatype:jackson-datatype-jdk8", "com.fasterxml.jackson.datatype:jackson-datatype-jsr310", "com.fasterxml.jackson.module:jackson-module-afterburner", - "com.netflix.feign:feign-jackson", "com.palantir.atlasdb:atlasdb-api", "com.palantir.atlasdb:atlasdb-client", "com.palantir.remoting2:jackson-support", @@ -68,7 +67,6 @@ "transitive": [ "com.palantir.atlasdb.examples:profile-client-protobufs", "com.palantir.atlasdb:atlasdb-api", - "com.palantir.atlasdb:atlasdb-client", "com.palantir.atlasdb:atlasdb-client-protobufs", "com.palantir.atlasdb:atlasdb-commons", "com.palantir.atlasdb:commons-executors", @@ -119,25 +117,6 @@ "com.palantir.atlasdb:atlasdb-client" ] }, - "com.netflix.feign:feign-core": { - "locked": "8.17.0", - "transitive": [ - "com.netflix.feign:feign-jackson", - "com.netflix.feign:feign-jaxrs" - ] - }, - "com.netflix.feign:feign-jackson": { - "locked": "8.17.0", - "transitive": [ - "com.palantir.atlasdb:atlasdb-client" - ] - }, - "com.netflix.feign:feign-jaxrs": { - "locked": "8.17.0", - "transitive": [ - "com.palantir.atlasdb:atlasdb-client" - ] - }, "com.palantir.atlasdb.examples:profile-client-protobufs": { "project": true }, @@ -198,7 +177,6 @@ "transitive": [ "com.palantir.atlasdb.examples:profile-client-protobufs", "com.palantir.atlasdb:atlasdb-api", - "com.palantir.atlasdb:atlasdb-client", "com.palantir.atlasdb:atlasdb-client-protobufs", "com.palantir.atlasdb:atlasdb-commons", "com.palantir.atlasdb:commons-executors", @@ -287,12 +265,6 @@ "org.mpierce.metrics.reservoir:hdrhistogram-metrics-reservoir" ] }, - "org.jvnet:animal-sniffer-annotation": { - "locked": "1.0", - "transitive": [ - "com.netflix.feign:feign-core" - ] - }, "org.mpierce.metrics.reservoir:hdrhistogram-metrics-reservoir": { "locked": "1.1.2", "transitive": [ @@ -346,7 +318,6 @@ "com.fasterxml.jackson.datatype:jackson-datatype-jdk8", "com.fasterxml.jackson.datatype:jackson-datatype-jsr310", "com.fasterxml.jackson.module:jackson-module-afterburner", - "com.netflix.feign:feign-jackson", "com.palantir.atlasdb:atlasdb-api", "com.palantir.atlasdb:atlasdb-client", "com.palantir.remoting2:jackson-support", @@ -387,7 +358,6 @@ "transitive": [ "com.palantir.atlasdb.examples:profile-client-protobufs", "com.palantir.atlasdb:atlasdb-api", - "com.palantir.atlasdb:atlasdb-client", "com.palantir.atlasdb:atlasdb-client-protobufs", "com.palantir.atlasdb:atlasdb-commons", "com.palantir.atlasdb:commons-executors", @@ -438,25 +408,6 @@ "com.palantir.atlasdb:atlasdb-client" ] }, - "com.netflix.feign:feign-core": { - "locked": "8.17.0", - "transitive": [ - "com.netflix.feign:feign-jackson", - "com.netflix.feign:feign-jaxrs" - ] - }, - "com.netflix.feign:feign-jackson": { - "locked": "8.17.0", - "transitive": [ - "com.palantir.atlasdb:atlasdb-client" - ] - }, - "com.netflix.feign:feign-jaxrs": { - "locked": "8.17.0", - "transitive": [ - "com.palantir.atlasdb:atlasdb-client" - ] - }, "com.palantir.atlasdb.examples:profile-client-protobufs": { "project": true }, @@ -517,7 +468,6 @@ "transitive": [ "com.palantir.atlasdb.examples:profile-client-protobufs", "com.palantir.atlasdb:atlasdb-api", - "com.palantir.atlasdb:atlasdb-client", "com.palantir.atlasdb:atlasdb-client-protobufs", "com.palantir.atlasdb:atlasdb-commons", "com.palantir.atlasdb:commons-executors", @@ -606,12 +556,6 @@ "org.mpierce.metrics.reservoir:hdrhistogram-metrics-reservoir" ] }, - "org.jvnet:animal-sniffer-annotation": { - "locked": "1.0", - "transitive": [ - "com.netflix.feign:feign-core" - ] - }, "org.mpierce.metrics.reservoir:hdrhistogram-metrics-reservoir": { "locked": "1.1.2", "transitive": [ diff --git a/gradle/feign-shading.gradle b/gradle/feign-shading.gradle new file mode 100644 index 00000000000..51fec5461ef --- /dev/null +++ b/gradle/feign-shading.gradle @@ -0,0 +1,18 @@ +apply plugin: 'com.github.johnrengelman.shadow' + +// Avoid conflicts between the location of the "lean" jar and the shadow jar. +// The jar is around largely so that we can build multiproject dependencies without running into potential +// class-loading problems. +jar { + classifier 'lean' +} + +shadowJar { + mergeServiceFiles() + relocate('feign', 'com.palantir.atlasdb.shaded.feign') + classifier '' + + dependencies { + include(dependency('com.netflix.feign:feign-.*')) + } +} diff --git a/gradle/publish-jars.gradle b/gradle/publish-jars.gradle index 44eaaa0c3c2..b5cbd1aa81b 100644 --- a/gradle/publish-jars.gradle +++ b/gradle/publish-jars.gradle @@ -18,22 +18,22 @@ task testJar(type: Jar) { publishing { publications { - artifactory(MavenPublication) { - from components.hasProperty('shadow') ? components.shadow : components.java - artifact(sourceJar) { - classifier 'sources' - } - artifact(testJar) { - classifier 'tests' - } - pom.withXml { - def scm = asNode().appendNode('scm') - scm.appendNode('url', 'https://github.com/palantir/atlasdb') - def licenses = asNode().appendNode('licenses') - def license = licenses.appendNode('license') - license.appendNode('name', 'BSD-3') - license.appendNode('url', 'http://opensource.org/licenses/BSD-3-Clause') - } + artifactory(MavenPublication) { publication -> + project.shadow.component(publication) + artifact(sourceJar) { + classifier 'sources' + } + artifact(testJar) { + classifier 'tests' + } + pom.withXml { + def scm = asNode().appendNode('scm') + scm.appendNode('url', 'https://github.com/palantir/atlasdb') + def licenses = asNode().appendNode('licenses') + def license = licenses.appendNode('license') + license.appendNode('name', 'BSD-3') + license.appendNode('url', 'http://opensource.org/licenses/BSD-3-Clause') + } } } } diff --git a/timelock-server/build.gradle b/timelock-server/build.gradle index f24712e9304..af6fb7b86f9 100644 --- a/timelock-server/build.gradle +++ b/timelock-server/build.gradle @@ -19,7 +19,7 @@ dependencies { compile project(":timestamp-impl") compile project(":lock-impl") compile project(":leader-election-impl") - compile (project(path: ":atlasdb-config", configuration: "shadow")) { + compile (project(path: ":atlasdb-config", configuration: "remotingShadow")) { exclude group:'io.dropwizard' }