Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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 .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"editor.formatOnPaste": false,
"editor.formatOnType": false,
"editor.formatOnSave": false,
"java.jdt.ls.vmargs": "-Xms512M -Xmx2G -XX:+UseG1GC -XX:+UseStringDeduplication -XX:AdaptiveSizePolicyWeight=90"
"java.jdt.ls.vmargs": "-Xms512M -Xmx4G -XX:+UseG1GC -XX:+UseStringDeduplication -XX:AdaptiveSizePolicyWeight=90"
}
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,18 @@ You can optionally use the `-Pexample` property to specify an example to start w
./gradlew runExamples -Pexample=jme3test.light.pbr.TestPBRSimple
```

### Android examples

You can run the Android examples on a local android emulator with:

```bash
./gradlew -PbuildAndroidExamples=true -PbuildNativeProjects=true runAndroidExamples
# or for a specific example:
# ./gradlew -PbuildAndroidExamples=true -PbuildNativeProjects=true runAndroidExamples -Pexample=jme3test.post.TestBloom
```

*Make sure to have the SDK and NDK installed and configured properly, and the emulator running before executing the command.*


## Running Tests

Expand Down
53 changes: 46 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -182,17 +182,56 @@ task configureAndroidNDK {
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
def ndkCandidates = []
if (System.env.ANDROID_NDK) {
ndkCandidates << file(System.env.ANDROID_NDK)
}
if (System.env.ANDROID_NDK_HOME) {
ndkCandidates << file(System.env.ANDROID_NDK_HOME)
}
if (project.hasProperty('ndkPath') && ndkPath) {
ndkCandidates << file(ndkPath)
}

if (new File(ndkBuildPath).exists()) {
def localProperties = file('local.properties')
if (localProperties.isFile()) {
Properties properties = new Properties()
localProperties.withInputStream { properties.load(it) }
if (properties.getProperty('ndk.dir')) {
ndkCandidates << file(properties.getProperty('ndk.dir'))
}
if (properties.getProperty('sdk.dir')) {
ndkCandidates.addAll(findAndroidNdkDirs(file(properties.getProperty('sdk.dir'))))
}
}

if (System.env.ANDROID_HOME) {
ndkCandidates.addAll(findAndroidNdkDirs(file(System.env.ANDROID_HOME)))
}
if (System.env.ANDROID_SDK_ROOT) {
ndkCandidates.addAll(findAndroidNdkDirs(file(System.env.ANDROID_SDK_ROOT)))
}
ndkCandidates.addAll(findAndroidNdkDirs(file("${System.properties['user.home']}/Android/Sdk")))

def ndkBuildPath = ndkCandidates.collect { new File(it, ndkBuildFile) }.find { it.isFile() }
if (ndkBuildPath != null) {
ndkExists = true
ndkCommandPath = ndkBuildPath
ndkCommandPath = ndkBuildPath.absolutePath
}
}

def findAndroidNdkDirs(File sdkDir) {
def ndkDirs = []
def nestedSdkDir = new File(sdkDir, 'Sdk')
if (nestedSdkDir.isDirectory()) {
ndkDirs.addAll(findAndroidNdkDirs(nestedSdkDir))
}
def sideBySideDir = new File(sdkDir, 'ndk')
if (sideBySideDir.isDirectory()) {
ndkDirs.addAll(sideBySideDir.listFiles()?.findAll { it.isDirectory() }?.sort { a, b -> b.name <=> a.name } ?: [])
}
ndkDirs << new File(sdkDir, 'ndk-bundle')
return ndkDirs
}

gradle.rootProject.ext.set("usePrebuildNatives", buildNativeProjects!="true");
Expand Down
2 changes: 1 addition & 1 deletion common-android-app.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ version = jmeFullVersion
repositories {
mavenCentral()
maven {
url "http://nifty-gui.sourceforge.net/nifty-maven-repo"
url "https://nifty-gui.sourceforge.net/nifty-maven-repo"
}
}
2 changes: 2 additions & 0 deletions common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ java {
targetCompatibility = JavaVersion.VERSION_1_8
}

apply from: rootProject.file('gradle/native-image-metadata.gradle')

tasks.withType(JavaCompile) { // compile-time options:
//options.compilerArgs << '-Xlint:deprecation' // to show deprecation warnings
options.compilerArgs << '-Xlint:unchecked'
Expand Down
4 changes: 3 additions & 1 deletion gradle/jacoco.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ reporting {

def jacocoSubprojects = subprojects.findAll { p ->
(p.file("src/main/java").exists() || p.file("src/main/groovy").exists()) &&
(p.file("src/test/java").exists() || p.file("src/test/groovy").exists())
(p.file("src/test/java").exists() || p.file("src/test/groovy").exists()) &&
p.tasks.findByName('test') &&
p.tasks.findByName('jacocoTestReport')
}

dependencies {
Expand Down
3 changes: 3 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ spotbugs = "4.9.8"
[libraries]

androidx-annotation = "androidx.annotation:annotation:1.7.1"
androidx-fragment = "androidx.fragment:fragment:1.8.9"
androidx-lifecycle-common = "androidx.lifecycle:lifecycle-common:2.7.0"
android-build-gradle = "com.android.tools.build:gradle:9.1.0"
android-support-appcompat = "com.android.support:appcompat-v7:28.0.0"
androidx-test-runner = "androidx.test:runner:1.7.0"
gradle-git = "org.ajoberstar:gradle-git:1.2.0"
groovy-test = "org.apache.groovy:groovy-test:4.0.31"
gson = "com.google.code.gson:gson:2.13.2"
Expand All @@ -23,6 +25,7 @@ jinput = "net.java.jinput:jinput:2.0.9"
jna = "net.java.dev.jna:jna:5.18.1"
jnaerator-runtime = "com.nativelibs4java:jnaerator-runtime:0.12"
junit-bom = "org.junit:junit-bom:5.13.4"
junit4 = "junit:junit:4.13.2"
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter" }
junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher" }
lwjgl2 = "org.jmonkeyengine:lwjgl:2.9.5"
Expand Down
Loading
Loading