diff options
Diffstat (limited to 'platform/android/java')
-rw-r--r-- | platform/android/java/app/build.gradle | 8 | ||||
-rw-r--r-- | platform/android/java/app/gradle.properties | 4 | ||||
-rw-r--r-- | platform/android/java/app/settings.gradle | 2 | ||||
-rw-r--r-- | platform/android/java/app/src/com/godot/game/GodotApp.java | 2 | ||||
-rw-r--r-- | platform/android/java/build.gradle | 14 | ||||
-rw-r--r-- | platform/android/java/gradle.properties | 2 | ||||
-rw-r--r-- | platform/android/java/lib/src/org/godotengine/godot/Godot.java | 17 |
7 files changed, 29 insertions, 20 deletions
diff --git a/platform/android/java/app/build.gradle b/platform/android/java/app/build.gradle index 63b10e62b1..01b148aeef 100644 --- a/platform/android/java/app/build.gradle +++ b/platform/android/java/app/build.gradle @@ -50,7 +50,7 @@ dependencies { } else if (rootProject.findProject(":godot:lib")) { implementation project(":godot:lib") } else { - // Custom build mode. In this scenario this project is the only one around and the Godot + // Godot gradle build mode. In this scenario this project is the only one around and the Godot // library is available through the pre-generated godot-lib.*.aar android archive files. debugImplementation fileTree(dir: 'libs/debug', include: ['*.jar', '*.aar']) devImplementation fileTree(dir: 'libs/dev', include: ['*.jar', '*.aar']) @@ -153,7 +153,7 @@ android { debug { // Signing and zip-aligning are skipped for prebuilt builds, but - // performed for custom builds. + // performed for Godot gradle builds. zipAlignEnabled shouldZipAlign() if (shouldSign()) { signingConfig signingConfigs.debug @@ -165,7 +165,7 @@ android { dev { initWith debug // Signing and zip-aligning are skipped for prebuilt builds, but - // performed for custom builds. + // performed for Godot gradle builds. zipAlignEnabled shouldZipAlign() if (shouldSign()) { signingConfig signingConfigs.debug @@ -176,7 +176,7 @@ android { release { // Signing and zip-aligning are skipped for prebuilt builds, but - // performed for custom builds. + // performed for Godot gradle builds. zipAlignEnabled shouldZipAlign() if (shouldSign()) { signingConfig signingConfigs.release diff --git a/platform/android/java/app/gradle.properties b/platform/android/java/app/gradle.properties index 0ad8e611ca..d9f79b6818 100644 --- a/platform/android/java/app/gradle.properties +++ b/platform/android/java/app/gradle.properties @@ -1,5 +1,5 @@ -# Godot custom build Gradle settings. -# These properties apply when running custom build from the Godot editor. +# Godot gradle build settings. +# These properties apply when running a gradle build from the Godot editor. # NOTE: This should be kept in sync with 'godot/platform/android/java/gradle.properties' except # where otherwise specified. diff --git a/platform/android/java/app/settings.gradle b/platform/android/java/app/settings.gradle index ba53aefe7f..b4524a3f60 100644 --- a/platform/android/java/app/settings.gradle +++ b/platform/android/java/app/settings.gradle @@ -1,4 +1,4 @@ -// This is the root directory of the Godot custom build. +// This is the root directory of the Godot Android gradle build. pluginManagement { apply from: 'config.gradle' diff --git a/platform/android/java/app/src/com/godot/game/GodotApp.java b/platform/android/java/app/src/com/godot/game/GodotApp.java index a43e289b6b..1d2cc05715 100644 --- a/platform/android/java/app/src/com/godot/game/GodotApp.java +++ b/platform/android/java/app/src/com/godot/game/GodotApp.java @@ -35,7 +35,7 @@ import org.godotengine.godot.FullScreenGodotApp; import android.os.Bundle; /** - * Template activity for Godot Android custom builds. + * Template activity for Godot Android builds. * Feel free to extend and modify this class for your custom logic. */ public class GodotApp extends FullScreenGodotApp { diff --git a/platform/android/java/build.gradle b/platform/android/java/build.gradle index 5a91e5ce32..cffe0a33d9 100644 --- a/platform/android/java/build.gradle +++ b/platform/android/java/build.gradle @@ -152,14 +152,14 @@ task copyReleaseAARToBin(type: Copy) { } /** - * Generate Godot custom build template by zipping the source files from the app directory, as well + * Generate Godot gradle build template by zipping the source files from the app directory, as well * as the AAR files generated by 'copyDebugAAR', 'copyDevAAR' and 'copyReleaseAAR'. - * The zip file also includes some gradle tools to allow building of the custom build. + * The zip file also includes some gradle tools to enable gradle builds from the Godot Editor. */ -task zipCustomBuild(type: Zip) { +task zipGradleBuild(type: Zip) { onlyIf { generateGodotTemplates.state.executed || generateDevTemplate.state.executed } doFirst { - logger.lifecycle("Generating Godot custom build template") + logger.lifecycle("Generating Godot gradle build template") } from(fileTree(dir: 'app', excludes: ['**/build/**', '**/.gradle/**', '**/*.iml']), fileTree(dir: '.', includes: ['gradlew', 'gradlew.bat', 'gradle/**'])) include '**/*' @@ -195,7 +195,7 @@ def templateBuildTasks() { && targetLibs.listFiles() != null && targetLibs.listFiles().length > 0) { String capitalizedTarget = target.capitalize() - // Copy the generated aar library files to the custom build directory. + // Copy the generated aar library files to the build directory. tasks += "copy" + capitalizedTarget + "AARToAppModule" // Copy the generated aar library files to the bin directory. tasks += "copy" + capitalizedTarget + "AARToBin" @@ -260,7 +260,7 @@ task generateGodotTemplates { gradle.startParameter.excludedTaskNames += templateExcludedBuildTask() dependsOn = templateBuildTasks() - finalizedBy 'zipCustomBuild' + finalizedBy 'zipGradleBuild' } /** @@ -273,7 +273,7 @@ task generateDevTemplate { gradle.startParameter.excludedTaskNames += templateExcludedBuildTask() dependsOn = templateBuildTasks() - finalizedBy 'zipCustomBuild' + finalizedBy 'zipGradleBuild' } task clean(type: Delete) { diff --git a/platform/android/java/gradle.properties b/platform/android/java/gradle.properties index 5cd94e85d9..39a0dcda16 100644 --- a/platform/android/java/gradle.properties +++ b/platform/android/java/gradle.properties @@ -24,5 +24,5 @@ org.gradle.jvmargs=-Xmx4536m org.gradle.warning.mode=all # Disable resource optimizations for template release build. -# NOTE: This is turned on for custom build in order to improve the release build. +# NOTE: This is turned on for Godot Editor's gradle builds in order to improve the release build. android.enableResourceOptimizations=false diff --git a/platform/android/java/lib/src/org/godotengine/godot/Godot.java b/platform/android/java/lib/src/org/godotengine/godot/Godot.java index 6296ee2c22..307fa7bae1 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/Godot.java +++ b/platform/android/java/lib/src/org/godotengine/godot/Godot.java @@ -275,16 +275,16 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC return false; } - final String renderer = GodotLib.getGlobal("rendering/renderer/rendering_method"); - if (renderer.equals("gl_compatibility")) { - mRenderView = new GodotGLRenderView(activity, this, xrMode, use_debug_opengl); - } else { + if (usesVulkan()) { if (!meetsVulkanRequirements(activity.getPackageManager())) { Log.e(TAG, "Missing requirements for vulkan support! Aborting..."); alert(R.string.error_missing_vulkan_requirements_message, R.string.text_error_title, this::forceQuit); return false; } mRenderView = new GodotVulkanRenderView(activity, this); + } else { + // Fallback to openGl + mRenderView = new GodotGLRenderView(activity, this, xrMode, use_debug_opengl); } View view = mRenderView.getView(); @@ -323,6 +323,15 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC } /** + * Returns true if `Vulkan` is used for rendering. + */ + private boolean usesVulkan() { + final String renderer = GodotLib.getGlobal("rendering/renderer/rendering_method"); + final String renderingDevice = GodotLib.getGlobal("rendering/rendering_device/driver"); + return ("forward_plus".equals(renderer) || "mobile".equals(renderer)) && "vulkan".equals(renderingDevice); + } + + /** * Returns true if the device meets the base requirements for Vulkan support, false otherwise. */ private boolean meetsVulkanRequirements(@Nullable PackageManager packageManager) { |