summaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorMikael Hermansson <mikael@hermansson.io>2024-09-17 12:48:10 +0200
committerMikael Hermansson <mikael@hermansson.io>2024-09-25 17:07:28 +0200
commitd3be030ea6f3e295603ccf6cc9080a1d32051332 (patch)
treeea184077a368d8c447527dd8cb72f7eab1c27200 /main
parent4254946de93bab0cc1fb36a7b9039c9ec43be924 (diff)
downloadredot-engine-d3be030ea6f3e295603ccf6cc9080a1d32051332.tar.gz
Add ability to export patch packs
Co-authored-by: Poq Xert <poqxert@poqxert.ru>
Diffstat (limited to 'main')
-rw-r--r--main/main.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/main/main.cpp b/main/main.cpp
index 439cd385c0..9d350e60e7 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -650,6 +650,8 @@ void Main::print_help(const char *p_binary) {
print_help_option("", "The target directory must exist.\n");
print_help_option("--export-debug <preset> <path>", "Export the project in debug mode using the given preset and output path. See --export-release description for other considerations.\n", CLI_OPTION_AVAILABILITY_EDITOR);
print_help_option("--export-pack <preset> <path>", "Export the project data only using the given preset and output path. The <path> extension determines whether it will be in PCK or ZIP format.\n", CLI_OPTION_AVAILABILITY_EDITOR);
+ print_help_option("--export-patch <preset> <path>", "Export pack with changed files only. See --export-pack description for other considerations.\n", CLI_OPTION_AVAILABILITY_EDITOR);
+ print_help_option("--patches <paths>", "List of patches to use with --export-patch. The list is comma-separated.\n", CLI_OPTION_AVAILABILITY_EDITOR);
print_help_option("--install-android-build-template", "Install the Android build template. Used in conjunction with --export-release or --export-debug.\n", CLI_OPTION_AVAILABILITY_EDITOR);
#ifndef DISABLE_DEPRECATED
// Commands are long; split the description to a second line.
@@ -1469,12 +1471,23 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
wait_for_import = true;
quit_after = 1;
} else if (arg == "--export-release" || arg == "--export-debug" ||
- arg == "--export-pack") { // Export project
+ arg == "--export-pack" || arg == "--export-patch") { // Export project
// Actually handling is done in start().
editor = true;
cmdline_tool = true;
wait_for_import = true;
main_args.push_back(arg);
+ } else if (arg == "--patches") {
+ if (N) {
+ // Actually handling is done in start().
+ main_args.push_back(arg);
+ main_args.push_back(N->get());
+
+ N = N->next();
+ } else {
+ OS::get_singleton()->print("Missing comma-separated list of patches after --patches, aborting.\n");
+ goto error;
+ }
#ifndef DISABLE_DEPRECATED
} else if (arg == "--export") { // For users used to 3.x syntax.
OS::get_singleton()->print("The Godot 3 --export option was changed to more explicit --export-release / --export-debug / --export-pack options.\nSee the --help output for details.\n");
@@ -3480,9 +3493,11 @@ int Main::start() {
bool doc_tool_implicit_cwd = false;
BitField<DocTools::GenerateFlags> gen_flags;
String _export_preset;
+ Vector<String> patches;
bool export_debug = false;
bool export_pack_only = false;
bool install_android_build_template = false;
+ bool export_patch = false;
#ifdef MODULE_GDSCRIPT_ENABLED
String gdscript_docs_path;
#endif
@@ -3572,6 +3587,14 @@ int Main::start() {
editor = true;
_export_preset = E->next()->get();
export_pack_only = true;
+ } else if (E->get() == "--export-patch") {
+ ERR_FAIL_COND_V_MSG(!editor && !found_project, EXIT_FAILURE, "Please provide a valid project path when exporting, aborting.");
+ editor = true;
+ _export_preset = E->next()->get();
+ export_pack_only = true;
+ export_patch = true;
+ } else if (E->get() == "--patches") {
+ patches = E->next()->get().split(",", false);
#endif
} else {
// The parameter does not match anything known, don't skip the next argument
@@ -3975,7 +3998,7 @@ int Main::start() {
sml->get_root()->add_child(editor_node);
if (!_export_preset.is_empty()) {
- editor_node->export_preset(_export_preset, positional_arg, export_debug, export_pack_only, install_android_build_template);
+ editor_node->export_preset(_export_preset, positional_arg, export_debug, export_pack_only, install_android_build_template, export_patch, patches);
game_path = ""; // Do not load anything.
}