mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 22:29:39 -06:00
Android: No longer require specification of NDK or Git paths in build.gradle.
This commit is contained in:
@ -82,8 +82,8 @@ task setupCMake(type: Exec) {
|
||||
"-DANDROID_NATIVE_API_LEVEL=android-18",
|
||||
"-DCMAKE_TOOLCHAIN_FILE=../../../android.toolchain.cmake",
|
||||
"../../../../..",
|
||||
"-DGIT_EXECUTABLE=" + buildProperties.gitPath,
|
||||
"-DANDROID_NDK=" + buildProperties.ndkPath,
|
||||
"-DGIT_EXECUTABLE=" + getGitPath(),
|
||||
"-DANDROID_NDK=" + getNdkPath(),
|
||||
"-DANDROID_TOOLCHAIN_NAME=" + buildProperties.toolchain,
|
||||
"-DANDROID_ABI=" + buildProperties.abi
|
||||
} else {
|
||||
@ -111,4 +111,46 @@ task compileNative(type: Exec, dependsOn: 'setupCMake') {
|
||||
executable 'echo'
|
||||
args 'No build.properties found; skipping native build.'
|
||||
}
|
||||
}
|
||||
|
||||
String getGitPath() {
|
||||
try {
|
||||
def stdout = new ByteArrayOutputStream()
|
||||
|
||||
exec {
|
||||
commandLine 'which', 'git'
|
||||
standardOutput = stdout
|
||||
}
|
||||
|
||||
def gitPath = stdout.toString().trim()
|
||||
project.logger.quiet("Gradle: Found git executuable:" + gitPath)
|
||||
|
||||
return gitPath
|
||||
} catch (ignored) {
|
||||
// Shouldn't happen. How did the user get this file without git?
|
||||
project.logger.error("Gradle error: Couldn't find git executable.")
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
String getNdkPath() {
|
||||
try {
|
||||
def stdout = new ByteArrayOutputStream()
|
||||
|
||||
exec {
|
||||
// ndk-build.cmd is a file unique to the root directory of android-ndk-r10d.
|
||||
commandLine 'locate', 'ndk-build.cmd'
|
||||
standardOutput = stdout
|
||||
}
|
||||
|
||||
def ndkCmdPath = stdout.toString()
|
||||
def ndkPath = ndkCmdPath.substring(0, ndkCmdPath.lastIndexOf('/'))
|
||||
|
||||
project.logger.quiet("Gradle: Found Android NDK:" + ndkPath)
|
||||
|
||||
return ndkPath
|
||||
} catch (ignored) {
|
||||
project.logger.error("Gradle error: Couldn't find NDK.")
|
||||
return null;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user