Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
bbb4f9c
First attempt at building android-natives.
MeFisto94 Sep 9, 2019
d09e6b9
Use OpenJDK because native build is broken without
MeFisto94 Sep 9, 2019
9e25072
Try OpenJDK 10
MeFisto94 Sep 9, 2019
a1109dc
Try openJDK 9
MeFisto94 Sep 9, 2019
bdbdff9
Try openJDK11 again but "enable" the EE Module
MeFisto94 Sep 9, 2019
fb78b25
OpenJDK 11 has no Java EE Module anymore.
MeFisto94 Sep 9, 2019
db95af3
Try to fix Android Header Generation
MeFisto94 Sep 10, 2019
d9abed8
Fix invalid flag error with javac by removing empty quotes
MeFisto94 Sep 10, 2019
6ae69a8
Try to fix build of decode.
MeFisto94 Sep 10, 2019
00f2e24
Remove jni generated headers from the repository.
MeFisto94 Sep 10, 2019
62d385a
Adjust .gitignore as those header files won't appear at that location…
MeFisto94 Sep 10, 2019
701c2c1
Fix Android Build: Fill the jme3-android-native headers during the bu…
MeFisto94 Sep 10, 2019
0c00679
Copy jni headers to the jni directory.
MeFisto94 Sep 10, 2019
bdf8419
Adjust the path slightly
MeFisto94 Sep 10, 2019
b771da4
Try to silence android sdk's license print out
MeFisto94 Sep 10, 2019
f6043b7
Also fix openAL
MeFisto94 Sep 10, 2019
c90a754
Solve task name conflict
MeFisto94 Sep 10, 2019
523fc5a
Really silence license now
MeFisto94 Sep 10, 2019
cfec451
Tasks seem shared but Strings are not...
MeFisto94 Sep 10, 2019
8eab823
Only build Android-Native
MeFisto94 Sep 10, 2019
03c0d08
Trying to reduce the amount of dependencies needed.
MeFisto94 Sep 10, 2019
5b36109
Remove even more dependencies
MeFisto94 Sep 10, 2019
ce8a526
Even more removal
MeFisto94 Sep 10, 2019
cd187fa
Prepare Deployment
MeFisto94 Sep 10, 2019
bd49a53
Fix Deployment
MeFisto94 Sep 10, 2019
0ae70db
Cleanup: Remove feature branch from branches for travis.
MeFisto94 Sep 10, 2019
0ff27de
Revert a few unnecessary things
MeFisto94 Sep 13, 2019
ff3520c
Removed NDK Comments.
MeFisto94 Sep 13, 2019
5dcb59e
Bullet Android: Some cosmetic changes (removed commented debug code) …
MeFisto94 Sep 13, 2019
903f23f
Fix Bullet Build by using GNU libstdc++ instead of STLPort (discontin…
MeFisto94 Sep 14, 2019
0fd191a
Merge branch 'master' into travis/build-android-bullet
MeFisto94 Sep 14, 2019
4810c7d
Fix Bullet-Native Compilation
MeFisto94 Sep 14, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ matrix:
before_script:
- export ANDROID_NDK=$ANDROID_HOME/ndk-bundle
script:
- ./gradlew -PbuildNativeProjects=true jme3-android-native:assemble
- ./gradlew -PbuildNativeProjects=true jme3-android-native:assemble jme3-bullet-native-android:assemble
after_success:
- '[ "$TRAVIS_PULL_REQUEST" == "false" ] && ./private/upload_native.sh || :'
- '[ -n "$TRAVIS_TAG" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && ./gradlew bintrayUpload || :'
Expand Down
81 changes: 23 additions & 58 deletions jme3-bullet-native-android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
String jmeBulletNativeProjectPath = '../jme3-bullet-native'
String jmeBulletNativeProjectPath = project(":jme3-bullet-native").projectDir

String localUnzipPath = jmeBulletNativeProjectPath
String localZipFile = jmeBulletNativeProjectPath + File.separator + bulletZipFile
Expand All @@ -24,7 +24,7 @@ dependencies {
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 {
main {
java {
Expand All @@ -42,70 +42,41 @@ task downloadBullet(type: MyDownload) {

// Unzip bullet if not available
task unzipBullet(type: Copy) {
def zipFile = file(localZipFile)
def outputDir = file(localUnzipPath)
// println "unzipBullet zipFile = " + zipFile.absolutePath
// println "unzipBullet outputDir = " + outputDir.absolutePath

from zipTree(zipFile)
into outputDir
from zipTree(localZipFile)
into file(localUnzipPath)
}

unzipBullet.dependsOn {
def zipFile = file(localZipFile)
// println "zipFile path: " + zipFile.absolutePath
// println "zipFile exists: " + zipFile.exists()

if (!zipFile.exists()) {
if (!file(localZipFile).exists()) {
downloadBullet
}
}

// Copy Bullet files to jni directory
task copyBullet(type: Copy) {
def sourceDir = file(bulletSrcPath)
def outputDir = new File(jniPath)
// println "copyBullet sourceDir = " + sourceDir
// println "copyBullet outputDir = " + outputDir

from sourceDir
into outputDir
from file(bulletSrcPath)
into file(jniPath)
}

copyBullet.dependsOn {
def bulletUnzipDir = file(localZipFolder)
// println "bulletUnzipDir: " + bulletUnzipDir.absolutePath
// println "bulletUnzipDir exists: " + bulletUnzipDir.exists()
// println "bulletUnzipDir isDirectory: " + bulletUnzipDir.isDirectory()
if (!bulletUnzipDir.isDirectory()) {
if (!file(localZipFolder).isDirectory()) {
unzipBullet
}
}

// Copy jME cpp native files to jni directory
task copyJmeCpp(type: Copy) {
def sourceDir = new File(jmeCppPath)
def outputDir = new File(jniPath)
// println "copyJmeCpp sourceDir = " + sourceDir
// println "copyJmeCpp outputDir = " + outputDir

from sourceDir
into outputDir
from file(jmeCppPath)
into file(jniPath)
}

// Copy jME android native files to jni directory
task copyJmeAndroid(type: Copy) {
def sourceDir = new File(jmeAndroidPath)
def outputDir = new File(jniPath)
// println "copyJmeAndroid sourceDir = " + sourceDir
// println "copyJmeAndroid outputDir = " + outputDir

from sourceDir
into outputDir
from file(jmeAndroidPath)
into file(jniPath)
}

//dependsOn ':jme3-bullet:generateNativeHeaders'
task buildBulletNativeLib(type: Exec, dependsOn: [copyJmeAndroid, ':jme3-bullet:generateNativeHeaders', copyJmeCpp, copyBullet]) {
task buildBulletNativeLib(type: Exec, dependsOn: [copyJmeAndroid, ':jme3-bullet:compileJava', copyJmeCpp, copyBullet]) {
// args 'TARGET_PLATFORM=android-9'
// println "buildBulletNativeLib ndkWorkingPath: " + ndkWorkingPath
// println "buildBulletNativeLib rootProject.ndkCommandPath: " + rootProject.ndkCommandPath
Expand All @@ -114,26 +85,20 @@ task buildBulletNativeLib(type: Exec, dependsOn: [copyJmeAndroid, ':jme3-bullet:
args "-j" + Runtime.runtime.availableProcessors()
}

//task updatePreCompiledBulletLibs(type: Copy, dependsOn: generateNativeHeaders) {
task updatePreCompiledBulletLibs(type: Copy, dependsOn: buildBulletNativeLib) {
def sourceDir = new File(ndkOutputPath)
def outputDir = new File(bulletPreCompiledLibsDir)
// println "updatePreCompiledBulletLibs sourceDir: " + sourceDir
// println "updatePreCompiledBulletLibs outputDir: " + outputDir
/* The following two tasks: We store a prebuilt version in the repository, so nobody has to build
* natives in order to build the engine. When building these natives however, the prebuilt libraries
* can be updated (which is what the CI does). That's what the following two tasks do
*/

from sourceDir
into outputDir
task updatePreCompiledBulletLibs(type: Copy, dependsOn: buildBulletNativeLib) {
from file(ndkOutputPath)
into file(bulletPreCompiledLibsDir)
}

// Copy pre-compiled libs to build directory (when not building new libs)
task copyPreCompiledBulletLibs(type: Copy) {
def sourceDir = new File(bulletPreCompiledLibsDir)
def outputDir = new File(ndkOutputPath)
// println "copyPreCompiledBulletLibs sourceDir: " + sourceDir
// println "copyPreCompiledBulletLibs outputDir: " + outputDir

from sourceDir
into outputDir
from file(bulletPreCompiledLibsDir)
into file(ndkOutputPath)
}

// ndkExists is a boolean from the build.gradle in the root project
Expand All @@ -149,7 +114,7 @@ if (ndkExists && buildNativeProjects == "true") {
jar.into("lib") { from ndkOutputPath }


// Helper class to wrap ant dowload task
// Helper class to wrap ant download task
class MyDownload extends DefaultTask {
@Input
String sourceUrl
Expand Down
4 changes: 2 additions & 2 deletions jme3-bullet-native-android/src/native/android/Application.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
APP_OPTIM := release
APP_ABI := all
APP_STL := stlport_static
# gnustl_static or stlport_static
# Used to be stlport_static, but that has been removed.
APP_STL := c++_static
APP_MODULES := bulletjme
APP_CFLAGS += -funroll-loops -Ofast

2 changes: 1 addition & 1 deletion jme3-bullet-native/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ model {

tasks.all {
dependsOn unzipBulletIfNeeded
dependsOn ':jme3-bullet:generateNativeHeaders'
dependsOn ':jme3-bullet:compileJava'
}

// Add output to jar file
Expand Down
24 changes: 6 additions & 18 deletions jme3-bullet/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
apply plugin: 'java'

if (!hasProperty('mainClass')) {
ext.mainClass = ''
}

String classBuildDir = "${buildDir}" + File.separator + 'classes'
def nativeIncludes = new File(project(":jme3-bullet-native").projectDir, "src/native/cpp")

sourceSets {
main {
Expand All @@ -18,22 +21,7 @@ dependencies {
compile project(':jme3-terrain')
}

task generateNativeHeaders(type: Exec, dependsOn: classes) {
def files0 = fileTree("src/main/java/").filter { it.isFile() && it.getName().endsWith(".java") }.files
def files1 = fileTree("src/common/java/").filter { it.isFile() && it.getName().endsWith(".java") }.files
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"
compileJava {
// The Android-Native Project requires the jni headers to be generated, so we do that here
options.compilerArgs += ["-h", nativeIncludes]
}

assemble.dependsOn(generateNativeHeaders)