Android:Changes to simplify command-line building of the app, and bugfixes to the Gradle script

This commit is contained in:
sigmabeta 2015-07-11 17:13:55 -04:00 committed by sigmabeta
parent 08516ee09e
commit 658c49fab3
5 changed files with 25 additions and 9 deletions

View File

@ -65,14 +65,14 @@ and place the following inside:
# Specifies arguments for the 'make' command. Can be blank. # Specifies arguments for the 'make' command. Can be blank.
makeArgs= makeArgs=
# The path to your machine's Git executable. Will autodetect if blank. # The path to your machine's Git executable. Will autodetect if blank (on Linux only).
gitPath= gitPath=
# The path to the extracted NDK package. Will autodetect if blank. # The path to the CMake executable. Will autodetect if blank (on Linux only).
ndkPath=
# The path to the CMake executable. Will autodetect if blank.
cmakePath= cmakePath=
# The path to the extracted NDK package. Will autodetect if blank (on Linux only).
ndkPath=
``` ```
If you prefer, you can run the CMake step manually, and it will copy the resulting If you prefer, you can run the CMake step manually, and it will copy the resulting

View File

@ -36,7 +36,6 @@ workspace.xml
tasks.xml tasks.xml
.gradle/* .gradle/*
.idea .idea
gradle/
build/ build/
*.so *.so
*.iml *.iml

View File

@ -134,7 +134,11 @@ task compileNative(type: Exec, dependsOn: 'setupCMake') {
executable 'make' executable 'make'
args buildProperties.makeArgs if (buildProperties.makeArgs == null || buildProperties.makeArgs.isEmpty()) {
// TODO
} else {
args buildProperties.makeArgs
}
} else { } else {
executable 'echo' executable 'echo'
args 'No build.properties found; skipping native build.' args 'No build.properties found; skipping native build.'
@ -144,13 +148,15 @@ task compileNative(type: Exec, dependsOn: 'setupCMake') {
String getExecutablePath(String command) { String getExecutablePath(String command) {
def propsFile = rootProject.file("build.properties") def propsFile = rootProject.file("build.properties")
def path = null def path = null
if (propsFile.canRead()) { if (propsFile.canRead()) {
def buildProperties = new Properties() def buildProperties = new Properties()
buildProperties.load(new FileInputStream(propsFile)) buildProperties.load(new FileInputStream(propsFile))
println buildProperties println buildProperties
path = buildProperties[command + "Path"] path = buildProperties[command + "Path"]
} }
if (path == null) {
if (path == null || path.isEmpty()) {
try { try {
def stdout = new ByteArrayOutputStream() def stdout = new ByteArrayOutputStream()
@ -164,21 +170,25 @@ String getExecutablePath(String command) {
project.logger.error("Gradle error: Couldn't find " + command + " executable.") project.logger.error("Gradle error: Couldn't find " + command + " executable.")
} }
} }
if (path != null) { if (path != null) {
project.logger.quiet("Gradle: Found " + command + " executuable:" + path) project.logger.quiet("Gradle: Found " + command + " executuable:" + path)
} }
return path return path
} }
String getNdkPath() { String getNdkPath() {
def propsFile = rootProject.file("build.properties") def propsFile = rootProject.file("build.properties")
def ndkPath = null def ndkPath = null
if (propsFile.canRead()) { if (propsFile.canRead()) {
def buildProperties = new Properties() def buildProperties = new Properties()
buildProperties.load(new FileInputStream(propsFile)) buildProperties.load(new FileInputStream(propsFile))
ndkPath = buildProperties.ndkPath ndkPath = buildProperties.ndkPath
} }
if (ndkPath == null) {
if (ndkPath == null || ndkPath.isEmpty()) {
try { try {
def stdout = new ByteArrayOutputStream() def stdout = new ByteArrayOutputStream()
@ -194,6 +204,7 @@ String getNdkPath() {
project.logger.error("Gradle error: Couldn't find NDK.") project.logger.error("Gradle error: Couldn't find NDK.")
} }
} }
if (ndkPath != null) { if (ndkPath != null) {
project.logger.quiet("Gradle: Found Android NDK: " + ndkPath) project.logger.quiet("Gradle: Found Android NDK: " + ndkPath)
} }

Binary file not shown.

View File

@ -0,0 +1,6 @@
#Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip