Build android bullet-native on Travis (#1175)
* First attempt at building android-natives. * Use OpenJDK because native build is broken without * Try OpenJDK 10 * Try openJDK 9 * Try openJDK11 again but "enable" the EE Module * OpenJDK 11 has no Java EE Module anymore. * Try to fix Android Header Generation * Fix invalid flag error with javac by removing empty quotes * Try to fix build of decode. * Remove jni generated headers from the repository. * Adjust .gitignore as those header files won't appear at that location anymore * Fix Android Build: Fill the jme3-android-native headers during the build of jme3-android. This works because jme3-android-native already depends on jme3-android. Due to technical reasons, the headers share the same location and thus the include directives have been adjusted slightly. * Copy jni headers to the jni directory. * Adjust the path slightly * Try to silence android sdk's license print out * Also fix openAL * Solve task name conflict * Really silence license now * Tasks seem shared but Strings are not... * Only build Android-Native * Trying to reduce the amount of dependencies needed. * Remove even more dependencies * Even more removal * Prepare Deployment * Fix Deployment * Cleanup: Remove feature branch from branches for travis. * Revert a few unnecessary things * Removed NDK Comments. * Bullet Android: Some cosmetic changes (removed commented debug code) and generate bullet-native headers during jme3-bullet compilation. * Fix Bullet Build by using GNU libstdc++ instead of STLPort (discontinued) * Fix Bullet-Native Compilation
This commit is contained in:
parent
194ae883c5
commit
1bde90d1a1
@ -30,7 +30,7 @@ matrix:
|
|||||||
before_script:
|
before_script:
|
||||||
- export ANDROID_NDK=$ANDROID_HOME/ndk-bundle
|
- export ANDROID_NDK=$ANDROID_HOME/ndk-bundle
|
||||||
script:
|
script:
|
||||||
- ./gradlew -PbuildNativeProjects=true jme3-android-native:assemble
|
- ./gradlew -PbuildNativeProjects=true jme3-android-native:assemble jme3-bullet-native-android:assemble
|
||||||
after_success:
|
after_success:
|
||||||
- '[ "$TRAVIS_PULL_REQUEST" == "false" ] && ./private/upload_native.sh || :'
|
- '[ "$TRAVIS_PULL_REQUEST" == "false" ] && ./private/upload_native.sh || :'
|
||||||
- '[ -n "$TRAVIS_TAG" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && ./gradlew bintrayUpload || :'
|
- '[ -n "$TRAVIS_TAG" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && ./gradlew bintrayUpload || :'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
String jmeBulletNativeProjectPath = '../jme3-bullet-native'
|
String jmeBulletNativeProjectPath = project(":jme3-bullet-native").projectDir
|
||||||
|
|
||||||
String localUnzipPath = jmeBulletNativeProjectPath
|
String localUnzipPath = jmeBulletNativeProjectPath
|
||||||
String localZipFile = jmeBulletNativeProjectPath + File.separator + bulletZipFile
|
String localZipFile = jmeBulletNativeProjectPath + File.separator + bulletZipFile
|
||||||
@ -24,7 +24,7 @@ dependencies {
|
|||||||
compile project(':jme3-bullet')
|
compile project(':jme3-bullet')
|
||||||
}
|
}
|
||||||
|
|
||||||
// Java source sets for IDE acces and source jar bundling / mavenization
|
// Java source sets for IDE access and source jar bundling / mavenization
|
||||||
sourceSets {
|
sourceSets {
|
||||||
main {
|
main {
|
||||||
java {
|
java {
|
||||||
@ -42,70 +42,41 @@ task downloadBullet(type: MyDownload) {
|
|||||||
|
|
||||||
// Unzip bullet if not available
|
// Unzip bullet if not available
|
||||||
task unzipBullet(type: Copy) {
|
task unzipBullet(type: Copy) {
|
||||||
def zipFile = file(localZipFile)
|
from zipTree(localZipFile)
|
||||||
def outputDir = file(localUnzipPath)
|
into file(localUnzipPath)
|
||||||
// println "unzipBullet zipFile = " + zipFile.absolutePath
|
|
||||||
// println "unzipBullet outputDir = " + outputDir.absolutePath
|
|
||||||
|
|
||||||
from zipTree(zipFile)
|
|
||||||
into outputDir
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unzipBullet.dependsOn {
|
unzipBullet.dependsOn {
|
||||||
def zipFile = file(localZipFile)
|
if (!file(localZipFile).exists()) {
|
||||||
// println "zipFile path: " + zipFile.absolutePath
|
|
||||||
// println "zipFile exists: " + zipFile.exists()
|
|
||||||
|
|
||||||
if (!zipFile.exists()) {
|
|
||||||
downloadBullet
|
downloadBullet
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy Bullet files to jni directory
|
// Copy Bullet files to jni directory
|
||||||
task copyBullet(type: Copy) {
|
task copyBullet(type: Copy) {
|
||||||
def sourceDir = file(bulletSrcPath)
|
from file(bulletSrcPath)
|
||||||
def outputDir = new File(jniPath)
|
into file(jniPath)
|
||||||
// println "copyBullet sourceDir = " + sourceDir
|
|
||||||
// println "copyBullet outputDir = " + outputDir
|
|
||||||
|
|
||||||
from sourceDir
|
|
||||||
into outputDir
|
|
||||||
}
|
}
|
||||||
|
|
||||||
copyBullet.dependsOn {
|
copyBullet.dependsOn {
|
||||||
def bulletUnzipDir = file(localZipFolder)
|
if (!file(localZipFolder).isDirectory()) {
|
||||||
// println "bulletUnzipDir: " + bulletUnzipDir.absolutePath
|
|
||||||
// println "bulletUnzipDir exists: " + bulletUnzipDir.exists()
|
|
||||||
// println "bulletUnzipDir isDirectory: " + bulletUnzipDir.isDirectory()
|
|
||||||
if (!bulletUnzipDir.isDirectory()) {
|
|
||||||
unzipBullet
|
unzipBullet
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy jME cpp native files to jni directory
|
// Copy jME cpp native files to jni directory
|
||||||
task copyJmeCpp(type: Copy) {
|
task copyJmeCpp(type: Copy) {
|
||||||
def sourceDir = new File(jmeCppPath)
|
from file(jmeCppPath)
|
||||||
def outputDir = new File(jniPath)
|
into file(jniPath)
|
||||||
// println "copyJmeCpp sourceDir = " + sourceDir
|
|
||||||
// println "copyJmeCpp outputDir = " + outputDir
|
|
||||||
|
|
||||||
from sourceDir
|
|
||||||
into outputDir
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy jME android native files to jni directory
|
// Copy jME android native files to jni directory
|
||||||
task copyJmeAndroid(type: Copy) {
|
task copyJmeAndroid(type: Copy) {
|
||||||
def sourceDir = new File(jmeAndroidPath)
|
from file(jmeAndroidPath)
|
||||||
def outputDir = new File(jniPath)
|
into file(jniPath)
|
||||||
// println "copyJmeAndroid sourceDir = " + sourceDir
|
|
||||||
// println "copyJmeAndroid outputDir = " + outputDir
|
|
||||||
|
|
||||||
from sourceDir
|
|
||||||
into outputDir
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//dependsOn ':jme3-bullet:generateNativeHeaders'
|
task buildBulletNativeLib(type: Exec, dependsOn: [copyJmeAndroid, ':jme3-bullet:compileJava', copyJmeCpp, copyBullet]) {
|
||||||
task buildBulletNativeLib(type: Exec, dependsOn: [copyJmeAndroid, ':jme3-bullet:generateNativeHeaders', copyJmeCpp, copyBullet]) {
|
|
||||||
// args 'TARGET_PLATFORM=android-9'
|
// args 'TARGET_PLATFORM=android-9'
|
||||||
// println "buildBulletNativeLib ndkWorkingPath: " + ndkWorkingPath
|
// println "buildBulletNativeLib ndkWorkingPath: " + ndkWorkingPath
|
||||||
// println "buildBulletNativeLib rootProject.ndkCommandPath: " + rootProject.ndkCommandPath
|
// println "buildBulletNativeLib rootProject.ndkCommandPath: " + rootProject.ndkCommandPath
|
||||||
@ -114,26 +85,20 @@ task buildBulletNativeLib(type: Exec, dependsOn: [copyJmeAndroid, ':jme3-bullet:
|
|||||||
args "-j" + Runtime.runtime.availableProcessors()
|
args "-j" + Runtime.runtime.availableProcessors()
|
||||||
}
|
}
|
||||||
|
|
||||||
//task updatePreCompiledBulletLibs(type: Copy, dependsOn: generateNativeHeaders) {
|
/* The following two tasks: We store a prebuilt version in the repository, so nobody has to build
|
||||||
task updatePreCompiledBulletLibs(type: Copy, dependsOn: buildBulletNativeLib) {
|
* natives in order to build the engine. When building these natives however, the prebuilt libraries
|
||||||
def sourceDir = new File(ndkOutputPath)
|
* can be updated (which is what the CI does). That's what the following two tasks do
|
||||||
def outputDir = new File(bulletPreCompiledLibsDir)
|
*/
|
||||||
// println "updatePreCompiledBulletLibs sourceDir: " + sourceDir
|
|
||||||
// println "updatePreCompiledBulletLibs outputDir: " + outputDir
|
|
||||||
|
|
||||||
from sourceDir
|
task updatePreCompiledBulletLibs(type: Copy, dependsOn: buildBulletNativeLib) {
|
||||||
into outputDir
|
from file(ndkOutputPath)
|
||||||
|
into file(bulletPreCompiledLibsDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy pre-compiled libs to build directory (when not building new libs)
|
// Copy pre-compiled libs to build directory (when not building new libs)
|
||||||
task copyPreCompiledBulletLibs(type: Copy) {
|
task copyPreCompiledBulletLibs(type: Copy) {
|
||||||
def sourceDir = new File(bulletPreCompiledLibsDir)
|
from file(bulletPreCompiledLibsDir)
|
||||||
def outputDir = new File(ndkOutputPath)
|
into file(ndkOutputPath)
|
||||||
// println "copyPreCompiledBulletLibs sourceDir: " + sourceDir
|
|
||||||
// println "copyPreCompiledBulletLibs outputDir: " + outputDir
|
|
||||||
|
|
||||||
from sourceDir
|
|
||||||
into outputDir
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ndkExists is a boolean from the build.gradle in the root project
|
// ndkExists is a boolean from the build.gradle in the root project
|
||||||
@ -149,7 +114,7 @@ if (ndkExists && buildNativeProjects == "true") {
|
|||||||
jar.into("lib") { from ndkOutputPath }
|
jar.into("lib") { from ndkOutputPath }
|
||||||
|
|
||||||
|
|
||||||
// Helper class to wrap ant dowload task
|
// Helper class to wrap ant download task
|
||||||
class MyDownload extends DefaultTask {
|
class MyDownload extends DefaultTask {
|
||||||
@Input
|
@Input
|
||||||
String sourceUrl
|
String sourceUrl
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
APP_OPTIM := release
|
APP_OPTIM := release
|
||||||
APP_ABI := all
|
APP_ABI := all
|
||||||
APP_STL := stlport_static
|
# Used to be stlport_static, but that has been removed.
|
||||||
# gnustl_static or stlport_static
|
APP_STL := c++_static
|
||||||
APP_MODULES := bulletjme
|
APP_MODULES := bulletjme
|
||||||
APP_CFLAGS += -funroll-loops -Ofast
|
APP_CFLAGS += -funroll-loops -Ofast
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ model {
|
|||||||
|
|
||||||
tasks.all {
|
tasks.all {
|
||||||
dependsOn unzipBulletIfNeeded
|
dependsOn unzipBulletIfNeeded
|
||||||
dependsOn ':jme3-bullet:generateNativeHeaders'
|
dependsOn ':jme3-bullet:compileJava'
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add output to jar file
|
// Add output to jar file
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
|
apply plugin: 'java'
|
||||||
|
|
||||||
if (!hasProperty('mainClass')) {
|
if (!hasProperty('mainClass')) {
|
||||||
ext.mainClass = ''
|
ext.mainClass = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
String classBuildDir = "${buildDir}" + File.separator + 'classes'
|
String classBuildDir = "${buildDir}" + File.separator + 'classes'
|
||||||
|
def nativeIncludes = new File(project(":jme3-bullet-native").projectDir, "src/native/cpp")
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
main {
|
main {
|
||||||
@ -18,22 +21,7 @@ dependencies {
|
|||||||
compile project(':jme3-terrain')
|
compile project(':jme3-terrain')
|
||||||
}
|
}
|
||||||
|
|
||||||
task generateNativeHeaders(type: Exec, dependsOn: classes) {
|
compileJava {
|
||||||
def files0 = fileTree("src/main/java/").filter { it.isFile() && it.getName().endsWith(".java") }.files
|
// The Android-Native Project requires the jni headers to be generated, so we do that here
|
||||||
def files1 = fileTree("src/common/java/").filter { it.isFile() && it.getName().endsWith(".java") }.files
|
options.compilerArgs += ["-h", nativeIncludes]
|
||||||
def files2 = fileTree("../jme3-core/src/main/java/").filter { it.isFile() && it.getName().endsWith(".java") }.files
|
|
||||||
def files3 = fileTree("../jme3-core/src/plugins/java/").filter { it.isFile() && it.getName().endsWith(".java") }.files
|
|
||||||
def files4 = fileTree("../jme3-core/src/tools/java/").filter { it.isFile() && it.getName().endsWith(".java") }.files
|
|
||||||
def files5 = fileTree("../jme3-terrain/src/main/java/").filter { it.isFile() && it.getName().endsWith(".java") }.files
|
|
||||||
def classpath = sourceSets.main.runtimeClasspath.asPath
|
|
||||||
def nativeIncludes = new File(project(":jme3-bullet-native").projectDir, "src/native/cpp")
|
|
||||||
def filesList = "\"" + files0.join("\"\n\"") + "\"\n\"" + files1.join("\"\n\"") + "\"\n\"" + files2.join("\"\n\"") + "\"\n\"" + files3.join("\"\n\"") + "\"\n\"" + files4.join("\"\n\"") + "\"\n\"" + files5.join("\"\n\"") + "\""
|
|
||||||
new File("$projectDir/java_classes.jtxt").text = filesList.replaceAll(java.util.regex.Pattern.quote("\\"), java.util.regex.Matcher.quoteReplacement("/"))
|
|
||||||
executable org.gradle.internal.jvm.Jvm.current().getExecutable('javac')
|
|
||||||
args "-h", nativeIncludes
|
|
||||||
args "@$projectDir/java_classes.jtxt"
|
|
||||||
args '-d', classBuildDir
|
|
||||||
args "-encoding", "UTF-8"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assemble.dependsOn(generateNativeHeaders)
|
|
Loading…
x
Reference in New Issue
Block a user