Unverified Commit 233c5013 authored by Nikolay Igotti's avatar Nikolay Igotti Committed by GitHub

Fix local Android build (#474)

* Fix local Android build

* Tweaks
parent b43c8fbb
......@@ -717,15 +717,14 @@ fun Project.androidClangFor(targetArch: Arch, version: String = "30"): Provider<
.orEmpty()
.map { ndkHomeEnv ->
ndkHomeEnv.ifEmpty {
androidHomePath().map { androidHome ->
val ndkDir1 = file("$androidHome/ndk")
val candidates1 = if (ndkDir1.exists()) ndkDir1.list() else emptyArray()
val ndkVersion =
arrayOf(*(candidates1.map { "ndk/$it" }.sortedDescending()).toTypedArray(), "ndk-bundle").find {
File(androidHome).resolve(it).exists()
} ?: throw GradleException("Cannot find NDK, is it installed (Tools/SDK Manager)?")
"$androidHome/$ndkVersion"
}
val androidHome = androidHomePath().get()
val ndkDir1 = file("$androidHome/ndk")
val candidates1 = if (ndkDir1.exists()) ndkDir1.list() else emptyArray()
val ndkVersion =
arrayOf(*(candidates1.map { "ndk/$it" }.sortedDescending()).toTypedArray(), "ndk-bundle").find {
File(androidHome).resolve(it).exists()
} ?: throw GradleException("Cannot find NDK, is it installed (Tools/SDK Manager)?")
"$androidHome/$ndkVersion"
}
}
return ndkPath.map { ndkPath ->
......
......@@ -181,17 +181,17 @@ abstract class CompileSkikoCppTask() : AbstractSkikoNativeToolTask() {
}
private fun findCompilerExecutable(): File {
val compilerNameOrFile = compiler.get()
val compilerFile = File(compilerNameOrFile)
val compilerName = compiler.get()
val compilerFile = File(compilerName)
if (compilerFile.isFile) return compilerFile
val paths = System.getenv("PATH").split(File.pathSeparator)
for (path in paths) {
val file = File(path).resolve(compilerNameOrFile)
val file = File(path).resolve(compilerName)
if (file.isFile) return file
}
error("Could not find compiler '$compilerNameOrFile' in PATH: $paths")
error("Could not find compiler '$compilerName' in PATH: $paths")
}
override fun cleanStaleOutput(mode: ToolMode.NonIncremental) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment