diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index 031582bc..00000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1,180 +0,0 @@ -# Lines starting with '#' are comments. -# Each line is a file pattern followed by one or more owners. -# Owners can be @users, @org/teams or emails - -# Buildsystem - -.* @godotengine/buildsystem -.github/ @godotengine/buildsystem -*.py @godotengine/buildsystem -SConstruct @godotengine/buildsystem -SCsub @godotengine/buildsystem - -# Core - -/core/ @godotengine/core -/core/crypto/ @godotengine/network -/core/debugger/ @godotengine/debugger -/core/extension/ @godotengine/gdextension -/core/input/ @godotengine/input - -# Doc - -/doc/ @godotengine/documentation -doc_classes/* @godotengine/documentation - -# Drivers - -## Audio -/drivers/alsa/ @godotengine/audio -/drivers/alsamidi/ @godotengine/audio -/drivers/coreaudio/ @godotengine/audio -/drivers/coremidi/ @godotengine/audio -/drivers/pulseaudio/ @godotengine/audio -/drivers/wasapi/ @godotengine/audio -/drivers/winmidi/ @godotengine/audio -/drivers/xaudio2/ @godotengine/audio - -## Rendering -/drivers/dummy/ @godotengine/rendering -/drivers/gles3/ @godotengine/rendering -/drivers/spirv-reflect/ @godotengine/rendering -/drivers/vulkan/ @godotengine/rendering - -## OS -/drivers/unix/ @godotengine/_platforms -/drivers/windows/ @godotengine/windows - -## Misc -/drivers/png/ @godotengine/import - -# Editor - -/editor/*debugger* @godotengine/debugger -/editor/icons/ @godotengine/usability -/editor/import/ @godotengine/import -/editor/plugins/*2d_*.* @godotengine/2d-editor -/editor/plugins/*3d_*.* @godotengine/3d-editor -/editor/plugins/script_*.* @godotengine/script-editor -/editor/plugins/*shader*.* @godotengine/shaders -/editor/code_editor.* @godotengine/script-editor -/editor/*dock*.* @godotengine/docks -/editor/*shader*.* @godotengine/shaders - -# Main - -/main/ @godotengine/core - -# Misc - -/misc/ @godotengine/buildsystem - -# Modules - -## Audio (+ video) -/modules/minimp3/ @godotengine/audio -/modules/ogg/ @godotengine/audio -/modules/opus/ @godotengine/audio -/modules/theora/ @godotengine/audio -/modules/vorbis/ @godotengine/audio -/modules/webm/ @godotengine/audio - -## Import -/modules/basis_universal/ @godotengine/import -/modules/bmp/ @godotengine/import -/modules/cvtt/ @godotengine/import -/modules/dds/ @godotengine/import -/modules/etc/ @godotengine/import -/modules/fbx/ @godotengine/import -/modules/gltf/ @godotengine/import -/modules/hdr/ @godotengine/import -/modules/jpg/ @godotengine/import -/modules/pvr/ @godotengine/import -/modules/squish/ @godotengine/import -/modules/svg/ @godotengine/import -/modules/tga/ @godotengine/import -/modules/tinyexr/ @godotengine/import -/modules/webp/ @godotengine/import - -## Network -/modules/enet/ @godotengine/network -/modules/mbedtls/ @godotengine/network -/modules/upnp/ @godotengine/network -/modules/webrtc/ @godotengine/network -/modules/websocket/ @godotengine/network - -## Rendering -/modules/denoise/ @godotengine/rendering -/modules/glslang/ @godotengine/rendering -/modules/lightmapper_rd/ @godotengine/rendering -/modules/meshoptimizer/ @godotengine/rendering -/modules/vhacd/ @godotengine/rendering -/modules/xatlas_unwrap/ @godotengine/rendering - -## Scripting -/modules/gdscript/ @godotengine/gdscript -/modules/jsonrpc/ @godotengine/gdscript -/modules/mono/ @godotengine/dotnet - -## Text -/modules/freetype/ @godotengine/buildsystem -/modules/text_server_adv/ @godotengine/gui-nodes -/modules/text_server_fb/ @godotengine/gui-nodes - -## XR -/modules/camera/ @godotengine/xr -/modules/gdextension/xr/ @godotengine/xr -/modules/mobile_vr/ @godotengine/xr -/modules/webxr/ @godotengine/xr - -## Misc -/modules/bullet/ @godotengine/physics -/modules/csg/ @godotengine/3d-nodes -/modules/gdnavigation/ @godotengine/navigation -/modules/gridmap/ @godotengine/3d-nodes -/modules/opensimplex/ @godotengine/3d-nodes -/modules/regex/ @godotengine/core - -# Platform - -/platform/android/ @godotengine/android -/platform/ios/ @godotengine/ios -/platform/javascript/ @godotengine/html5 -/platform/linuxbsd/ @godotengine/linux-bsd -/platform/macos/ @godotengine/macos -/platform/uwp/ @godotengine/uwp -/platform/windows/ @godotengine/windows - -# Scene - -/scene/2d/ @godotengine/2d-nodes -/scene/3d/ @godotengine/3d-nodes -/scene/animation/ @godotengine/animation -/scene/audio/ @godotengine/audio -/scene/debugger/ @godotengine/debugger -/scene/gui/ @godotengine/gui-nodes -/scene/main/ @godotengine/core -/scene/resources/default_theme/ @godotengine/gui-nodes -/scene/resources/font.* @godotengine/gui-nodes -/scene/resources/text_line.* @godotengine/gui-nodes -/scene/resources/text_paragraph.* @godotengine/gui-nodes -/scene/resources/visual_shader*.* @godotengine/shaders - -# Servers - -/servers/audio* @godotengine/audio -/servers/camera* @godotengine/xr -/servers/display_server.* @godotengine/_platforms -/servers/navigation_server*.* @godotengine/navigation -/servers/physics* @godotengine/physics -/servers/rendering* @godotengine/rendering -/servers/text_server.* @godotengine/gui-nodes -/servers/xr* @godotengine/xr - -# Tests - -/tests/ @godotengine/tests - -# Thirdparty - -/thirdparty/ @godotengine/buildsystem diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml deleted file mode 100644 index 0b4abac1..00000000 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: Bug report -description: Report a bug in Godot -body: - -- type: markdown - attributes: - value: | - - Read our [CONTRIBUTING.md guide](https://github.com/godotengine/godot/blob/master/CONTRIBUTING.md#reporting-bugs) on reporting bugs. - - Write a descriptive issue title above. - - Search [open](https://github.com/godotengine/godot/issues) and [closed](https://github.com/godotengine/godot/issues?q=is%3Aissue+is%3Aclosed) issues to ensure it has not already been reported. - - Verify that you are using a [supported Godot version](https://docs.godotengine.org/en/stable/about/release_policy.html). - -- type: input - attributes: - label: Godot version - description: > - Specify the Git commit hash if using a development or non-official build. - If you use a custom build, please test if your issue is reproducible in official builds too. - placeholder: 3.3.stable, 4.0.dev (3041becc6) - validations: - required: true - -- type: input - attributes: - label: System information - description: | - Specify the OS version, and when relevant hardware information. - For graphics-related issues, specify the GPU model, driver version, and the rendering backend (GLES2, GLES3, Vulkan). - placeholder: Windows 10, GLES3, Intel HD Graphics 620 (27.20.100.9616) - validations: - required: true - -- type: textarea - attributes: - label: Issue description - description: | - Describe your issue briefly. What doesn't work, and how do you expect it to work instead? - You can include images or videos with drag and drop, and format code blocks or logs with ``` tags. - validations: - required: true - -- type: textarea - attributes: - label: Steps to reproduce - description: | - List of steps or sample code that reproduces the issue. Having reproducible issues is a prerequisite for contributors to be able to solve them. - If you include a minimal reproduction project below, you can detail how to use it here. - validations: - required: true - -- type: textarea - attributes: - label: Minimal reproduction project - description: | - A small Godot project which reproduces the issue, with no unnecessary files included. Be sure to not include the `.godot` folder in the archive (but keep `project.godot`). - Required, unless the reproduction steps are trivial and don't require any project files to be followed. In this case, write "N/A" in the field. - Drag and drop a ZIP archive to upload it. **Do not select another field until the project is done uploading.** - validations: - required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index f787bec0..00000000 --- a/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1,14 +0,0 @@ -blank_issues_enabled: false - -contact_links: - - name: Godot proposals - url: https://github.com/godotengine/godot-proposals - about: Please submit feature proposals on the Godot proposals repository, not here. - - - name: Godot documentation repository - url: https://github.com/godotengine/godot-docs - about: Please report issues with documentation on the Godot documentation repository, not here. - - - name: Godot community channels - url: https://godotengine.org/community - about: Please ask for technical support on one of the other community channels, not here. diff --git a/.github/actions/godot-build/action.yml b/.github/actions/godot-build/action.yml deleted file mode 100644 index 377480b1..00000000 --- a/.github/actions/godot-build/action.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Build Godot -description: Build Godot with the provided options. -inputs: - target: - description: Build target (editor, template_release, template_debug). - default: "editor" - tests: - description: Unit tests. - default: false - platform: - description: Target platform. - required: false - sconsflags: - default: "" - scons-cache: - description: The scons cache path. - default: "${{ github.workspace }}/.scons-cache/" - scons-cache-limit: - description: The scons cache size limit. - # actions/cache has 10 GiB limit, and GitHub runners have a 14 GiB disk. - # Limit to 7 GiB to avoid having the extracted cache fill the disk. - default: 7168 -runs: - using: "composite" - steps: - - name: Scons Build - shell: sh - env: - SCONSFLAGS: ${{ inputs.sconsflags }} - SCONS_CACHE: ${{ inputs.scons-cache }} - SCONS_CACHE_LIMIT: ${{ inputs.scons-cache-limit }} - run: | - echo "Building with flags:" platform=${{ inputs.platform }} target=${{ inputs.target }} tests=${{ inputs.tests }} ${{ env.SCONSFLAGS }} - if [ "${{ inputs.target }}" != "editor" ]; then rm -rf editor; fi # Ensure we don't include editor code. - scons platform=${{ inputs.platform }} target=${{ inputs.target }} tests=${{ inputs.tests }} ${{ env.SCONSFLAGS }} - ls -l bin/ diff --git a/.github/actions/godot-cache/action.yml b/.github/actions/godot-cache/action.yml deleted file mode 100644 index 2d7afc85..00000000 --- a/.github/actions/godot-cache/action.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Setup Godot build cache -description: Setup Godot build cache. -inputs: - cache-name: - description: The cache base name (job name by default). - default: "${{github.job}}" - scons-cache: - description: The scons cache path. - default: "${{github.workspace}}/.scons-cache/" -runs: - using: "composite" - steps: - # Upload cache on completion and check it out now - - name: Load .scons_cache directory - uses: actions/cache@v3 - with: - path: ${{inputs.scons-cache}} - key: ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} - restore-keys: | - ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} - ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}} - ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}} diff --git a/.github/actions/godot-deps/action.yml b/.github/actions/godot-deps/action.yml deleted file mode 100644 index 38731db5..00000000 --- a/.github/actions/godot-deps/action.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Setup python and scons -description: Setup python, install the pip version of scons. -inputs: - python-version: - description: The python version to use. - default: "3.x" - python-arch: - description: The python architecture. - default: "x64" -runs: - using: "composite" - steps: - # Use python 3.x release (works cross platform) - - name: Set up Python 3.x - uses: actions/setup-python@v4 - with: - # Semantic version range syntax or exact version of a Python version - python-version: ${{ inputs.python-version }} - # Optional - x64 or x86 architecture, defaults to x64 - architecture: ${{ inputs.python-arch }} - - - name: Setup scons - shell: bash - run: | - python -c "import sys; print(sys.version)" - python -m pip install scons==4.4.0 - scons --version diff --git a/.github/actions/upload-artifact/action.yml b/.github/actions/upload-artifact/action.yml deleted file mode 100644 index ae0e634c..00000000 --- a/.github/actions/upload-artifact/action.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Upload Godot artifact -description: Upload the Godot artifact. -inputs: - name: - description: The artifact name. - default: "${{ github.job }}" - path: - description: The path to upload. - required: true - default: "bin/*" -runs: - using: "composite" - steps: - - name: Upload Godot Artifact - uses: actions/upload-artifact@v3 - with: - name: ${{ inputs.name }} - path: ${{ inputs.path }} - retention-days: 14 diff --git a/.github/workflows/android_builds.yml b/.github/workflows/android_builds.yml index 42125db9..96e4b163 100644 --- a/.github/workflows/android_builds.yml +++ b/.github/workflows/android_builds.yml @@ -1,12 +1,14 @@ name: ๐Ÿค– Android Builds on: workflow_call: + inputs: + version: + required: true + type: string # Global Settings env: - # Used for the cache key. Add version suffix to force clean build. - GODOT_BASE_BRANCH: '4.0' - SCONSFLAGS: verbose=yes warnings=extra werror=yes debug_symbols=no module_text_server_fb_enabled=yes + SCONSFLAGS: warnings=extra werror=yes debug_symbols=no module_text_server_fb_enabled=yes concurrency: group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-android @@ -19,13 +21,13 @@ jobs: steps: - name: Checkout Godot - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: repository: godotengine/godot - ref: ${{ env.GODOT_BASE_BRANCH }} + ref: ${{ inputs.version }} - name: Checkout ECMAScript - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: path: ${{github.workspace}}/modules/javascript/ diff --git a/.github/workflows/get_version.yml b/.github/workflows/get_version.yml new file mode 100644 index 00000000..d90a2bc3 --- /dev/null +++ b/.github/workflows/get_version.yml @@ -0,0 +1,30 @@ +--- +name: ๐Ÿ†š Get godot version + +on: + workflow_call: + # Map the workflow outputs to job outputs + outputs: + version: + description: "Which version we should use based on target branch" + value: ${{ jobs.version.outputs.version }} + +jobs: + version: + name: Get godot version + runs-on: ubuntu-latest + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - name: ๐Ÿท Get and set godot version + id: version + # TODO: GH-Action should extract target branch; branches should be named according to godot engine branches + run: | + VERSION="4.1" + echo "version=$VERSION" >> $GITHUB_OUTPUT + + - name: ๐ŸŒณ Log Valid Version + env: + VERSION: ${{ steps.version.outputs.version }} + run: echo "$VERSION" + diff --git a/.github/workflows/ios_builds.yml b/.github/workflows/ios_builds.yml index 78c05c78..065eba09 100644 --- a/.github/workflows/ios_builds.yml +++ b/.github/workflows/ios_builds.yml @@ -1,12 +1,14 @@ name: ๐Ÿ iOS Builds on: workflow_call: + inputs: + version: + required: true + type: string # Global Settings env: - # Used for the cache key. Add version suffix to force clean build. - GODOT_BASE_BRANCH: '4.0' - SCONSFLAGS: verbose=yes warnings=extra werror=yes debug_symbols=no module_text_server_fb_enabled=yes + SCONSFLAGS: warnings=extra werror=yes debug_symbols=no module_text_server_fb_enabled=yes concurrency: group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-ios @@ -19,13 +21,13 @@ jobs: steps: - name: Checkout Godot - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: repository: godotengine/godot - ref: ${{ env.GODOT_BASE_BRANCH }} + ref: ${{ inputs.version }} - name: Checkout ECMAScript - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: path: ${{github.workspace}}/modules/javascript/ diff --git a/.github/workflows/linux_builds.yml b/.github/workflows/linux_builds.yml index d180139c..94420555 100644 --- a/.github/workflows/linux_builds.yml +++ b/.github/workflows/linux_builds.yml @@ -1,12 +1,17 @@ name: ๐Ÿง Linux Builds on: workflow_call: + inputs: + version: + required: true + type: string + # Global Settings env: - # Used for the cache key, and godot-cpp checkout. Add version suffix to force clean build. - GODOT_BASE_BRANCH: '4.0' - SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes + # We need to remove 'werror=yes' because of thirdparty/quickjs/quickjs/quickjs.h:975 + # Look at https://stackoverflow.com/questions/559581/casting-a-function-pointer-to-another-type for more information + SCONSFLAGS: warnings=extra module_text_server_fb_enabled=yes DOTNET_NOLOGO: true DOTNET_CLI_TELEMETRY_OPTOUT: true @@ -33,20 +38,33 @@ jobs: proj-conv: true artifact: true - - name: Minimal template (target=template_release, everything disabled) - cache-name: linux-template-minimal - target: template_release - tests: false - sconsflags: modules_enabled_by_default=no disable_3d=yes disable_advanced_gui=yes deprecated=no + # Removed dev-builds (https://github.com/godotengine/godot/blob/master/.github/workflows/linux_builds.yml#L38) + # TODO: There was an issue with quickjs debugger, maybe this can be enabled again after fixing the debugger + + - name: Template w/ Mono (target=template_release) + cache-name: linux-template-mono + target: template_release + tests: false + sconsflags: module_mono_enabled=yes + build-mono: false + artifact: true + + - name: Minimal template (target=template_release, everything disabled) + cache-name: linux-template-minimal + target: template_release + tests: false + sconsflags: modules_enabled_by_default=no disable_3d=yes disable_advanced_gui=yes deprecated=no minizip=no + artifact: true + steps: - name: Checkout Godot - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: repository: godotengine/godot - ref: ${{ env.GODOT_BASE_BRANCH }} + ref: ${{ inputs.version }} - name: Checkout ECMAScript - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: path: ${{github.workspace}}/modules/javascript/ @@ -150,8 +168,40 @@ jobs: xvfb-run ${{ matrix.bin }} 40 --audio-driver Dummy --path test_project 2>&1 | tee sanitizers_log.txt || true misc/scripts/check_ci_log.py sanitizers_log.txt - - name: Upload artifact - uses: ./.github/actions/upload-artifact - if: ${{ matrix.artifact }} - with: - name: ${{ matrix.cache-name }} + # Checkout godot-cpp + - name: Checkout godot-cpp + if: ${{ matrix.godot-cpp-test }} + uses: actions/checkout@v3 + with: + repository: godotengine/godot-cpp + ref: ${{ inputs.version }} + submodules: 'recursive' + path: 'godot-cpp' + + # Dump GDExtension interface and API + - name: Dump GDExtension interface and API for godot-cpp build + if: ${{ matrix.godot-cpp-test }} + run: | + ${{ matrix.bin }} --headless --dump-gdextension-interface --dump-extension-api + cp -f gdextension_interface.h godot-cpp/gdextension/ + cp -f extension_api.json godot-cpp/gdextension/ + + # Build godot-cpp test extension + - name: Build godot-cpp test extension + if: ${{ matrix.godot-cpp-test }} + run: | + cd godot-cpp/test + scons target=template_debug dev_build=yes + cd ../.. + + - name: Prepare artifact + if: ${{ matrix.artifact }} + run: | + strip bin/godot.* + chmod +x bin/godot.* + + - name: Upload artifact + uses: ./.github/actions/upload-artifact + if: ${{ matrix.artifact }} + with: + name: ${{ matrix.cache-name }} diff --git a/.github/workflows/macos_builds.yml b/.github/workflows/macos_builds.yml index 7cb31994..48ec3190 100644 --- a/.github/workflows/macos_builds.yml +++ b/.github/workflows/macos_builds.yml @@ -1,12 +1,15 @@ name: ๐ŸŽ macOS Builds on: workflow_call: + inputs: + version: + required: true + type: string + # Global Settings env: - # Used for the cache key. Add version suffix to force clean build. - GODOT_BASE_BRANCH: '4.0' - SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes + SCONSFLAGS: warnings=extra werror=yes module_text_server_fb_enabled=yes concurrency: group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-macos @@ -34,13 +37,13 @@ jobs: steps: - name: Checkout Godot - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: repository: godotengine/godot - ref: ${{ env.GODOT_BASE_BRANCH }} + ref: ${{ inputs.version }} - name: Checkout ECMAScript - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: path: ${{github.workspace}}/modules/javascript/ diff --git a/.github/workflows/runner.yml b/.github/workflows/runner.yml index be255b54..e76bdf3d 100644 --- a/.github/workflows/runner.yml +++ b/.github/workflows/runner.yml @@ -6,36 +6,55 @@ concurrency: cancel-in-progress: true jobs: + get-version: + name: ๐Ÿ†š Get godot version + uses: ./.github/workflows/get_version.yml + static-checks: name: ๐Ÿ“Š Static checks uses: ./.github/workflows/static_checks.yml + needs: get-version + with: + version: ${{ needs.get-version.outputs.version }} android-build: name: ๐Ÿค– Android - needs: static-checks + needs: [static-checks, get-version] uses: ./.github/workflows/android_builds.yml + with: + version: ${{ needs.get-version.outputs.version }} ios-build: name: ๐Ÿ iOS - needs: static-checks + needs: [static-checks, get-version] uses: ./.github/workflows/ios_builds.yml + with: + version: ${{ needs.get-version.outputs.version }} linux-build: name: ๐Ÿง Linux - needs: static-checks + needs: [static-checks, get-version] uses: ./.github/workflows/linux_builds.yml + with: + version: ${{ needs.get-version.outputs.version }} macos-build: name: ๐ŸŽ macOS - needs: static-checks + needs: [static-checks, get-version] uses: ./.github/workflows/macos_builds.yml + with: + version: ${{ needs.get-version.outputs.version }} windows-build: name: ๐Ÿ Windows - needs: static-checks + needs: [static-checks, get-version] uses: ./.github/workflows/windows_builds.yml + with: + version: ${{ needs.get-version.outputs.version }} web-build: name: ๐ŸŒ Web - needs: static-checks + needs: [static-checks, get-version] uses: ./.github/workflows/web_builds.yml + with: + version: ${{ needs.get-version.outputs.version }} diff --git a/.github/workflows/static_checks.yml b/.github/workflows/static_checks.yml index a004c269..5e0207f6 100644 --- a/.github/workflows/static_checks.yml +++ b/.github/workflows/static_checks.yml @@ -1,6 +1,11 @@ name: ๐Ÿ“Š Static Checks on: workflow_call: + inputs: + version: + required: true + type: string + concurrency: group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-static @@ -12,9 +17,20 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + + - name: Checkout Godot + uses: actions/checkout@v4 with: - fetch-depth: 2 + repository: godotengine/godot + ref: ${{ inputs.version }} + sparse-checkout: | + misc/scripts + sparse-checkout-cone-mode: false + path: tmp + + - name: Checkout workaround + run: mv tmp/misc/scripts misc/scripts - name: Install APT dependencies uses: awalsh128/cache-apt-pkgs-action@latest diff --git a/.github/workflows/web_builds.yml b/.github/workflows/web_builds.yml index 12b32b8d..94c7ef99 100644 --- a/.github/workflows/web_builds.yml +++ b/.github/workflows/web_builds.yml @@ -1,12 +1,15 @@ name: ๐ŸŒ Web Builds on: workflow_call: + inputs: + version: + required: true + type: string + # Global Settings env: - # Used for the cache key. Add version suffix to force clean build. - GODOT_BASE_BRANCH: '4.0' - SCONSFLAGS: verbose=yes warnings=extra werror=yes debug_symbols=no + SCONSFLAGS: warnings=extra werror=yes debug_symbols=no EM_VERSION: 3.1.18 EM_CACHE_FOLDER: "emsdk-cache" @@ -21,13 +24,13 @@ jobs: steps: - name: Checkout Godot - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: repository: godotengine/godot - ref: ${{ env.GODOT_BASE_BRANCH }} + ref: ${{ inputs.version }} - name: Checkout ECMAScript - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: path: ${{github.workspace}}/modules/javascript/ diff --git a/.github/workflows/windows_builds.yml b/.github/workflows/windows_builds.yml index 67af76e3..d403efaa 100644 --- a/.github/workflows/windows_builds.yml +++ b/.github/workflows/windows_builds.yml @@ -1,13 +1,16 @@ name: ๐Ÿ Windows Builds on: workflow_call: + inputs: + version: + required: true + type: string + # Global Settings # SCONS_CACHE for windows must be set in the build environment env: - # Used for the cache key. Add version suffix to force clean build. - GODOT_BASE_BRANCH: '4.0' - SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes + SCONSFLAGS: warnings=extra werror=yes module_text_server_fb_enabled=yes SCONS_CACHE_MSVC_CONFIG: true concurrency: @@ -39,13 +42,13 @@ jobs: steps: - name: Checkout Godot - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: repository: godotengine/godot - ref: ${{ env.GODOT_BASE_BRANCH }} + ref: ${{ inputs.version }} - name: Checkout ECMAScript - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: path: ${{github.workspace}}/modules/javascript/ diff --git a/.gitignore b/.gitignore index a3c7a391..b1580d74 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ *.gen.cpp *.gen.json .vscode +.idea diff --git a/README.md b/README.md index 0af0483f..37cc0df6 100644 --- a/README.md +++ b/README.md @@ -11,22 +11,21 @@ This module implements JavaScript/TypeScript language support for the Godot game - [Using third-party libraries from npm](https://github.com/GodotExplorer/ECMAScriptDemos/tree/master/npm_module) - Multi-thread support with Worker API - Full code completion support for all Godot APIs including signals and enumerations -- Debug in Visual Studio Code with the [plugin](https://marketplace.visualstudio.com/items?itemName=geequlim.godot-javascript-debug) +- Debug in Visual Studio Code with the [plugin](https://marketplace.visualstudio.com/items?itemName=geequlim.godot-javascript-debug) - currently not available for 4.x ## Installation -No installation or setup necessary. The binaries for download are the complete, usable Godot editor and engine with Javascript/Typescript language support. +No installation or setup necessary. The binaries for download are the complete, usable Godot editor and engine with JavaScript/TypeScript language support. -### Download +## Download -You can try the pre-compiled binaries from the [release page](https://github.com/GodotExplorer/ECMAScript/releases) -You can also get the binaries with lastest commits from the [github build action result](https://github.com/GodotExplorer/ECMAScript/actions) +You can try the pre-compiled binaries from the [release page](https://github.com/GodotExplorer/ECMAScript/releases) or get the binaries with the latest commits from the [GitHub build action result](https://github.com/GodotExplorer/ECMAScript/actions). ## Compilation 1. Clone the source code of [godot](https://github.com/godotengine/godot) 2. Clone this module and put it into `godot/modules/` and make sure the folder name of this module is `javascript` -3. [Recompile the godot engine](https://docs.godotengine.org/en/3.3/development/compiling/index.html) **(Only MinGW is supported on Windows for now!)** +3. [Recompile the godot engine](https://docs.godotengine.org/en/4.1/development/compiling/index.html) - Use ``scons`` with those additional options ``warnings=extra werror=yes module_text_server_fb_enabled=yes`` to show all potential errors ![Build Godot with ECMAScript](https://github.com/GodotExplorer/ECMAScript/workflows/Build%20Godot%20with%20ECMAScript/badge.svg) @@ -283,10 +282,6 @@ You can try demos in the [ECMAScriptDemos](https://github.com/Geequlim/ECMAScrip ## Developer notes - This package is not compatible with MSVC, you will get build errors in quickjs. -- To update the github actions scripts we have the file `build_github_actions.py`. This script will copy the actions from the godot repo (usually at `../../`) and modify them to fix the requirements of quickjs and this repo. - \*\* If you are updating this repo's compatibility, you should run that script (a brief description is at the top of the script) and it will re-create the actions `.yml` files for you. - The script also build the `on_tag.yml` script which automates the github release publishing. \*\* 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. -- Linux ubsan asan build woes: -- 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). - They should definitely be fixed & enabled at some point, **so please submit a PR if you have any ideas of how to do that!** diff --git a/SCsub b/SCsub index 1efe9a28..7db16db0 100644 --- a/SCsub +++ b/SCsub @@ -7,6 +7,10 @@ env_module = env_modules.Clone() JS_ENGINE = "quickjs" TOOLS = "editor" == env_module["target"] +if env["platform"] == "windows": + if env["use_mingw"]: + env.Append(LIBS=["pthread"]) + def open_file(path, mode): if platform.python_version() > "3": @@ -37,20 +41,19 @@ if JS_ENGINE == "quickjs": thirdparty.quickjs.builtin_binding_generator.generate_builtin_bindings() version = open("thirdparty/quickjs/quickjs/VERSION.txt", "r").read().split("\n")[0] - env_module.Append(CPPDEFINES={"QUICKJS_CONFIG_VERSION": '"' + version + '"'}) - env_module.Append(CPPDEFINES=["CONFIG_BIGNUM"]) - if "release" not in (env_module["target"] or ""): - env_module.Append(CPPDEFINES={"DUMP_LEAKS": 1}) - env_module.Append(CPPDEFINES={"QUICKJS_WITH_DEBUGGER": 1}) - env_module.Append(CPPPATH=["thirdparty/quickjs/quickjs"]) - env_module.Append(CPPPATH=["thirdparty/quickjs"]) - - if TOOLS: - env_module.add_source_files(env.modules_sources, "tools/editor_tools.cpp") - env_module.add_source_files(env.modules_sources, "thirdparty/quickjs/quickjs_builtin_binder.gen.cpp") - env_module.add_source_files(env.modules_sources, "thirdparty/quickjs/*.cpp") - env_module.add_source_files(env.modules_sources, "thirdparty/quickjs/quickjs/*.c") - + quickjs_env = env_modules.Clone() + quickjs_env.Append(CPPDEFINES={"QUICKJS_CONFIG_VERSION": '"' + version + '"'}) + quickjs_env.Append(CPPDEFINES=["CONFIG_BIGNUM"]) + if "release" not in (quickjs_env["target"] or ""): + quickjs_env.Append(CPPDEFINES={"DUMP_LEAKS": 1}) + # TODO: Fix debugger + # quickjs_env.Append(CPPDEFINES={"QUICKJS_WITH_DEBUGGER": 1}) + quickjs_env.Append(CPPPATH=["thirdparty/quickjs/quickjs"]) + quickjs_env.Append(CPPPATH=["thirdparty/quickjs"]) + quickjs_env.disable_warnings() + quickjs_env.add_source_files(env.modules_sources, "thirdparty/quickjs/quickjs_builtin_binder.gen.cpp") + quickjs_env.add_source_files(env.modules_sources, "thirdparty/quickjs/*.cpp") + quickjs_env.add_source_files(env.modules_sources, "thirdparty/quickjs/quickjs/*.c") # Binding script to run at engine initializing with open("misc/godot.binding_script.gen.cpp", "w") as f: @@ -70,19 +73,19 @@ if TOOLS: '/* THIS FILE IS GENERATED DO NOT EDIT */\n#include "editor_tools.h"\nString JavaScriptPlugin::{} = \n{};' ) tool_fns = { - "tools/godot.d.ts.gen.cpp": ( + "editor/godot.d.ts.gen.cpp": ( "BUILTIN_DECLARATION_TEXT", dump_text_file_to_cpp("misc/godot.d.ts"), ), - "tools/tsconfig.json.gen.cpp": ( + "editor/tsconfig.json.gen.cpp": ( "TSCONFIG_CONTENT", dump_text_file_to_cpp("misc/tsconfig.json"), ), - "tools/decorators.ts.gen.cpp": ( + "editor/decorators.ts.gen.cpp": ( "TS_DECORATORS_CONTENT", dump_text_file_to_cpp("misc/decorators.ts"), ), - "tools/package.json.gen.cpp": ( + "editor/package.json.gen.cpp": ( "PACKAGE_JSON_CONTENT", dump_text_file_to_cpp("misc/package.json"), ), diff --git a/config.py b/config.py index 951e814f..e9f39c99 100644 --- a/config.py +++ b/config.py @@ -1,5 +1,5 @@ def can_build(env, platform): - return not (platform == "windows" and not env["use_mingw"]) + return True def configure(env): diff --git a/doc_classes/JavaScript.xml b/doc_classes/JavaScript.xml index ca3f4659..88bc9a12 100644 --- a/doc_classes/JavaScript.xml +++ b/doc_classes/JavaScript.xml @@ -1,5 +1,5 @@ - + A JavaScript script resource for creating and managing JavaScript scripts in Godot. diff --git a/doc_classes/JavaScriptModule.xml b/doc_classes/JavaScriptModule.xml index c9f1c7f9..878c6d1b 100644 --- a/doc_classes/JavaScriptModule.xml +++ b/doc_classes/JavaScriptModule.xml @@ -1,5 +1,5 @@ - + A JavaScript module resource for managing JavaScript source code and bytecode. diff --git a/editor/editor_tools.cpp b/editor/editor_tools.cpp index cc443f23..d2ccff05 100644 --- a/editor/editor_tools.cpp +++ b/editor/editor_tools.cpp @@ -29,6 +29,9 @@ /**************************************************************************/ #include "editor_tools.h" + +#ifdef TOOLS_ENABLED + #include "core/math/expression.h" #include "core/os/keyboard.h" #include "editor/doc_tools.h" @@ -115,8 +118,8 @@ JavaScriptPlugin::JavaScriptPlugin(EditorNode *p_node) { enumberation_file_dialog->set_title(TTR("Generate Enumeration Binding Script")); enumberation_file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); enumberation_file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM); - enumberation_file_dialog->add_filter(TTR("*.jsx;JavaScript file")); - enumberation_file_dialog->set_current_file("enumerations.jsx"); + enumberation_file_dialog->add_filter(TTR("*.mjs;JavaScript file")); + enumberation_file_dialog->set_current_file("enumerations.mjs"); enumberation_file_dialog->connect("file_selected", callable_mp(this, &JavaScriptPlugin::_export_enumeration_binding_file)); EditorNode::get_singleton()->get_gui_base()->add_child(enumberation_file_dialog); @@ -743,3 +746,5 @@ void JavaScriptPlugin::_generate_typescript_project() { dump_to_file("res://decorators.ts", TS_DECORATORS_CONTENT); dump_to_file("res://package.json", PACKAGE_JSON_CONTENT); } + +#endif // TOOLS_ENABLED diff --git a/quickjs/quickjs_callable.h b/editor/editor_tools.h similarity index 64% rename from quickjs/quickjs_callable.h rename to editor/editor_tools.h index 809b93b2..6b38fcc8 100644 --- a/quickjs/quickjs_callable.h +++ b/editor/editor_tools.h @@ -1,5 +1,5 @@ /**************************************************************************/ -/* quickjs_callable.h */ +/* editor_tools.h */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,34 +28,45 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef QUICKJS_CALLABLE_H -#define QUICKJS_CALLABLE_H +#ifndef EDITOR_TOOLS_H +#define EDITOR_TOOLS_H -#include "../javascript_callable.h" -#include "quickjs/quickjs.h" +#include "editor/editor_node.h" +#include "editor/editor_plugin.h" +#include "editor/gui/editor_file_dialog.h" -#if !defined(JS_NAN_BOXING) -///typedef uint64_t JSValue; defined in quickjs.h if defined(JS_NAN_BOXING) -struct JSValue; -#endif +class DocTools; +class EditorFileDialog; +class JavaScriptPlugin : public EditorPlugin { + GDCLASS(JavaScriptPlugin, EditorPlugin); -class QuickJSCallable : public JavaScriptCallable { - static bool compare_equal(const CallableCustom *p_a, const CallableCustom *p_b); - static bool compare_less(const CallableCustom *p_a, const CallableCustom *p_b); + enum MenuItem { + ITEM_GEN_DECLARE_FILE, + ITEM_GEN_TYPESCRIPT_PROJECT, + ITEM_GEN_ENUM_BINDING_SCRIPT, + }; -public: - QuickJSCallable(JSContext *ctx, const JSValue &p_value); - QuickJSCallable(const JavaScriptGCHandler &p_function); - virtual ~QuickJSCallable(); + EditorFileDialog *declaration_file_dialog; + EditorFileDialog *enumberation_file_dialog; + const Dictionary *modified_api; + +protected: + static String BUILTIN_DECLARATION_TEXT; + static String TSCONFIG_CONTENT; + static String TS_DECORATORS_CONTENT; + static String PACKAGE_JSON_CONTENT; - virtual uint32_t hash() const override; - virtual String get_as_text() const override; + static void _bind_methods(); - virtual CompareEqualFunc get_compare_equal_func() const override { return QuickJSCallable::compare_equal; } - virtual CompareLessFunc get_compare_less_func() const override { return QuickJSCallable::compare_less; } + void _notification(int p_what); + void _on_menu_item_pressed(int item); + void _export_typescript_declare_file(const String &p_path); + void _export_enumeration_binding_file(const String &p_path); + void _generate_typescript_project(); - virtual ObjectID get_object() const override; - virtual void call(const Variant **p_arguments, int p_argcount, Variant &r_return_value, Callable::CallError &r_call_error) const override; +public: + virtual String get_name() const override { return "JavaScriptPlugin"; } + JavaScriptPlugin(EditorNode *p_node); }; -#endif // QUICKJS_CALLABLE_H +#endif // EDITOR_TOOLS_H diff --git a/javascript.cpp b/javascript.cpp index 9c1c0940..078aabd5 100644 --- a/javascript.cpp +++ b/javascript.cpp @@ -269,19 +269,19 @@ Ref ResourceFormatLoaderJavaScript::load(const String &p_path, const S if (r_error) *r_error = err; ERR_FAIL_COND_V_MSG(err != OK, Ref(), "Cannot load script file '" + p_path + "'."); - Ref script; - script.instantiate(); - script->set_script_path(p_path); - script->bytecode = module->get_bytecode(); - script->set_source_code(module->get_source_code()); - err = script->reload(); + Ref javaScript; + javaScript.instantiate(); + javaScript->set_script_path(p_path); + javaScript->bytecode = module->get_bytecode(); + javaScript->set_source_code(module->get_source_code()); + err = javaScript->reload(); if (r_error) *r_error = err; ERR_FAIL_COND_V_MSG(err != OK, Ref(), "Parse source code from file '" + p_path + "' failed."); #ifdef TOOLS_ENABLED - JavaScriptLanguage::get_singleton()->get_scripts().insert(script); + JavaScriptLanguage::get_singleton()->get_scripts().insert(javaScript); #endif - return script; + return javaScript; } void ResourceFormatLoaderJavaScript::get_recognized_extensions(List *p_extensions) const { @@ -308,10 +308,10 @@ bool ResourceFormatLoaderJavaScript::recognize_path(const String &p_path, const } Error ResourceFormatSaverJavaScript::save(const Ref &p_resource, const String &p_path, uint32_t p_flags) { - Ref script = p_resource; - ERR_FAIL_COND_V(script.is_null(), ERR_INVALID_PARAMETER); + Ref javaScript = p_resource; + ERR_FAIL_COND_V(javaScript.is_null(), ERR_INVALID_PARAMETER); - String source = script->get_source_code(); + String source = javaScript->get_source_code(); Error err; Ref file = FileAccess::open(p_path, FileAccess::WRITE, &err); @@ -322,7 +322,7 @@ Error ResourceFormatSaverJavaScript::save(const Ref &p_resource, const } if (ScriptServer::is_reload_scripts_on_save_enabled()) { - script->reload(); + javaScript->reload(); } return OK; diff --git a/javascript_instance.h b/javascript_instance.h index f013c1df..1ee6ef22 100644 --- a/javascript_instance.h +++ b/javascript_instance.h @@ -32,7 +32,6 @@ #define JAVASCRIPT_INSTANCE_H #include "core/object/script_language.h" - #include "core/variant/callable.h" #include "javascript.h" #include "javascript_binder.h" @@ -64,7 +63,7 @@ class JavaScriptInstance : public ScriptInstance { virtual Ref