From 85781a23d0abcba169ec8aa7d6d409741c0ac5df Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Fri, 22 Nov 2019 12:54:34 +0100 Subject: [PATCH] Clean up protobuf/grpc config and dependencies This change: - Removes several superfluous dependencies not required for our purposes with gRPC - Cleans up the way Gradle source sets are managed for generated gRPC sources and classes - Makes use of Gradle's new `implementation`, `compileOnly` and `runtimeOnly` dependency configurations where changes were otherwise being made. See https://stackoverflow.com/a/47365147 for details. Remaining uses of the now-deprecated `compile` and `runtime` configurations should be eliminated in a refactoring separate and apart from the present gRPC API work. - Upgrades several existing dependencies to align with newer versions of the same dependencies introduced transitively by grpc-* 1.25.0 libraries, including: - protoc from 3.9.1 => 3.10.0 - gson from 2.7 => 2.8.5 Note that a number of the grpc-* libraries depend on Guava v28, and our existing dependency on Guava v20 has *not* been upgraded to this newer version because it is incompatible with the way we have used Guava's Futures API. It appears that the grpc-* libraries function correctly against this older version of Guava, and more investigation would be required see whether upgrading our uses to the new Guava API is feasible / worth it. The way we are preventing this upgrade is with the use of `exclude(module: "guava")` directives on grpc-* dependencies. --- build.gradle | 91 +++++++++++----------------- gradle/witness/gradle-witness.gradle | 36 ++--------- 2 files changed, 43 insertions(+), 84 deletions(-) diff --git a/build.gradle b/build.gradle index 25558511ce8..eeaee65ab32 100644 --- a/build.gradle +++ b/build.gradle @@ -33,7 +33,6 @@ configure(subprojects) { bitcoinjVersion = 'a88d36d' btcdCli4jVersion = '975ff5d4' codecVersion = '1.9' - commonProtosVersion = '1.17.0' easybindVersion = '1.0.3' easyVersion = '4.0.1' findbugsVersion = '3.0.2' @@ -62,9 +61,9 @@ configure(subprojects) { logbackVersion = '1.1.10' lombokVersion = '1.18.2' mockitoVersion = '3.0.0' - nettyTcNativeVersion = '2.0.27.Final' netlayerVersion = '0.6.5.2' - protobufVersion = '3.9.1' + protobufVersion = '3.10.0' + protocVersion = protobufVersion pushyVersion = '0.13.2' qrgenVersion = '1.3' sarxosVersion = '0.3.12' @@ -174,7 +173,7 @@ configure(project(':common')) { protobuf { protoc { - artifact = "com.google.protobuf:protoc:$protobufVersion" + artifact = "com.google.protobuf:protoc:$protocVersion" } } @@ -183,7 +182,7 @@ configure(project(':common')) { compile "org.openjfx:javafx-base:$javafxVersion:$os" compile "org.openjfx:javafx-graphics:$javafxVersion:$os" compile "com.google.protobuf:protobuf-java:$protobufVersion" - compile 'com.google.code.gson:gson:2.7' + compile 'com.google.code.gson:gson:2.8.5' compile "org.springframework:spring-core:$springVersion" compile "org.slf4j:slf4j-api:$slf4jVersion" compile "ch.qos.logback:logback-core:$logbackVersion" @@ -235,26 +234,6 @@ configure(project(':p2p')) { configure(project(':core')) { apply plugin: 'com.google.protobuf' - // FIXME we dont want to have one src dir inside the other.... - sourceSets.main.java.srcDir "$buildDir/generated/source/proto/main" - sourceSets.main.java.srcDir "$buildDir/generated/source/proto/main/java" - - protobuf { - protoc { - artifact = "com.google.protobuf:protoc:$protobufVersion" - } - plugins { - grpc { - artifact = "io.grpc:protoc-gen-grpc-java:$grpcVersion" - } - } - generateProtoTasks { - all()*.plugins { - grpc {} - } - } - } - dependencies { compile project(':assets') compile project(':p2p') @@ -280,44 +259,20 @@ configure(project(':core')) { compile("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion") { exclude(module: 'jackson-annotations') } - - compileOnly "org.projectlombok:lombok:$lombokVersion" - annotationProcessor "org.projectlombok:lombok:$lombokVersion" - - compile "com.google.protobuf:protobuf-java:$protobufVersion" - compile "com.google.api.grpc:proto-google-common-protos:$commonProtosVersion" - - // FIXME Not clear which of the following libs have a newer version of guava which is not compatible with ours - compile ("io.grpc:grpc-alts:$grpcVersion") { + implementation "com.google.protobuf:protobuf-java:$protobufVersion" + implementation("io.grpc:grpc-protobuf:$grpcVersion") { exclude(module: 'guava') } - - compile ("io.grpc:grpc-netty:$grpcVersion") { + implementation("io.grpc:grpc-stub:$grpcVersion") { exclude(module: 'guava') } - - compile ("io.grpc:grpc-protobuf:$grpcVersion") { - exclude(module: 'guava') - } - - compile ("io.grpc:grpc-stub:$grpcVersion") { + compileOnly "javax.annotation:javax.annotation-api:1.2" + runtimeOnly ("io.grpc:grpc-netty-shaded:$grpcVersion") { exclude(module: 'guava') } - - // Used for TLS in HelloWorldServerTls - compile "io.netty:netty-tcnative-boringssl-static:${nettyTcNativeVersion}" - compileOnly "org.projectlombok:lombok:$lombokVersion" - compileOnly "javax.annotation:javax.annotation-api:1.2" annotationProcessor "org.projectlombok:lombok:$lombokVersion" - testCompile "io.grpc:grpc-testing:${grpcVersion}" - testCompile "org.mockito:mockito-core:$mockitoVersion" - testCompile "org.springframework:spring-test:$springVersion" - testCompile "com.natpryce:make-it-easy:$easyVersion" - testCompileOnly "org.projectlombok:lombok:$lombokVersion" - testAnnotationProcessor "org.projectlombok:lombok:$lombokVersion" - testCompile "org.mockito:mockito-core:$mockitoVersion" testCompile "org.springframework:spring-test:$springVersion" testCompile "com.natpryce:make-it-easy:$easyVersion" @@ -326,6 +281,25 @@ configure(project(':core')) { testAnnotationProcessor "org.projectlombok:lombok:$lombokVersion" } + protobuf { + protoc { + artifact = "com.google.protobuf:protoc:${protocVersion}" + } + plugins { + grpc { + artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" + } + } + generateProtoTasks { + all()*.plugins { grpc {} } + } + } + + sourceSets.main.java.srcDirs += [ + 'build/generated/source/proto/main/grpc', + 'build/generated/source/proto/main/java' + ] + test { systemProperty 'jdk.attach.allowAttachSelf', true } @@ -336,6 +310,12 @@ configure(project(':cli')) { dependencies { compile project(':core') + implementation("io.grpc:grpc-core:$grpcVersion") { + exclude(module: 'guava') + } + implementation("io.grpc:grpc-stub:$grpcVersion") { + exclude(module: 'guava') + } compileOnly "org.projectlombok:lombok:$lombokVersion" annotationProcessor "org.projectlombok:lombok:$lombokVersion" } @@ -482,6 +462,9 @@ configure(project(':grpc')) { dependencies { compile project(':core') + implementation("io.grpc:grpc-stub:$grpcVersion") { + exclude(module: 'guava') + } compileOnly "org.projectlombok:lombok:$lombokVersion" compileOnly "javax.annotation:javax.annotation-api:1.2" annotationProcessor "org.projectlombok:lombok:$lombokVersion" diff --git a/gradle/witness/gradle-witness.gradle b/gradle/witness/gradle-witness.gradle index 423c357f312..1a1f47ba50a 100644 --- a/gradle/witness/gradle-witness.gradle +++ b/gradle/witness/gradle-witness.gradle @@ -17,7 +17,7 @@ dependencyVerification { 'ch.qos.logback:logback-classic:e66efc674e94837344bc5b748ff510c37a44eeff86cbfdbf9e714ef2eb374013', 'ch.qos.logback:logback-core:4cd46fa17d77057b39160058df2f21ebbc2aded51d0edcc25d2c1cecc042a005', 'com.fasterxml.jackson.core:jackson-annotations:2566b3a6662afa3c6af4f5b25006cb46be2efc68f1b5116291d6998a8cdf7ed3', - 'com.fasterxml.jackson.core:jackson-core:3083079be6088db2ed0a0c6ff92204e0aa48fa1de9db5b59c468f35acf882c2c', + 'com.fasterxml.jackson.core:jackson-core:39a74610521d7fb9eb3f437bb8739bbf47f6435be12d17bf954c731a0c6352bb', 'com.fasterxml.jackson.core:jackson-databind:fcf3c2b0c332f5f54604f7e27fa7ee502378a2cc5df6a944bbfae391872c32ff', 'com.github.JesusMcCloud.netlayer:tor.external:10c3acfbcf8f80154a3f10640c4d4d275c4fc9baaf5c476d631da4e2382aaa5b', 'com.github.JesusMcCloud.netlayer:tor.native:fba4dca6a139af741c36713bcfe3680a92870009dbb59a3a14f9dae7f6cd116e', @@ -32,19 +32,12 @@ dependencyVerification { 'com.github.ravn:jsocks:3c71600af027b2b6d4244e4ad14d98ff2352a379410daebefff5d8cd48d742a4', 'com.github.sarxos:webcam-capture:d960b7ea8ec3ddf2df0725ef214c3fccc9699ea7772df37f544e1f8e4fd665f6', 'com.google.android:annotations:ba734e1e84c09d615af6a09d33034b4f0442f8772dec120efb376d86a565ae15', - 'com.google.api.grpc:proto-google-common-protos:ad25472c73ee470606fb500b376ae5a97973d5406c2f5c3b7d07fb25b4648b65', - 'com.google.auth:google-auth-library-credentials:aaeea9333fff9b763715bca0174ec76c4f9551b5731c89a95f263cdc82b4b56e', - 'com.google.auth:google-auth-library-oauth2-http:fa9a1589c8bc279416988d437c2636967cd5e4eff70fbddc986b9c5a77b0231b', - 'com.google.auto.value:auto-value-annotations:3bf4b9e74a6bf0f38ac70af571e0f8a9d85ccba4c0693a72fea9ea46def0d5a0', + 'com.google.api.grpc:proto-google-common-protos:bd60cd7a423b00fb824c27bdd0293aaf4781be1daba6ed256311103fb4b84108', 'com.google.code.findbugs:jsr305:766ad2a0783f2687962c8ad74ceecc38a28b9f72a2d085ee438b7813e928d0c7', 'com.google.code.gson:gson:233a0149fc365c9f6edbd683cfe266b19bdc773be98eabdaf6b3c924b48e7d81', 'com.google.errorprone:error_prone_annotations:ec59f1b702d9afc09e8c3929f5c42777dec623a6ea2731ac694332c7d7680f5a', 'com.google.guava:guava:36a666e3b71ae7f0f0dca23654b67e086e6c93d192f60ba5dfd5519db6c288c8', - 'com.google.http-client:google-http-client-jackson2:480b67711dd75054b45ec4f88056e53fda9773145117a1a852c803e2cb4b84e0', - 'com.google.http-client:google-http-client:2b4353d8ca918f92f3a5fcd6b6b2de09858eae683423225773f24c828cd06cc8', 'com.google.inject:guice:d258ff1bd9b8b527872f8402648226658ad3149f1f40e74b0566d69e7e042fbc', - 'com.google.j2objc:j2objc-annotations:21af30c92267bd6122c0e0b4d20cccb6641a37eaf956c6540ec471d584e64a7b', - 'com.google.protobuf:protobuf-java-util:619b0b0dc344cb141e493cbedc5687c8fb7c985e609a1b035e621bfab2f89021', 'com.google.protobuf:protobuf-java:161d7d61a8cb3970891c299578702fd079646e032329d6c2cabf998d191437c9', 'com.google.zxing:core:11aae8fd974ab25faa8208be50468eb12349cd239e93e7c797377fa13e381729', 'com.google.zxing:javase:0ec23e2ec12664ddd6347c8920ad647bb3b9da290f897a88516014b56cc77eb9', @@ -55,38 +48,22 @@ dependencyVerification { 'com.nativelibs4java:bridj:101bcd9b6637e6bc16e56deb3daefba62b1f5e8e9e37e1b3e56e3b5860d659cf', 'com.squareup.okhttp:okhttp:b4c943138fcef2bcc9d2006b2250c4aabbedeafc5947ed7c0af7fd103ceb2707', 'com.squareup.okio:okio:114bdc1f47338a68bcbc95abf2f5cdc72beeec91812f2fcd7b521c1937876266', - 'commons-codec:commons-codec:e599d5318e97aa48f42136a2927e6dfa4e8881dff0e6c8e3109ddbbff51d7b7d', + 'commons-codec:commons-codec:ad19d2601c3abf0b946b5c3a4113e226a8c1e3305e395b90013b78dd94a723ce', 'commons-io:commons-io:cc6a41dc3eaacc9e440a6bd0d2890b20d36b4ee408fe2d67122f328bb6e01581', 'commons-logging:commons-logging:daddea1ea0be0f56978ab3006b8ac92834afeefbd9b7e4e6316fca57df0fa636', 'de.jensd:fontawesomefx-commons:5539bb3335ecb822dbf928546f57766eeb9f1516cc1417a064b5709629612149', 'de.jensd:fontawesomefx-materialdesignfont:dbad8dfdd1c85e298d5bbae25b2399aec9e85064db57b2427d10f3815aa98752', 'de.jensd:fontawesomefx:73bacc991a0a6f5cf0f911767c8db161e0949dbca61e8371eb4342e3da96887b', 'io.github.microutils:kotlin-logging:4992504fd3c6ecdf9ed10874b9508e758bb908af9e9d7af19a61e9afb6b7e27a', - 'io.grpc:grpc-alts:177aa1e578c10e274f8feedd6f555c2e7741c195a84f533f9a51fb82dbe8a596', 'io.grpc:grpc-api:a269094009588213ab5386a6fb92426b8056a130b2653d3b4e59e971f2f1ef08', - 'io.grpc:grpc-auth:782ae07923d53b56f54326e7b32480b425eb3df71deb5a4a33bbfc6487e706a4', 'io.grpc:grpc-context:f4c8f878c320f6fb56c1c14692618f6df8253314b556176e32727afbc5921a73', 'io.grpc:grpc-core:d67fa113fd9cc45a02710f9c41dda9c15191448c14e9e96fcc21839a41345d4c', - 'io.grpc:grpc-grpclb:aaac0d6063204dfc52abc51af94f16b6cecfd582bb477ee1d232e42920bf49e3', 'io.grpc:grpc-netty-shaded:9edfd45da473d2efbb5683fc3eaf1857e82d2148033d82dd558a7ac38731ea33', - 'io.grpc:grpc-netty:167e834788f6d4f7bd129bfb244d4e09d061a0e7165288378386ae871e3cfe51', 'io.grpc:grpc-protobuf-lite:9ba9aaa3e6997a04c707793c25e3ec88c6bad86f8d6f6b8b7a1a0c33ea2429d8', 'io.grpc:grpc-protobuf:454dae7e246dac25526ed5b795d97a5dafedd3cc2042cfc810f02051d7d3e3cb', 'io.grpc:grpc-stub:1532e291c0e9fd8230a6416c8ebbd902d99c7e2760241ae638ea761aa3dd5f43', - 'io.netty:netty-buffer:7b0171a4e8bcd573e08d9f2bba053c67b557ab5012106a5982ccbae5743814c0', - 'io.netty:netty-codec-http2:8bac9625eb68635396eb0c13c9cc0b22bde7c83d0cd2dae3fe9b6f9cf929e372', - 'io.netty:netty-codec-http:eb349c0f1b249af7c7a8fbbd1c761d65d9bc230880cd8d37feab9e8278292625', - 'io.netty:netty-codec-socks:7f14b3a95ee9aa5a26f66af668690578a81a883683ac1c4ca9e9afdf4d4c7894', - 'io.netty:netty-codec:e96ced697fb7df589da7c20c995e01f75a9cb246be242bbc4cd3b4af424ff189', - 'io.netty:netty-common:3d0a918d78292eeca02a7bb2188daa4e5053b6e29b71e6308309033e121242b5', - 'io.netty:netty-handler-proxy:25f22da21c29ab0d3b6b889412351bcfc5f9ccd42e07d2d5513d5c4eb571f343', - 'io.netty:netty-handler:11eda86500c33b9d386719b5419f513fd9c097d13894f25dd0c75b610d636e03', - 'io.netty:netty-resolver:89768242b6b7cce9bd9f5945ad21d1b4bae515c6b1bf03a8af5d1899779cebc9', - 'io.netty:netty-tcnative-boringssl-static:0ea1a935a1023a88e99a4f9b1aba2e3ff2799d4d1994f4bff848f85b367d48ed', - 'io.netty:netty-transport:dfa817a156ea263aa9ad8364a2e226527665c9722aca40a7945f228c2c14f1da', 'io.opencensus:opencensus-api:8e2cb0f6391d8eb0a1bcd01e7748883f0033b1941754f4ed3f19d2c3e4276fc8', 'io.opencensus:opencensus-contrib-grpc-metrics:29fc79401082301542cab89d7054d2f0825f184492654c950020553ef4ff0ef8', - 'io.opencensus:opencensus-contrib-http-util:d62fd27175a842bde135f6f6b1d6f25d42e9bd59a87bc98709a4760fe399ee14', 'io.perfmark:perfmark-api:b734ba2149712409a44eabdb799f64768578fee0defe1418bb108fe32ea43e1a', 'javax.inject:javax.inject:91c77044a50c481636c32d916fd89c9118a72195390452c81065080f957de7ff', 'net.glxn:qrgen:c85d9d8512d91e8ad11fe56259a7825bd50ce0245447e236cf168d1b17591882', @@ -95,14 +72,13 @@ dependencyVerification { 'network.bisq.btcd-cli4j:btcd-cli4j-core:203156fc63dc1202774de9818e4f21149549f79b25d356b08bb0c784be40c0e8', 'network.bisq.btcd-cli4j:btcd-cli4j-daemon:0a2783a851add6e3d8ae899ade48c041b250bfac64b6a4c5f6380ebcdbbe6848', 'org.apache.commons:commons-compress:5f2df1e467825e4cac5996d44890c4201c000b43c0b23cffc0782d28a0beb9b0', - 'org.apache.commons:commons-lang3:8ac96fc686512d777fca85e144f196cd7cfe0c0aec23127229497d1a38ff651c', - 'org.apache.httpcomponents:httpclient:6c7e3bb423d8c5574f28157fe42b4c38d6a3477bfa2954cfe5f330b14ecad8a9', - 'org.apache.httpcomponents:httpcore:d799522d579aac06b170603f8f080f6e3248dadc01f9652cdd7ea7bc318c21ce', + 'org.apache.commons:commons-lang3:734c8356420cc8e30c795d64fd1fcd5d44ea9d90342a2cc3262c5158fbc6d98b', + 'org.apache.httpcomponents:httpclient:db3d1b6c2d6a5e5ad47577ad61854e2f0e0936199b8e05eb541ed52349263135', + 'org.apache.httpcomponents:httpcore:d7f853dee87680b07293d30855b39b9eb56c1297bd16ff1cd6f19ddb8fa745fb', 'org.bitcoinj:orchid:f836325cfa0466a011cb755c9b0fee6368487a2352eb45f4306ad9e4c18de080', 'org.bouncycastle:bcpg-jdk15on:de3355b821fc81dd32e1f3f560d5b3eca1c678fd2400011d0bfc69fb91bcde85', 'org.bouncycastle:bcprov-jdk15on:963e1ee14f808ffb99897d848ddcdb28fa91ddda867eb18d303e82728f878349', 'org.codehaus.mojo:animal-sniffer-annotations:92654f493ecfec52082e76354f0ebf87648dc3d5cec2e3c3cdb947c016747a53', - 'org.conscrypt:conscrypt-openjdk-uber:27f4314bf01e5af288ade537f06cb6eb7f0c760aed4a8d7cf441de71de0a7abb', 'org.fxmisc.easybind:easybind:666af296dda6de68751668a62661571b5238ac6f1c07c8a204fc6f902b222aaf', 'org.jetbrains.kotlin:kotlin-stdlib-common:6c91dea17d7dce5f0b550c3de3305767e5fb46247b6d1eb7eca0ca1fe18458de', 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:25e2409aba0ec37d2fd7c77727d7835b511879de8d9bf4862af0b493aabbe39e',