builds godot
patch for https://github.com/godotengine/godot-proposals/issues/4815
bendn 2022-08-15
parent 5bd6de5 · commit 95e8e7f
-rw-r--r--.github/actions/build-godot/action.yml5
-rw-r--r--.github/actions/get-version/action.yml3
-rw-r--r--.github/actions/setup/action.yml20
-rw-r--r--.github/workflows/build-3.5-normal.yml2
-rw-r--r--.github/workflows/build-3.x-normal.yml2
-rw-r--r--.github/workflows/reusable-build.yml6
-rw-r--r--patches/no-arg-handling.patch140
7 files changed, 163 insertions, 15 deletions
diff --git a/.github/actions/build-godot/action.yml b/.github/actions/build-godot/action.yml
index 3300261..8c84607 100644
--- a/.github/actions/build-godot/action.yml
+++ b/.github/actions/build-godot/action.yml
@@ -37,11 +37,6 @@ runs:
tree
shell: bash
- - name: Setup Python
- uses: actions/setup-python@v2
- with:
- python-version: 3.9
-
- name: Setup scons
run: pip install scons
shell: bash
diff --git a/.github/actions/get-version/action.yml b/.github/actions/get-version/action.yml
index cb89328..1b8297a 100644
--- a/.github/actions/get-version/action.yml
+++ b/.github/actions/get-version/action.yml
@@ -9,9 +9,6 @@ runs:
with:
ref: ${{ env.ref }}
- - name: Setup Python
- uses: actions/setup-python@v2
-
- name: Get version
run: |
cd godot
diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml
index 77e2564..d26934c 100644
--- a/.github/actions/setup/action.yml
+++ b/.github/actions/setup/action.yml
@@ -27,8 +27,24 @@ runs:
ref: ${{ inputs.ref }}
path: "godot"
- - name: Get module data
+ - uses: actions/checkout@v3
+ if: steps.clean.outputs.clean == 'true'
+ with:
+ path: "repo"
+
+ - name: Setup Python
+ if: steps.clean.outputs.clean == 'true'
+ uses: actions/setup-python@v2
+ with:
+ python-version: 3.9
+
+ - name: Apply patches to godot
if: steps.clean.outputs.clean == 'true'
run: |
- curl "${{ env.modules }}" --output godot/custom.py || wget -nv "$modules" -O godot/custom.py
+ # Patch godot
+ echo "::group::Patch godot"
+ (cd repo && mv "${{ env.modules }}" ../godot/custom.py && mv patches ../godot)
+ cd godot
+ for patch in patches/*; do git apply --ignore-whitespace "$patch" || echo "::error file={${patch}}::Go update your patch"; done
+ echo "::endgroup::"
shell: bash
diff --git a/.github/workflows/build-3.5-normal.yml b/.github/workflows/build-3.5-normal.yml
index d129aa1..b54c493 100644
--- a/.github/workflows/build-3.5-normal.yml
+++ b/.github/workflows/build-3.5-normal.yml
@@ -16,5 +16,5 @@ jobs:
with:
ref: 3.5-stable
name: godot
- modules-url: https://raw.githubusercontent.com/bend-n/godot-builds/main/.github/normal-build-modules.py
+ modules-path: ./.github/normal-build-modules.py
secrets: inherit
diff --git a/.github/workflows/build-3.x-normal.yml b/.github/workflows/build-3.x-normal.yml
index 1b3fec5..4a9e8c5 100644
--- a/.github/workflows/build-3.x-normal.yml
+++ b/.github/workflows/build-3.x-normal.yml
@@ -18,5 +18,5 @@ jobs:
with:
ref: 3.x
name: godot
- modules-url: https://raw.githubusercontent.com/bend-n/godot-builds/main/.github/normal-build-modules.py
+ modules-path: ./.github/normal-build-modules.py
secrets: inherit
diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml
index 2395607..679d1a0 100644
--- a/.github/workflows/reusable-build.yml
+++ b/.github/workflows/reusable-build.yml
@@ -10,9 +10,9 @@ on:
type: string
default: disable_3d=yes
required: false
- modules-url:
+ modules-path:
type: string
- default: "https://raw.githubusercontent.com/bend-n/godot-builds/main/.github/2d-build-modules.py"
+ default: ./.github/2d-build-modules.py
required: false
name:
type: string
@@ -22,7 +22,7 @@ on:
env:
ref: ${{ inputs.ref }}
flags: ${{ inputs.flags }}
- modules: ${{ inputs.modules-url }}
+ modules: ${{ inputs.modules-path }}
tools: no
jobs:
diff --git a/patches/no-arg-handling.patch b/patches/no-arg-handling.patch
new file mode 100644
index 0000000..f82a21e
--- /dev/null
+++ b/patches/no-arg-handling.patch
@@ -0,0 +1,140 @@
+diff --git a/main/main.cpp b/main/main.cpp
+index 37ef433..c5b8363 100644
+--- a/main/main.cpp
++++ b/main/main.cpp
+@@ -128,7 +128,9 @@ static int audio_driver_idx = -1;
+ static bool editor = false;
+ static bool project_manager = false;
+ static String locale;
++#ifdef TOOLS_ENABLED
+ static bool show_help = false;
++#endif
+ static bool auto_quit = false;
+ static OS::ProcessID allow_focus_steal_pid = 0;
+ static bool delta_sync_after_draw = false;
+@@ -239,6 +241,7 @@ void finalize_navigation_server() {
+ #define MAIN_PRINT(m_txt)
+ #endif
+
++#ifdef TOOLS_ENABLED
+ void Main::print_help(const char *p_binary) {
+ print_line(String(VERSION_NAME) + " v" + get_full_version_string() + " - " + String(VERSION_WEBSITE));
+ OS::get_singleton()->print("Free and open source software under the terms of the MIT license.\n");
+@@ -256,11 +259,9 @@ void Main::print_help(const char *p_binary) {
+ OS::get_singleton()->print("\n");
+
+ OS::get_singleton()->print("Run options:\n");
+-#ifdef TOOLS_ENABLED
+ OS::get_singleton()->print(" -e, --editor Start the editor instead of running the scene.\n");
+ OS::get_singleton()->print(" -p, --project-manager Start the project manager, even if a project is auto-detected.\n");
+ OS::get_singleton()->print(" --debug-server <address> Start the editor debug server (<IP>:<port>, e.g. 127.0.0.1:6007)\n");
+-#endif
+ OS::get_singleton()->print(" -q, --quit Quit after the first iteration.\n");
+ OS::get_singleton()->print(" -l, --language <locale> Use a specific locale (<locale> being a two-letter code).\n");
+ OS::get_singleton()->print(" --path <directory> Path to a project (<directory> must contain a 'project.godot' file).\n");
+@@ -355,6 +356,7 @@ void Main::print_help(const char *p_binary) {
+ OS::get_singleton()->print(").\n");
+ #endif
+ }
++#endif
+
+ /* Engine initialization
+ *
+@@ -493,9 +495,8 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
+ #endif
+
+ List<String>::Element *N = I->next();
+-
++#ifdef TOOLS_ENABLED
+ if (I->get() == "-h" || I->get() == "--help" || I->get() == "/?") { // display help
+-
+ show_help = true;
+ exit_code = ERR_HELP; // Hack to force an early exit in `main()` with a success code.
+ goto error;
+@@ -737,7 +738,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
+ OS::get_singleton()->print("Missing render thread mode argument, aborting.\n");
+ goto error;
+ }
+-#ifdef TOOLS_ENABLED
+ } else if (I->get() == "-e" || I->get() == "--editor") { // starts editor
+
+ editor = true;
+@@ -773,7 +773,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
+
+ editor = true;
+ main_args.push_back(I->get());
+-#endif
+ } else if (I->get() == "--path") { // set path of project to start or edit
+
+ if (I->next()) {
+@@ -806,9 +805,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
+ } else {
+ project_path = path;
+ }
+-#ifdef TOOLS_ENABLED
+ editor = true;
+-#endif
+ } else if (I->get() == "-b" || I->get() == "--breakpoints") { // add breakpoints
+
+ if (I->next()) {
+@@ -902,6 +899,10 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
+ }
+
+ I = N;
++#else
++ main_args.push_back(I->get());
++ I = N;
++#endif
+ }
+
+ #ifdef TOOLS_ENABLED
+@@ -909,7 +910,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
+ OS::get_singleton()->print("Error: Command line arguments implied opening both editor and project manager, which is not possible. Aborting.\n");
+ goto error;
+ }
+-#endif
+
+ // Network file system needs to be configured before globals, since globals are based on the
+ // 'project.godot' file which will only be available through the network if this is enabled
+@@ -932,7 +932,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
+
+ FileAccess::make_default<FileAccessNetwork>(FileAccess::ACCESS_RESOURCES);
+ }
+-
++#endif
+ if (globals->setup(project_path, main_pack, upwards, editor) == OK) {
+ #ifdef TOOLS_ENABLED
+ found_project = true;
+@@ -1001,12 +1001,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
+ if (editor) {
+ packed_data->set_disabled(true);
+ globals->set_disable_feature_overrides(true);
+- }
+-
+-#endif
+-
+-#ifdef TOOLS_ENABLED
+- if (editor) {
+ Engine::get_singleton()->set_editor_hint(true);
+ main_args.push_back("--editor");
+ if (!init_windowed) {
+@@ -1281,7 +1275,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
+ return OK;
+
+ error:
+-
+ video_driver = "";
+ audio_driver = "";
+ tablet_driver = "";
+@@ -1290,9 +1283,11 @@ error:
+ args.clear();
+ main_args.clear();
+
++#ifdef TOOLS_ENABLED
+ if (show_help) {
+ print_help(execpath);
+ }
++#endif
+
+ if (performance) {
+ memdelete(performance);