Store prebuild libraries outside the source folder, download prebuilt libraries from bintray

fix-openal-soft-deadlink
Riccardo Balbo 5 years ago committed by Riccardo Balbo
parent 8a6bd1947c
commit 88e9c8482c
  1. 12
      .gitignore
  2. 66
      build.gradle
  3. 5
      gradle.properties
  4. 3
      jme3-android-native/decode.gradle
  5. BIN
      jme3-android-native/libs/decode/arm64-v8a/libdecodejme.so
  6. BIN
      jme3-android-native/libs/decode/armeabi-v7a/libdecodejme.so
  7. BIN
      jme3-android-native/libs/decode/armeabi/libdecodejme.so
  8. BIN
      jme3-android-native/libs/decode/mips/libdecodejme.so
  9. BIN
      jme3-android-native/libs/decode/mips64/libdecodejme.so
  10. BIN
      jme3-android-native/libs/decode/x86/libdecodejme.so
  11. BIN
      jme3-android-native/libs/decode/x86_64/libdecodejme.so
  12. BIN
      jme3-android-native/libs/openalsoft/arm64-v8a/libopenalsoftjme.so
  13. BIN
      jme3-android-native/libs/openalsoft/armeabi-v7a/libopenalsoftjme.so
  14. BIN
      jme3-android-native/libs/openalsoft/armeabi/libopenalsoftjme.so
  15. BIN
      jme3-android-native/libs/openalsoft/mips/libopenalsoftjme.so
  16. BIN
      jme3-android-native/libs/openalsoft/mips64/libopenalsoftjme.so
  17. BIN
      jme3-android-native/libs/openalsoft/x86/libopenalsoftjme.so
  18. BIN
      jme3-android-native/libs/openalsoft/x86_64/libopenalsoftjme.so
  19. 3
      jme3-android-native/openalsoft.gradle
  20. 3
      jme3-bullet-native-android/build.gradle
  21. BIN
      jme3-bullet-native-android/libs/arm64-v8a/libbulletjme.so
  22. BIN
      jme3-bullet-native-android/libs/armeabi-v7a/libbulletjme.so
  23. BIN
      jme3-bullet-native-android/libs/armeabi/libbulletjme.so
  24. BIN
      jme3-bullet-native-android/libs/mips/libbulletjme.so
  25. BIN
      jme3-bullet-native-android/libs/mips64/libbulletjme.so
  26. BIN
      jme3-bullet-native-android/libs/x86/libbulletjme.so
  27. BIN
      jme3-bullet-native-android/libs/x86_64/libbulletjme.so
  28. 21
      jme3-bullet-native/build.gradle
  29. BIN
      jme3-bullet-native/libs/native/linux/x86/libbulletjme.so
  30. BIN
      jme3-bullet-native/libs/native/linux/x86_64/libbulletjme.so
  31. BIN
      jme3-bullet-native/libs/native/osx/x86/libbulletjme.dylib
  32. BIN
      jme3-bullet-native/libs/native/osx/x86_64/libbulletjme.dylib
  33. BIN
      jme3-bullet-native/libs/native/windows/x86/bulletjme.dll
  34. BIN
      jme3-bullet-native/libs/native/windows/x86_64/bulletjme.dll

12
.gitignore vendored

@ -34,12 +34,6 @@
/jme3-android-native/src/native/jme_decode/STBI/ /jme3-android-native/src/native/jme_decode/STBI/
/jme3-android-native/src/native/jme_decode/Tremor/ /jme3-android-native/src/native/jme_decode/Tremor/
/jme3-android-native/stb_image.h /jme3-android-native/stb_image.h
!/jme3-bullet-native/libs/native/windows/x86_64/bulletjme.dll
!/jme3-bullet-native/libs/native/windows/x86/bulletjme.dll
!/jme3-bullet-native/libs/native/osx/x86/libbulletjme.dylib
!/jme3-bullet-native/libs/native/osx/x86_64/libbulletjme.dylib
!/jme3-bullet-native/libs/native/linux/x86/libbulletjme.so
!/jme3-bullet-native/libs/native/linux/x86_64/libbulletjme.so
/jme3-examples/private/ /jme3-examples/private/
!/jme3-vr/src/main/resources/**/*.dylib !/jme3-vr/src/main/resources/**/*.dylib
!/jme3-vr/src/main/resources/**/*.so !/jme3-vr/src/main/resources/**/*.so
@ -47,4 +41,8 @@
!/jme3-vr/src/main/resources/**/*.dll !/jme3-vr/src/main/resources/**/*.dll
!/jme3-vr/src/main/resources/**/*.pdb !/jme3-vr/src/main/resources/**/*.pdb
/buildMaven.bat /buildMaven.bat
/private
.travis.yml
appveyor.yml
javadoc_deploy
javadoc_deploy.pub

@ -1,3 +1,6 @@
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
buildscript { buildscript {
repositories { repositories {
google() google()
@ -146,6 +149,69 @@ task configureAndroidNDK {
} }
} }
gradle.rootProject.ext.set("usePrebuildNatives", buildNativeProjects!="true");
if(skipPrebuildLibraries!="true"&&buildNativeProjects!="true"){
String rootPath = rootProject.projectDir.absolutePath
Properties nativesSnasphotProp = new Properties()
File nativesSnasphotPropF=new File("${rootPath}/natives-snapshot.properties");
if(nativesSnasphotPropF.exists()){
nativesSnasphotPropF.withInputStream { nativesSnasphotProp.load(it) }
String nativesSnasphot=nativesSnasphotProp.getProperty("natives.snapshot");
String nativesUrl=PREBUILD_NATIVES_URL.replace('${natives.snapshot}',nativesSnasphot)
println "Use natives snapshot: "+nativesUrl
String nativesZipFile="${rootPath}" + File.separator + "build"+ File.separator +nativesSnasphot+"-natives.zip"
String nativesPath="${rootPath}" + File.separator + "build"+ File.separator +"native"
build.dependsOn('getPrebuiltNatives')
task getPrebuiltNatives() {
doFirst {
File target = file(nativesZipFile);
if (!target.exists()) {
println("Download natives from "+nativesUrl+" to "+nativesZipFile);
target.getParentFile().mkdirs();
ant.get(src: nativesUrl, dest: target);
}
for(File src : zipTree(nativesZipFile)){
String srcRel=src.getAbsolutePath().substring((int)(nativesZipFile.length()+1));
srcRel=srcRel.substring(srcRel.indexOf("/")+1);
File dest=new File(nativesPath+File.separator+srcRel);
boolean include=false;
if(!dest.exists()){
include=true;
println("Copy "+src+" "+dest+ ". Destination does not exist");
}else if(dest.lastModified()<src.lastModified()){
include=true;
println("Copy "+src+" "+dest+ ". Source is newer. src "+src.lastModified()+ " dest "+dest.lastModified());
}
else{
println(""+dest+" Up to date. Skip.");
}
if(include){
dest.getParentFile().mkdirs();
Files.copy(src.toPath(), dest.toPath(), StandardCopyOption.REPLACE_EXISTING);
}
}
}
}
}
}
//class IncrementalReverseTask extends DefaultTask { //class IncrementalReverseTask extends DefaultTask {
// @InputDirectory // @InputDirectory
// def File inputDir // def File inputDir

@ -15,7 +15,8 @@ buildNativeProjects = false
buildAndroidExamples = false buildAndroidExamples = false
buildForPlatforms = Linux64,Linux32,Windows64,Windows32,Mac64,Mac32 buildForPlatforms = Linux64,Linux32,Windows64,Windows32,Mac64,Mac32
# Forcefully ignore prebuilt libraries
skipPrebuildLibraries=false
# Path to android NDK for building native libraries # Path to android NDK for building native libraries
#ndkPath=/Users/normenhansen/Documents/Code-Import/android-ndk-r7 #ndkPath=/Users/normenhansen/Documents/Code-Import/android-ndk-r7
ndkPath = /opt/android-ndk-r16b ndkPath = /opt/android-ndk-r16b
@ -40,3 +41,5 @@ POM_INCEPTION_YEAR=2009
# Bintray settings to override in $HOME/.gradle/gradle.properties or ENV or commandline # Bintray settings to override in $HOME/.gradle/gradle.properties or ENV or commandline
bintray_user= bintray_user=
bintray_api_key= bintray_api_key=
PREBUILD_NATIVES_URL=https://dl.bintray.com/riccardoblsandbox/jmonkeyengine-files/${natives.snapshot}/jme3-natives.zip

@ -8,7 +8,8 @@ String decodeBuildJniDir = decodeBuildDir + File.separator + 'jni'
String decodeBuildLibsDir = decodeBuildDir + File.separator + 'libs' String decodeBuildLibsDir = decodeBuildDir + File.separator + 'libs'
// Pre-compiled libs directory // Pre-compiled libs directory
String decodePreCompiledLibsDir = 'libs' + File.separator + 'decode' def rootPath = rootProject.projectDir.absolutePath
String decodePreCompiledLibsDir = rootPath + File.separator + 'build' + File.separator + 'native' + File.separator + 'android' + File.separator + 'decode'
// jME Android Native source files path // jME Android Native source files path
String decodeSourceDir = 'src/native/jme_decode' String decodeSourceDir = 'src/native/jme_decode'

@ -14,7 +14,8 @@ String openalsoftBuildJniDir = openalsoftBuildDir + File.separator + 'jni'
String openalsoftBuildLibsDir = openalsoftBuildDir + File.separator + 'libs' String openalsoftBuildLibsDir = openalsoftBuildDir + File.separator + 'libs'
//Pre-compiled libs directory //Pre-compiled libs directory
String openalsoftPreCompiledLibsDir = 'libs' + File.separator + 'openalsoft' def rootPath = rootProject.projectDir.absolutePath
String openalsoftPreCompiledLibsDir = rootPath + File.separator + 'build' + File.separator + 'native' + File.separator + 'android' + File.separator + 'openalsoft'
// jME Android Native source files path // jME Android Native source files path
String openalsoftJmeAndroidPath = 'src/native/jme_openalsoft' String openalsoftJmeAndroidPath = 'src/native/jme_openalsoft'

@ -14,7 +14,8 @@ String jniPath = ndkWorkingPath + '/jni'
String ndkOutputPath = ndkWorkingPath + '/libs' String ndkOutputPath = ndkWorkingPath + '/libs'
//Pre-compiled libs directory //Pre-compiled libs directory
String bulletPreCompiledLibsDir = 'libs' def rootPath = rootProject.projectDir.absolutePath
String bulletPreCompiledLibsDir = rootPath + File.separator + 'build' + File.separator + 'native' + File.separator + 'android' + File.separator + 'bullet'
if (!hasProperty('mainClass')) { if (!hasProperty('mainClass')) {
ext.mainClass = '' ext.mainClass = ''

@ -43,12 +43,17 @@ model {
"LinuxArm64" "LinuxArm64"
]; ];
String[] filter=buildForPlatforms.split(","); String[] filter=gradle.rootProject.ext.usePrebuildNatives==true?null:buildForPlatforms.split(",");
if(filter==null)println("No filter set. build for all");
for(String target:targets){ for(String target:targets){
for(String f:filter){ if(filter==null){
if(f.equals(target)){ targetPlatform(target);
targetPlatform(target); }else{
break; for(String f:filter){
if(f.equals(target)){
targetPlatform(target);
break;
}
} }
} }
} }
@ -115,7 +120,7 @@ model {
binaries { binaries {
withType(SharedLibraryBinarySpec) { withType(SharedLibraryBinarySpec) {
def projectPath = project.projectDir.absolutePath def rootPath = rootProject.projectDir.absolutePath
def javaHome = org.gradle.internal.jvm.Jvm.current().javaHome def javaHome = org.gradle.internal.jvm.Jvm.current().javaHome
def os = targetPlatform.operatingSystem.name def os = targetPlatform.operatingSystem.name
def arch = targetPlatform.architecture.name def arch = targetPlatform.architecture.name
@ -139,7 +144,7 @@ model {
} }
} else { } else {
// Get from libs folder if no fresh build is available in the build folder and add to jar file // Get from libs folder if no fresh build is available in the build folder and add to jar file
def precompiledFile = Paths.get(projectPath, 'libs', 'native', os, arch, fileName).toFile() def precompiledFile = Paths.get(rootPath, 'build', 'native', 'bullet', os, arch, fileName).toFile()
if (precompiledFile.exists()) { if (precompiledFile.exists()) {
jar.into("native/${os}/${arch}") { jar.into("native/${os}/${arch}") {
from precompiledFile from precompiledFile
@ -203,7 +208,7 @@ model {
// Add output to libs folder // Add output to libs folder
task "copyBinaryToLibs${targetPlatform.name}"(type: Copy, dependsOn: tasks) { task "copyBinaryToLibs${targetPlatform.name}"(type: Copy, dependsOn: tasks) {
from sharedLibraryFile from sharedLibraryFile
into "libs/native/${os}/${arch}" into "${rootPath}/build/native/bullet/${os}/${arch}"
} }
// Add depend on copy // Add depend on copy
jar.dependsOn("copyBinaryToLibs${targetPlatform.name}") jar.dependsOn("copyBinaryToLibs${targetPlatform.name}")

Loading…
Cancel
Save