mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-22 11:56:49 +01:00
Backported Update Android dependencies for the project
- Update Java version from 11 to 17
- Update Android gradle plugin version from 7.2.1 to 8.2.0
- Update gradle version from 7.4.2 to 8.2
- Update target SDK from 33 to 34
- Update build tools version from 33.0.2 to 34.0.0
- Update kotlin version from 1.7.0 to 1.9.20
- Update Android fragment version from 1.3.6 to 1.6.2
- Update AndroidX window version from 1.0.0 to 1.2.0
- Update Nexus plugin version from 1.1.0 to 1.3.0
- m4gr3d
eba77be573
Unfortunately this raises the required java version to 17. On the flip side hovewer there is a new editor java home setting, and also the JAVA_HOME environment variable gets picked up.
This commit is contained in:
parent
d6af267b6b
commit
914c956b75
4
.github/workflows/android_builds.yml
vendored
4
.github/workflows/android_builds.yml
vendored
@ -26,11 +26,11 @@ jobs:
|
|||||||
sudo cp -f misc/ci/sources.list /etc/apt/sources.list
|
sudo cp -f misc/ci/sources.list /etc/apt/sources.list
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
|
|
||||||
- name: Set up Java 11
|
- name: Set up Java 17
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
java-version: 11
|
java-version: 17
|
||||||
|
|
||||||
- name: Setup Pandemonium build cache
|
- name: Setup Pandemonium build cache
|
||||||
uses: ./.github/actions/pandemonium-cache
|
uses: ./.github/actions/pandemonium-cache
|
||||||
|
4
.github/workflows/android_editor_builds.yml
vendored
4
.github/workflows/android_editor_builds.yml
vendored
@ -26,11 +26,11 @@ jobs:
|
|||||||
sudo cp -f misc/ci/sources.list /etc/apt/sources.list
|
sudo cp -f misc/ci/sources.list /etc/apt/sources.list
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
|
|
||||||
- name: Set up Java 11
|
- name: Set up Java 17
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
java-version: 11
|
java-version: 17
|
||||||
|
|
||||||
- name: Setup Pandemonium build cache
|
- name: Setup Pandemonium build cache
|
||||||
uses: ./.github/actions/pandemonium-cache
|
uses: ./.github/actions/pandemonium-cache
|
||||||
|
8
TODO.md
8
TODO.md
@ -261,14 +261,6 @@ This PR mainly is to aid in faster development as outlined in godotengine/godot-
|
|||||||
|
|
||||||
https://github.com/godotengine/godot/pull/52566
|
https://github.com/godotengine/godot/pull/52566
|
||||||
|
|
||||||
## [3.x] Update Android dependencies for the project
|
|
||||||
|
|
||||||
Updates Java version from 11 to 17. Will need more testing, also likely an udpate to my build containers.\
|
|
||||||
Do after the next release.
|
|
||||||
|
|
||||||
https://github.com/godotengine/godot/commit/d1b6b6f725af4fadb8108c3769d3e7a36f6f8e5a
|
|
||||||
https://github.com/godotengine/godot/pull/87588
|
|
||||||
|
|
||||||
## Cleanup TODOs
|
## Cleanup TODOs
|
||||||
|
|
||||||
Cleanup this file, lots of things are already done.
|
Cleanup this file, lots of things are already done.
|
||||||
|
@ -38,11 +38,8 @@
|
|||||||
|
|
||||||
void register_android_exporter() {
|
void register_android_exporter() {
|
||||||
#ifndef ANDROID_ENABLED
|
#ifndef ANDROID_ENABLED
|
||||||
String exe_ext;
|
EDITOR_DEF("export/android/java_sdk_path", OS::get_singleton()->get_environment("JAVA_HOME"));
|
||||||
if (OS::get_singleton()->get_name() == "Windows") {
|
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/android/java_sdk_path", PROPERTY_HINT_GLOBAL_DIR));
|
||||||
exe_ext = "*.exe";
|
|
||||||
}
|
|
||||||
|
|
||||||
EDITOR_DEF("export/android/android_sdk_path", OS::get_singleton()->get_environment("ANDROID_SDK_ROOT"));
|
EDITOR_DEF("export/android/android_sdk_path", OS::get_singleton()->get_environment("ANDROID_SDK_ROOT"));
|
||||||
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/android/android_sdk_path", PROPERTY_HINT_GLOBAL_DIR));
|
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/android/android_sdk_path", PROPERTY_HINT_GLOBAL_DIR));
|
||||||
EDITOR_DEF("export/android/debug_keystore", "");
|
EDITOR_DEF("export/android/debug_keystore", "");
|
||||||
|
@ -227,7 +227,7 @@ static const char *APK_ASSETS_DIRECTORY = "res://android/build/assets";
|
|||||||
static const char *AAB_ASSETS_DIRECTORY = "res://android/build/assetPacks/installTime/src/main/assets";
|
static const char *AAB_ASSETS_DIRECTORY = "res://android/build/assetPacks/installTime/src/main/assets";
|
||||||
|
|
||||||
static const int DEFAULT_MIN_SDK_VERSION = 19; // Should match the value in 'platform/android/java/app/config.gradle#minSdk'
|
static const int DEFAULT_MIN_SDK_VERSION = 19; // Should match the value in 'platform/android/java/app/config.gradle#minSdk'
|
||||||
static const int DEFAULT_TARGET_SDK_VERSION = 33; // Should match the value in 'platform/android/java/app/config.gradle#targetSdk'
|
static const int DEFAULT_TARGET_SDK_VERSION = 34; // Should match the value in 'platform/android/java/app/config.gradle#targetSdk'
|
||||||
const String SDK_VERSION_RANGE = vformat("%s,%s,1", DEFAULT_MIN_SDK_VERSION, DEFAULT_TARGET_SDK_VERSION);
|
const String SDK_VERSION_RANGE = vformat("%s,%s,1", DEFAULT_MIN_SDK_VERSION, DEFAULT_TARGET_SDK_VERSION);
|
||||||
|
|
||||||
#ifndef ANDROID_ENABLED
|
#ifndef ANDROID_ENABLED
|
||||||
@ -1939,6 +1939,15 @@ Ref<Texture> EditorExportPlatformAndroid::get_run_icon() const {
|
|||||||
return run_icon;
|
return run_icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String EditorExportPlatformAndroid::get_java_path() {
|
||||||
|
String exe_ext = "";
|
||||||
|
if (OS::get_singleton()->get_name() == "Windows") {
|
||||||
|
exe_ext = ".exe";
|
||||||
|
}
|
||||||
|
String java_sdk_path = EditorSettings::get_singleton()->get("export/android/java_sdk_path");
|
||||||
|
return java_sdk_path.plus_file("bin/java" + exe_ext);
|
||||||
|
}
|
||||||
|
|
||||||
String EditorExportPlatformAndroid::get_adb_path() {
|
String EditorExportPlatformAndroid::get_adb_path() {
|
||||||
String exe_ext = "";
|
String exe_ext = "";
|
||||||
if (OS::get_singleton()->get_name() == "Windows") {
|
if (OS::get_singleton()->get_name() == "Windows") {
|
||||||
@ -2069,6 +2078,32 @@ bool EditorExportPlatformAndroid::has_valid_export_configuration(const Ref<Edito
|
|||||||
err += TTR("Release keystore incorrectly configured in the export preset.") + "\n";
|
err += TTR("Release keystore incorrectly configured in the export preset.") + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String java_sdk_path = EditorSettings::get_singleton()->get("export/android/java_sdk_path");
|
||||||
|
if (java_sdk_path == "") {
|
||||||
|
err += TTR("A valid Java SDK path is required in Editor Settings.") + "\n";
|
||||||
|
valid = false;
|
||||||
|
} else {
|
||||||
|
// Validate the given path by checking that `java` is present under the `bin` directory.
|
||||||
|
Error errn;
|
||||||
|
// Check for the bin directory.
|
||||||
|
DirAccessRef da = DirAccess::open(java_sdk_path.plus_file("bin"), &errn);
|
||||||
|
if (errn != OK) {
|
||||||
|
err += TTR("Invalid Java SDK path in Editor Settings.");
|
||||||
|
err += TTR("Missing 'bin' directory!");
|
||||||
|
err += "\n";
|
||||||
|
valid = false;
|
||||||
|
} else {
|
||||||
|
// Check for the `java` command.
|
||||||
|
String java_path = get_java_path();
|
||||||
|
if (!FileAccess::exists(java_path)) {
|
||||||
|
err += TTR("Unable to find 'java' command using the Java SDK path.");
|
||||||
|
err += TTR("Please check the Java SDK directory specified in Editor Settings.");
|
||||||
|
err += "\n";
|
||||||
|
valid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String sdk_path = EditorSettings::get_singleton()->get("export/android/android_sdk_path");
|
String sdk_path = EditorSettings::get_singleton()->get("export/android/android_sdk_path");
|
||||||
if (sdk_path == "") {
|
if (sdk_path == "") {
|
||||||
err += TTR("A valid Android SDK path is required in Editor Settings.") + "\n";
|
err += TTR("A valid Android SDK path is required in Editor Settings.") + "\n";
|
||||||
@ -2804,6 +2839,11 @@ Error EditorExportPlatformAndroid::export_project_helper(const Ref<EditorExportP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const String assets_directory = get_assets_directory(p_preset, export_format);
|
const String assets_directory = get_assets_directory(p_preset, export_format);
|
||||||
|
|
||||||
|
String java_sdk_path = EDITOR_GET("export/android/java_sdk_path");
|
||||||
|
ERR_FAIL_COND_V_MSG(java_sdk_path.empty(), ERR_UNCONFIGURED, "Java SDK path must be configured in Editor Settings at 'export/android/java_sdk_path'.");
|
||||||
|
print_verbose("Java sdk path: " + java_sdk_path);
|
||||||
|
|
||||||
String sdk_path = EDITOR_GET("export/android/android_sdk_path");
|
String sdk_path = EDITOR_GET("export/android/android_sdk_path");
|
||||||
ERR_FAIL_COND_V_MSG(sdk_path.empty(), ERR_UNCONFIGURED, "Android SDK path must be configured in Editor Settings at 'export/android/android_sdk_path'.");
|
ERR_FAIL_COND_V_MSG(sdk_path.empty(), ERR_UNCONFIGURED, "Android SDK path must be configured in Editor Settings at 'export/android/android_sdk_path'.");
|
||||||
print_verbose("Android sdk path: " + sdk_path);
|
print_verbose("Android sdk path: " + sdk_path);
|
||||||
@ -2848,8 +2888,11 @@ Error EditorExportPlatformAndroid::export_project_helper(const Ref<EditorExportP
|
|||||||
print_verbose("Storing command line flags..");
|
print_verbose("Storing command line flags..");
|
||||||
store_file_at_path(assets_directory + "/_cl_", command_line_flags);
|
store_file_at_path(assets_directory + "/_cl_", command_line_flags);
|
||||||
|
|
||||||
|
print_verbose("Updating JAVA_HOME environment to " + java_sdk_path);
|
||||||
|
OS::get_singleton()->set_environment("JAVA_HOME", java_sdk_path);
|
||||||
|
|
||||||
print_verbose("Updating ANDROID_HOME environment to " + sdk_path);
|
print_verbose("Updating ANDROID_HOME environment to " + sdk_path);
|
||||||
OS::get_singleton()->set_environment("ANDROID_HOME", sdk_path); //set and overwrite if required
|
OS::get_singleton()->set_environment("ANDROID_HOME", sdk_path);
|
||||||
String build_command;
|
String build_command;
|
||||||
|
|
||||||
#ifdef WINDOWS_ENABLED
|
#ifdef WINDOWS_ENABLED
|
||||||
@ -2877,6 +2920,7 @@ Error EditorExportPlatformAndroid::export_project_helper(const Ref<EditorExportP
|
|||||||
bool clean_build_required = is_clean_build_required(enabled_plugins);
|
bool clean_build_required = is_clean_build_required(enabled_plugins);
|
||||||
|
|
||||||
List<String> cmdline;
|
List<String> cmdline;
|
||||||
|
cmdline.push_back("validateJavaVersion");
|
||||||
if (clean_build_required) {
|
if (clean_build_required) {
|
||||||
cmdline.push_back("clean");
|
cmdline.push_back("clean");
|
||||||
}
|
}
|
||||||
|
@ -205,6 +205,8 @@ public:
|
|||||||
|
|
||||||
static String get_apksigner_path();
|
static String get_apksigner_path();
|
||||||
|
|
||||||
|
static String get_java_path();
|
||||||
|
|
||||||
virtual bool has_valid_export_configuration(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const;
|
virtual bool has_valid_export_configuration(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const;
|
||||||
virtual bool has_valid_project_configuration(const Ref<EditorExportPreset> &p_preset, String &r_error) const;
|
virtual bool has_valid_project_configuration(const Ref<EditorExportPreset> &p_preset, String &r_error) const;
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
package="com.pandemonium.game"
|
|
||||||
android:versionCode="1"
|
android:versionCode="1"
|
||||||
android:versionName="1.0"
|
android:versionName="1.0"
|
||||||
android:installLocation="auto" >
|
android:installLocation="auto" >
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
apply plugin: 'com.android.asset-pack'
|
plugins {
|
||||||
|
id 'com.android.asset-pack'
|
||||||
|
}
|
||||||
|
|
||||||
assetPack {
|
assetPack {
|
||||||
packName = "installTime" // Directory name for the asset pack
|
packName = "installTime" // Directory name for the asset pack
|
||||||
|
@ -8,12 +8,14 @@ buildscript {
|
|||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
|
maven { url "https://plugins.gradle.org/m2/" }
|
||||||
//CHUNK_BUILDSCRIPT_REPOSITORIES_BEGIN
|
//CHUNK_BUILDSCRIPT_REPOSITORIES_BEGIN
|
||||||
//CHUNK_BUILDSCRIPT_REPOSITORIES_END
|
//CHUNK_BUILDSCRIPT_REPOSITORIES_END
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath libraries.androidGradlePlugin
|
classpath "com.android.tools.build:gradle:$versions.androidGradlePlugin"
|
||||||
classpath libraries.kotlinGradlePlugin
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$versions.kotlinVersion"
|
||||||
//CHUNK_BUILDSCRIPT_DEPENDENCIES_BEGIN
|
//CHUNK_BUILDSCRIPT_DEPENDENCIES_BEGIN
|
||||||
//CHUNK_BUILDSCRIPT_DEPENDENCIES_END
|
//CHUNK_BUILDSCRIPT_DEPENDENCIES_END
|
||||||
}
|
}
|
||||||
@ -30,6 +32,8 @@ allprojects {
|
|||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
|
maven { url "https://plugins.gradle.org/m2/" }
|
||||||
//CHUNK_ALLPROJECTS_REPOSITORIES_BEGIN
|
//CHUNK_ALLPROJECTS_REPOSITORIES_BEGIN
|
||||||
//CHUNK_ALLPROJECTS_REPOSITORIES_END
|
//CHUNK_ALLPROJECTS_REPOSITORIES_END
|
||||||
|
|
||||||
@ -51,8 +55,7 @@ configurations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation libraries.kotlinStdLib
|
implementation "androidx.fragment:fragment:$versions.fragmentVersion"
|
||||||
implementation libraries.androidxFragment
|
|
||||||
|
|
||||||
if (rootProject.findProject(":lib")) {
|
if (rootProject.findProject(":lib")) {
|
||||||
implementation project(":lib")
|
implementation project(":lib")
|
||||||
@ -100,6 +103,8 @@ android {
|
|||||||
|
|
||||||
assetPacks = [":assetPacks:installTime"]
|
assetPacks = [":assetPacks:installTime"]
|
||||||
|
|
||||||
|
namespace = 'com.pandemonium.game'
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
// The default ignore pattern for the 'assets' directory includes hidden files and directories which are used by Pandemonium projects.
|
// The default ignore pattern for the 'assets' directory includes hidden files and directories which are used by Pandemonium projects.
|
||||||
aaptOptions {
|
aaptOptions {
|
||||||
@ -284,5 +289,28 @@ task copyAndRenameReleaseAab(type: Copy) {
|
|||||||
rename "build-release.aab", getExportFilename()
|
rename "build-release.aab", getExportFilename()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to validate the version of the Java SDK used for the Godot gradle builds.
|
||||||
|
*/
|
||||||
|
task validateJavaVersion {
|
||||||
|
if (JavaVersion.current() != versions.javaVersion) {
|
||||||
|
throw new GradleException("Invalid Java version ${JavaVersion.current()}. Version ${versions.javaVersion} is the required Java version for Godot gradle builds.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
When they're scheduled to run, the copy*AARToAppModule tasks generate dependencies for the 'app'
|
||||||
|
module, so we're ensuring the ':app:preBuild' task is set to run after those tasks.
|
||||||
|
*/
|
||||||
|
if (rootProject.tasks.findByPath("copyDebugAARToAppModule") != null) {
|
||||||
|
preBuild.mustRunAfter(rootProject.tasks.named("copyDebugAARToAppModule"))
|
||||||
|
}
|
||||||
|
if (rootProject.tasks.findByPath("copyDevAARToAppModule") != null) {
|
||||||
|
preBuild.mustRunAfter(rootProject.tasks.named("copyDevAARToAppModule"))
|
||||||
|
}
|
||||||
|
if (rootProject.tasks.findByPath("copyReleaseAARToAppModule") != null) {
|
||||||
|
preBuild.mustRunAfter(rootProject.tasks.named("copyReleaseAARToAppModule"))
|
||||||
|
}
|
||||||
|
|
||||||
//CHUNK_GLOBAL_BEGIN
|
//CHUNK_GLOBAL_BEGIN
|
||||||
//CHUNK_GLOBAL_END
|
//CHUNK_GLOBAL_END
|
||||||
|
@ -1,22 +1,14 @@
|
|||||||
ext.versions = [
|
ext.versions = [
|
||||||
androidGradlePlugin: '7.2.1',
|
androidGradlePlugin: '8.2.0',
|
||||||
compileSdk : 33,
|
compileSdk : 34,
|
||||||
minSdk : 19, // Also update 'platform/android/export/export_plugin.cpp#DEFAULT_MIN_SDK_VERSION'
|
minSdk : 19, // Also update 'platform/android/export/export_plugin.cpp#DEFAULT_MIN_SDK_VERSION'
|
||||||
targetSdk : 33, // Also update 'platform/android/export/export_plugin.cpp#DEFAULT_TARGET_SDK_VERSION'
|
targetSdk : 34, // Also update 'platform/android/export/export_plugin.cpp#DEFAULT_TARGET_SDK_VERSION'
|
||||||
buildTools : '33.0.2',
|
buildTools : '34.0.0',
|
||||||
kotlinVersion : '1.7.0',
|
kotlinVersion : '1.9.20',
|
||||||
fragmentVersion : '1.3.6',
|
fragmentVersion : '1.6.2',
|
||||||
nexusPublishVersion: '1.1.0',
|
nexusPublishVersion: '1.3.0',
|
||||||
javaVersion : 11,
|
javaVersion : JavaVersion.VERSION_17,
|
||||||
ndkVersion : '23.2.8568313' // Also update 'platform/android/detect.py#get_ndk_version' when this is updated.
|
ndkVersion : '23.2.8568313' // Also update 'platform/android/detect.py#get_ndk_version' when this is updated.
|
||||||
|
|
||||||
]
|
|
||||||
|
|
||||||
ext.libraries = [
|
|
||||||
androidGradlePlugin: "com.android.tools.build:gradle:$versions.androidGradlePlugin",
|
|
||||||
kotlinGradlePlugin : "org.jetbrains.kotlin:kotlin-gradle-plugin:$versions.kotlinVersion",
|
|
||||||
kotlinStdLib : "org.jetbrains.kotlin:kotlin-stdlib:$versions.kotlinVersion",
|
|
||||||
androidxFragment : "androidx.fragment:fragment:$versions.fragmentVersion",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
ext.getExportPackageName = { ->
|
ext.getExportPackageName = { ->
|
||||||
|
@ -7,8 +7,10 @@ pluginManagement {
|
|||||||
id 'org.jetbrains.kotlin.android' version versions.kotlinVersion
|
id 'org.jetbrains.kotlin.android' version versions.kotlinVersion
|
||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
gradlePluginPortal()
|
|
||||||
google()
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
|
maven { url "https://plugins.gradle.org/m2/" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,17 +1,4 @@
|
|||||||
|
|
||||||
buildscript {
|
|
||||||
apply from: 'app/config.gradle'
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
google()
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
dependencies {
|
|
||||||
classpath libraries.androidGradlePlugin
|
|
||||||
classpath libraries.kotlinGradlePlugin
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'io.github.gradle-nexus.publish-plugin'
|
id 'io.github.gradle-nexus.publish-plugin'
|
||||||
}
|
}
|
||||||
@ -23,6 +10,8 @@ allprojects {
|
|||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
|
maven { url "https://plugins.gradle.org/m2/" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,6 +19,10 @@ ext {
|
|||||||
supportedAbis = ["armv7", "arm64v8", "x86", "x86_64"]
|
supportedAbis = ["armv7", "arm64v8", "x86", "x86_64"]
|
||||||
supportedTargetsMap = [release: "release", dev: "debug", debug: "release_debug"]
|
supportedTargetsMap = [release: "release", dev: "debug", debug: "release_debug"]
|
||||||
supportedFlavors = ["editor", "template"]
|
supportedFlavors = ["editor", "template"]
|
||||||
|
supportedTargetsMapByFlavors = [
|
||||||
|
"editor": [release: "release_debug", dev: "debug", debug: "release_debug"],
|
||||||
|
"template": [release: "release", dev: "debug", debug: "release_debug"]
|
||||||
|
]
|
||||||
|
|
||||||
// Used by gradle to specify which architecture to build for by default when running
|
// Used by gradle to specify which architecture to build for by default when running
|
||||||
// `./gradlew build` (this command is usually used by Android Studio).
|
// `./gradlew build` (this command is usually used by Android Studio).
|
||||||
@ -161,10 +154,21 @@ task zipCustomBuild(type: Zip) {
|
|||||||
destinationDirectory = file(binDir)
|
destinationDirectory = file(binDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the scons build tasks responsible for generating the Godot native shared
|
||||||
|
* libraries should be excluded.
|
||||||
|
*/
|
||||||
|
def excludeSconsBuildTasks() {
|
||||||
|
return !isAndroidStudio() && !project.hasProperty("generateNativeLibs")
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates the list of build tasks that should be excluded from the build process.\
|
||||||
|
*/
|
||||||
def templateExcludedBuildTask() {
|
def templateExcludedBuildTask() {
|
||||||
// We exclude these gradle tasks so we can run the scons command manually.
|
// We exclude these gradle tasks so we can run the scons command manually.
|
||||||
def excludedTasks = []
|
def excludedTasks = []
|
||||||
if (!isAndroidStudio()) {
|
if (!excludeSconsBuildTasks()) {
|
||||||
logger.lifecycle("Excluding Android studio build tasks")
|
logger.lifecycle("Excluding Android studio build tasks")
|
||||||
for (String flavor : supportedFlavors) {
|
for (String flavor : supportedFlavors) {
|
||||||
for (String buildType : supportedTargetsMap.keySet()) {
|
for (String buildType : supportedTargetsMap.keySet()) {
|
||||||
@ -183,23 +187,45 @@ def templateExcludedBuildTask() {
|
|||||||
return excludedTasks
|
return excludedTasks
|
||||||
}
|
}
|
||||||
|
|
||||||
def templateBuildTasks() {
|
/**
|
||||||
|
* Generates the build tasks for the given flavor
|
||||||
|
* @param flavor Must be one of the supported flavors ('template' / 'editor')
|
||||||
|
*/
|
||||||
|
def generateBuildTasks(String flavor = "template") {
|
||||||
|
if (!supportedFlavors.contains(flavor)) {
|
||||||
|
throw new GradleException("Invalid build flavor: $flavor")
|
||||||
|
}
|
||||||
|
|
||||||
def tasks = []
|
def tasks = []
|
||||||
|
|
||||||
// Only build the apks and aar files for which we have native shared libraries.
|
// Only build the apks and aar files for which we have native shared libraries unless we intend
|
||||||
for (String target : supportedTargetsMap.keySet()) {
|
// to run the scons build tasks.
|
||||||
File targetLibs = new File("lib/libs/" + target)
|
boolean excludeSconsBuildTasks = excludeSconsBuildTasks()
|
||||||
if (targetLibs != null
|
boolean isTemplate = flavor == "template"
|
||||||
|
String libsDir = isTemplate ? "lib/libs/" : "lib/libs/tools/"
|
||||||
|
for (String target : supportedTargetsMapByFlavors[flavor].keySet()) {
|
||||||
|
File targetLibs = new File(libsDir + target)
|
||||||
|
if (!excludeSconsBuildTasks || (targetLibs != null
|
||||||
&& targetLibs.isDirectory()
|
&& targetLibs.isDirectory()
|
||||||
&& targetLibs.listFiles() != null
|
&& targetLibs.listFiles() != null
|
||||||
&& targetLibs.listFiles().length > 0) {
|
&& targetLibs.listFiles().length > 0)) {
|
||||||
|
|
||||||
String capitalizedTarget = target.capitalize()
|
String capitalizedTarget = target.capitalize()
|
||||||
// Copy the generated aar library files to the custom build directory.
|
|
||||||
tasks += "copy" + capitalizedTarget + "AARToAppModule"
|
if (isTemplate) {
|
||||||
|
// Copy the generated aar library files to the build directory.
|
||||||
|
tasks += "copy${capitalizedTarget}AARToAppModule"
|
||||||
// Copy the generated aar library files to the bin directory.
|
// Copy the generated aar library files to the bin directory.
|
||||||
tasks += "copy" + capitalizedTarget + "AARToBin"
|
tasks += "copy${capitalizedTarget}AARToBin"
|
||||||
// Copy the prebuilt binary templates to the bin directory.
|
// Copy the prebuilt binary templates to the bin directory.
|
||||||
tasks += "copy" + capitalizedTarget + "BinaryToBin"
|
tasks += "copy${capitalizedTarget}BinaryToBin"
|
||||||
|
} else {
|
||||||
|
// Copy the generated editor apk to the bin directory.
|
||||||
|
tasks += "copyEditor${capitalizedTarget}ApkToBin"
|
||||||
|
// Copy the generated editor aab to the bin directory.
|
||||||
|
tasks += "copyEditor${capitalizedTarget}AabToBin"
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
logger.lifecycle("No native shared libs for target $target. Skipping build.")
|
logger.lifecycle("No native shared libs for target $target. Skipping build.")
|
||||||
}
|
}
|
||||||
@ -230,31 +256,14 @@ task copyEditorDevBinaryToBin(type: Copy) {
|
|||||||
/**
|
/**
|
||||||
* Generate the Pandemonium Editor Android apk.
|
* Generate the Pandemonium Editor Android apk.
|
||||||
*
|
*
|
||||||
* Note: The Pandemonium 'tools' shared libraries must have been generated (via scons) prior to running
|
* Note: Unless the 'generateNativeLibs` argument is specified, the Pandemonium 'tools' shared libraries
|
||||||
* this gradle task. The task will only build the apk(s) for which the shared libraries is
|
* must have been generated (via scons) prior to running this gradle task.
|
||||||
* available.
|
* The task will only build the apk(s) for which the shared libraries is available.
|
||||||
*/
|
*/
|
||||||
task generatePandemoniumEditor {
|
task generatePandemoniumEditor {
|
||||||
gradle.startParameter.excludedTaskNames += templateExcludedBuildTask()
|
gradle.startParameter.excludedTaskNames += templateExcludedBuildTask()
|
||||||
|
|
||||||
def tasks = []
|
dependsOn = generateBuildTasks("editor")
|
||||||
|
|
||||||
for (String target : supportedTargetsMap.keySet()) {
|
|
||||||
if (target == "release") {
|
|
||||||
// The editor can't be used with target=release as debugging tools are then not
|
|
||||||
// included, and it would crash on errors instead of reporting them.
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
File targetLibs = new File("lib/libs/tools/" + target)
|
|
||||||
if (targetLibs != null
|
|
||||||
&& targetLibs.isDirectory()
|
|
||||||
&& targetLibs.listFiles() != null
|
|
||||||
&& targetLibs.listFiles().length > 0) {
|
|
||||||
tasks += "copyEditor${target.capitalize()}BinaryToBin"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependsOn = tasks
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -262,7 +271,7 @@ task generatePandemoniumEditor {
|
|||||||
*/
|
*/
|
||||||
task generatePandemoniumTemplates {
|
task generatePandemoniumTemplates {
|
||||||
gradle.startParameter.excludedTaskNames += templateExcludedBuildTask()
|
gradle.startParameter.excludedTaskNames += templateExcludedBuildTask()
|
||||||
dependsOn = templateBuildTasks()
|
dependsOn = generateBuildTasks("template")
|
||||||
|
|
||||||
finalizedBy 'zipCustomBuild'
|
finalizedBy 'zipCustomBuild'
|
||||||
}
|
}
|
||||||
@ -277,10 +286,10 @@ task clean(type: Delete) {
|
|||||||
*/
|
*/
|
||||||
task generateDevTemplate {
|
task generateDevTemplate {
|
||||||
// add parameter to set symbols to true
|
// add parameter to set symbols to true
|
||||||
gradle.startParameter.projectProperties += [doNotStrip: true]
|
gradle.startParameter.projectProperties += [doNotStrip: "true"]
|
||||||
|
|
||||||
gradle.startParameter.excludedTaskNames += templateExcludedBuildTask()
|
gradle.startParameter.excludedTaskNames += templateExcludedBuildTask()
|
||||||
dependsOn = templateBuildTasks()
|
dependsOn = generateBuildTasks("template")
|
||||||
|
|
||||||
finalizedBy 'zipCustomBuild'
|
finalizedBy 'zipCustomBuild'
|
||||||
}
|
}
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'com.android.application'
|
id 'com.android.application'
|
||||||
id 'org.jetbrains.kotlin.android'
|
id 'org.jetbrains.kotlin.android'
|
||||||
|
id 'base'
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation libraries.kotlinStdLib
|
implementation "androidx.fragment:fragment:$versions.fragmentVersion"
|
||||||
implementation libraries.androidxFragment
|
|
||||||
implementation project(":lib")
|
implementation project(":lib")
|
||||||
|
|
||||||
implementation "androidx.window:window:1.0.0"
|
implementation "androidx.window:window:1.2.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
@ -17,6 +17,8 @@ android {
|
|||||||
buildToolsVersion versions.buildTools
|
buildToolsVersion versions.buildTools
|
||||||
ndkVersion versions.ndkVersion
|
ndkVersion versions.ndkVersion
|
||||||
|
|
||||||
|
namespace = "org.pandemoniumengine.editor"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
// The 'applicationId' suffix allows to install Pandemonium 3.x(v3) and 4.x(v4) on the same device
|
// The 'applicationId' suffix allows to install Pandemonium 3.x(v3) and 4.x(v4) on the same device
|
||||||
applicationId "org.pandemoniumengine.editor.v3"
|
applicationId "org.pandemoniumengine.editor.v3"
|
||||||
@ -27,6 +29,10 @@ android {
|
|||||||
missingDimensionStrategy 'products', 'editor'
|
missingDimensionStrategy 'products', 'editor'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
base {
|
||||||
|
archivesName = "android_editor"
|
||||||
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility versions.javaVersion
|
sourceCompatibility versions.javaVersion
|
||||||
targetCompatibility versions.javaVersion
|
targetCompatibility versions.javaVersion
|
||||||
@ -36,6 +42,10 @@ android {
|
|||||||
jvmTarget = versions.javaVersion
|
jvmTarget = versions.javaVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buildFeatures {
|
||||||
|
buildConfig = true
|
||||||
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
dev {
|
dev {
|
||||||
initWith debug
|
initWith debug
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
package="org.pandemoniumengine.editor"
|
|
||||||
android:installLocation="auto">
|
android:installLocation="auto">
|
||||||
|
|
||||||
<supports-screens
|
<supports-screens
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="org.pandemoniumengine.pandemonium"
|
|
||||||
android:versionCode="1"
|
android:versionCode="1"
|
||||||
android:versionName="1.0">
|
android:versionName="1.0">
|
||||||
|
|
||||||
|
@ -4,8 +4,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation libraries.kotlinStdLib
|
implementation "androidx.fragment:fragment:$versions.fragmentVersion"
|
||||||
implementation libraries.androidxFragment
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def pathToRootDir = "../../../../"
|
def pathToRootDir = "../../../../"
|
||||||
@ -31,6 +30,11 @@ android {
|
|||||||
jvmTarget = versions.javaVersion
|
jvmTarget = versions.javaVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buildFeatures {
|
||||||
|
aidl = true
|
||||||
|
buildConfig = true
|
||||||
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
dev {
|
dev {
|
||||||
initWith debug
|
initWith debug
|
||||||
|
@ -212,7 +212,7 @@ internal class PandemoniumGestureHandler : SimpleOnGestureListener(), OnScaleGes
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onScroll(
|
override fun onScroll(
|
||||||
originEvent: MotionEvent,
|
originEvent: MotionEvent?,
|
||||||
terminusEvent: MotionEvent,
|
terminusEvent: MotionEvent,
|
||||||
distanceX: Float,
|
distanceX: Float,
|
||||||
distanceY: Float
|
distanceY: Float
|
||||||
@ -220,6 +220,7 @@ internal class PandemoniumGestureHandler : SimpleOnGestureListener(), OnScaleGes
|
|||||||
if (scaleInProgress) {
|
if (scaleInProgress) {
|
||||||
if (dragInProgress) {
|
if (dragInProgress) {
|
||||||
// Cancel the drag
|
// Cancel the drag
|
||||||
|
if (originEvent != null) {
|
||||||
PandemoniumInputHandler.handleMotionEvent(
|
PandemoniumInputHandler.handleMotionEvent(
|
||||||
originEvent.source,
|
originEvent.source,
|
||||||
MotionEvent.ACTION_CANCEL,
|
MotionEvent.ACTION_CANCEL,
|
||||||
@ -227,6 +228,7 @@ internal class PandemoniumGestureHandler : SimpleOnGestureListener(), OnScaleGes
|
|||||||
originEvent.x,
|
originEvent.x,
|
||||||
originEvent.y
|
originEvent.y
|
||||||
)
|
)
|
||||||
|
}
|
||||||
dragInProgress = false
|
dragInProgress = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest package="org.pandemoniumengine.pandemonium" />
|
<manifest />
|
||||||
|
@ -9,6 +9,8 @@ android {
|
|||||||
buildToolsVersion versions.buildTools
|
buildToolsVersion versions.buildTools
|
||||||
ndkVersion versions.ndkVersion
|
ndkVersion versions.ndkVersion
|
||||||
|
|
||||||
|
namespace = "org.pandemoniumengine.pandemonium"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion versions.minSdk
|
minSdkVersion versions.minSdk
|
||||||
targetSdkVersion versions.targetSdk
|
targetSdkVersion versions.targetSdk
|
||||||
|
@ -5,12 +5,15 @@ pluginManagement {
|
|||||||
plugins {
|
plugins {
|
||||||
id 'com.android.application' version versions.androidGradlePlugin
|
id 'com.android.application' version versions.androidGradlePlugin
|
||||||
id 'com.android.library' version versions.androidGradlePlugin
|
id 'com.android.library' version versions.androidGradlePlugin
|
||||||
|
id 'com.android.asset-pack' version versions.androidGradlePlugin
|
||||||
id 'org.jetbrains.kotlin.android' version versions.kotlinVersion
|
id 'org.jetbrains.kotlin.android' version versions.kotlinVersion
|
||||||
id 'io.github.gradle-nexus.publish-plugin' version versions.nexusPublishVersion
|
id 'io.github.gradle-nexus.publish-plugin' version versions.nexusPublishVersion
|
||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
gradlePluginPortal()
|
|
||||||
google()
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
|
maven { url "https://plugins.gradle.org/m2/" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user