From 32ee342c64aabf6b569f5516a06aa1b1495f38ce Mon Sep 17 00:00:00 2001 From: weisj <31143295+weisJ@users.noreply.github.com> Date: Wed, 30 Jun 2021 22:04:23 +0200 Subject: [PATCH] Build: Replace usage of deprecated JavaNativeInterfaceLibrary with JavaNativeInterfaceLibrary --- buildSrc/src/main/kotlin/JniUtils.kt | 10 ++++------ buildSrc/src/main/kotlin/UberJniJarPlugin.kt | 6 ++---- .../kotlin/UsePrebuiltBinariesWhenUnbuildablePlugin.kt | 4 ++-- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/buildSrc/src/main/kotlin/JniUtils.kt b/buildSrc/src/main/kotlin/JniUtils.kt index 20a09d99..11aa9ddc 100644 --- a/buildSrc/src/main/kotlin/JniUtils.kt +++ b/buildSrc/src/main/kotlin/JniUtils.kt @@ -1,5 +1,4 @@ -import dev.nokee.platform.jni.JniLibraryDependencies -import org.gradle.nativeplatform.MachineArchitecture +import dev.nokee.platform.jni.JavaNativeInterfaceLibraryComponentDependencies import dev.nokee.runtime.nativebase.OperatingSystemFamily import dev.nokee.runtime.nativebase.TargetMachine import dev.nokee.language.base.tasks.SourceCompile @@ -8,7 +7,6 @@ import org.gradle.api.GradleException import org.gradle.api.Project import org.gradle.api.artifacts.MinimalExternalModuleDependency import org.gradle.api.artifacts.ModuleDependency -import org.gradle.api.artifacts.ModuleDependencyCapabilitiesHandler import org.gradle.api.provider.Provider import org.gradle.nativeplatform.toolchain.Clang import org.gradle.nativeplatform.toolchain.Gcc @@ -19,15 +17,15 @@ typealias OSFamily = org.gradle.nativeplatform.OperatingSystemFamily fun MinimalExternalModuleDependency.dependencyNotation() = "${module.group}:${module.name}:${versionConstraint.requiredVersion}" -fun JniLibraryDependencies.jvmLibImplementation(notation: Provider) { +fun JavaNativeInterfaceLibraryComponentDependencies.jvmLibImplementation(notation: Provider) { jvmImplementation(notation.map { it.dependencyNotation() }.get()) } -fun JniLibraryDependencies.nativeLibImplementation(notation: Provider) { +fun JavaNativeInterfaceLibraryComponentDependencies.nativeLibImplementation(notation: Provider) { nativeImplementation(notation.map { it.dependencyNotation() }.get()) } -fun JniLibraryDependencies.nativeLibImplementation( +fun JavaNativeInterfaceLibraryComponentDependencies.nativeLibImplementation( notation: Provider, action: Action ) { diff --git a/buildSrc/src/main/kotlin/UberJniJarPlugin.kt b/buildSrc/src/main/kotlin/UberJniJarPlugin.kt index 6d7d20ec..e5a76790 100644 --- a/buildSrc/src/main/kotlin/UberJniJarPlugin.kt +++ b/buildSrc/src/main/kotlin/UberJniJarPlugin.kt @@ -1,13 +1,11 @@ -import dev.nokee.platform.jni.JarBinary import dev.nokee.platform.jni.JniJarBinary -import dev.nokee.platform.jni.JniLibraryExtension +import dev.nokee.platform.jni.JavaNativeInterfaceLibrary import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.file.DuplicatesStrategy import org.gradle.api.file.FileTree import org.gradle.api.provider.Provider import org.gradle.jvm.tasks.Jar -import org.gradle.nativeplatform.tasks.LinkSharedLibrary class UberJniJarPlugin : Plugin { @@ -20,7 +18,7 @@ class UberJniJarPlugin : Plugin { private fun configure(task: Jar) { val project = task.project val logger = task.logger - val library = project.extensions.getByType(JniLibraryExtension::class.java) + val library = project.extensions.getByType(JavaNativeInterfaceLibrary::class.java) // Prevent variants from being published. val targetMachines = library.targetMachines.forUseAtConfigurationTime().get() diff --git a/buildSrc/src/main/kotlin/UsePrebuiltBinariesWhenUnbuildablePlugin.kt b/buildSrc/src/main/kotlin/UsePrebuiltBinariesWhenUnbuildablePlugin.kt index 475f839b..c68355ae 100644 --- a/buildSrc/src/main/kotlin/UsePrebuiltBinariesWhenUnbuildablePlugin.kt +++ b/buildSrc/src/main/kotlin/UsePrebuiltBinariesWhenUnbuildablePlugin.kt @@ -1,7 +1,7 @@ +import dev.nokee.platform.jni.JavaNativeInterfaceLibrary import org.gradle.api.Action import org.gradle.api.Plugin import org.gradle.api.Project -import dev.nokee.platform.jni.JniLibraryExtension import dev.nokee.platform.jni.JniLibrary import java.io.File @@ -15,7 +15,7 @@ class UsePrebuiltBinariesWhenUnbuildablePlugin : Plugin { override fun apply(target: Project) { prebuiltExtension = target.extensions.create("prebuiltBinaries", PrebuiltBinariesExtension::class.java) - val library = target.extensions.getByType(JniLibraryExtension::class.java) + val library = target.extensions.getByType(JavaNativeInterfaceLibrary::class.java) library.variants.configureEach { if (prebuiltExtension.alwaysUsePrebuiltArtifact || !sharedLibrary.isBuildable) { configure(target, this)