From 12196f08929b5296c352dfd3c3cd0ef41e159a35 Mon Sep 17 00:00:00 2001 From: Gedeon Date: Wed, 27 Sep 2023 10:34:47 -0400 Subject: [PATCH] Fix mobile core not building on non-darwin machines (#1388) * find `llvm-ranlib` for linux and windows systems * simplify the exec block * fix path not recognizing `darwin` --- .../mobile/modules/sd-core/android/build.gradle | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/apps/mobile/modules/sd-core/android/build.gradle b/apps/mobile/modules/sd-core/android/build.gradle index f7a01dba2..365e78c74 100644 --- a/apps/mobile/modules/sd-core/android/build.gradle +++ b/apps/mobile/modules/sd-core/android/build.gradle @@ -2,6 +2,7 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'maven-publish' + group = 'com.spacedrive.core' version = '0.0.1' @@ -101,21 +102,23 @@ if (System.getenv('SPACEDRIVE_CI') != "1") { } cargo { + final String osName = System.getProperty("os.name").toLowerCase(); + module = "./crate" libname = "sd_mobile_android" pythonCommand = 'python3' profile = 'release' // 'debug' targets = cargoTargets targetDirectory = "../../../../../target" // Monorepo moment - exec { spec, toolchain -> - def dir = "${android.ndkDirectory}/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ranlib" - spec.environment("RANLIB_armv7-linux-androideabi", "${dir}") - spec.environment("RANLIB_aarch64-linux-android", "${dir}") - spec.environment("RANLIB_i686-linux-android", "${dir}") - spec.environment("RANLIB_x86_64-linux-android", "${dir}") - } + def dir = "${android.ndkDirectory}/toolchains/llvm/prebuilt/${osName.contains("mac") ? "darwin" : osName}-x86_64/bin/llvm-ranlib" + + spec.environment("RANLIB_armv7-linux-androideabi", "${dir}") + spec.environment("RANLIB_aarch64-linux-android", "${dir}") + spec.environment("RANLIB_i686-linux-android", "${dir}") + spec.environment("RANLIB_x86_64-linux-android", "${dir}") + } } tasks.whenTaskAdded { task ->