diff --git a/.gitattributes b/.gitattributes index bd00056..8ad74f7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,14 +1,2 @@ # Normalize EOL for all files that Git considers text files. * text=auto eol=lf - -# Ignore some files when exporting to a ZIP. -/.github/ export-ignore -/godot-cpp/ export-ignore -/godot-git-plugin/ export-ignore -/thirdparty/ export-ignore -/.gitattributes export-ignore -/.gitignore export-ignore -/.gitmodules export-ignore -/api.ci.json export-ignore -/build_openssl_universal_oxs.sh export-ignore -/SConstruct export-ignore diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 911f103..8388feb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,13 +23,17 @@ jobs: run: | pip3 install scons scons platform=linux arch=x86_64 target=editor generate_bindings=yes - ldd demo/addons/godot-git-plugin/linux/*.so + ldd addons/godot-git-plugin/linux/*.so + - name: Prepare artifact + run: | + mkdir out + mv addons out/ - uses: actions/upload-artifact@v4 with: name: libgit_plugin.linux.x86_64.editor.so-${{ github.sha }} if-no-files-found: error path: | - demo/ + out/ windows-x64: runs-on: windows-2022 @@ -48,13 +52,20 @@ jobs: run: | pip3 install scons scons platform=windows arch=x86_64 target=editor generate_bindings=yes - dumpbin /dependents .\demo\addons\godot-git-plugin\win64\*.dll + dumpbin /dependents .\addons\godot-git-plugin\windows\*.dll + - name: Prepare artifact + shell: bash + run: | + # Not needed to use the plugin. + rm -f addons/godot-git-plugin/windows/*.{exp,lib} + mkdir out + mv addons out/ - uses: actions/upload-artifact@v4 with: name: libgit_plugin.windows.x86_64.editor.dll-${{ github.sha }} if-no-files-found: error path: | - demo/ + out/ macos-universal: runs-on: macos-15 @@ -70,10 +81,14 @@ jobs: run: | pip install scons scons platform=macos arch=universal target=editor generate_bindings=yes macos_deployment_target=10.13 - otool -L demo/addons/godot-git-plugin/macos/*.dylib + otool -L addons/godot-git-plugin/macos/*.dylib + - name: Prepare artifact + run: | + mkdir out + mv addons out/ - uses: actions/upload-artifact@v4 with: name: libgit_plugin.macos.universal.editor.dylib-${{ github.sha }} if-no-files-found: error path: | - demo/ + out/ diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index 9c5236c..cd728c6 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -12,4 +12,4 @@ jobs: with: source: "godot-git-plugin/src" extensions: "h,cpp" - clangFormatVersion: 11 + clangFormatVersion: 18 diff --git a/.gitignore b/.gitignore index 45ed369..f46add8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,6 @@ # SConstruct db *.dblite -# Godot ignores -demo/.godot/ - # Godot Serialisations extension_api.json !/ci/extension_api.json @@ -34,3 +31,7 @@ win64/ *.ilk *.pdb *.pyc +*.zip + +# Misc +*.log diff --git a/README.md b/README.md index 220929c..35ea4a3 100644 --- a/README.md +++ b/README.md @@ -6,37 +6,28 @@ Git implementation of the Godot Engine VCS interface in Godot. We use [libgit2](https://libgit2.org) as our backend to simulate Git in code. -> Planned for the upcoming version of Godot. Look for other branches for support in other Godot releases. +## Installation -## Installation Instructions - -1. Grab the platform binaries here: +1. Grab the platform binaries here: https://github.com/godotengine/godot-git-plugin/releases 2. Then read the installation instructions: https://github.com/godotengine/godot-git-plugin/wiki -## Build Instructions +## Build This section onwards is only meant to be used if you intend to compile the plugin from source. -### Required Tools +### Required tools -- Full copy of the source code. Remember to use `git clone --recursive`. -- [SCons](https://scons.org/pages/download.html) (v3.0.1+) +- Full copy of the source code. Remember to use `git clone --recursive`, or initialize submodules with `git submodule update --init`. +- [SCons](https://scons.org/pages/download.html) (v3.1.2+), CMake, and Perl. - C++17 and C90 compilers detectable by SCons and present in `PATH`. -- Platforms Specific Setup - - Windows - - No extra steps required other than setting up the compilers. - - MacOS - - For making universal builds targeting both Apple Silicon and x86_64, you can optionally run `build_openssl_universal_macos.sh` to build OpenSSL yourself and replace the already prebuilt libraries provided inside `thirdparty/openssl/`, otherwise, just run `brew install openssl@1.1` to use the prebuilt libraries provided in this repository. - - Linux - - Run `sudo apt-get install libssl-dev`, or your local package manager's equivalent. -### Release Build +### Release build ``` -scons platform= target=editor -j 6 +scons platform= target=editor ``` -> You may get the gdextension dump yourself from Godot using the instructions in the next section, or use the ones provided in `godot-cpp/gdextension` or `ci/`. +> You may get the GDExtension dump yourself from Godot using the instructions in the next section, or use the ones provided in `godot-cpp`. For more build options, run `scons platform= -h` @@ -49,19 +40,18 @@ If you need to use a custom GDExtension API: 1. Dump the new bindings from the custom Godot build. ```shell -cd local/copy/of/godot/source -.\bin\godot.xxx --headless --dump-gdextension-interface --dump-extension-api +./path/to/godot/bin/godot..editor. --headless --dump-gdextension-interface --dump-extension-api ``` 2. Build the plugin along with the godot-cpp library. ``` -scons platform= target=editor generate_bindings=yes dev_build=yes -j 6 +scons platform= target=editor generate_bindings=yes dev_build=yes ``` > You only need to build godot-cpp once every change in the GDExtension API, hence, `generate_bindings=yes` should only be passed in during the first time after generating a new GDExtension API dump. -3. Open the project provided inside `demo/` in the custom Godot build. +3. To test the plugin, set up a testing project with Godot, and copy or symlink the `addons` folder. To view more options available while recompiling godot-git-plugin, run `scons platform= -h`. diff --git a/SConstruct b/SConstruct index 1f2c62b..ad759fe 100644 --- a/SConstruct +++ b/SConstruct @@ -2,8 +2,8 @@ import os -EnsureSConsVersion(3, 0, 0) -EnsurePythonVersion(3, 5) +EnsureSConsVersion(3, 1, 2) +EnsurePythonVersion(3, 6) opts = Variables([], ARGUMENTS) @@ -11,7 +11,7 @@ env = Environment(ENV=os.environ) # Define our options opts.Add(PathVariable("target_path", - "The path where the lib is installed.", "demo/addons/godot-git-plugin/")) + "The path where the lib is installed.", "addons/godot-git-plugin/")) opts.Add(PathVariable("target_name", "The library name.", "libgit_plugin", PathVariable.PathAccept)) diff --git a/THIRDPARTY.md b/THIRDPARTY.md index b9b8b52..7b72b27 100644 --- a/THIRDPARTY.md +++ b/THIRDPARTY.md @@ -5,7 +5,7 @@ The Godot Git Plugin source code uses the following third-party source code: 1. godotengine/godot-cpp - MIT License - https://github.com/godotengine/godot-cpp/tree/02336831735fd6affbe0a6fa252ec98d3e78120c 2. libgit2/libgit2 - GPLv2 with a special Linking Exception - https://github.com/libgit2/libgit2/tree/b7bad55e4bb0a285b073ba5e02b01d3f522fc95d 3. libssh2/libssh2 - BSD-3-Clause License - https://github.com/libssh2/libssh2/tree/635caa90787220ac3773c1d5ba11f1236c22eae8 -4. openssl (only on Linux and MacOS) - OpenSSL License - https://github.com/openssl/openssl/tree/26baecb28ce461696966dac9ac889629db0b3b96 +4. openssl - OpenSSL License - https://github.com/openssl/openssl/tree/26baecb28ce461696966dac9ac889629db0b3b96 ## License Texts diff --git a/demo/addons/godot-git-plugin/git_plugin.gdextension b/addons/godot-git-plugin/git_plugin.gdextension similarity index 50% rename from demo/addons/godot-git-plugin/git_plugin.gdextension rename to addons/godot-git-plugin/git_plugin.gdextension index 49fffbf..62cf890 100644 --- a/demo/addons/godot-git-plugin/git_plugin.gdextension +++ b/addons/godot-git-plugin/git_plugin.gdextension @@ -1,12 +1,10 @@ [configuration] entry_symbol = "git_plugin_init" -compatibility_minimum = "4.1.0" +compatibility_minimum = "4.2.0" [libraries] -macos.editor = "macos/libgit_plugin.macos.editor.universal.dylib" -windows.editor.x86_64 = "win64/libgit_plugin.windows.editor.x86_64.dll" linux.editor.x86_64 = "linux/libgit_plugin.linux.editor.x86_64.so" -linux.editor.arm64 = "linux/libgit_plugin.linux.editor.arm64.so" -linux.editor.rv64 = "" +macos.editor = "macos/libgit_plugin.macos.editor.universal.dylib" +windows.editor.x86_64 = "windows/libgit_plugin.windows.editor.x86_64.dll" diff --git a/build_openssl_universal_macos.sh b/build_openssl_universal_macos.sh deleted file mode 100644 index a5bc08e..0000000 --- a/build_openssl_universal_macos.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -OPENSSL_VERSION="1.1.1s" - -curl -OL http://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz -tar -xzvf openssl-$OPENSSL_VERSION.tar.gz -mv openssl-$OPENSSL_VERSION openssl_arm64 -tar -xzvf openssl-$OPENSSL_VERSION.tar.gz -mv openssl-$OPENSSL_VERSION openssl_x86_64 -cd openssl_arm64 -./Configure darwin64-arm64-cc -make -cd ../ -cd openssl_x86_64 -./Configure darwin64-x86_64-cc -mmacosx-version-min=10.13 -make -cd ../ -lipo -create openssl_arm64/libcrypto.a openssl_x86_64/libcrypto.a -output thirdparty/openssl/libcrypto.a -lipo -create openssl_arm64/libssl.a openssl_x86_64/libssl.a -output thirdparty/openssl/libssl.a -rm openssl-$OPENSSL_VERSION.tar.gz diff --git a/demo/.gitattributes b/demo/.gitattributes deleted file mode 100644 index 8ad74f7..0000000 --- a/demo/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -# Normalize EOL for all files that Git considers text files. -* text=auto eol=lf diff --git a/demo/.gitignore b/demo/.gitignore deleted file mode 100644 index 4709183..0000000 --- a/demo/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# Godot 4+ specific ignores -.godot/ diff --git a/demo/addons/godot-git-plugin/plugin.cfg b/demo/addons/godot-git-plugin/plugin.cfg deleted file mode 100644 index fcb0b3a..0000000 --- a/demo/addons/godot-git-plugin/plugin.cfg +++ /dev/null @@ -1,7 +0,0 @@ -[plugin] - -name="Godot Git Plugin" -description="This plugin lets you interact with Git without leaving the Godot editor. More information can be found at https://github.com/godotengine/godot-git-plugin/wiki" -author="twaritwaikar" -version="3.1.1" -script="godot-git-plugin.gd" diff --git a/demo/demo.tscn b/demo/demo.tscn deleted file mode 100644 index 23b69b6..0000000 --- a/demo/demo.tscn +++ /dev/null @@ -1,3 +0,0 @@ -[gd_scene format=3 uid="uid://cr5ci1iwmxnlb"] - -[node name="Node3D" type="Node3D"] diff --git a/demo/new_script.gd b/demo/new_script.gd deleted file mode 100644 index 3acb4f1..0000000 --- a/demo/new_script.gd +++ /dev/null @@ -1,12 +0,0 @@ -extends Node - - -# Called when the node enters the scene tree for the first time. -func _ready(): - print("Hello world!") - pass # Replace with function body. - - -# Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta): - pass diff --git a/demo/project.godot b/demo/project.godot deleted file mode 100644 index 8bdc985..0000000 --- a/demo/project.godot +++ /dev/null @@ -1,22 +0,0 @@ -; Engine configuration file. -; It's best edited using the editor UI and not directly, -; since the parameters that go here are not all obvious. -; -; Format: -; [section] ; section goes between [] -; param=value ; assign values to parameters - -config_version=5 - -[application] - -config/features=PackedStringArray("4.1") - -[editor] - -version_control/plugin_name="GitPlugin" -version_control/autoload_on_startup=true - -[editor_plugins] - -enabled=PackedStringArray() diff --git a/godot-git-plugin/SCsub b/godot-git-plugin/SCsub index 3f3d0bf..05ec994 100644 --- a/godot-git-plugin/SCsub +++ b/godot-git-plugin/SCsub @@ -6,38 +6,21 @@ env = {} Import("env") Import("ssl") -# Process some arguments -if env["use_llvm"]: - env["CC"] = "clang" - env["CXX"] = "clang++" - -if env["platform"] == "": - print("No valid target platform selected.") - quit() - env["target_path"] = "../" + env["target_path"] if not os.path.isdir(env["target_path"]): os.mkdir(env["target_path"]) # Check our platform specifics +env["target_path"] += env["platform"] + "/" + if env["platform"] == "macos": - env["target_path"] += "macos/" - - # Force static linkage (https://stackoverflow.com/a/2995999/7370948) - if env["macos_deployment_target"] != "default": env.Append(CCFLAGS=["-mmacosx-version-min=" + env["macos_deployment_target"]]) env.Append(LINKFLAGS=["-mmacosx-version-min=" + env["macos_deployment_target"]]) - -elif env["platform"] == "linux": - env["target_path"] += "linux/" - elif env["platform"] == "windows": - env["target_path"] += "win64/" - env.Append(LIBS=["advapi32", "winhttp", "rpcrt4", "crypt32", "ole32", "user32", "wsock32", "ws2_32", "bcrypt"]) diff --git a/release.sh b/release.sh old mode 100644 new mode 100755 index 9235887..771212d --- a/release.sh +++ b/release.sh @@ -5,19 +5,21 @@ echo "Enter the new version number (e.g. 1.2.1):" read version -echo "Enter the Windows x64 release ZIP URL:" -read windowsZIPURL +echo "Enter the Windows x64 release ZIP artifact ID or URL:" +read windowsArtifactID -echo "Enter the Linux x64 release ZIP URL:" -read linuxZIPURL +echo "Enter the Linux x64 release ZIP artifact ID or URL:" +read linuxArtifactID -echo "Enter the MacOS universal release ZIP URL:" -read macZIPURL +echo "Enter the MacOS universal release ZIP artifact ID or URL:" +read macArtifactID # wget-ing the github.com URL gives a 404, so we use the method proposed here - https://github.com/actions/upload-artifact/issues/51#issuecomment-735989475 -windowsZIPURL=${windowsZIPURL/github.com/nightly.link} -linuxZIPURL=${linuxZIPURL/github.com/nightly.link} -macZIPURL=${macZIPURL/github.com/nightly.link} +# The ${foo##*/} syntax extracts the string after the last '/' in case it's a full artifact URL. +baseURL=https://nightly.link/godotengine/godot-git-plugin/actions/artifacts/ +windowsZIPURL=${baseURL}${windowsArtifactID##*/}.zip +linuxZIPURL=${baseURL}${linuxArtifactID##*/}.zip +macZIPURL=${baseURL}${macArtifactID##*/}.zip wget -O windows.zip $windowsZIPURL wget -O linux.zip $linuxZIPURL @@ -43,7 +45,7 @@ sed -i "s/version=\"[^\"]*\"/version=\"v${version}\"/g" $pluginPath/plugin.cfg cp LICENSE $pluginPath/LICENSE cp THIRDPARTY.md $pluginPath/THIRDPARTY.md -zip -r $releasePath.zip $addonsPath +zip -r $releasePath.zip $addonsPath rm -rf $releasePath rm -rf windows