From a0ccd9984c328dda80df3acffad6095e76878c52 Mon Sep 17 00:00:00 2001 From: iwgeric Date: Mon, 24 Mar 2014 00:05:23 -0400 Subject: [PATCH] add method to find the android ndk build executable in a common way for all sub projects that need to build a native android lib --- build.gradle | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/build.gradle b/build.gradle index 9f233e5e0..8d8bd25c9 100644 --- a/build.gradle +++ b/build.gradle @@ -14,9 +14,9 @@ subprojects { task run(dependsOn: ':jme3-examples:build', type: JavaExec) { description = 'Run the jME3 examples' main = 'jme3test.TestChooser' - classpath += files(subprojects.collect{project -> + classpath += files(subprojects.collect{project -> project.sourceSets*.runtimeClasspath}) -// classpath += files(subprojects.collect {project -> +// classpath += files(subprojects.collect {project -> // project.sourceSets*.output}) // classpath = sourceSets.main.runtimeClasspath // args 'mrhaki' @@ -62,7 +62,7 @@ task copyLibs(type: Copy){ from { subprojects*.configurations*.compile*.copyRecursive({ !(it instanceof ProjectDependency); })*.resolve() } - + into "$buildDir/libDist/lib-ext" //buildDir.path + '/' + libsDirName + '/lib' } @@ -75,11 +75,11 @@ task mergedJavadoc(type: Javadoc, description: 'Creates Javadoc from all the pro destinationDir = mkdir("dist/javadoc") // Note: The closures below are executed lazily. - source subprojects.collect {project -> + source subprojects.collect {project -> project.sourceSets*.allJava } -// classpath = files(subprojects.collect {project -> -// project.sourceSets*.compileClasspath}) +// classpath = files(subprojects.collect {project -> +// project.sourceSets*.compileClasspath}) // source { // subprojects*.sourceSets*.main*.allSource // } @@ -89,13 +89,33 @@ task mergedJavadoc(type: Javadoc, description: 'Creates Javadoc from all the pro } task mergedSource(type: Copy){ - + } task wrapper(type: Wrapper, description: 'Creates and deploys the Gradle wrapper to the current directory.') { gradleVersion = '1.11' } +String findNDK() { + def ndkBuildFile = "ndk-build" + // if windows, use ndk-build.cmd instead + if (System.properties['os.name'].toLowerCase().contains('windows')) { + ndkBuildFile = "ndk-build.cmd" + } + + // ndkPath is defined in the root project gradle.properties file + String ndkBuildPath = ndkPath + File.separator + ndkBuildFile + //Use the environment variable for the NDK location if defined + if (System.env.ANDROID_NDK != null) { + ndkBuildPath = System.env.ANDROID_NDK + File.separator + ndkBuildFile + } + if (new File(ndkBuildPath).exists()) { + return ndkBuildPath + } else { + return null + } +} + //class IncrementalReverseTask extends DefaultTask { // @InputDirectory // def File inputDir