summaryrefslogtreecommitdiff
path: root/platform/uwp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-01-07 13:29:02 +0100
committerRémi Verschelde <rverschelde@gmail.com>2020-01-07 14:25:56 +0100
commit5011afcb6ad6a7f7eb37a2cb74f28985e70cbc20 (patch)
tree337be6abf4964783cc3a47bdaf6345c4ed9e806e /platform/uwp
parent96fdb48edd49966485cc344a01eaaa74a2999d42 (diff)
Export: Improve usability of command line interface
I'm barely scratching the surface of the changes needed to make the --export command line interface easy to use, but this should already improve things somewhat. - Streamline `can_export()` templates check in all platforms, checking first for the presence of official templates, then of any defined custom template, and reporting on the absence of any. Shouldn't change the actual return value much which is still true if either release or debug is usable - we might want to change that eventually and better validate against the requested target. - Fix discrepancy between platforms using `custom_package/debug` and `custom_template/debug` (resp. `release`). All now use `custom_template`, which will break compatibility for `export_presets.cfg` with earlier projects (but is easy to fix). - Use `can_export()` when attempting a command line export and report the same errors that would be shown in the editor. - Improve error reporting after a failed export attempt, handling missing template and invalid path more gracefully. - Cleanup of unused stuff in EditorNode around the export workflow. - Improve --export documentation in --help a bit. Fixes #16949 (at least many of the misunderstandings listed there). Fixes #18470.
Diffstat (limited to 'platform/uwp')
-rw-r--r--platform/uwp/export/export.cpp49
1 files changed, 18 insertions, 31 deletions
diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp
index 3fa5512819..57fb9004b8 100644
--- a/platform/uwp/export/export.cpp
+++ b/platform/uwp/export/export.cpp
@@ -1090,15 +1090,14 @@ public:
}
virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const {
+
String err;
- bool valid = true;
- Platform arch = (Platform)(int)(p_preset->get("architecture/target"));
+ bool valid = false;
- String custom_debug_binary = p_preset->get("custom_template/debug");
- String custom_release_binary = p_preset->get("custom_template/release");
+ // Look for export templates (first official, and if defined custom templates).
+ Platform arch = (Platform)(int)(p_preset->get("architecture/target"));
String platform_infix;
-
switch (arch) {
case EditorExportPlatformUWP::ARM: {
platform_infix = "arm";
@@ -1111,38 +1110,26 @@ public:
} break;
}
- if (!exists_export_template("uwp_" + platform_infix + "_debug.zip", &err) || !exists_export_template("uwp_" + platform_infix + "_release.zip", &err)) {
- valid = false;
- r_missing_templates = true;
- }
+ bool dvalid = exists_export_template("uwp_" + platform_infix + "_debug.zip", &err);
+ bool rvalid = exists_export_template("uwp_" + platform_infix + "_release.zip", &err);
- if (!valid && custom_debug_binary == "" && custom_release_binary == "") {
- if (!err.empty()) {
- r_error = err;
+ if (p_preset->get("custom_template/debug") != "") {
+ dvalid = FileAccess::exists(p_preset->get("custom_template/debug"));
+ if (!dvalid) {
+ err += TTR("Custom debug template not found.") + "\n";
}
- return valid;
}
-
- bool dvalid = true;
- bool rvalid = true;
-
- if (!FileAccess::exists(custom_debug_binary)) {
- dvalid = false;
- err += TTR("Custom debug template not found.") + "\n";
- }
-
- if (!FileAccess::exists(custom_release_binary)) {
- rvalid = false;
- err += TTR("Custom release template not found.") + "\n";
+ if (p_preset->get("custom_template/release") != "") {
+ rvalid = FileAccess::exists(p_preset->get("custom_template/release"));
+ if (!rvalid) {
+ err += TTR("Custom release template not found.") + "\n";
+ }
}
- if (dvalid || rvalid)
- valid = true;
+ valid = dvalid || rvalid;
+ r_missing_templates = !valid;
- if (!valid) {
- r_error = err;
- return valid;
- }
+ // Validate the rest of the configuration.
if (!_valid_resource_name(p_preset->get("package/short_name"))) {
valid = false;