diff --git a/.github/workflows/static_checks.yml b/.github/workflows/static_checks.yml index 9d9e1874..c327db34 100644 --- a/.github/workflows/static_checks.yml +++ b/.github/workflows/static_checks.yml @@ -31,7 +31,7 @@ jobs: - name: Checkout workaround run: | mv tmp/misc/scripts misc/scripts - cp misc/formatting/clang_format.sh misc/scripts/clang_format.sh + cp clang_format.sh misc/scripts/clang_format.sh - name: Install APT dependencies uses: awalsh128/cache-apt-pkgs-action@latest @@ -62,10 +62,6 @@ jobs: run: | bash ./misc/scripts/file_format.sh changed.txt - - name: Header guards formatting checks (header_guards.sh) - run: | - bash ./misc/scripts/header_guards.sh changed.txt - - name: Python scripts static analysis (mypy_check.sh) run: | if grep -qE '\.py$|SConstruct|SCsub' changed.txt || [ -z "$(cat changed.txt)" ]; then diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b3aae617..21824c08 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,12 +20,13 @@ - ``.github``: Runs custom CI/CD in GitHub - ``docs``: Add some additional stuff for README.md - ``src``: Contains custom C++ code + - [language](src/language/README.md) ## Preparing your PR The project is using [`clang-format`](https://clang.llvm.org/docs/ClangFormat.html) to format C++ files. -You need to run `bash ./misc/formatting/clang_format.sh` before your PR for a successful pipeline. +You need to run `bash clang_format.sh` before your PR for a successful pipeline. Furthermore, there is an `utf-8` and `LF` checker to fix file formats. Additionally, some spellchecks run inside the [pipeline](.github/workflows/static_checks.yml). diff --git a/SCsub b/SCsub index 5b87ceee..0246a116 100644 --- a/SCsub +++ b/SCsub @@ -69,7 +69,6 @@ if env["tests"]: sources = [ "register_types.cpp", - "javascript_language.cpp", "javascript_instance.cpp", "javascript.cpp", ] @@ -77,6 +76,17 @@ sources = [ # Add all required files for "Javascript" language into godot env_javascript.Append(CPPPATH=["#modules/javascript"]) env_javascript.add_source_files(env.modules_sources, sources) +env_javascript.add_source_files(env.modules_sources, "src/language/*.cpp") +env_javascript.add_source_files(env.modules_sources, "src/language/templates/*.cpp") + +# --- Generate template files --- +from misc.generate.templates import get_templates_header +from misc.generate.templates import get_templates_files +from misc.generate.generate_files import generate_templates + +files = get_templates_files() +generate_templates(javascript_dir, get_templates_header(), files) +env_javascript.add_source_files(env.modules_sources, files.keys()) # --- Generate binding files --- # Binding script to run at engine initializing diff --git a/misc/formatting/clang_format.sh b/clang_format.sh similarity index 100% rename from misc/formatting/clang_format.sh rename to clang_format.sh diff --git a/editor/editor_tools.cpp b/editor/editor_tools.cpp index 875405dc..5741eb56 100644 --- a/editor/editor_tools.cpp +++ b/editor/editor_tools.cpp @@ -8,7 +8,7 @@ #include "editor/editor_help.h" #include "editor/filesystem_dock.h" -#include "../javascript_language.h" +#include "../src/language/javascript_language.h" #define TS_IGNORE "//@ts-ignore\n" static HashMap> ts_ignore_errors; diff --git a/javascript.cpp b/javascript.cpp index 7ad4b3b8..98eadbbd 100644 --- a/javascript.cpp +++ b/javascript.cpp @@ -2,11 +2,10 @@ /* After loading it contains the code/bytecode of the loaded file. */ #include "javascript.h" -#include "core/config/engine.h" #include "core/io/file_access_encrypted.h" #include "javascript_instance.h" -#include "javascript_language.h" #include "scene/resources/resource_format_text.h" +#include "src/language/javascript_language.h" ScriptLanguage *JavaScript::get_language() const { return JavaScriptLanguage::get_singleton(); diff --git a/javascript.h b/javascript.h index 2813c89d..98bfc4eb 100644 --- a/javascript.h +++ b/javascript.h @@ -9,7 +9,9 @@ #include "javascript_binder.h" +#define EXT_NAME "JavaScript" #define EXT_JSCLASS "mjs" +#define EXT_TSCLASS "ts" #define EXT_JSMODULE "js" #define EXT_JSON "json" diff --git a/javascript_instance.cpp b/javascript_instance.cpp index af0e67b8..4c286ace 100644 --- a/javascript_instance.cpp +++ b/javascript_instance.cpp @@ -1,6 +1,6 @@ #include "javascript_instance.h" #include "javascript.h" -#include "javascript_language.h" +#include "src/language/javascript_language.h" Ref