Port demo files to Godot 4.0

This commit is contained in:
Twarit Waikar
2022-07-31 21:27:47 +05:30
parent d0c59416d1
commit 521341e7bf
22 changed files with 255220 additions and 212771 deletions

View File

@@ -15,7 +15,7 @@ jobs:
ldd demo/addons/godot-git-plugin/linux/libgit_plugin.so
- uses: actions/upload-artifact@v2
with:
name: godot-git-plugin-linux-release-x64-${{ github.sha }}
name: libgit_plugin.linux.x86_64.release.dll-${{ github.sha }}
if-no-files-found: error
path: |
demo/
@@ -37,7 +37,7 @@ jobs:
dumpbin /dependents .\demo\addons\godot-git-plugin\win64\libgit_plugin.dll
- uses: actions/upload-artifact@v2
with:
name: godot-git-plugin-windows-release-x64-${{ github.sha }}
name: libgit_plugin.windows.x86_64.release.dll-${{ github.sha }}
if-no-files-found: error
path: |
demo/
@@ -54,7 +54,7 @@ jobs:
otool -L demo/addons/godot-git-plugin/osx/libgit_plugin.dylib
- uses: actions/upload-artifact@v2
with:
name: godot-git-plugin-macos-release-x64-${{ github.sha }}
name: libgit_plugin.osx.x86_64.release.dylib-${{ github.sha }}
if-no-files-found: error
path: |
demo/

5
.gitignore vendored
View File

@@ -1,8 +1,11 @@
# SConstruct db
*.dblite
# Godot ignores
demo/.godot/
# Godot Serialisations
api.json
extension_api.json
# Visual Studio Cache
.vs/

View File

@@ -26,29 +26,37 @@ This section onwards is only meant to be used if you intend to compile the plugi
- 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_osx.sh` to build OpenSSL yourself and replace the already prebuilt libraries provided inside `thirdparty/openssl/`, otherwise, just run `brew install openssl@1.1`.
- For making universal builds targeting both Apple Silicon and x86_64, you can optionally run `build_openssl_universal_osx.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 local package manager equivalent.
- Run `sudo apt-get install libssl-dev`, or your local package manager's equivalent.
### Build
### Release Build
```
scons platform=<platform> target=release bits=64 -j 6
scons platform=<platform> target=release -j 6
```
For more build options, run `scons platform=<platform> -h`
## Bleeding Edge
## Dev builds
Most of the times when new features are being worked on for the Godot VCS Integration, it requires developers to make changes in the Godot Editor source code along with this plugin. This means we need to manually generate the GDNative API from the custom Godot builds and then use it to compile godot-cpp.
When new features are being worked on for the Godot VCS Integration, the build process sometimes requires developers to make changes in the GDExtension API along with this plugin. This means we need to manually generate the GDExtension API from the custom Godot builds and then use it to compile godot-cpp.
To build using custom GDNative API definition JSON files, run the below helper command:
If you need to use a custom GDExtension API:
```
scons platform=<platform> target=debug godot_cpp=yes generate_bindings=yes bits=64 use_custom_api_file=yes custom_api_file=path/to/api.json -j 6
scons platform=<platform> target=debug godot_cpp=yes generate_bindings=yes bits=64 use_custom_api_file=yes custom_api_file=path/to/extension_api.json -j 6
```
Once this command is completed successfully, the standard build commands in the above section can be run without recompiling godot-cpp. Once compiled, to stop godot-cpp from recompiling, do not use the `godot_cpp` option in SCons arguments. To view more options available while recompiling godot-cpp, run `scons platform=<platform> godot_cpp=yes -h`.
You only need to build godot-cpp once every change in the GDExtension API, hence, this command should only be run the first time after generating a new JSON API file.
To reuse the once-built godot-cpp library:
```
scons platform=<platform> target=debug -j 6
```
To view more options available while recompiling godot-cpp, run `scons platform=<platform> godot_cpp=yes -h`.
---

View File

@@ -37,6 +37,9 @@ opts.Add(PathVariable("macos_openssl_static_crypto", "Path to OpenSSL libcrypto.
# Updates the environment with the option variables.
opts.Update(env)
if env["p"] != "":
env["platform"] = env["p"]
if env["platform"] == "osx":
# Use only clang on osx because we need to do universal builds
env["CXX"] = "clang++"
@@ -54,7 +57,7 @@ Export("env")
SConscript("thirdparty/SCsub")
if env["godot_cpp"]:
if ARGUMENTS.get("use_custom_api_file", False) and ARGUMENTS.get("custom_api_file", "") != "":
if ARGUMENTS.get("custom_api_file", "") != "":
ARGUMENTS["custom_api_file"] = "../" + ARGUMENTS["custom_api_file"]
SConscript("godot-cpp/SConstruct")

212598
api.ci.json

File diff suppressed because it is too large Load Diff

13
demo/.gitignore vendored
View File

@@ -1,11 +1,2 @@
# Godot-specific ignores
.import/
export.cfg
export_presets.cfg
# Imported translations (automatically generated from CSV files)
*.translation
# Mono-specific ignores
.mono/
data_*/
# Godot 4+ specific ignores
.godot/

View File

@@ -1,18 +0,0 @@
[general]
load_once=true
symbol_prefix="godot_"
reloadable=false
singleton=false
[entry]
OSX.64="res://addons/godot-git-plugin/osx/libgit_plugin.dylib"
Windows.64="res://addons/godot-git-plugin/win64/libgit_plugin.dll"
X11.64="res://addons/godot-git-plugin/linux/libgit_plugin.so"
[dependencies]
OSX.64=[ ]
Windows.64=[ ]
X11.64=[ ]

View File

@@ -1,9 +0,0 @@
[gd_resource type="NativeScript" load_steps=2 format=2]
[ext_resource path="res://addons/godot-git-plugin/git_plugin.gdnlib" type="GDNativeLibrary" id=1]
[resource]
resource_name = "GitPlugin"
class_name = "GitPlugin"
library = ExtResource( 1 )
script_class_name = "GitPlugin"

View File

@@ -0,0 +1,16 @@
[configuration]
entry_symbol = "git_plugin_init"
[libraries]
macos.debug = "osx/libgit_plugin.osx.universal.debug.dylib"
macos.release = "osx/libgit_plugin.osx.universal.release.dylib"
windows.debug.x86_64 = "win64/libgit_plugin.windows.x86_64.debug.dll"
windows.release.x86_64 = "win64/libgit_plugin.windows.x86_64.release.dll"
linux.debug.x86_64 = "linux/libgit_plugin.linux.x86_64.debug.so"
linux.release.x86_64 = "linux/libgit_plugin.linux.x86_64.release.so"
linux.debug.arm64 = "linux/libgit_plugin.linux.arm64.debug.so"
linux.release.arm64 = "linux/libgit_plugin.linux.arm64.release.so"
linux.debug.rv64 = ""
linux.release.rv64 = ""

View File

@@ -3,5 +3,5 @@
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="ChronicallySerious"
version="v2.0.0"
version="v3.0.0-beta"
script="git_plugin.gdns"

View File

@@ -1,7 +0,0 @@
[gd_resource type="Environment" load_steps=2 format=2]
[sub_resource type="ProceduralSky" id=1]
[resource]
background_mode = 2
background_sky = SubResource( 1 )

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -1,35 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.png"
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@@ -1,16 +1,12 @@
extends Node
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
print("Hello Godot!")
print("Hello world!")
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
func _process(delta):
pass

View File

@@ -6,29 +6,13 @@
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=4
_global_script_classes=[ {
"base": "EditorVCSInterface",
"class": "GitPlugin",
"language": "NativeScript",
"path": "res://addons/godot-git-plugin/git_plugin.gdns"
} ]
_global_script_class_icons={
"GitPlugin": ""
}
config_version=5
[application]
config/name="demo"
run/main_scene="res://demo.tscn"
config/icon="res://icon.png"
config/features=PackedStringArray("4.0")
[editor]
version_control/autoload_on_startup=true
version_control/plugin_name="GitPlugin"
[rendering]
environment/default_environment="res://default_env.tres"
version_control/autoload_on_startup=true

255141
extension_api.ci.json Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -8,20 +8,21 @@ Import("env")
godot_headers_path = "../godot-cpp/godot-headers/"
cpp_bindings_path = "../godot-cpp/"
cpp_library = "libgodot-cpp"
bits = env["bits"]
target_arch = env["bits"]
dynamic_lib_extension = ""
# Process some arguments
if env["use_llvm"]:
env["CC"] = "clang"
env["CXX"] = "clang++"
if env["p"] != "":
env["platform"] = env["p"]
if env["platform"] == "":
print("No valid target platform selected.")
quit()
if env["bits"] == "64":
target_arch = "x86_64"
env["target_path"] = "../" + env["target_path"]
if not os.path.isdir(env["target_path"]):
@@ -31,6 +32,8 @@ if not os.path.isdir(env["target_path"]):
if env["platform"] == "osx":
env["target_path"] += "osx/"
cpp_library += ".osx"
dynamic_lib_extension = "dylib"
target_arch = env["macos_arch"]
# Force static linkage (https://stackoverflow.com/a/2995999/7370948)
static_ssl = File(env["macos_openssl_static_ssl"])
@@ -46,6 +49,7 @@ elif env["platform"] == "linux":
env["target_path"] += "linux/"
cpp_library += ".linux"
env.Append(LIBS=["ssl", "crypto"])
dynamic_lib_extension = "so"
if env["target"] in ("debug", "d"):
env.Append(CCFLAGS=["-fPIC", "-g3", "-Og", "-std=c++17"])
@@ -53,12 +57,14 @@ elif env["platform"] == "linux":
env.Append(CCFLAGS=["-fPIC", "-g", "-O3", "-std=c++17"])
elif env["platform"] == "windows":
env.Append(CPPDEFINES=["TYPED_METHOD_BIND"]) # TODO: Make this only apply when using MSVC
# TODO: Make this only apply when using MSVC
env.Append(CPPDEFINES=["TYPED_METHOD_BIND"])
env["target_path"] += "win64/"
cpp_library += ".windows"
# This makes sure to keep the session environment variables on windows,
# that way you can run scons in a vs 2017 prompt and it will find all the required tools
env.Append(ENV=os.environ)
dynamic_lib_extension = "dll"
env.Append(CCFLAGS=["-DWIN32", "-D_WIN32", "-D_WINDOWS",
"-W3", "-GR", "-D_CRT_SECURE_NO_WARNINGS", "/std:c++17"])
@@ -78,7 +84,7 @@ else:
if env['platform'] == 'osx' and env['macos_arch'] != 'universal':
cpp_library += "." + env['macos_arch']
else:
cpp_library += "." + str(bits)
cpp_library += "." + "x86_64"
env.Append(CPPPATH=[".", "src/"])
env.Append(CPPPATH=[
@@ -86,11 +92,14 @@ env.Append(CPPPATH=[
cpp_bindings_path + "include/",
cpp_bindings_path + "gen/include/"
])
env.Append(CPPPATH=["../thirdparty/git2/libgit2/include/"])
env.Append(LIBPATH=[cpp_bindings_path + "bin/", "../thirdparty/bin/"])
env.Prepend(LIBS=[cpp_library, "git2", "ssh2"])
library = env.SharedLibrary(
target=env["target_path"] + env["target_name"],
target=env["target_path"] + env["target_name"] + "." +
env["platform"] + "." + target_arch + "." +
env["target"] + "." + dynamic_lib_extension,
source=Glob("src/*.cpp"))
Default(library)

View File

@@ -38,15 +38,9 @@ extern "C" int transfer_progress_cb(const git_indexer_progress *stats, void *pay
(void)payload;
if (stats->received_objects == stats->total_objects) {
std::cout << "Resolving deltas " << stats->indexed_deltas << "/" << stats->total_deltas << std::endl;
printf("Resolving deltas %d/%d\n", stats->indexed_deltas, stats->total_deltas);
} else if (stats->total_objects > 0) {
std::cout << "Received %d/%d objects (%d) in %d bytes"
<< stats->received_objects << "/"
<< stats->total_objects << " objects ("
<< stats->indexed_objects << ") in "
<< static_cast<int>(stats->received_bytes)
<< " bytes"
<< std::endl;
printf("Received %d/%d objects (%d) in %zu bytes\n", stats->received_objects, stats->total_objects, stats->indexed_objects, stats->received_bytes);
}
return 0;
}

View File

@@ -26,29 +26,7 @@
#define COMMA ,
void GitPlugin::_bind_methods() {
godot::ClassDB::bind_method(godot::D_METHOD("_commit", "msg"), &GitPlugin::_commit);
godot::ClassDB::bind_method(godot::D_METHOD("_get_modified_files_data"), &GitPlugin::_get_modified_files_data);
godot::ClassDB::bind_method(godot::D_METHOD("_get_remotes"), &GitPlugin::_get_remotes);
godot::ClassDB::bind_method(godot::D_METHOD("_get_diff", "identifier", "area"), &GitPlugin::_get_diff);
godot::ClassDB::bind_method(godot::D_METHOD("_get_vcs_name"), &GitPlugin::_get_vcs_name);
godot::ClassDB::bind_method(godot::D_METHOD("_initialize", "project_path"), &GitPlugin::_initialize);
godot::ClassDB::bind_method(godot::D_METHOD("_shut_down"), &GitPlugin::_shut_down);
godot::ClassDB::bind_method(godot::D_METHOD("_stage_file", "file_path"), &GitPlugin::_stage_file);
godot::ClassDB::bind_method(godot::D_METHOD("_discard_file", "file_path"), &GitPlugin::_discard_file);
godot::ClassDB::bind_method(godot::D_METHOD("_unstage_file", "file_path"), &GitPlugin::_unstage_file);
godot::ClassDB::bind_method(godot::D_METHOD("_get_previous_commits", "max_commits"), &GitPlugin::_get_previous_commits);
godot::ClassDB::bind_method(godot::D_METHOD("_get_branch_list"), &GitPlugin::_get_branch_list);
godot::ClassDB::bind_method(godot::D_METHOD("_create_branch", "branch_name"), &GitPlugin::_create_branch);
godot::ClassDB::bind_method(godot::D_METHOD("_create_remote", "remote_url"), &GitPlugin::_create_remote);
godot::ClassDB::bind_method(godot::D_METHOD("_remove_branch", "branch_name"), &GitPlugin::_remove_branch);
godot::ClassDB::bind_method(godot::D_METHOD("_remove_remote", "remote_name"), &GitPlugin::_remove_remote);
godot::ClassDB::bind_method(godot::D_METHOD("_get_current_branch_name"), &GitPlugin::_get_current_branch_name);
godot::ClassDB::bind_method(godot::D_METHOD("_checkout_branch", "branch_name"), &GitPlugin::_checkout_branch);
godot::ClassDB::bind_method(godot::D_METHOD("_fetch", "remote"), &GitPlugin::_fetch);
godot::ClassDB::bind_method(godot::D_METHOD("_pull", "remote"), &GitPlugin::_pull);
godot::ClassDB::bind_method(godot::D_METHOD("_push", "remote", "force"), &GitPlugin::_push);
godot::ClassDB::bind_method(godot::D_METHOD("_get_line_diff", "file_path", "text"), &GitPlugin::_get_line_diff);
godot::ClassDB::bind_method(godot::D_METHOD("_set_credentials", "username", "password", "ssh_public_key_path", "ssh_private_key_path", "ssh_passphrase"), &GitPlugin::_set_credentials);
// Doesn't seem to require binding functions for now
}
GitPlugin::GitPlugin() {
@@ -207,17 +185,8 @@ void GitPlugin::create_gitignore_and_gitattributes() {
godot::File file;
file.open("res://.gitignore", godot::File::ModeFlags::WRITE);
file.store_string(
"# Godot-specific ignores\n"
".import/\n"
"export.cfg\n"
"export_presets.cfg\n\n"
"# Imported translations (automatically generated from CSV files)\n"
"*.translation\n\n"
"# Mono-specific ignores\n"
".mono/\n"
"data_*/\n");
"# Godot 4+ specific ignores\n"
".godot/\n");
file.close();
}

0
release.sh Executable file → Normal file
View File

2
thirdparty/SCsub vendored
View File

@@ -1,4 +1,6 @@
#!/usr/bin/env python
Import("env")
SConscript("ssh2/SCsub")
SConscript("git2/SCsub")