From cbaa52d20f718595d1bbce2f2548f7d65d1e7831 Mon Sep 17 00:00:00 2001 From: Matthew Nelson Date: Mon, 18 Mar 2024 10:33:43 -0400 Subject: [PATCH] Add support for JPMS via Multi-Release jar --- build-logic/src/main/kotlin/-KmpConfigurationExtension.kt | 7 +++++-- library/endians/build.gradle.kts | 2 +- library/endians/src/jvmMain/java9/module-info.java | 5 +++++ 3 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 library/endians/src/jvmMain/java9/module-info.java diff --git a/build-logic/src/main/kotlin/-KmpConfigurationExtension.kt b/build-logic/src/main/kotlin/-KmpConfigurationExtension.kt index 3dd646e..e93887a 100644 --- a/build-logic/src/main/kotlin/-KmpConfigurationExtension.kt +++ b/build-logic/src/main/kotlin/-KmpConfigurationExtension.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. **/ +import io.matthewnelson.kmp.configuration.ExperimentalKmpConfigurationApi import io.matthewnelson.kmp.configuration.extension.KmpConfigurationExtension import io.matthewnelson.kmp.configuration.extension.container.target.KmpConfigurationContainerDsl import org.gradle.api.Action @@ -20,17 +21,19 @@ import org.gradle.api.JavaVersion import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl fun KmpConfigurationExtension.configureShared( + java9ModuleName: String? = null, publish: Boolean = false, explicitApi: Boolean = true, action: Action ) { configure { jvm { - target { withJava() } - kotlinJvmTarget = JavaVersion.VERSION_1_8 compileSourceCompatibility = JavaVersion.VERSION_1_8 compileTargetCompatibility = JavaVersion.VERSION_1_8 + + @OptIn(ExperimentalKmpConfigurationApi::class) + java9MultiReleaseModuleInfo(java9ModuleName) } js() diff --git a/library/endians/build.gradle.kts b/library/endians/build.gradle.kts index d3a1968..ec75b57 100644 --- a/library/endians/build.gradle.kts +++ b/library/endians/build.gradle.kts @@ -18,5 +18,5 @@ plugins { } kmpConfiguration { - configureShared(publish = true) {} + configureShared(java9ModuleName = "org.kotlincrypto.endians", publish = true) {} } diff --git a/library/endians/src/jvmMain/java9/module-info.java b/library/endians/src/jvmMain/java9/module-info.java new file mode 100644 index 0000000..5d596f9 --- /dev/null +++ b/library/endians/src/jvmMain/java9/module-info.java @@ -0,0 +1,5 @@ +module org.kotlincrypto.endians { + requires kotlin.stdlib; + + exports org.kotlincrypto.endians; +}