1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-10 13:00:37 +00:00

Allow project export to be canceled

This commit is contained in:
George Marques
2018-12-19 16:50:40 -02:00
parent ac58abfd58
commit c121d8871d
6 changed files with 120 additions and 48 deletions

View File

@@ -617,7 +617,9 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
String dst_path = p_path.replace_first("res://", "assets/");
store_in_apk(ed, dst_path, p_data, _should_compress_asset(p_path, p_data) ? Z_DEFLATED : 0);
ed->ep->step("File: " + p_path, 3 + p_file * 100 / p_total);
if (ed->ep->step("File: " + p_path, 3 + p_file * 100 / p_total)) {
return ERR_SKIP;
}
return OK;
}
@@ -1255,7 +1257,9 @@ public:
}
//export_temp
ep.step("Exporting APK", 0);
if (ep.step("Exporting APK", 0)) {
return ERR_SKIP;
}
const bool use_remote = (p_debug_flags & DEBUG_FLAG_REMOTE_DEBUG) || (p_debug_flags & DEBUG_FLAG_DUMB_CLIENT);
const bool use_reverse = devices[p_device].api_level >= 21;
@@ -1278,7 +1282,9 @@ public:
String package_name = p_preset->get("package/unique_name");
if (remove_prev) {
ep.step("Uninstalling...", 1);
if (ep.step("Uninstalling...", 1)) {
return ERR_SKIP;
}
print_line("Uninstalling previous version: " + devices[p_device].name);
@@ -1291,7 +1297,9 @@ public:
}
print_line("Installing to device (please wait...): " + devices[p_device].name);
ep.step("Installing to device (please wait...)", 2);
if (ep.step("Installing to device (please wait...)", 2)) {
return ERR_SKIP;
}
args.clear();
args.push_back("-s");
@@ -1357,7 +1365,9 @@ public:
}
}
ep.step("Running on Device...", 3);
if (ep.step("Running on Device...", 3)) {
return ERR_SKIP;
}
args.clear();
args.push_back("-s");
args.push_back(devices[p_device].id);
@@ -1763,7 +1773,7 @@ public:
String src_apk;
EditorProgress ep("export", "Exporting for Android", 105);
EditorProgress ep("export", "Exporting for Android", 105, true);
if (bool(p_preset->get("custom_package/use_custom_build"))) { //custom build
//re-generate build.gradle and AndroidManifest.xml
@@ -1855,7 +1865,9 @@ public:
FileAccess *src_f = NULL;
zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
ep.step("Creating APK", 0);
if (ep.step("Creating APK", 0)) {
return ERR_SKIP;
}
unzFile pkg = unzOpen2(src_apk.utf8().get_data(), &io);
if (!pkg) {
@@ -1997,7 +2009,9 @@ public:
ret = unzGoToNextFile(pkg);
}
ep.step("Adding Files...", 1);
if (ep.step("Adding Files...", 1)) {
return ERR_SKIP;
}
Error err = OK;
Vector<String> cl = cmdline.strip_edges().split(" ");
for (int i = 0; i < cl.size(); i++) {
@@ -2135,14 +2149,18 @@ public:
user = EditorSettings::get_singleton()->get("export/android/debug_keystore_user");
}
ep.step("Signing debug APK...", 103);
if (ep.step("Signing debug APK...", 103)) {
return ERR_SKIP;
}
} else {
keystore = release_keystore;
password = release_password;
user = release_username;
ep.step("Signing release APK...", 103);
if (ep.step("Signing release APK...", 103)) {
return ERR_SKIP;
}
}
if (!FileAccess::exists(keystore)) {
@@ -2174,7 +2192,9 @@ public:
return ERR_CANT_CREATE;
}
ep.step("Verifying APK...", 104);
if (ep.step("Verifying APK...", 104)) {
return ERR_SKIP;
}
args.clear();
args.push_back("-verify");
@@ -2194,7 +2214,9 @@ public:
static const int ZIP_ALIGNMENT = 4;
ep.step("Aligning APK...", 105);
if (ep.step("Aligning APK...", 105)) {
return ERR_SKIP;
}
unzFile tmp_unaligned = unzOpen2(unaligned_path.utf8().get_data(), &io);
if (!tmp_unaligned) {