diff --git a/anoncred-kmm/anoncreds-kmp/build.gradle.kts b/anoncred-kmm/anoncreds-kmp/build.gradle.kts index 5d01ea95..fee75a53 100644 --- a/anoncred-kmm/anoncreds-kmp/build.gradle.kts +++ b/anoncred-kmm/anoncreds-kmp/build.gradle.kts @@ -5,13 +5,13 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile val os: OperatingSystem = OperatingSystem.current() plugins { - kotlin("multiplatform") id("com.android.library") + kotlin("multiplatform") id("maven-publish") } apply(plugin = "kotlinx-atomicfu") -version = "0.4.3" +version = "0.4.4" group = "io.iohk.atala.prism.anoncredskmp" fun KotlinNativeCompilation.anoncredsCinterops(type: String) { @@ -20,8 +20,7 @@ fun KotlinNativeCompilation.anoncredsCinterops(type: String) { val crate = this.name packageName("$crate.cinterop") header( - buildDir - .resolve("generated") + project.layout.buildDirectory.asFile.get() .resolve("nativeInterop") .resolve("cinterop") .resolve("headers") @@ -43,6 +42,7 @@ fun KotlinNativeCompilation.anoncredsCinterops(type: String) { .absolutePath ) } + "macosArm64" -> { extraOpts( "-libraryPath", @@ -54,6 +54,7 @@ fun KotlinNativeCompilation.anoncredsCinterops(type: String) { .absolutePath ) } + "ios" -> { extraOpts( "-libraryPath", @@ -65,6 +66,7 @@ fun KotlinNativeCompilation.anoncredsCinterops(type: String) { .absolutePath ) } + else -> { throw GradleException("Unsupported linking") } @@ -76,7 +78,7 @@ fun KotlinNativeCompilation.anoncredsCinterops(type: String) { kotlin { jvm { compilations.all { - kotlinOptions.jvmTarget = "11" + kotlinOptions.jvmTarget = "17" } testRuns["test"].executionTask.configure { useJUnitPlatform() @@ -84,6 +86,9 @@ kotlin { } androidTarget { publishAllLibraryVariants() + compilations.all { + kotlinOptions.jvmTarget = "17" + } } // if (os.isMacOsX) { @@ -101,46 +106,46 @@ kotlin { // } // } -/* - val crateTargetLibDir = rootDir.resolve("anoncred-wrapper-rust").resolve("target").resolve("debug") - val hostOs = System.getProperty("os.name") - val isMingwX64 = hostOs.startsWith("Windows") - val nativeTarget = when { - hostOs == "Mac OS X" -> { - if (System.getProperty("os.arch") != "x86_64") { - macosArm64("native") - } else { - macosX64("native") + /* + val crateTargetLibDir = rootDir.resolve("anoncred-wrapper-rust").resolve("target").resolve("debug") + val hostOs = System.getProperty("os.name") + val isMingwX64 = hostOs.startsWith("Windows") + val nativeTarget = when { + hostOs == "Mac OS X" -> { + if (System.getProperty("os.arch") != "x86_64") { + macosArm64("native") + } else { + macosX64("native") + } } + hostOs == "Linux" -> linuxArm64("native") + isMingwX64 -> mingwX64("native") + else -> throw GradleException("Host OS is not supported in Kotlin/Native.") } - hostOs == "Linux" -> linuxArm64("native") - isMingwX64 -> mingwX64("native") - else -> throw GradleException("Host OS is not supported in Kotlin/Native.") - } - nativeTarget.apply { - compilations.getByName("main") { - println("nativeTarget-only-main") - cinterops { - val anoncreds_wrapper by creating { - val crate = this.name - packageName("$crate.cinterop") - header( - generatedDir.resolve("nativeInterop").resolve("cinterop").resolve("headers") - .resolve(crate).resolve("$crate.h") - ) - tasks.named(interopProcessingTaskName) { - dependsOn(":anoncred-wrapper-rust:buildRust") + nativeTarget.apply { + compilations.getByName("main") { + println("nativeTarget-only-main") + cinterops { + val anoncreds_wrapper by creating { + val crate = this.name + packageName("$crate.cinterop") + header( + generatedDir.resolve("nativeInterop").resolve("cinterop").resolve("headers") + .resolve(crate).resolve("$crate.h") + ) + tasks.named(interopProcessingTaskName) { + dependsOn(":anoncred-wrapper-rust:buildRust") + } + extraOpts("-libraryPath", crateTargetLibDir.absolutePath) } - extraOpts("-libraryPath", crateTargetLibDir.absolutePath) } } } - } -*/ + */ sourceSets { val commonMain by getting { - val generatedDir = buildDir + val generatedDir = project.layout.buildDirectory.asFile.get() .resolve("generated") .resolve("commonMain") .resolve("kotlin") @@ -157,12 +162,12 @@ kotlin { } } val jvmMain by getting { - val generatedDir = buildDir + val generatedDir = project.layout.buildDirectory.asFile.get() .resolve("generated") .resolve("jvmMain") .resolve("kotlin") kotlin.srcDir(generatedDir) - val generatedResources = buildDir + val generatedResources = project.layout.buildDirectory.asFile.get() .resolve("generatedResources") .resolve("jvm") .resolve("main") @@ -173,12 +178,12 @@ kotlin { } val jvmTest by getting val androidMain by getting { - val generatedDir = buildDir + val generatedDir = project.layout.buildDirectory.asFile.get() .resolve("generated") .resolve("androidMain") .resolve("kotlin") kotlin.srcDir(generatedDir) - val generatedResources = buildDir + val generatedResources = project.layout.buildDirectory.asFile.get() .resolve("generatedResources") .resolve("android") .resolve("main") @@ -241,14 +246,14 @@ publishing { android { ndkVersion = "26.0.10792818" - compileSdk = 33 + compileSdk = 34 namespace = "io.iohk.atala.prism.anoncredskmp" sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") sourceSets["main"].jniLibs { setSrcDirs( listOf( - buildDir + project.layout.buildDirectory.asFile.get() .resolve("generatedResources") .resolve("android") .resolve("main") @@ -258,11 +263,10 @@ android { } defaultConfig { minSdk = 21 - targetSdk = 32 } compileOptions { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } /** * Because Software Components will not be created automatically for Maven publishing from @@ -286,10 +290,4 @@ afterEvaluate { tasks.withType { dependsOn(":anoncred-wrapper-rust:buildRust") } - tasks.named("lintAnalyzeDebug") { - this.enabled = false - } - tasks.named("lintAnalyzeRelease") { - this.enabled = false - } } diff --git a/anoncred-kmm/build.gradle.kts b/anoncred-kmm/build.gradle.kts index cb29dbdc..3fd8fcf4 100644 --- a/anoncred-kmm/build.gradle.kts +++ b/anoncred-kmm/build.gradle.kts @@ -1,6 +1,7 @@ plugins { id("org.jlleitschuh.gradle.ktlint") version "11.6.0" - kotlin("jvm") version "1.8.20" + kotlin("jvm") version "1.9.22" + id("com.android.library") version "8.1.4" apply false } buildscript { @@ -11,12 +12,17 @@ buildscript { mavenCentral() } dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.21") - classpath("com.android.tools.build:gradle:7.2.2") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.22") classpath("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.21.0") } } +java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(17)) + } +} + allprojects { repositories { mavenLocal() @@ -47,7 +53,7 @@ subprojects { exclude("**/generated/**") exclude { projectDir.toURI().relativize(it.file.toURI()).path.contains("/generated/") } exclude { element -> element.file.path.contains("generated/") } - exclude { it.file.path.contains("$buildDir/generated/") } + exclude("${project.layout.buildDirectory.asFile.get()}/generated/") exclude { it.file.path.contains(layout.buildDirectory.dir("generated").get().toString()) } } } diff --git a/anoncred-kmm/gradle/wrapper/gradle-wrapper.properties b/anoncred-kmm/gradle/wrapper/gradle-wrapper.properties index f398c33c..744c64d1 100644 --- a/anoncred-kmm/gradle/wrapper/gradle-wrapper.properties +++ b/anoncred-kmm/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists