Merge pull request #72552 from m4gr3d/cleanup_custom_build_main

Rename Godot's 'custom build' to 'gradle build' to better reflect the underlying build process
This commit is contained in:
Rémi Verschelde 2023-02-06 22:50:22 +01:00
commit 09b2c5fd05
No known key found for this signature in database
GPG Key ID: C3336907360768E1
12 changed files with 65 additions and 65 deletions

View File

@ -2953,7 +2953,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
} else if (export_template_manager->can_install_android_template()) {
install_android_build_template->popup_centered();
} else {
custom_build_manage_templates->popup_centered();
gradle_build_manage_templates->popup_centered();
}
}
} break;
@ -3043,7 +3043,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
#endif
} break;
case SETTINGS_INSTALL_ANDROID_BUILD_TEMPLATE: {
custom_build_manage_templates->hide();
gradle_build_manage_templates->hide();
file_android_build_source->popup_centered_ratio();
} break;
case SETTINGS_MANAGE_FEATURE_PROFILES: {
@ -7706,12 +7706,12 @@ EditorNode::EditorNode() {
save_confirmation->connect("confirmed", callable_mp(this, &EditorNode::_menu_confirm_current));
save_confirmation->connect("custom_action", callable_mp(this, &EditorNode::_discard_changes));
custom_build_manage_templates = memnew(ConfirmationDialog);
custom_build_manage_templates->set_text(TTR("Android build template is missing, please install relevant templates."));
custom_build_manage_templates->set_ok_button_text(TTR("Manage Templates"));
custom_build_manage_templates->add_button(TTR("Install from file"))->connect("pressed", callable_mp(this, &EditorNode::_menu_option).bind(SETTINGS_INSTALL_ANDROID_BUILD_TEMPLATE));
custom_build_manage_templates->connect("confirmed", callable_mp(this, &EditorNode::_menu_option).bind(SETTINGS_MANAGE_EXPORT_TEMPLATES));
gui_base->add_child(custom_build_manage_templates);
gradle_build_manage_templates = memnew(ConfirmationDialog);
gradle_build_manage_templates->set_text(TTR("Android build template is missing, please install relevant templates."));
gradle_build_manage_templates->set_ok_button_text(TTR("Manage Templates"));
gradle_build_manage_templates->add_button(TTR("Install from file"))->connect("pressed", callable_mp(this, &EditorNode::_menu_option).bind(SETTINGS_INSTALL_ANDROID_BUILD_TEMPLATE));
gradle_build_manage_templates->connect("confirmed", callable_mp(this, &EditorNode::_menu_option).bind(SETTINGS_MANAGE_EXPORT_TEMPLATES));
gui_base->add_child(gradle_build_manage_templates);
file_android_build_source = memnew(EditorFileDialog);
file_android_build_source->set_title(TTR("Select Android sources file"));
@ -7722,7 +7722,7 @@ EditorNode::EditorNode() {
gui_base->add_child(file_android_build_source);
install_android_build_template = memnew(ConfirmationDialog);
install_android_build_template->set_text(TTR("This will set up your project for custom Android builds by installing the source template to \"res://android/build\".\nYou can then apply modifications and build your own custom APK on export (adding modules, changing the AndroidManifest.xml, etc.).\nNote that in order to make custom builds instead of using pre-built APKs, the \"Use Custom Build\" option should be enabled in the Android export preset."));
install_android_build_template->set_text(TTR("This will set up your project for gradle Android builds by installing the source template to \"res://android/build\".\nYou can then apply modifications and build your own custom APK on export (adding modules, changing the AndroidManifest.xml, etc.).\nNote that in order to make gradle builds instead of using pre-built APKs, the \"Use Gradle Build\" option should be enabled in the Android export preset."));
install_android_build_template->set_ok_button_text(TTR("Install"));
install_android_build_template->connect("confirmed", callable_mp(this, &EditorNode::_menu_confirm_current));
gui_base->add_child(install_android_build_template);

View File

@ -398,7 +398,7 @@ private:
PopupMenu *editor_layouts = nullptr;
EditorLayoutsDialog *layout_dialog = nullptr;
ConfirmationDialog *custom_build_manage_templates = nullptr;
ConfirmationDialog *gradle_build_manage_templates = nullptr;
ConfirmationDialog *install_android_build_template = nullptr;
ConfirmationDialog *remove_android_build_template = nullptr;

View File

@ -1702,12 +1702,12 @@ void EditorExportPlatformAndroid::get_export_options(List<ExportOption> *r_optio
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/debug", PROPERTY_HINT_GLOBAL_FILE, "*.apk"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/release", PROPERTY_HINT_GLOBAL_FILE, "*.apk"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "custom_build/use_custom_build"), false));
r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "custom_build/export_format", PROPERTY_HINT_ENUM, "Export APK,Export AAB"), EXPORT_FORMAT_APK));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "gradle_build/use_gradle_build"), false));
r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "gradle_build/export_format", PROPERTY_HINT_ENUM, "Export APK,Export AAB"), EXPORT_FORMAT_APK));
// Using String instead of int to default to an empty string (no override) with placeholder for instructions (see GH-62465).
// This implies doing validation that the string is a proper int.
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_build/min_sdk", PROPERTY_HINT_PLACEHOLDER_TEXT, vformat("%d (default)", DEFAULT_MIN_SDK_VERSION)), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_build/target_sdk", PROPERTY_HINT_PLACEHOLDER_TEXT, vformat("%d (default)", DEFAULT_TARGET_SDK_VERSION)), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "gradle_build/min_sdk", PROPERTY_HINT_PLACEHOLDER_TEXT, vformat("%d (default)", DEFAULT_MIN_SDK_VERSION)), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "gradle_build/target_sdk", PROPERTY_HINT_PLACEHOLDER_TEXT, vformat("%d (default)", DEFAULT_TARGET_SDK_VERSION)), ""));
Vector<PluginConfigAndroid> plugins_configs = get_plugins();
for (int i = 0; i < plugins_configs.size(); i++) {
@ -2132,11 +2132,11 @@ String EditorExportPlatformAndroid::get_apksigner_path(int p_target_sdk, bool p_
bool EditorExportPlatformAndroid::has_valid_export_configuration(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const {
String err;
bool valid = false;
const bool custom_build_enabled = p_preset->get("custom_build/use_custom_build");
const bool gradle_build_enabled = p_preset->get("gradle_build/use_gradle_build");
// Look for export templates (first official, and if defined custom templates).
if (!custom_build_enabled) {
if (!gradle_build_enabled) {
String template_err;
bool dvalid = false;
bool rvalid = false;
@ -2243,7 +2243,7 @@ bool EditorExportPlatformAndroid::has_valid_export_configuration(const Ref<Edito
valid = false;
}
String target_sdk_version = p_preset->get("custom_build/target_sdk");
String target_sdk_version = p_preset->get("gradle_build/target_sdk");
if (!target_sdk_version.is_valid_int()) {
target_sdk_version = itos(DEFAULT_TARGET_SDK_VERSION);
}
@ -2267,7 +2267,7 @@ bool EditorExportPlatformAndroid::has_valid_export_configuration(const Ref<Edito
bool EditorExportPlatformAndroid::has_valid_project_configuration(const Ref<EditorExportPreset> &p_preset, String &r_error) const {
String err;
bool valid = true;
const bool custom_build_enabled = p_preset->get("custom_build/use_custom_build");
const bool gradle_build_enabled = p_preset->get("gradle_build/use_gradle_build");
// Validate the project configuration.
bool apk_expansion = p_preset->get("apk_expansion/enable");
@ -2296,11 +2296,11 @@ bool EditorExportPlatformAndroid::has_valid_project_configuration(const Ref<Edit
err += etc_error;
}
// Ensure that `Use Custom Build` is enabled if a plugin is selected.
// Ensure that `Use Gradle Build` is enabled if a plugin is selected.
String enabled_plugins_names = PluginConfigAndroid::get_plugins_names(get_enabled_plugins(p_preset));
if (!enabled_plugins_names.is_empty() && !custom_build_enabled) {
if (!enabled_plugins_names.is_empty() && !gradle_build_enabled) {
valid = false;
err += TTR("\"Use Custom Build\" must be enabled to use the plugins.");
err += TTR("\"Use Gradle Build\" must be enabled to use the plugins.");
err += "\n";
}
@ -2308,9 +2308,9 @@ bool EditorExportPlatformAndroid::has_valid_project_configuration(const Ref<Edit
int xr_mode_index = p_preset->get("xr_features/xr_mode");
int hand_tracking = p_preset->get("xr_features/hand_tracking");
int passthrough_mode = p_preset->get("xr_features/passthrough");
if (xr_mode_index == XR_MODE_OPENXR && !custom_build_enabled) {
if (xr_mode_index == XR_MODE_OPENXR && !gradle_build_enabled) {
valid = false;
err += TTR("OpenXR requires \"Use Custom Build\" to be enabled");
err += TTR("OpenXR requires \"Use Gradle Build\" to be enabled");
err += "\n";
}
@ -2328,20 +2328,20 @@ bool EditorExportPlatformAndroid::has_valid_project_configuration(const Ref<Edit
}
}
if (int(p_preset->get("custom_build/export_format")) == EXPORT_FORMAT_AAB &&
!custom_build_enabled) {
if (int(p_preset->get("gradle_build/export_format")) == EXPORT_FORMAT_AAB &&
!gradle_build_enabled) {
valid = false;
err += TTR("\"Export AAB\" is only valid when \"Use Custom Build\" is enabled.");
err += TTR("\"Export AAB\" is only valid when \"Use Gradle Build\" is enabled.");
err += "\n";
}
// Check the min sdk version.
String min_sdk_str = p_preset->get("custom_build/min_sdk");
String min_sdk_str = p_preset->get("gradle_build/min_sdk");
int min_sdk_int = DEFAULT_MIN_SDK_VERSION;
if (!min_sdk_str.is_empty()) { // Empty means no override, nothing to do.
if (!custom_build_enabled) {
if (!gradle_build_enabled) {
valid = false;
err += TTR("\"Min SDK\" can only be overridden when \"Use Custom Build\" is enabled.");
err += TTR("\"Min SDK\" can only be overridden when \"Use Gradle Build\" is enabled.");
err += "\n";
}
if (!min_sdk_str.is_valid_int()) {
@ -2359,12 +2359,12 @@ bool EditorExportPlatformAndroid::has_valid_project_configuration(const Ref<Edit
}
// Check the target sdk version.
String target_sdk_str = p_preset->get("custom_build/target_sdk");
String target_sdk_str = p_preset->get("gradle_build/target_sdk");
int target_sdk_int = DEFAULT_TARGET_SDK_VERSION;
if (!target_sdk_str.is_empty()) { // Empty means no override, nothing to do.
if (!custom_build_enabled) {
if (!gradle_build_enabled) {
valid = false;
err += TTR("\"Target SDK\" can only be overridden when \"Use Custom Build\" is enabled.");
err += TTR("\"Target SDK\" can only be overridden when \"Use Gradle Build\" is enabled.");
err += "\n";
}
if (!target_sdk_str.is_valid_int()) {
@ -2484,12 +2484,12 @@ void EditorExportPlatformAndroid::get_command_line_flags(const Ref<EditorExportP
}
Error EditorExportPlatformAndroid::sign_apk(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &export_path, EditorProgress &ep) {
int export_format = int(p_preset->get("custom_build/export_format"));
int export_format = int(p_preset->get("gradle_build/export_format"));
String export_label = export_format == EXPORT_FORMAT_AAB ? "AAB" : "APK";
String release_keystore = p_preset->get("keystore/release");
String release_username = p_preset->get("keystore/release_user");
String release_password = p_preset->get("keystore/release_password");
String target_sdk_version = p_preset->get("custom_build/target_sdk");
String target_sdk_version = p_preset->get("gradle_build/target_sdk");
if (!target_sdk_version.is_valid_int()) {
target_sdk_version = itos(DEFAULT_TARGET_SDK_VERSION);
}
@ -2666,7 +2666,7 @@ String EditorExportPlatformAndroid::join_abis(const Vector<EditorExportPlatformA
}
Error EditorExportPlatformAndroid::export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags) {
int export_format = int(p_preset->get("custom_build/export_format"));
int export_format = int(p_preset->get("gradle_build/export_format"));
bool should_sign = p_preset->get("package/signed");
return export_project_helper(p_preset, p_debug, p_path, export_format, should_sign, p_flags);
}
@ -2679,7 +2679,7 @@ Error EditorExportPlatformAndroid::export_project_helper(const Ref<EditorExportP
EditorProgress ep("export", TTR("Exporting for Android"), 105, true);
bool use_custom_build = bool(p_preset->get("custom_build/use_custom_build"));
bool use_gradle_build = bool(p_preset->get("gradle_build/use_gradle_build"));
bool p_give_internet = p_flags & (DEBUG_FLAG_DUMB_CLIENT | DEBUG_FLAG_REMOTE_DEBUG);
bool apk_expansion = p_preset->get("apk_expansion/enable");
Vector<ABI> enabled_abis = get_enabled_abis(p_preset);
@ -2689,7 +2689,7 @@ Error EditorExportPlatformAndroid::export_project_helper(const Ref<EditorExportP
print_verbose("- export path: " + p_path);
print_verbose("- export format: " + itos(export_format));
print_verbose("- sign build: " + bool_to_string(should_sign));
print_verbose("- custom build enabled: " + bool_to_string(use_custom_build));
print_verbose("- gradle build enabled: " + bool_to_string(use_gradle_build));
print_verbose("- apk expansion enabled: " + bool_to_string(apk_expansion));
print_verbose("- enabled abis: " + join_abis(enabled_abis, ",", false));
print_verbose("- export filter: " + itos(p_preset->get_export_filter()));
@ -2729,14 +2729,14 @@ Error EditorExportPlatformAndroid::export_project_helper(const Ref<EditorExportP
return ERR_UNCONFIGURED;
}
if (use_custom_build) {
print_verbose("Starting custom build...");
if (use_gradle_build) {
print_verbose("Starting gradle build...");
//test that installed build version is alright
{
print_verbose("Checking build version...");
Ref<FileAccess> f = FileAccess::open("res://android/.build_version", FileAccess::READ);
if (f.is_null()) {
add_message(EXPORT_MESSAGE_ERROR, TTR("Export"), TTR("Trying to build from a custom built template, but no version info for it exists. Please reinstall from the 'Project' menu."));
add_message(EXPORT_MESSAGE_ERROR, TTR("Export"), TTR("Trying to build from a gradle built template, but no version info for it exists. Please reinstall from the 'Project' menu."));
return ERR_UNCONFIGURED;
}
String version = f->get_line().strip_edges();
@ -2806,11 +2806,11 @@ Error EditorExportPlatformAndroid::export_project_helper(const Ref<EditorExportP
String package_name = get_package_name(p_preset->get("package/unique_name"));
String version_code = itos(p_preset->get("version/code"));
String version_name = p_preset->get("version/name");
String min_sdk_version = p_preset->get("custom_build/min_sdk");
String min_sdk_version = p_preset->get("gradle_build/min_sdk");
if (!min_sdk_version.is_valid_int()) {
min_sdk_version = itos(DEFAULT_MIN_SDK_VERSION);
}
String target_sdk_version = p_preset->get("custom_build/target_sdk");
String target_sdk_version = p_preset->get("gradle_build/target_sdk");
if (!target_sdk_version.is_valid_int()) {
target_sdk_version = itos(DEFAULT_TARGET_SDK_VERSION);
}
@ -2936,7 +2936,7 @@ Error EditorExportPlatformAndroid::export_project_helper(const Ref<EditorExportP
return ERR_CANT_CREATE;
}
print_verbose("Successfully completed Android custom build.");
print_verbose("Successfully completed Android gradle build.");
return OK;
}
// This is the start of the Legacy build system

View File

@ -74,7 +74,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
Vector<PluginConfigAndroid> plugins;
String last_plugin_names;
uint64_t last_custom_build_time = 0;
uint64_t last_gradle_build_time = 0;
SafeFlag plugins_changed;
Mutex plugins_lock;
Vector<Device> devices;
@ -215,14 +215,14 @@ public:
inline bool is_clean_build_required(Vector<PluginConfigAndroid> enabled_plugins) {
String plugin_names = PluginConfigAndroid::get_plugins_names(enabled_plugins);
bool first_build = last_custom_build_time == 0;
bool first_build = last_gradle_build_time == 0;
bool have_plugins_changed = false;
if (!first_build) {
have_plugins_changed = plugin_names != last_plugin_names;
if (!have_plugins_changed) {
for (int i = 0; i < enabled_plugins.size(); i++) {
if (enabled_plugins.get(i).last_updated > last_custom_build_time) {
if (enabled_plugins.get(i).last_updated > last_gradle_build_time) {
have_plugins_changed = true;
break;
}
@ -230,7 +230,7 @@ public:
}
}
last_custom_build_time = OS::get_singleton()->get_unix_time();
last_gradle_build_time = OS::get_singleton()->get_unix_time();
last_plugin_names = plugin_names;
return have_plugins_changed || first_build;

View File

@ -166,7 +166,7 @@ Error store_string_at_path(const String &p_path, const String &p_data) {
// This method will only be called as an input to export_project_files.
// It is used by the export_project_files method to save all the asset files into the gradle project.
// It's functionality mirrors that of the method save_apk_file.
// This method will be called ONLY when custom build is enabled.
// This method will be called ONLY when gradle build is enabled.
Error rename_and_store_file_in_gradle_project(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total, const Vector<String> &p_enc_in_filters, const Vector<String> &p_enc_ex_filters, const Vector<uint8_t> &p_key) {
CustomExportData *export_data = static_cast<CustomExportData *>(p_userdata);
String dst_path = p_path.replace_first("res://", export_data->assets_directory + "/");

View File

@ -104,7 +104,7 @@ Error store_string_at_path(const String &p_path, const String &p_data);
// This method will only be called as an input to export_project_files.
// It is used by the export_project_files method to save all the asset files into the gradle project.
// It's functionality mirrors that of the method save_apk_file.
// This method will be called ONLY when custom build is enabled.
// This method will be called ONLY when gradle build is enabled.
Error rename_and_store_file_in_gradle_project(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total, const Vector<String> &p_enc_in_filters, const Vector<String> &p_enc_ex_filters, const Vector<uint8_t> &p_key);
// Creates strings.xml files inside the gradle project for different locales.

View File

@ -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

View File

@ -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.

View File

@ -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'

View File

@ -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 {

View File

@ -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) {

View File

@ -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