MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / export_project_helper

Method export_project_helper

platform/android/export/export_plugin.cpp:3515–4246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3513}
3514
3515Error EditorExportPlatformAndroid::export_project_helper(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int export_format, bool should_sign, BitField<EditorExportPlatform::DebugFlags> p_flags) {
3516 ExportNotifier notifier(*this, p_preset, p_debug, p_path, p_flags);
3517
3518 const String base_dir = p_path.get_base_dir();
3519 if (!DirAccess::exists(base_dir)) {
3520 add_message(EXPORT_MESSAGE_ERROR, TTR("Export"), vformat(TTR("Target folder does not exist or is inaccessible: \"%s\""), base_dir));
3521 return ERR_FILE_BAD_PATH;
3522 }
3523
3524 String src_apk;
3525 Error err;
3526
3527 EditorProgress ep("export", TTR("Exporting for Android"), 105, true);
3528
3529 bool use_gradle_build = bool(p_preset->get("gradle_build/use_gradle_build"));
3530 String gradle_build_directory = use_gradle_build ? ExportTemplateManager::get_android_build_directory(p_preset) : "";
3531 bool p_give_internet = p_flags.has_flag(DEBUG_FLAG_DUMB_CLIENT) || p_flags.has_flag(DEBUG_FLAG_REMOTE_DEBUG);
3532 bool apk_expansion = p_preset->get("apk_expansion/enable");
3533 Vector<ABI> enabled_abis = get_enabled_abis(p_preset);
3534
3535 print_verbose("Exporting for Android...");
3536 print_verbose("- debug build: " + bool_to_string(p_debug));
3537 print_verbose("- export path: " + p_path);
3538 print_verbose("- export format: " + itos(export_format));
3539 print_verbose("- sign build: " + bool_to_string(should_sign));
3540 print_verbose("- gradle build enabled: " + bool_to_string(use_gradle_build));
3541 print_verbose("- apk expansion enabled: " + bool_to_string(apk_expansion));
3542 print_verbose("- enabled abis: " + join_abis(enabled_abis, ",", false));
3543 print_verbose("- export filter: " + itos(p_preset->get_export_filter()));
3544 print_verbose("- include filter: " + p_preset->get_include_filter());
3545 print_verbose("- exclude filter: " + p_preset->get_exclude_filter());
3546
3547 Ref<Image> main_image;
3548 Ref<Image> foreground;
3549 Ref<Image> background;
3550 Ref<Image> monochrome;
3551
3552 load_icon_refs(p_preset, main_image, foreground, background, monochrome);
3553
3554 Vector<uint8_t> command_line_flags;
3555 // Write command line flags into the command_line_flags variable.
3556 get_command_line_flags(p_preset, p_path, p_flags, command_line_flags);
3557
3558 if (export_format == EXPORT_FORMAT_AAB) {
3559 if (!p_path.ends_with(".aab")) {
3560 add_message(EXPORT_MESSAGE_ERROR, TTR("Export"), TTR("Invalid filename! Android App Bundle requires the *.aab extension."));
3561 return ERR_UNCONFIGURED;
3562 }
3563 if (apk_expansion) {
3564 add_message(EXPORT_MESSAGE_ERROR, TTR("Export"), TTR("APK Expansion not compatible with Android App Bundle."));
3565 return ERR_UNCONFIGURED;
3566 }
3567 }
3568 if (export_format == EXPORT_FORMAT_APK && !p_path.ends_with(".apk")) {
3569 add_message(EXPORT_MESSAGE_ERROR, TTR("Export"), TTR("Invalid filename! Android APK requires the *.apk extension."));
3570 return ERR_UNCONFIGURED;
3571 }
3572 if (export_format > EXPORT_FORMAT_AAB || export_format < EXPORT_FORMAT_APK) {

Callers

nothing calls this directly

Calls 15

TTRFunction · 0.85
vformatFunction · 0.85
bool_to_stringFunction · 0.85
itosFunction · 0.85
store_file_at_pathFunction · 0.85
zipio_create_ioFunction · 0.85
uitosFunction · 0.85
print_lineFunction · 0.85
get_base_dirMethod · 0.80
get_export_filterMethod · 0.80
get_include_filterMethod · 0.80

Tested by

no test coverage detected