From 9ee4a22fbe357afeda21becc12ab13c110512c05 Mon Sep 17 00:00:00 2001 From: Ben Hale Date: Fri, 11 May 2018 10:55:24 -0700 Subject: [PATCH] Maven Dependency Improvements Previously, an update the build system resulted in the Maven dependencies being aggressively calculated, before each project add dependencies to itself. This change updates the ordering of this calculation such that it happens after each project configures itself. In addition, this change goes through each project and ensures that the dependencies are scoped appropriately in order to achieve the a minimal and accurate Maven POM. [#463][#498] --- README.md | 2 +- artifactory.gradle | 33 ++++++++++--------- rsocket-core/build.gradle | 10 ++++-- .../io/rsocket/util/DefaultPayloadTest.java | 3 +- rsocket-examples/build.gradle | 14 ++++---- rsocket-load-balancer/build.gradle | 3 +- rsocket-micrometer/build.gradle | 7 ++-- rsocket-transport-aeron/build.gradle | 2 +- rsocket-transport-local/build.gradle | 5 +-- rsocket-transport-netty/build.gradle | 3 +- 10 files changed, 44 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index f657e8015..d3a592ae1 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ repositories { } dependencies { - compile 'io.rsocket:reactivesocket:0.9.20' + implementation 'io.rsocket:reactivesocket:0.9.20' } ``` diff --git a/artifactory.gradle b/artifactory.gradle index e562c5647..6e622a610 100644 --- a/artifactory.gradle +++ b/artifactory.gradle @@ -15,25 +15,26 @@ */ if (project.hasProperty('bintrayUser') && project.hasProperty('bintrayKey')) { - artifactory { - publish { - contextUrl = 'https://oss.jfrog.org' - - repository { - repoKey = 'oss-snapshot-local' - - // Credentials for oss.jfrog.org are a user's Bintray credentials - username = project.property('bintrayUser') - password = project.property('bintrayKey') - } - } - } subprojects { plugins.withId('com.jfrog.artifactory') { - artifactoryPublish { - publications('maven') + artifactory { + publish { + contextUrl = 'https://oss.jfrog.org' + + repository { + repoKey = 'oss-snapshot-local' + + // Credentials for oss.jfrog.org are a user's Bintray credentials + username = project.property('bintrayUser') + password = project.property('bintrayKey') + } + + defaults { + publications('maven') + } + } } } } -} \ No newline at end of file +} diff --git a/rsocket-core/build.gradle b/rsocket-core/build.gradle index ec1c529a1..9efd6e346 100644 --- a/rsocket-core/build.gradle +++ b/rsocket-core/build.gradle @@ -27,18 +27,20 @@ plugins { dependencies { api 'io.netty:netty-buffer' api 'io.projectreactor:reactor-core' - api 'io.projectreactor.addons:reactor-extra' - implementation 'com.google.code.findbugs:jsr305' - implementation 'org.jctools:jctools-core' + implementation 'io.projectreactor.addons:reactor-extra' implementation 'org.slf4j:slf4j-api' + compileOnly 'com.google.code.findbugs:jsr305' + compileOnly 'org.jctools:jctools-core' + testImplementation 'io.projectreactor:reactor-test' testImplementation 'org.assertj:assertj-core' testImplementation 'org.junit.jupiter:junit-jupiter-api' testImplementation 'org.mockito:mockito-core' testRuntimeOnly 'ch.qos.logback:logback-classic' + testRuntimeOnly 'org.jctools:jctools-core' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' // TODO: Remove after JUnit5 migration @@ -53,6 +55,8 @@ jar { } shadowJar { + configurations = [project.configurations.compileOnly] + dependencies { include(dependency('org.jctools:jctools-core')) } diff --git a/rsocket-core/src/test/java/io/rsocket/util/DefaultPayloadTest.java b/rsocket-core/src/test/java/io/rsocket/util/DefaultPayloadTest.java index 1e6af7d5e..45ee4eacb 100644 --- a/rsocket-core/src/test/java/io/rsocket/util/DefaultPayloadTest.java +++ b/rsocket-core/src/test/java/io/rsocket/util/DefaultPayloadTest.java @@ -20,7 +20,6 @@ import static org.hamcrest.Matchers.*; import io.rsocket.Payload; -import javax.annotation.Nullable; import org.junit.Test; public class DefaultPayloadTest { @@ -34,7 +33,7 @@ public void testReuse() { assertDataAndMetadata(p, DATA_VAL, METADATA_VAL); } - public void assertDataAndMetadata(Payload p, String dataVal, @Nullable String metadataVal) { + public void assertDataAndMetadata(Payload p, String dataVal, String metadataVal) { assertThat("Unexpected data.", p.getDataUtf8(), equalTo(dataVal)); if (metadataVal == null) { assertThat("Non-null metadata", p.hasMetadata(), equalTo(false)); diff --git a/rsocket-examples/build.gradle b/rsocket-examples/build.gradle index 9cb14cd98..04cd59c50 100644 --- a/rsocket-examples/build.gradle +++ b/rsocket-examples/build.gradle @@ -19,17 +19,17 @@ plugins { } dependencies { - compile project(':rsocket-core') - compile project(':rsocket-transport-local') - compile project(':rsocket-transport-netty') + implementation project(':rsocket-core') + implementation project(':rsocket-transport-local') + implementation project(':rsocket-transport-netty') - testCompile project(':rsocket-test') - testCompile 'org.junit.jupiter:junit-jupiter-api' - testCompile 'org.mockito:mockito-core' + testImplementation project(':rsocket-test') + testImplementation 'org.junit.jupiter:junit-jupiter-api' + testImplementation 'org.mockito:mockito-core' // TODO: Remove after JUnit5 migration testCompileOnly 'junit:junit' - testCompile 'org.hamcrest:hamcrest-library' + testImplementation 'org.hamcrest:hamcrest-library' testRuntimeOnly 'org.junit.vintage:junit-vintage-engine' } diff --git a/rsocket-load-balancer/build.gradle b/rsocket-load-balancer/build.gradle index 36512e429..a2c8b73c7 100644 --- a/rsocket-load-balancer/build.gradle +++ b/rsocket-load-balancer/build.gradle @@ -22,7 +22,8 @@ plugins { } dependencies { - implementation project(':rsocket-core') + api project(':rsocket-core') + implementation 'org.slf4j:slf4j-api' testImplementation project(':rsocket-test') diff --git a/rsocket-micrometer/build.gradle b/rsocket-micrometer/build.gradle index d1c103806..5f2aeb16f 100644 --- a/rsocket-micrometer/build.gradle +++ b/rsocket-micrometer/build.gradle @@ -22,11 +22,12 @@ plugins { } dependencies { - implementation project(':rsocket-core') - implementation 'com.google.code.findbugs:jsr305' - implementation 'io.micrometer:micrometer-core' + api project(':rsocket-core') + api 'io.micrometer:micrometer-core' + implementation 'org.slf4j:slf4j-api' + compileOnly 'com.google.code.findbugs:jsr305' testImplementation project(':rsocket-test') testImplementation 'io.projectreactor:reactor-test' diff --git a/rsocket-transport-aeron/build.gradle b/rsocket-transport-aeron/build.gradle index 799e8b6ba..cf983a9de 100644 --- a/rsocket-transport-aeron/build.gradle +++ b/rsocket-transport-aeron/build.gradle @@ -22,9 +22,9 @@ plugins { } dependencies { + api project(':rsocket-core') api 'io.aeron:aeron-all' - implementation project(':rsocket-core') implementation 'org.slf4j:slf4j-api' testImplementation project(':rsocket-test') diff --git a/rsocket-transport-local/build.gradle b/rsocket-transport-local/build.gradle index b9b04dffa..8c3226065 100644 --- a/rsocket-transport-local/build.gradle +++ b/rsocket-transport-local/build.gradle @@ -22,8 +22,9 @@ plugins { } dependencies { - implementation project(':rsocket-core') - implementation 'com.google.code.findbugs:jsr305' + api project(':rsocket-core') + + compileOnly 'com.google.code.findbugs:jsr305' testImplementation project(':rsocket-test') testImplementation 'io.projectreactor:reactor-test' diff --git a/rsocket-transport-netty/build.gradle b/rsocket-transport-netty/build.gradle index a1ddaa1e4..20a7f7b9d 100644 --- a/rsocket-transport-netty/build.gradle +++ b/rsocket-transport-netty/build.gradle @@ -22,10 +22,9 @@ plugins { } dependencies { + api project(':rsocket-core') api 'io.projectreactor.ipc:reactor-netty' - implementation project(':rsocket-core') - testImplementation project(':rsocket-test') testImplementation 'org.junit.jupiter:junit-jupiter-api'