[Command line export] return 0 exit code when export is finished with warnings.
This commit is contained in:
parent
d26442e709
commit
d02bf7584a
1 changed files with 10 additions and 5 deletions
|
@ -923,6 +923,7 @@ void EditorNode::_fs_changed() {
|
||||||
|
|
||||||
// FIXME: Move this to a cleaner location, it's hacky to do this in _fs_changed.
|
// FIXME: Move this to a cleaner location, it's hacky to do this in _fs_changed.
|
||||||
String export_error;
|
String export_error;
|
||||||
|
Error err = OK;
|
||||||
if (!export_defer.preset.is_empty() && !EditorFileSystem::get_singleton()->is_scanning()) {
|
if (!export_defer.preset.is_empty() && !EditorFileSystem::get_singleton()->is_scanning()) {
|
||||||
String preset_name = export_defer.preset;
|
String preset_name = export_defer.preset;
|
||||||
// Ensures export_project does not loop infinitely, because notifications may
|
// Ensures export_project does not loop infinitely, because notifications may
|
||||||
|
@ -940,6 +941,7 @@ void EditorNode::_fs_changed() {
|
||||||
if (export_preset.is_null()) {
|
if (export_preset.is_null()) {
|
||||||
Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
|
Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
|
||||||
if (da->file_exists("res://export_presets.cfg")) {
|
if (da->file_exists("res://export_presets.cfg")) {
|
||||||
|
err = FAILED;
|
||||||
export_error = vformat(
|
export_error = vformat(
|
||||||
"Invalid export preset name: %s.\nThe following presets were detected in this project's `export_presets.cfg`:\n\n",
|
"Invalid export preset name: %s.\nThe following presets were detected in this project's `export_presets.cfg`:\n\n",
|
||||||
preset_name);
|
preset_name);
|
||||||
|
@ -948,17 +950,19 @@ void EditorNode::_fs_changed() {
|
||||||
export_error += vformat(" \"%s\"\n", EditorExport::get_singleton()->get_export_preset(i)->get_name());
|
export_error += vformat(" \"%s\"\n", EditorExport::get_singleton()->get_export_preset(i)->get_name());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
err = FAILED;
|
||||||
export_error = "This project doesn't have an `export_presets.cfg` file at its root.\nCreate an export preset from the \"Project > Export\" dialog and try again.";
|
export_error = "This project doesn't have an `export_presets.cfg` file at its root.\nCreate an export preset from the \"Project > Export\" dialog and try again.";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Ref<EditorExportPlatform> platform = export_preset->get_platform();
|
Ref<EditorExportPlatform> platform = export_preset->get_platform();
|
||||||
const String export_path = export_defer.path.is_empty() ? export_preset->get_export_path() : export_defer.path;
|
const String export_path = export_defer.path.is_empty() ? export_preset->get_export_path() : export_defer.path;
|
||||||
if (export_path.is_empty()) {
|
if (export_path.is_empty()) {
|
||||||
|
err = FAILED;
|
||||||
export_error = vformat("Export preset \"%s\" doesn't have a default export path, and none was specified.", preset_name);
|
export_error = vformat("Export preset \"%s\" doesn't have a default export path, and none was specified.", preset_name);
|
||||||
} else if (platform.is_null()) {
|
} else if (platform.is_null()) {
|
||||||
|
err = FAILED;
|
||||||
export_error = vformat("Export preset \"%s\" doesn't have a matching platform.", preset_name);
|
export_error = vformat("Export preset \"%s\" doesn't have a matching platform.", preset_name);
|
||||||
} else {
|
} else {
|
||||||
Error err = OK;
|
|
||||||
if (export_defer.pack_only) { // Only export .pck or .zip data pack.
|
if (export_defer.pack_only) { // Only export .pck or .zip data pack.
|
||||||
if (export_path.ends_with(".zip")) {
|
if (export_path.ends_with(".zip")) {
|
||||||
err = platform->export_zip(export_preset, export_defer.debug, export_path);
|
err = platform->export_zip(export_preset, export_defer.debug, export_path);
|
||||||
|
@ -979,17 +983,18 @@ void EditorNode::_fs_changed() {
|
||||||
if (err != OK) {
|
if (err != OK) {
|
||||||
export_error = vformat("Project export for preset \"%s\" failed.", preset_name);
|
export_error = vformat("Project export for preset \"%s\" failed.", preset_name);
|
||||||
} else if (platform->get_worst_message_type() >= EditorExportPlatform::EXPORT_MESSAGE_WARNING) {
|
} else if (platform->get_worst_message_type() >= EditorExportPlatform::EXPORT_MESSAGE_WARNING) {
|
||||||
export_error = vformat("Project export for preset \"%s\" completed with errors.", preset_name);
|
export_error = vformat("Project export for preset \"%s\" completed with warnings.", preset_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!export_error.is_empty()) {
|
if (err != OK) {
|
||||||
ERR_PRINT(export_error);
|
ERR_PRINT(export_error);
|
||||||
_exit_editor(EXIT_FAILURE);
|
_exit_editor(EXIT_FAILURE);
|
||||||
} else {
|
} else if (!export_error.is_empty()) {
|
||||||
_exit_editor(EXIT_SUCCESS);
|
WARN_PRINT(export_error);
|
||||||
}
|
}
|
||||||
|
_exit_editor(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue