Merge pull request #47937 from m4gr3d/display_export_command_errors

[3.x] Fix issue causing export to fail
This commit is contained in:
Rémi Verschelde 2021-04-15 23:24:30 +02:00 committed by GitHub
commit 595a74ca79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1869,7 +1869,7 @@ public:
if (use_reverse)
p_debug_flags |= DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST;
String tmp_export_path = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmpexport.apk");
String tmp_export_path = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmpexport." + uitos(OS::get_singleton()->get_unix_time()) + ".apk");
#define CLEANUP_AND_RETURN(m_err) \
{ \
@ -1887,6 +1887,7 @@ public:
List<String> args;
int rv;
String output;
bool remove_prev = p_preset->get("one_click_deploy/clear_previous_install");
String version_name = p_preset->get("version/name");
@ -1904,7 +1905,9 @@ public:
args.push_back("uninstall");
args.push_back(get_package_name(package_name));
err = OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv);
output.clear();
err = OS::get_singleton()->execute(adb, args, true, NULL, &output, &rv, true);
print_verbose(output);
}
print_line("Installing to device (please wait...): " + devices[p_device].name);
@ -1919,7 +1922,9 @@ public:
args.push_back("-r");
args.push_back(tmp_export_path);
err = OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv);
output.clear();
err = OS::get_singleton()->execute(adb, args, true, NULL, &output, &rv, true);
print_verbose(output);
if (err || rv != 0) {
EditorNode::add_io_error("Could not install to device.");
CLEANUP_AND_RETURN(ERR_CANT_CREATE);
@ -1937,7 +1942,9 @@ public:
args.push_back(devices[p_device].id);
args.push_back("reverse");
args.push_back("--remove-all");
OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv);
output.clear();
OS::get_singleton()->execute(adb, args, true, NULL, &output, &rv, true);
print_verbose(output);
if (p_debug_flags & DEBUG_FLAG_REMOTE_DEBUG) {
@ -1949,7 +1956,9 @@ public:
args.push_back("tcp:" + itos(dbg_port));
args.push_back("tcp:" + itos(dbg_port));
OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv);
output.clear();
OS::get_singleton()->execute(adb, args, true, NULL, &output, &rv, true);
print_verbose(output);
print_line("Reverse result: " + itos(rv));
}
@ -1964,7 +1973,9 @@ public:
args.push_back("tcp:" + itos(fs_port));
args.push_back("tcp:" + itos(fs_port));
err = OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv);
output.clear();
err = OS::get_singleton()->execute(adb, args, true, NULL, &output, &rv, true);
print_verbose(output);
print_line("Reverse result2: " + itos(rv));
}
} else {
@ -1993,7 +2004,9 @@ public:
args.push_back("-n");
args.push_back(get_package_name(package_name) + "/com.godot.game.GodotApp");
err = OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv);
output.clear();
err = OS::get_singleton()->execute(adb, args, true, NULL, &output, &rv, true);
print_verbose(output);
if (err || rv != 0) {
EditorNode::add_io_error("Could not execute on device.");
CLEANUP_AND_RETURN(ERR_CANT_CREATE);
@ -2693,6 +2706,7 @@ public:
return ERR_FILE_CANT_OPEN;
}
String output;
List<String> args;
args.push_back("sign");
args.push_back("--verbose");
@ -2708,7 +2722,9 @@ public:
print_verbose("Signing debug binary using: " + String("\n") + apksigner + " " + join_list(args, String(" ")));
}
int retval;
OS::get_singleton()->execute(apksigner, args, true, NULL, NULL, &retval);
output.clear();
OS::get_singleton()->execute(apksigner, args, true, NULL, &output, &retval, true);
print_verbose(output);
if (retval) {
EditorNode::add_io_error("'apksigner' returned with error #" + itos(retval));
return ERR_CANT_CREATE;
@ -2726,7 +2742,9 @@ public:
print_verbose("Verifying signed build using: " + String("\n") + apksigner + " " + join_list(args, String(" ")));
}
OS::get_singleton()->execute(apksigner, args, true, NULL, NULL, &retval);
output.clear();
OS::get_singleton()->execute(apksigner, args, true, NULL, &output, &retval, true);
print_verbose(output);
if (retval) {
EditorNode::add_io_error("'apksigner' verification of " + export_label + " failed.");
return ERR_CANT_CREATE;
@ -3032,7 +3050,7 @@ public:
FileAccess *dst_f = NULL;
io2.opaque = &dst_f;
String tmp_unaligned_path = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmpexport-unaligned.apk");
String tmp_unaligned_path = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmpexport-unaligned." + uitos(OS::get_singleton()->get_unix_time()) + ".apk");
#define CLEANUP_AND_RETURN(m_err) \
{ \