Misc fixes and cleanup

- Remove the `demo` project which isn't really useful.
  * Instead the `addons` subfolder is made top-level and that's where stuff gets written.
- Update the README following recent PRs (#191, #199) as OpenSSL is now compiled from source for all platforms.
  * Also remove obsolete `build_openssl_universal_macos.sh` script.
- Remove the bogus `plugin.cfg` which isn't necessary, and was confusing users who tried to enable it.
  * Fixes #267.
- Bump min SCons version to 3.1.2 and Python to 3.6.
- Bump `compatibility_minimum` to `4.2.0` following #196.
- Remove some code in `godot-git-plugin/SCsub` that seems redundant with `godot-cpp` config.
- Remove unnecessary `.exp` and `.lib` files in Windows artifact, rename its folder to `windows`.
- Remove `export-ignore`s in `.gitattributes`, they're incomplete and not actually doing anything usable.
- Fix artifacts URL handling in `release.sh`, make it executable.
- CI: Update clang-format check to version 18.
This commit is contained in:
Rémi Verschelde
2025-05-27 18:22:09 +02:00
parent fd85a8ef39
commit 2a4c781e86
17 changed files with 59 additions and 150 deletions

12
.gitattributes vendored
View File

@@ -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

View File

@@ -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/

View File

@@ -12,4 +12,4 @@ jobs:
with:
source: "godot-git-plugin/src"
extensions: "h,cpp"
clangFormatVersion: 11
clangFormatVersion: 18

7
.gitignore vendored
View File

@@ -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

View File

@@ -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: <https://github.com/godotengine/godot-git-plugin/releases>
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=<platform> target=editor -j 6
scons platform=<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=<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.<platform>.editor.<arch> --headless --dump-gdextension-interface --dump-extension-api
```
2. Build the plugin along with the godot-cpp library.
```
scons platform=<platform> target=editor generate_bindings=yes dev_build=yes -j 6
scons platform=<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=<platform> -h`.

View File

@@ -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))

View File

@@ -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

View File

@@ -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"

View File

@@ -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

2
demo/.gitattributes vendored
View File

@@ -1,2 +0,0 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf

2
demo/.gitignore vendored
View File

@@ -1,2 +0,0 @@
# Godot 4+ specific ignores
.godot/

View File

@@ -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"

View File

@@ -1,3 +0,0 @@
[gd_scene format=3 uid="uid://cr5ci1iwmxnlb"]
[node name="Node3D" type="Node3D"]

View File

@@ -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

View File

@@ -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()

View File

@@ -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"])

22
release.sh Normal file → Executable file
View File

@@ -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