Skip to content
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
81 changes: 60 additions & 21 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,57 @@ on: [push, pull_request]
env:
# Only used for the cache key. Increment version to force clean build.
GODOT_BASE_BRANCH: master
SCONSFLAGS: target=editor build_profile=build_profile.json api_version=4.3
SCONS_CACHE: ${{ github.workspace }}/.scons-cache/

jobs:
linux-x64:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
env:
BUILDROOT: x86_64-godot-linux-gnu_sdk-buildroot
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Setup Godot build cache
uses: ./godot-cpp/.github/actions/godot-cache
- name: Restore Godot build cache
uses: ./godot-cpp/.github/actions/godot-cache-restore
with:
cache-name: linux-x86_64
scons-cache: ${{ env.SCONS_CACHE }}
continue-on-error: true
- name: Setup Linux buildroot toolchain cache
uses: actions/cache@v5
with:
path: |
${{ env.BUILDROOT }}.tar.bz2
key: linux-${{ env.BUILDROOT }}-buildroot
continue-on-error: true
- name: Setup Linux toolchains
run: |
if [ ! -f ${{ env.BUILDROOT }}.tar.bz2 ]; then
wget https://github.com/godotengine/buildroot/releases/download/godot-2026.05.x-1/${{ env.BUILDROOT }}.tar.bz2
fi
tar -xjf ${{ env.BUILDROOT }}.tar.bz2
${{ env.BUILDROOT }}/relocate-sdk.sh
rm ${{ env.BUILDROOT }}/bin/cmake
echo "$GITHUB_WORKSPACE/${{ env.BUILDROOT }}/bin" >> $GITHUB_PATH
echo "PKG_CONFIG=$GITHUB_WORKSPACE/${{ env.BUILDROOT }}/share/pkgconfig/" >> $GITHUB_ENV
- name: Build for Linux editor x86_64
run: |
pip3 install scons
scons platform=linux arch=x86_64 target=editor generate_bindings=yes
scons platform=linux arch=x86_64
ldd addons/godot-git-plugin/linux/*.so
- name: Save Godot build cache
uses: ./godot-cpp/.github/actions/godot-cache-save
with:
cache-name: linux-x86_64
scons-cache: ${{ env.SCONS_CACHE }}
continue-on-error: true
- name: Prepare artifact
run: |
mkdir out
mv addons out/
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v7
with:
name: libgit_plugin.linux.x86_64.editor.so-${{ github.sha }}
if-no-files-found: error
Expand All @@ -38,59 +65,71 @@ jobs:
windows-x64:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Setup Godot build cache
uses: ./godot-cpp/.github/actions/godot-cache
- name: Restore Godot build cache
uses: ./godot-cpp/.github/actions/godot-cache-restore
with:
cache-name: windows-x86_64
scons-cache: ${{ env.SCONS_CACHE }}
continue-on-error: true
- uses: ilammy/msvc-dev-cmd@v1 # For dumpbin.
- uses: ilammy/setup-nasm@v1
- name: Build for Windows editor x86_64
shell: powershell
run: |
pip3 install scons
scons platform=windows arch=x86_64 target=editor generate_bindings=yes
scons platform=windows arch=x86_64
dumpbin /dependents .\addons\godot-git-plugin\windows\*.dll
- name: Save Godot build cache
uses: ./godot-cpp/.github/actions/godot-cache-save
with:
cache-name: windows-x86_64
scons-cache: ${{ env.SCONS_CACHE }}
continue-on-error: true
- 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
- uses: actions/upload-artifact@v7
with:
name: libgit_plugin.windows.x86_64.editor.dll-${{ github.sha }}
if-no-files-found: error
path: |
out/

macos-universal:
runs-on: macos-15
runs-on: macos-latest
steps:
- name: Setup Xcode 16.2 (16.3+ incompatible with libgit2's zlib)
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '16.2'
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Setup Godot build cache
uses: ./godot-cpp/.github/actions/godot-cache
- name: Restore Godot build cache
uses: ./godot-cpp/.github/actions/godot-cache-restore
with:
cache-name: macos-universal
scons-cache: ${{ env.SCONS_CACHE }}
continue-on-error: true
- name: Build for macOS editor universal
run: |
pip install scons
scons platform=macos arch=universal target=editor generate_bindings=yes macos_deployment_target=10.13
scons platform=macos arch=universal macos_deployment_target=10.13
otool -L addons/godot-git-plugin/macos/*.dylib
- name: Save Godot build cache
uses: ./godot-cpp/.github/actions/godot-cache-save
with:
cache-name: macos-universal
scons-cache: ${{ env.SCONS_CACHE }}
continue-on-error: true
- name: Prepare artifact
run: |
mkdir out
mv addons out/
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v7
with:
name: libgit_plugin.macos.universal.editor.dylib-${{ github.sha }}
if-no-files-found: error
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ build/
bin/
macos/
linux/
win64/
windows/
*.lib
*.a
*.obj
Expand Down
2 changes: 1 addition & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if ARGUMENTS.get("custom_api_file", "") != "":

ARGUMENTS["target"] = "editor"
env = SConscript("godot-cpp/SConstruct").Clone()
env.PrependENVPath("PATH", os.getenv("PATH")) # Prepend PATH, done upstream in recent godot-cpp verions.
env.__class__.msvc = env.get("is_msvc", False)

# Force linking with LTO on windows MSVC, silence the linker complaining that libgit uses LTO but we are not linking with it.
if env["platform"] == "windows" and env.get("is_msvc", False):
Expand Down
6 changes: 3 additions & 3 deletions THIRDPARTY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

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
1. godotengine/godot-cpp - MIT License - https://github.com/godotengine/godot-cpp/tree/58d1de720b8ffe9f8ffcdfe3a85148582cfd2e74
2. libgit2/libgit2 - GPLv2 with a special Linking Exception - https://github.com/libgit2/libgit2/tree/26055f5af74ab1cf636d272e8a34315496d3f06f
3. libssh2/libssh2 - BSD-3-Clause License - https://github.com/libssh2/libssh2/tree/635caa90787220ac3773c1d5ba11f1236c22eae8
4. openssl - OpenSSL License - https://github.com/openssl/openssl/tree/26baecb28ce461696966dac9ac889629db0b3b96
4. openssl - OpenSSL License - https://github.com/openssl/openssl/tree/aae016bfd52fcad2bc9657c2c782cfdf73b1ed5f

## License Texts

Expand Down
2 changes: 1 addition & 1 deletion addons/godot-git-plugin/git_plugin.gdextension
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[configuration]

entry_symbol = "git_plugin_init"
compatibility_minimum = "4.2.0"
compatibility_minimum = "4.3"

[libraries]

Expand Down
7 changes: 7 additions & 0 deletions build_profile.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"enabled_classes": [
"OS",
"EditorVCSInterface",
"Window"
]
}
2 changes: 1 addition & 1 deletion godot-cpp
Submodule godot-cpp updated 191 files
2 changes: 2 additions & 0 deletions godot-git-plugin/src/git_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include "godot_cpp/classes/editor_vcs_interface.hpp"
#include "git2.h"

#include <vector>

struct Credentials {
godot::String username;
godot::String password;
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/git2/libgit2
Submodule libgit2 updated 738 files
2 changes: 1 addition & 1 deletion thirdparty/openssl
Submodule openssl updated 23915 files
Empty file removed thirdparty/ssh2/libssh2_config.h
Empty file.
38 changes: 29 additions & 9 deletions tools/cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,30 @@


# This must be kept in sync with the value in https://github.com/godotengine/godot/blob/master/platform/android/detect.py#L58.
def get_ndk_version():
return "23.2.8568313"
def get_ndk_version(env):
return env["ndk_version"]


def cmake_default_flags(env):
if env.get("cmake_default_flags", ""):
return shlex.split(env["cmake_default_flags"])

config = {}
opt_level = env.get("optimize", "")
config = {
"CMAKE_BUILD_TYPE": "RELWITHDEBINFO"
if env.get("debug_symbols", True)
else ("MINSIZEREL" if opt_level == "size" else "RELEASE")
}

if env.get("lto", "none") != "none":
config["CMAKE_INTERPROCEDURAL_OPTIMIZATION"] = "1"

if "CC" in env:
config["CMAKE_C_COMPILER"] = env["CC"]
config["CMAKE_C_COMPILER"] = env["CC"] if os.name != "nt" else env.subst("$CC").replace("\\", "/") + ".exe"
if "CXX" in env:
config["CMAKE_CXX_COMPILER"] = env["CXX"]
config["CMAKE_CXX_COMPILER"] = env["CXX"] if os.name != "nt" else env.subst("$CXX").replace("\\", "/") + ".exe"
if "RC" in env:
config["CMAKE_RC_COMPILER"] = env["RC"] if os.name != "nt" else env.subst("$RC").replace("\\", "/") + ".exe"

if env["platform"] == "android":
api = env["android_api_level"]
Expand All @@ -35,7 +45,7 @@ def cmake_default_flags(env):
config["CMAKE_SYSTEM_VERSION"] = api
config["CMAKE_ANDROID_ARCH_ABI"] = abi
config["ANDROID_ABI"] = abi
ndk_root = os.environ.get("ANDROID_NDK_ROOT", env.get("ANDROID_HOME", "") + "/ndk/" + get_ndk_version())
ndk_root = os.environ.get("ANDROID_NDK_ROOT", env.get("ANDROID_HOME", "") + "/ndk/" + get_ndk_version(env))
config["CMAKE_TOOLCHAIN_FILE"] = "%s/build/cmake/android.toolchain.cmake" % ndk_root
config["CMAKE_ANDROID_STL_TYPE"] = "c++_static"

Expand Down Expand Up @@ -81,7 +91,7 @@ def cmake_default_flags(env):

elif env["platform"] == "windows":
config["CMAKE_SYSTEM_NAME"] = "Windows"
if env.get("is_msvc", False):
if env.msvc:
config["CMAKE_POLICY_DEFAULT_CMP0091"] = "NEW"
if env.get("debug_crt", False):
config["CMAKE_MSVC_RUNTIME_LIBRARY"] = "MultiThreadedDebugDLL"
Expand All @@ -95,6 +105,7 @@ def cmake_default_flags(env):


def cmake_emitter(target, source, env):
env.SideEffect(env["CMAKELOCK"], target)
return [str(target[0]) + "/CMakeCache.txt"] + target[1:], [str(source[0]) + "/CMakeLists.txt"] + source[1:]


Expand Down Expand Up @@ -130,7 +141,10 @@ def cmake_build(
else:
f = df[2:].split("=")[0]
if f in cmake_options:
df += " " + cmake_options[f]
if f == "CMAKE_BUILD_TYPE":
df = "-DCMAKE_BUILD_TYPE=" + cmake_options[f]
else:
df += " " + cmake_options[f]
cmake_options.pop(f)
flags.append(df)
for opt in cmake_options:
Expand All @@ -140,7 +154,7 @@ def cmake_build(
if env["cmake_generator"]:
flags.extend(["-G", env["cmake_generator"]])
elif env["platform"] == "windows":
if env.get("is_msvc", False):
if env.msvc:
flags.extend(["-G", "NMake Makefiles"])
elif sys.platform in ["win32", "msys", "cygwin"]:
flags.extend(["-G", "Ninja"])
Expand All @@ -158,6 +172,7 @@ def options(opts):
opts.Add("cmake_default_flags", "Default CMake platform flags override, will be autodetected if not specified.", "")
opts.Add("cmake_generator", "CMake generator override, will be autodetected from platform if not specified.", "")
opts.Add("cmake", "CMake binary to use", "cmake")
opts.Add("emcmake", "Emscripten's cmake configuration helper to use (only in web builds)", "emcmake")


def exists(env):
Expand All @@ -166,12 +181,17 @@ def exists(env):

def generate(env):
env["CMAKE"] = env["cmake"]
env["EMCMAKE"] = env["emcmake"]
env["CMAKECONFFLAGS"] = SCons.Util.CLVar("")
env["CMAKECONFCOM"] = "$CMAKE -B ${TARGET.dir} $CMAKECONFFLAGS ${SOURCE.dir}"
if env.get("platform", "") == "web":
env["CMAKECONFCOM"] = "$EMCMAKE " + env["CMAKECONFCOM"]

env["CMAKEBUILDJOBS"] = "${__env__.GetOption('num_jobs')}"
env["CMAKEBUILDFLAGS"] = SCons.Util.CLVar("")
env["CMAKEINSTALLFLAGS"] = SCons.Util.CLVar("")
env["CMAKEBUILDCOM"] = "$CMAKE --build ${TARGET.dir} $CMAKEBUILDFLAGS -j$CMAKEBUILDJOBS"
env["CMAKEINSTALLCOM"] = "$CMAKE --install ${TARGET.dir} $CMAKEINSTALLFLAGS"
env["BUILDERS"]["CMake"] = SCons.Builder.Builder(generator=cmake_generator, emitter=cmake_emitter)
env["CMAKELOCK"] = "#bin/cmake.lock"
env.AddMethod(cmake_build, "CMakeBuild")
27 changes: 14 additions & 13 deletions tools/git2.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,25 @@ def build_library(env, deps):
"OPENSSL_SSL_LIBRARY": env["SSL_LIBRARY"],
"OPENSSL_CRYPTO_LIBRARY": env["SSL_CRYPTO_LIBRARY"],
"OPENSSL_ROOT_DIR": env["SSL_INSTALL"],
"BUILD_TESTS": 0,
"BUILD_CLI": 0,
"BUILD_EXAMPLES": 0,
"BUILD_FUZZERS": 0,
"USE_SSH": 1,
"USE_HTTPS": 1,
"USE_SHA1": 1,
"USE_BUNDLED_ZLIB": 1,
"BUILD_TESTS": "OFF",
"BUILD_CLI": "OFF",
"BUILD_EXAMPLES": "OFF",
"BUILD_FUZZERS": "OFF",
"USE_SSH": "ON",
"USE_HTTPS": "OpenSSL",
"USE_SHA1": "CollisionDetection",
"USE_BUNDLED_ZLIB": "ON",
"USE_HTTP_PARSER": "builtin",
"REGEX_BACKEND": "builtin",
"USE_HTTPS": "OpenSSL",
"USE_SHA1": "OpenSSL",
"BUILD_SHARED_LIBS": 0,
"LINK_WITH_STATIC_LIBRARIES": 1,
"LIBSSH2_INCLUDE_DIR": env.Dir("#thirdparty/ssh2/libssh2/include").abspath,
"LIBSSH2_LIBRARY": deps[-1],
"LIBSSH2_INCLUDE_DIRS": env.Dir("#thirdparty/ssh2/libssh2/include").abspath,
"LIBSSH2_RESOLVED": deps[-1].abspath,
"LIBSSH2_LIBRARIES": "LIBSSH2",
"LIBSSH2_FOUND": 1,
"USE_WINHTTP": 0,
"STATIC_CRT": env.get("use_static_cpp", True),
"CMAKE_DISABLE_FIND_PACKAGE_ZLIB": 1,
"CMAKE_DISABLE_FIND_PACKAGE_OPENSSL": 1,
}

if env["platform"] != "windows":
Expand Down Expand Up @@ -57,6 +56,8 @@ def build_library(env, deps):
env.Prepend(LIBS=git2[1:])
if env["platform"] == "windows":
env.PrependUnique(LIBS=["secur32"])
elif env["platform"] == "macos":
env.Append(LIBS=["iconv"])

return git2

Expand Down
Loading
Loading