Skip to content

Commit 39421ba

Browse files
committed
Rename ECMAScript to JavaScript for godot 4
1 parent bb7a344 commit 39421ba

24 files changed

+865
-859
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## JavaScript language binding for godot game engine
22

3-
This module implements JavaScript/TypeScript language support for the godot game engine. [QuickJS](https://bellard.org/quickjs/) is used as the ECMAScript engine.
3+
This module implements JavaScript/TypeScript language support for the godot game engine. [QuickJS](https://bellard.org/quickjs/) is used as the JavaScript engine.
44

55
-----
66

@@ -20,15 +20,15 @@ You can also get the binaries with lastest commits from the [github build action
2020

2121
### Compilation
2222
* Clone the source code of [godot](https://github.com/godotengine/godot)
23-
* Clone this module and put it into `godot/modules/` and make sure the folder name of this module is `ECMAScript`
23+
* Clone this module and put it into `godot/modules/` and make sure the folder name of this module is `javascript`
2424
* [Recompile the godot engine](https://docs.godotengine.org/en/3.3/development/compiling/index.html) <b>(Only MinGW is supported on Windows for now!)</b>
2525

2626
![Build Godot with ECMAScript](https://github.com/GodotExplorer/ECMAScript/workflows/Build%20Godot%20with%20ECMAScript/badge.svg)
2727

2828
### Usage
2929

3030
##### How to export script class to godot
31-
1. Define your ECMAScript class and inherit from a godot class then export it as the **default** entry
31+
1. Define your JavaScript class and inherit from a godot class then export it as the **default** entry
3232
```js
3333
// The default export entry is treated as an exported class to godot
3434
export default class MySprite extends godot.Sprite {
@@ -94,15 +94,15 @@ godot.register_property(MyClass, 'number_value', {
9494
});
9595
```
9696

97-
For more detail on how to use it, [click here](https://github.com/GodotExplorer/ECMAScript/issues/24#issuecomment-655584829).
97+
For more detail on how to use it, [click here](https://github.com/Geequlim/ECMAScript/issues/24#issuecomment-655584829).
9898

9999
#### About the API
100100

101101
All of godots api's are defined within the `godot` namespace.
102102

103103
No API names have been renamed or changed so you shouldn't need to change your habits.
104104

105-
GDScript | ECMAScript
105+
GDScript | JavaScript
106106
---- | ---
107107
null | null
108108
int | number
@@ -180,7 +180,7 @@ Label.Align.ALIGN_LEFT | godot.Label.Align.ALIGN_LEFT
180180
```
181181

182182
### TypeScript support and JSX code completion
183-
- Run the menu command `Project > Tools > ECMAScript > Generate TypeScript Project` from the godot editor to generate a TypeScript project
183+
- Run the menu command `Project > Tools > JavaScript > Generate TypeScript Project` from the godot editor to generate a TypeScript project
184184
- Run `tsc -w -p .` under your project folder in the terminal to compile scripts
185185

186186
#### Code completion
@@ -269,6 +269,6 @@ You can try demos in the [ECMAScriptDemos](https://github.com/Geequlim/ECMAScrip
269269
* The script also build the `on_tag.yml` script which automates the github release publishing.
270270
** The `on_tag.yml` functionality tries to sleep until all jobs with the same `sha` are completed. It should be fine to run whenever, but depending on how github actions culls long running jobs you might want to make sure that all/(most of) the builds look good before tagging.
271271
* Linux ubsan asan build woes:
272-
** The godot repo has ubsan and asan builds that we can't build from. Currently we skip them (get removed via the `build_github_actions.py` script).
273-
** They should definitely be fixed & enabled at some point, **so please submit a PR if you have any ideas of how to do that!**
272+
* The godot repo has ubsan and asan builds that we can't build from. Currently we skip them (get removed via the `build_github_actions.py` script).
273+
* They should definitely be fixed & enabled at some point, **so please submit a PR if you have any ideas of how to do that!**
274274

SCsub

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,19 @@ if JS_ENGINE == 'quickjs':
4949

5050
# Binding script to run at engine initializing
5151
with open("misc/godot.binding_script.gen.cpp", "w") as f:
52-
text = '/* THIS FILE IS GENERATED DO NOT EDIT */\n#include "../ecmascript_binder.h"\nString ECMAScriptBinder::BINDING_SCRIPT_CONTENT = \n${source};'
52+
text = '/* THIS FILE IS GENERATED DO NOT EDIT */\n#include "../javascript_binder.h"\nString JavaScriptBinder::BINDING_SCRIPT_CONTENT = \n${source};'
5353
f.write(text.replace('${source}', dump_text_file_to_cpp("misc/binding_script.js")))
5454

5555
sources = [
5656
'register_types.cpp',
57-
'ecmascript_language.cpp',
58-
'ecmascript_instance.cpp',
59-
'ecmascript.cpp',
57+
'javascript_language.cpp',
58+
'javascript_instance.cpp',
59+
'javascript.cpp',
6060
'misc/godot.binding_script.gen.cpp',
6161
]
6262

6363
if env['tools']:
64-
base_text = '/* THIS FILE IS GENERATED DO NOT EDIT */\n#include "editor_tools.h"\nString ECMAScriptPlugin::{} = \n{};'
64+
base_text = '/* THIS FILE IS GENERATED DO NOT EDIT */\n#include "editor_tools.h"\nString JavaScriptPlugin::{} = \n{};'
6565
tool_fns = {"tools/godot.d.ts.gen.cpp": ("BUILTIN_DECLARATION_TEXT", dump_text_file_to_cpp("misc/godot.d.ts")),
6666
"tools/tsconfig.json.gen.cpp": ("TSCONFIG_CONTENT", dump_text_file_to_cpp("misc/tsconfig.json")),
6767
"tools/decorators.ts.gen.cpp": ("TS_DECORATORS_CONTENT", dump_text_file_to_cpp("misc/decorators.ts")),
@@ -73,5 +73,5 @@ if env['tools']:
7373
env_module.add_source_files(env.modules_sources, fn)
7474

7575

76-
env_module.Append(CPPPATH=["#modules/ECMAScript"])
76+
env_module.Append(CPPPATH=["#modules/javascript"])
7777
env_module.add_source_files(env.modules_sources, sources)

build_github_actions.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
You must be in this directory, and in the modules subfolder of godot (just as if you would install this project into godot)
55
66
usage:
7-
python build_github_actions.py --godot-version "3.5-stable" --godot-github-folder ../../.github --ECMAS-github-folder .github
7+
python build_github_actions.py --godot-version "3.5-stable" --godot-github-folder ../../.github --js-github-folder .github
88
99
"""
1010

@@ -53,7 +53,7 @@ def parseargs():
5353
parser = argparse.ArgumentParser()
5454
parser.add_argument("--godot-version", required=True)
5555
parser.add_argument("--godot-github-folder", required=True)
56-
parser.add_argument("--ECMAS-github-folder", required=True)
56+
parser.add_argument("--js-github-folder", required=True)
5757
return parser.parse_args()
5858

5959

@@ -83,17 +83,17 @@ def get_windows_mingw_checkout_steps() -> List[Dict[str, Any]]:
8383
return out
8484

8585

86-
def get_ECMAScript_checkout_steps() -> List[Dict[str, Any]]:
86+
def get_js_checkout_steps() -> List[Dict[str, Any]]:
8787
out = [
8888
{
8989
"name": "Checkout Godot",
9090
"uses": "actions/checkout@v2",
9191
"with": {"repository": "godotengine/godot", "ref": "${{ env.GODOT_BASE_BRANCH }}"},
9292
},
9393
{
94-
"name": "Checkout ECMAScript",
94+
"name": "Checkout javascript",
9595
"uses": "actions/checkout@v2",
96-
"with": {"path": "${{github.workspace}}/modules/ECMAScript/"},
96+
"with": {"path": "${{github.workspace}}/modules/javascript/"},
9797
},
9898
]
9999
return out
@@ -107,11 +107,11 @@ def get_rid_of_ubsan_asan_linux(matrix_step: Dict[str, Any]) -> Dict[str, Any]:
107107

108108

109109
def fix_all_workflows(
110-
ECMAS_github_folder: str, workflows: Dict[str, BuildOpts], wf_actions_that_require_shell: List[str]
110+
js_github_folder: str, workflows: Dict[str, BuildOpts], wf_actions_that_require_shell: List[str]
111111
) -> List[str]:
112112
wf_names: List[str] = []
113113
for wf_base_fn, build_opts in workflows.items():
114-
full_fn = os.path.join(ECMAS_github_folder, "workflows", wf_base_fn)
114+
full_fn = os.path.join(js_github_folder, "workflows", wf_base_fn)
115115
data = yaml.safe_load(open(full_fn))
116116
wf_names.append(data["name"])
117117

@@ -148,13 +148,13 @@ def fix_all_workflows(
148148
for step in data["jobs"][only_template_name]["steps"]:
149149
# replace godot checkout routine with this checkout routine
150150
if "uses" in step and "checkout" in step["uses"]:
151-
new_steps += get_ECMAScript_checkout_steps()
151+
new_steps += get_js_checkout_steps()
152152
elif (
153153
"uses" in step
154154
and base_github_string in step["uses"]
155155
and any(x in step["uses"] for x in wf_actions_that_require_shell)
156156
):
157-
step["uses"] = step["uses"].replace(base_github_string, "./modules/ECMAScript/.github/")
157+
step["uses"] = step["uses"].replace(base_github_string, "./modules/javascript/.github/")
158158
to_add = {"shell": "msys2 {0}" if "windows" in wf_base_fn else "sh"}
159159
if "with" not in step:
160160
step["with"] = to_add
@@ -170,15 +170,15 @@ def fix_all_workflows(
170170
return wf_names
171171

172172

173-
def fix_all_actions(ECMAS_github_folder: str, actions: List[str]) -> List[str]:
173+
def fix_all_actions(js_github_folder: str, actions: List[str]) -> List[str]:
174174
"""
175175
This can be simplified once:
176176
https://github.com/actions/runner/pull/1767
177177
is completed
178178
"""
179179
actions_that_require_shell_set = set()
180180
for action_base_fn in actions:
181-
full_action_fn = os.path.join(ECMAS_github_folder, action_base_fn)
181+
full_action_fn = os.path.join(js_github_folder, action_base_fn)
182182
data = yaml.safe_load(open(full_action_fn))
183183
new_steps = []
184184
for step in data["runs"]["steps"]:
@@ -308,13 +308,13 @@ def add_publish_workflow(out_fn: str, wf_name_list: List[str]):
308308
def main():
309309
args = parseargs()
310310
assert os.path.isdir(args.godot_github_folder)
311-
assert os.path.isdir(args.ECMAS_github_folder)
311+
assert os.path.isdir(args.js_github_folder)
312312
checkout_local_godot_install(args.godot_version)
313313

314314
for x in ["actions", "workflows"]:
315-
subprocess.call(["rm", "-rf", os.path.join(args.ECMAS_github_folder, x)])
315+
subprocess.call(["rm", "-rf", os.path.join(args.js_github_folder, x)])
316316
subprocess.call(
317-
["cp", "-r", os.path.join(args.godot_github_folder, x), os.path.join(args.ECMAS_github_folder, x)]
317+
["cp", "-r", os.path.join(args.godot_github_folder, x), os.path.join(args.js_github_folder, x)]
318318
)
319319

320320
basic_flags = " "
@@ -324,7 +324,7 @@ def main():
324324
"actions/godot-deps/action.yml",
325325
"actions/upload-artifact/action.yml",
326326
]
327-
wf_actions_that_require_shell = fix_all_actions(args.ECMAS_github_folder, actions)
327+
wf_actions_that_require_shell = fix_all_actions(args.js_github_folder, actions)
328328
workflows = {
329329
"android_builds.yml": BuildOpts(basic_flags, args.godot_version),
330330
"ios_builds.yml": BuildOpts(basic_flags, args.godot_version),
@@ -334,10 +334,10 @@ def main():
334334
"server_builds.yml": BuildOpts(basic_flags, args.godot_version),
335335
"windows_builds.yml": BuildOpts(f"{basic_flags} use_mingw=yes", args.godot_version),
336336
}
337-
wf_names = fix_all_workflows(args.ECMAS_github_folder, workflows, wf_actions_that_require_shell)
338-
subprocess.call(["rm", os.path.join(args.ECMAS_github_folder, "workflows", "static_checks.yml")])
337+
wf_names = fix_all_workflows(args.js_github_folder, workflows, wf_actions_that_require_shell)
338+
subprocess.call(["rm", os.path.join(args.js_github_folder, "workflows", "static_checks.yml")])
339339

340-
out_publish_fn = os.path.join(args.ECMAS_github_folder, "workflows", "on_tag.yml")
340+
out_publish_fn = os.path.join(args.js_github_folder, "workflows", "on_tag.yml")
341341
add_publish_workflow(out_publish_fn, wf_names)
342342

343343

ecmascript_binder.h

Lines changed: 0 additions & 102 deletions
This file was deleted.

ecmascript_instance.cpp

Lines changed: 0 additions & 71 deletions
This file was deleted.

0 commit comments

Comments
 (0)