Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: moved javascript_language.cpp and split it to multiple files #210

Merged
merged 7 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/workflows/static_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand Down
12 changes: 11 additions & 1 deletion SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,24 @@ if env["tests"]:

sources = [
"register_types.cpp",
"javascript_language.cpp",
"javascript_instance.cpp",
"javascript.cpp",
]

# 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
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion editor/editor_tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, HashSet<String>> ts_ignore_errors;
Expand Down Expand Up @@ -192,7 +192,7 @@
}

// The following functions are used to generate a godot.d.ts file out of the docs folder from godot
#pragma region TS declare file

Check warning on line 195 in editor/editor_tools.cpp

View workflow job for this annotation

GitHub Actions / 🐧 Linux / Editor w/ Mono (target=editor)

ignoring #pragma region TS [-Wunknown-pragmas]

static String format_doc_text(const String &p_bbcode, const String &p_indent = "\t") {
String markdown = p_bbcode.strip_edges();
Expand Down Expand Up @@ -727,6 +727,6 @@
}
}

#pragma endregion TS declare file

Check warning on line 730 in editor/editor_tools.cpp

View workflow job for this annotation

GitHub Actions / 🐧 Linux / Editor w/ Mono (target=editor)

ignoring #pragma endregion TS [-Wunknown-pragmas]

#endif // TOOLS_ENABLED
3 changes: 1 addition & 2 deletions javascript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions javascript.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion javascript_instance.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "javascript_instance.h"
#include "javascript.h"
#include "javascript_language.h"
#include "src/language/javascript_language.h"

Ref<Script> JavaScriptInstance::get_script() const {
return script;
Expand Down
Loading
Loading