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< ...@@ -717,15 +717,14 @@ fun Project.androidClangFor(targetArch: Arch, version: String = "30"): Provider<
.orEmpty() .orEmpty()
.map { ndkHomeEnv -> .map { ndkHomeEnv ->
ndkHomeEnv.ifEmpty { ndkHomeEnv.ifEmpty {
androidHomePath().map { androidHome -> val androidHome = androidHomePath().get()
val ndkDir1 = file("$androidHome/ndk") val ndkDir1 = file("$androidHome/ndk")
val candidates1 = if (ndkDir1.exists()) ndkDir1.list() else emptyArray() val candidates1 = if (ndkDir1.exists()) ndkDir1.list() else emptyArray()
val ndkVersion = val ndkVersion =
arrayOf(*(candidates1.map { "ndk/$it" }.sortedDescending()).toTypedArray(), "ndk-bundle").find { arrayOf(*(candidates1.map { "ndk/$it" }.sortedDescending()).toTypedArray(), "ndk-bundle").find {
File(androidHome).resolve(it).exists() File(androidHome).resolve(it).exists()
} ?: throw GradleException("Cannot find NDK, is it installed (Tools/SDK Manager)?") } ?: throw GradleException("Cannot find NDK, is it installed (Tools/SDK Manager)?")
"$androidHome/$ndkVersion" "$androidHome/$ndkVersion"
}
} }
} }
return ndkPath.map { ndkPath -> return ndkPath.map { ndkPath ->
......
...@@ -181,17 +181,17 @@ abstract class CompileSkikoCppTask() : AbstractSkikoNativeToolTask() { ...@@ -181,17 +181,17 @@ abstract class CompileSkikoCppTask() : AbstractSkikoNativeToolTask() {
} }
private fun findCompilerExecutable(): File { private fun findCompilerExecutable(): File {
val compilerNameOrFile = compiler.get() val compilerName = compiler.get()
val compilerFile = File(compilerNameOrFile) val compilerFile = File(compilerName)
if (compilerFile.isFile) return compilerFile if (compilerFile.isFile) return compilerFile
val paths = System.getenv("PATH").split(File.pathSeparator) val paths = System.getenv("PATH").split(File.pathSeparator)
for (path in paths) { for (path in paths) {
val file = File(path).resolve(compilerNameOrFile) val file = File(path).resolve(compilerName)
if (file.isFile) return file 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) { 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