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`
This commit is contained in:
Gedeon
2023-09-27 10:34:47 -04:00
committed by GitHub
parent 7b8919dd95
commit 12196f0892

View File

@@ -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 ->