From 39cc5e3403320929550f6b3f91e84cfb6e852e73 Mon Sep 17 00:00:00 2001 From: Chris Rankin Date: Mon, 6 Apr 2020 11:00:40 +0100 Subject: [PATCH] CORDA-3698: Require no classifier for Open Core and DJVM-related modules. (#6132) * ENT-4967: Require no classifier for corda-node-djvm, corda-deserializers-djvm. * Also remove classifiers from core, serialization and finance-contracts. * Compile corda-serialization-djvm for Java 8 and remove its classifier. --- core/build.gradle | 3 ++- finance/contracts/build.gradle | 4 +++- java8.gradle | 22 +++++++++++++++++++ node/djvm/build.gradle | 1 + serialization-djvm/build.gradle | 19 ++++++---------- serialization-djvm/deserializers/build.gradle | 1 + serialization/build.gradle | 3 ++- 7 files changed, 38 insertions(+), 15 deletions(-) create mode 100644 java8.gradle diff --git a/core/build.gradle b/core/build.gradle index 37b542c0e9..d024d164c0 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -101,7 +101,8 @@ task copyQuasarJar(type: Copy) { jar { finalizedBy(copyQuasarJar) - baseName 'corda-core' + archiveBaseName = 'corda-core' + archiveClassifier = '' } configurations { diff --git a/finance/contracts/build.gradle b/finance/contracts/build.gradle index 8b4e4a9351..6459515034 100644 --- a/finance/contracts/build.gradle +++ b/finance/contracts/build.gradle @@ -6,6 +6,7 @@ apply plugin: 'net.corda.plugins.publish-utils' apply plugin: 'net.corda.plugins.quasar-utils' apply plugin: 'net.corda.plugins.cordapp' apply plugin: 'com.jfrog.artifactory' +apply from: "${rootProject.projectDir}/java8.gradle" description 'Corda finance module - contracts' @@ -31,7 +32,8 @@ configurations { } jar { - baseName 'corda-finance-contracts' + archiveBaseName = 'corda-finance-contracts' + archiveClassifier = '' manifest { attributes('Corda-Revision': 'n/a') attributes('Corda-Vendor': 'Corda Open Source') diff --git a/java8.gradle b/java8.gradle new file mode 100644 index 0000000000..e0fbf629cc --- /dev/null +++ b/java8.gradle @@ -0,0 +1,22 @@ +import static org.gradle.api.JavaVersion.VERSION_1_8 + +/* + * Gradle script plugin: Configure a module such that Java and Kotlin + * are always compiled for Java 8. + */ +apply plugin: 'kotlin' + +tasks.withType(AbstractCompile) { + // This is a bit ugly, but Gradle isn't recognising the KotlinCompile task + // as it does the built-in JavaCompile task. + if (it.class.name.startsWith('org.jetbrains.kotlin.gradle.tasks.KotlinCompile')) { + kotlinOptions { + jvmTarget = VERSION_1_8 + } + } +} + +tasks.withType(JavaCompile) { + sourceCompatibility = VERSION_1_8 + targetCompatibility = VERSION_1_8 +} diff --git a/node/djvm/build.gradle b/node/djvm/build.gradle index efd62b2363..9c39b404d6 100644 --- a/node/djvm/build.gradle +++ b/node/djvm/build.gradle @@ -13,6 +13,7 @@ dependencies { jar { archiveBaseName = 'corda-node-djvm' + archiveClassifier = '' manifest { attributes('Automatic-Module-Name': 'net.corda.node.djvm') attributes('Sealed': true) diff --git a/serialization-djvm/build.gradle b/serialization-djvm/build.gradle index a082370d25..7ec41f9d32 100644 --- a/serialization-djvm/build.gradle +++ b/serialization-djvm/build.gradle @@ -1,3 +1,4 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import static org.gradle.api.JavaVersion.VERSION_1_8 plugins { @@ -8,6 +9,11 @@ plugins { id 'idea' } +// The DJVM only supports Java 8 byte-code, so the tests must +// be compiled for Java 8. The main artifact is only compiled +// for Java 8 because it belongs to "Open Core". +apply from: "${rootProject.projectDir}/java8.gradle" + description 'Serialization support for the DJVM' configurations { @@ -41,20 +47,9 @@ dependencies { sandboxTesting "org.slf4j:slf4j-nop:$slf4j_version" } -// The DJVM only supports Java 8 byte-code. -compileTestJava { - sourceCompatibility = VERSION_1_8 - targetCompatibility = VERSION_1_8 -} - -compileTestKotlin { - kotlinOptions { - jvmTarget = VERSION_1_8 - } -} - jar { archiveBaseName = 'corda-serialization-djvm' + archiveClassifier = '' manifest { attributes('Automatic-Module-Name': 'net.corda.serialization.djvm') attributes('Sealed': true) diff --git a/serialization-djvm/deserializers/build.gradle b/serialization-djvm/deserializers/build.gradle index 9c1b211150..d98513c8d5 100644 --- a/serialization-djvm/deserializers/build.gradle +++ b/serialization-djvm/deserializers/build.gradle @@ -17,6 +17,7 @@ dependencies { jar { archiveBaseName = 'corda-deserializers-djvm' + archiveClassifier = '' manifest { attributes('Automatic-Module-Name': 'net.corda.serialization.djvm.deserializers') attributes('Sealed': true) diff --git a/serialization/build.gradle b/serialization/build.gradle index 887bdb2a9e..0ba49a0804 100644 --- a/serialization/build.gradle +++ b/serialization/build.gradle @@ -63,7 +63,8 @@ artifacts { } jar { - baseName 'corda-serialization' + archiveBaseName = 'corda-serialization' + archiveClassifier = '' } publish {