From 601c31e344043f01a9f80eacc4292106eb1df335 Mon Sep 17 00:00:00 2001 From: Eldersonar Date: Wed, 3 Jun 2026 13:53:42 -0600 Subject: [PATCH] build(linux): linux-x86-64 native build for the isomdl uniffi bindings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - kotlin/build.gradle.kts: drop android/ios targets, embedRustLibrary=false, generateFromLibrary(LinuxX64) so a linux-x86-64 classifier jar is emitted for mavenLocal. - rust/Cargo.toml: [profile.release] strip=false (stripping removed the UNIFFI_META_* symbols that --library bindgen needs). NOTE: linux-only; drops android/ios — NOT for merge as-is. Captured here so the native can be reproduced on Linux. Durable path: publish the isomdl native with a linux-x86-64 classifier for all targets. Signed-off-by: Eldersonar --- kotlin/build.gradle.kts | 65 ++++++----------------------------------- rust/Cargo.toml | 2 +- 2 files changed, 10 insertions(+), 57 deletions(-) diff --git a/kotlin/build.gradle.kts b/kotlin/build.gradle.kts index db0ba05..53cbd68 100644 --- a/kotlin/build.gradle.kts +++ b/kotlin/build.gradle.kts @@ -21,7 +21,6 @@ import java.util.Properties plugins { alias(libs.plugins.kotlinMultiplatform) - alias(libs.plugins.androidLibrary) id("dev.gobley.cargo") version "0.3.7" id("dev.gobley.uniffi") version "0.3.7" kotlin("plugin.atomicfu") version libs.versions.kotlin @@ -72,53 +71,26 @@ cargo { } jvm{ - if(GobleyHost.Platform.MacOS.isCurrent){ - embedRustLibrary = when (rustTarget){ - RustWindowsTarget.X64 -> false - RustWindowsTarget.Arm64 -> false - else -> true - } - if (rustTarget == RustPosixTarget.MinGWX64) { - variants { - dynamicLibraries.set(listOf("isomdl_uniffi.dll")) - } - } - - RustPosixTarget.linuxTargets.forEach{ - if(rustTarget == it && GobleyHost.Platform.MacOS.isCurrent){ - embedRustLibrary = false - } - } - } - } - - android{ - variants{ - buildTaskProvider.configure { - additionalEnvironment.put("RUSTFLAGS", "-C link-args=-Wl,-z,max-page-size=16384") - } - } + // Linux-host build for holdr-sdk CLI: emit a per-target classifier jar + // (embedRustLibrary=false) instead of embedding the .so in the main jar, + // so it matches the `:linux-x86-64` coordinate holdr-sdk consumes. + embedRustLibrary = false } } } uniffi{ - generateFromLibrary() + generateFromLibrary{ + // Pin bindings generation to the Linux JVM target; default picked iosArm64 + // which cannot link on a Linux host. + build.set(RustPosixTarget.LinuxX64) + } } kotlin { jvmToolchain(17) applyDefaultHierarchyTemplate() - androidTarget { - publishLibraryVariants("release") - compilerOptions { - jvmTarget.set(JvmTarget.JVM_11) - } - instrumentedTestVariant.sourceSetTree.set(KotlinSourceSetTree.test) - unitTestVariant.sourceSetTree.set(KotlinSourceSetTree.unitTest) - } - jvm { compilerOptions { jvmTarget.set(JvmTarget.JVM_17) @@ -150,24 +122,5 @@ kotlin { } jvmTest.dependencies { } - androidUnitTest.dependencies{ - } - } -} - -android { - namespace = "tech.indicio.isomdl_uniffi" - compileSdk = 35 - - // Use the specific NDK version recommended for this project - // This version will be automatically installed in CI environments - ndkVersion = "28.2.13676358" - - defaultConfig { - minSdk = 24 - } - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 } } diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 5301cf6..e565d1c 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -63,7 +63,7 @@ crate-type = ["cdylib", "staticlib", "rlib"] name = "isomdl_uniffi" [profile.release] -strip = true +strip = false opt-level = "s" lto = true codegen-units = 1