37 Commits
v1.1 ... v1.2

Author SHA1 Message Date
Twarit
13c8905f72 Fix minor spell error: intialize -> initialize 2020-04-10 16:07:46 +05:30
Twarit Waikar
04cab3e227 Merge pull request #27 from godotengine/fix-link-error
Fix link errors due to not linking Advapi
2020-04-09 17:26:42 +05:30
Twarit
62247870dc Fix link errors in #26 2020-04-09 17:25:22 +05:30
Twarit
b1ac091571 Properly add PIC for all libgit2 builds 2020-03-30 19:25:06 +05:30
Twarit
aa3d85d970 Force -fPIC in libgit2 2020-03-30 17:13:47 +05:30
Twarit
b484d1eb3b Minor fix to not look deeper in dir to find libgit2.a 2020-03-30 16:56:27 +05:30
Twarit
923818997d Set Libgit2 to build into a static lib and use bundled zlib by default 2020-03-30 14:02:54 +05:30
Twarit
933fb7b7d0 Add AppVeyor build script 2020-03-30 14:02:23 +05:30
Twarit
cdbcbf8710 Remove MacOS and Windows CI, keep Linux only 2020-03-30 13:49:58 +05:30
Twarit
da42fb3896 Revert to using forward slash in CI script 2020-03-30 13:45:36 +05:30
Twarit
d915d53e31 Convert forward slashes to backslashes in .travis.yml 2020-03-30 13:42:55 +05:30
Twarit
0388ca39d5 Fix missing semicolon in travis file + use C++17 in CI build 2020-03-30 13:34:35 +05:30
Twarit
db05e54d00 Fix missing compiler and some C++ errors 2020-03-30 13:30:27 +05:30
Twarit
07876bff06 Use dev console in windows CI build 2020-03-30 13:20:40 +05:30
Twarit
827dabced8 Switch back to generating bindings in CI 2020-03-30 12:57:51 +05:30
Twarit
7bdda124aa Select OS in CI build 2020-03-30 12:49:32 +05:30
Twarit
5ddb2d44e5 Remove artifacts left over from copied .travis.yml 2020-03-30 12:42:34 +05:30
Twarit
7e57104764 Add macos CI + clean build script 2020-03-30 12:24:42 +05:30
Twarit
b44a9c29a9 Add Windows build to CI 2020-03-30 12:11:21 +05:30
Twarit
17dc47e151 Fix ambiguous conversion in git_api.cpp 2020-03-30 02:01:43 +05:30
Twarit
19627c4063 Use latest GCC in build 2020-03-30 01:40:10 +05:30
Twarit
f1feb86c42 Limit Travis to only Linux builds 2020-03-30 01:38:35 +05:30
Twarit
271fc3e996 Remove CI compilaion warnings/errors 2020-03-30 01:20:47 +05:30
Twarit
20e1148d39 Acquire scons before running SCons 2020-03-30 01:07:13 +05:30
Twarit
80fa3f185f Fix incorrect build scrit invokation in Travis 2020-03-30 01:04:19 +05:30
Twarit
3fc9aa263c Add Travis back in 2020-03-30 01:00:04 +05:30
Twarit
6ab8845dd2 Make build_libs.sh executable 2020-03-30 00:53:19 +05:30
Twarit
3364a0ef16 Automate compiling libgit2 2020-03-30 00:38:40 +05:30
Twarit
cc512c0a17 Shift gitsubmodule to godot-cpp root 2020-03-29 23:37:11 +05:30
Twarit
f0a5bf16d9 Removed submodule IronicallySerious/godot-cpp 2020-03-29 23:04:39 +05:30
Twarit
02d3df348f Update to godot-cpp from 3.2stable 2020-03-29 22:59:02 +05:30
Twarit Waikar
4908788e24 Replace link to GSoC progress report by Wiki link 2020-02-15 01:49:35 +05:30
Twarit
6dbac88d8f Fix crash on missing user.email and user.name in gitconfig 2020-02-15 01:28:40 +05:30
Twarit Waikar
bed4e799d6 Remove Travis CI (explanantion)
The godot-cpp build needs to refer to godot engine binary to extract the latest 3.2 GDNative API. Since godot-cpp has not been updated for 3.2, using any kind of CI will be a lot more effort than just setting up a build script
2020-02-14 22:53:20 +05:30
Twarit
ba4a907f89 Make build shell scripts executable 2020-02-14 22:48:37 +05:30
Twarit Waikar
f1e8e0ac1d Fix OS mismatch on debug and release jobs 2020-02-14 22:44:53 +05:30
Twarit Waikar
990ccfd0bc Add Travis CI build conf 2020-02-14 22:39:44 +05:30
18 changed files with 201 additions and 117 deletions

2
.gitmodules vendored
View File

@@ -1,3 +1,3 @@
[submodule "godot-cpp"]
path = godot-cpp
url = https://github.com/IronicallySerious/godot-cpp
url = https://github.com/GodotNativeTools/godot-cpp

57
.travis.yml Normal file
View File

@@ -0,0 +1,57 @@
language: cpp
dist: xenial
osx_image: xcode10.1
env:
global:
- SCONS_CACHE="$HOME/.scons_cache"
- SCONS_CACHE_LIMIT=1024
cache:
directories:
- $SCONS_CACHE
matrix:
include:
- name: Linux Debug
os: linux
compiler: gcc
env: TARGET=debug PLATFORM=x11
addons:
apt:
sources:
- llvm-toolchain-xenial-6.0
packages:
[scons, pkg-config, build-essential, p7zip-full]
- name: Linux Release
os: linux
compiler: gcc
addons:
apt:
packages:
[scons, pkg-config, build-essential, p7zip-full]
env: TARGET=release PLATFORM=x11
install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew update;
brew install scons p7zip;
fi
- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
curl -LO https://downloads.sourceforge.net/project/scons/scons-local/3.0.5/scons-local-3.0.5.zip;
unzip scons-local-3.0.5.zip;
fi
script:
- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
export SCONS="./scons.bat";
/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/2017/BuildTools/Common7/Tools/VsDevCmd.bat;
./build_libs.bat $TARGET;
else
export SCONS="scons";
./build_libs.sh $TARGET;
fi
- $SCONS platform=$PLATFORM target=$TARGET $SCONS_FLAGS;

View File

@@ -4,22 +4,18 @@ Implements the proxy end-points for the `EditorVCSInterface` API in the Godot En
## Installation Instructions
1. Plugin binary releases for Linux & Windows are here: <https://github.com/godotengine/godot-git-plugin/releases>
2. Installation instructions are here: <https://godotengine.org/article/gsoc-2019-progress-report-3#vcs-integration>
2. Installation instructions are here: https://github.com/godotengine/godot-git-plugin/wiki
## Build Instructions
> Replace `Release` with `Debug` for a debug build.
### Windows
1. Open `build_libs_release.bat` as text.
2. Edit the relative paths to the Godot binary and from the Godot binary directory to this repository's directory in line 1 and line 2.
3. Run `build_libs_release.bat`.
4. Run `cd ..` because the build file leaves you one level deeper in the repository.
5. Load the x64 command prompt: `x64 Native Tools Command Prompt for VS 2017`.
6. Run `scons platform=windows target=release`
1. Load the x64 command prompt: `x64 Native Tools Command Prompt for VS 20XX`.
2. Run `build_libs.bat Release`.
3. Run `scons platform=windows target=release`
### Linux
1. Open `build_libs_release.sh` as text.
2. Edit the relative paths to the Godot binary and from the Godot binary directory to this repository's directory in line 1 and line 2.
3. Prepare script for execution: `chmod 755 build_libs_release.sh`
4. Run ```. ./build_libs_release.sh```.
5. Run `cd ..` because the build file leaves you one level deeper in the repository.
6. Run `scons platform=x11 target=release`.
1. Prepare script for execution: `chmod 755 build_libs.sh`
2. Run ```. ./build_libs.sh Release```.
3. Run `scons platform=x11 target=release`.

View File

@@ -48,7 +48,7 @@ if env['platform'] == "osx":
env.Append(CCFLAGS = ['-g','-O2', '-arch', 'x86_64'])
env.Append(LINKFLAGS = ['-arch', 'x86_64'])
else:
env.Append(CCFLAGS = ['-g','-O3', '-arch', 'x86_64'])
env.Append(CCFLAGS = ['-g','-O3', '-arch', 'x86_64', '-std=c++17'])
env.Append(LINKFLAGS = ['-arch', 'x86_64'])
elif env['platform'] in ('x11', 'linux'):
@@ -69,6 +69,7 @@ elif env['platform'] == "windows":
env.Append(ENV = os.environ)
env.Append(CCFLAGS = ['-DWIN32', '-D_WIN32', '-D_WINDOWS', '-W3', '-GR', '-D_CRT_SECURE_NO_WARNINGS'])
env.Append(LIBS=['Advapi32'])
if env['target'] in ('debug', 'd'):
env.Append(CCFLAGS = ['-EHsc', '-D_DEBUG', '-MDd'])
else:

20
appveyor.yml Normal file
View File

@@ -0,0 +1,20 @@
environment:
matrix:
- vs_version: 15
os: Visual Studio 2017
configuration:
- Release
- Debug
platform:
- x64
install:
- call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
- curl -LO https://downloads.sourceforge.net/project/scons/scons-local/3.0.5/scons-local-3.0.5.zip
- unzip scons-local-3.0.5.zip
- ./build_libs.bat %configuration%
- scons platform=windows target=%configuration%

15
build_libs.bat Normal file
View File

@@ -0,0 +1,15 @@
git submodule init
git submodule update --init --recursive
cd godot-git-plugin\thirdparty\libgit2\
mkdir build
cd build\
del /F CMakeCache.txt
cmake ..
cmake --build .
cd ../../../../
copy godot-git-plugin\thirdparty\libgit2\build\%1\git2.lib demo\bin\win64\
cd godot-cpp\
scons platform=windows target=%1 generate_bindings=yes bits=64
cd ..

16
build_libs.sh Executable file
View File

@@ -0,0 +1,16 @@
git submodule init;
git submodule update --init --recursive;
cd godot-git-plugin/thirdparty/libgit2/
mkdir build
cd build/
rm CMakeCache.txt
cmake ..
cmake --build .
cd ../../../../
mv godot-git-plugin/thirdparty/libgit2/build/libgit2.a demo/bin/x11/libgit2.a
cd godot-cpp/;
apt-get install scons
scons platform=linux target=$1 generate_bindings=yes bits=64;
cd ..

View File

@@ -1,9 +0,0 @@
set GODOT_PATH_RELATIVE_TO_PLUGIN="..\godot\bin"
set GIT_PLUGIN_RELATIVE_TO_GODOT="..\..\godot-git-plugin\"
git submodule init
git submodule update --init --recursive
cd %GODOT_PATH_RELATIVE_TO_PLUGIN%
godot.windows.tools.64.exe --gdnative-generate-json-api api.json
copy api.json %GIT_PLUGIN_RELATIVE_TO_GODOT%\api.json /Y
cd %GIT_PLUGIN_RELATIVE_TO_GODOT%\godot-cpp\
scons platform=windows target=debug generate_bindings=yes use_custom_api_file=yes custom_api_file=../api.json bits=64

View File

@@ -1,10 +0,0 @@
GODOT_PATH_RELATIVE_TO_PLUGIN="../godot/bin";
GIT_PLUGIN_RELATIVE_TO_GODOT="../../godot-git-plugin/";
git submodule init;
git submodule update --init --recursive;
cd $GODOT_PATH_RELATIVE_TO_PLUGIN;
./godot.x11.tools.64 --gdnative-generate-json-api api.json;
cp api.json $GIT_PLUGIN_RELATIVE_TO_GODOT/api.json;
cd $GIT_PLUGIN_RELATIVE_TO_GODOT;
cd godot-cpp/;
scons platform=linux target=debug generate_bindings=yes use_custom_api_file=yes custom_api_file=../api.json bits=64;

View File

@@ -1,9 +0,0 @@
set GODOT_PATH_RELATIVE_TO_PLUGIN="..\godot\bin"
set GIT_PLUGIN_RELATIVE_TO_GODOT="..\..\godot-git-plugin\"
git submodule init
git submodule update --init --recursive
cd %GODOT_PATH_RELATIVE_TO_PLUGIN%
godot.windows.tools.64.exe --gdnative-generate-json-api api.json
copy api.json %GIT_PLUGIN_RELATIVE_TO_GODOT%\api.json /Y
cd %GIT_PLUGIN_RELATIVE_TO_GODOT%\godot-cpp\
scons platform=windows target=release generate_bindings=yes use_custom_api_file=yes custom_api_file=../api.json bits=64

View File

@@ -1,10 +0,0 @@
GODOT_PATH_RELATIVE_TO_PLUGIN="../godot/bin";
GIT_PLUGIN_RELATIVE_TO_GODOT="../../godot-git-plugin/";
git submodule init;
git submodule update --init --recursive;
cd $GODOT_PATH_RELATIVE_TO_PLUGIN;
./godot.x11.tools.64 --gdnative-generate-json-api api.json;
cp api.json $GIT_PLUGIN_RELATIVE_TO_GODOT/api.json;
cd $GIT_PLUGIN_RELATIVE_TO_GODOT;
cd godot-cpp/;
scons platform=linux target=release generate_bindings=yes use_custom_api_file=yes custom_api_file=../api.json bits=64;

8
demo/.gitattributes vendored
View File

@@ -1,17 +1,17 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
#Explicitly declare text files you want to always be normalized and converted
#to native line endings on checkout.
# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.cpp text
*.c text
*.h text
*.gd text
*.cs text
#Declare files that will always have CRLF line endings on checkout.
# Declare files that will always have CRLF line endings on checkout.
*.sln text eol=crlf
#Denote all files that are truly binary and should not be modified.
# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary

Binary file not shown.

View File

@@ -73,17 +73,17 @@
<IncludePath>D:\CPP Projects\godot-git-plugin\godot-git-plugin\thirdparty\libgit2\include;.\src\;..\godot-cpp\godot_headers\;..\godot-cpp\include\gen;..\godot-cpp\include\core\;..\godot-cpp\include\;$(IncludePath)</IncludePath>
<LibraryPath>D:\CPP Projects\godot-git-plugin\demo\bin\win64;..\godot-cpp\bin;$(LibraryPath)</LibraryPath>
<SourcePath>.\src\;$(VC_SourcePath);</SourcePath>
<OutDir>$(SolutionDir)..\demo\bin\win64\</OutDir>
<OutDir>$(SolutionDir)..\demo\bin\win64\debug\</OutDir>
<IntDir>$(SolutionDir)..\demo\bin\win64\intermediate\</IntDir>
<TargetName>libgitapi-debug</TargetName>
<TargetName>libgitapi</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>D:\CPP Projects\godot-git-plugin\godot-git-plugin\thirdparty\libgit2\include;.\src\;..\godot-cpp\godot_headers\;..\godot-cpp\include\gen;..\godot-cpp\include\core\;..\godot-cpp\include\;$(IncludePath)</IncludePath>
<LibraryPath>D:\CPP Projects\godot-git-plugin\demo\bin\win64;..\godot-cpp\bin;$(LibraryPath)</LibraryPath>
<SourcePath>.\src\;$(VC_SourcePath);</SourcePath>
<TargetName>libgitapi-release</TargetName>
<TargetName>libgitapi</TargetName>
<IntDir>$(SolutionDir)..\demo\bin\win64\intermediate\</IntDir>
<OutDir>$(SolutionDir)..\demo\bin\win64\</OutDir>
<OutDir>$(SolutionDir)..\demo\bin\win64\release\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
@@ -103,7 +103,7 @@
<Link>
<AdditionalDependencies>libgodot-cpp.windows.debug.64.lib;git2.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Console</SubSystem>
<OutputFile>$(SolutionDir)..\demo\bin\win64\libgitapi.dll</OutputFile>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">

View File

@@ -22,6 +22,12 @@ void GitAPI::_register_methods() {
void GitAPI::_commit(const String p_msg) {
if (!can_commit) {
godot::Godot::print("Git API cannot commit. Check previous errors.");
return;
}
git_signature *default_sign;
git_oid tree_id, parent_commit_id, new_commit_id;
git_tree *tree;
@@ -31,7 +37,7 @@ void GitAPI::_commit(const String p_msg) {
GIT2_CALL(git_repository_index(&repo_index, repo), "Could not get repository index", NULL);
for (int i = 0; i < staged_files.size(); i++) {
String file_path = ((String)staged_files[i]);
String file_path = staged_files[i];
File *file = File::_new();
if (file->file_exists(file_path)) {
@@ -50,19 +56,19 @@ void GitAPI::_commit(const String p_msg) {
GIT2_CALL(git_commit_lookup(&parent_commit, repo, &parent_commit_id), "Could not lookup parent commit data", NULL);
GIT2_CALL(
git_commit_create_v(
&new_commit_id,
repo,
"HEAD",
default_sign,
default_sign,
"UTF-8",
p_msg.alloc_c_string(),
tree,
1,
parent_commit),
"Could not create commit",
NULL);
git_commit_create_v(
&new_commit_id,
repo,
"HEAD",
default_sign,
default_sign,
"UTF-8",
p_msg.alloc_c_string(),
tree,
1,
parent_commit),
"Could not create commit",
NULL);
staged_files.clear();
@@ -96,14 +102,13 @@ void GitAPI::create_gitignore_and_gitattributes() {
file->open("res://.gitignore", File::ModeFlags::WRITE);
file->store_string(
"# Import cache\n"
".import/\n\n"
"# Import cache\n"
".import/\n\n"
"# Binaries\n"
"bin/\n"
"build/\n"
"lib/\n"
);
"# Binaries\n"
"bin/\n"
"build/\n"
"lib/\n");
file->close();
}
@@ -111,58 +116,63 @@ void GitAPI::create_gitignore_and_gitattributes() {
file->open("res://.gitattributes", File::ModeFlags::WRITE);
file->store_string(
"# Set the default behavior, in case people don't have core.autocrlf set.\n"
"* text=auto\n\n"
"# Set the default behavior, in case people don't have core.autocrlf set.\n"
"* text=auto\n\n"
"# Explicitly declare text files you want to always be normalized and converted\n"
"# to native line endings on checkout.\n"
"*.cpp text\n"
"*.c text\n"
"*.h text\n"
"*.gd text\n"
"*.cs text\n\n"
"# Explicitly declare text files you want to always be normalized and converted\n"
"# to native line endings on checkout.\n"
"*.cpp text\n"
"*.c text\n"
"*.h text\n"
"*.gd text\n"
"*.cs text\n\n"
"# Declare files that will always have CRLF line endings on checkout.\n"
"*.sln text eol=crlf\n\n"
"# Declare files that will always have CRLF line endings on checkout.\n"
"*.sln text eol=crlf\n\n"
"# Denote all files that are truly binary and should not be modified.\n"
"*.png binary\n"
"*.jpg binary\n");
"# Denote all files that are truly binary and should not be modified.\n"
"*.png binary\n"
"*.jpg binary\n");
file->close();
}
}
void GitAPI::create_initial_commit() {
bool GitAPI::create_initial_commit() {
git_signature *sig;
git_oid tree_id, commit_id;
git_index *repo_index;
git_tree *tree;
GIT2_CALL(git_signature_default(&sig, repo), "Unable to create a commit signature. Perhaps 'user.name' and 'user.email' are not set", NULL);
if (git_signature_default(&sig, repo) != 0) {
godot::Godot::print_error("Unable to create a commit signature. Perhaps 'user.name' and 'user.email' are not set. Set default user name and user email by `git config` and initialize again", __func__, __FILE__, __LINE__);
return false;
}
GIT2_CALL(git_repository_index(&repo_index, repo), "Could not get repository index", NULL);
GIT2_CALL(git_index_write_tree(&tree_id, repo_index), "Could not create intial commit", NULL);
GIT2_CALL(git_tree_lookup(&tree, repo, &tree_id), "Could not create intial commit", NULL);
GIT2_CALL(
git_commit_create_v(
&commit_id,
repo,
"HEAD",
sig,
sig,
NULL,
"Initial commit",
tree,
0
),
"Could not create the initial commit",
NULL);
git_commit_create_v(
&commit_id,
repo,
"HEAD",
sig,
sig,
NULL,
"Initial commit",
tree,
0),
"Could not create the initial commit",
NULL);
GIT2_CALL(git_index_write(repo_index), "Could not write index to disk", NULL);
git_index_free(repo_index);
git_tree_free(tree);
git_signature_free(sig);
return true;
}
bool GitAPI::_is_vcs_initialized() {
@@ -277,11 +287,16 @@ bool GitAPI::_initialize(const String p_project_root_path) {
return true;
}
can_commit = true;
GIT2_CALL(git_repository_init(&repo, p_project_root_path.alloc_c_string(), 0), "Could not initialize repository", NULL);
if (git_repository_head_unborn(repo) == 1) {
create_gitignore_and_gitattributes();
create_initial_commit();
if (!create_initial_commit()) {
godot::Godot::print_error("Initial commit could not be created. Commit functionality will not work.", __func__, __FILE__, __LINE__);
can_commit = false;
}
}
GIT2_CALL(git_repository_open(&repo, p_project_root_path.alloc_c_string()), "Could not open repository", NULL);

View File

@@ -23,6 +23,7 @@ class GitAPI : public EditorVCSInterface {
static GitAPI *singleton;
bool is_initialized;
bool can_commit;
Array staged_files;
@@ -50,7 +51,7 @@ public:
Array diff_contents;
void create_gitignore_and_gitattributes();
void create_initial_commit();
bool create_initial_commit();
void _init();
void _process();

View File

@@ -42,8 +42,9 @@ INCLUDE(EnableWarnings)
# Build options
#
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
OPTION(SONAME "Set the (SO)VERSION of the target" ON)
OPTION(BUILD_SHARED_LIBS "Build Shared Library (OFF for Static)" ON)
OPTION(BUILD_SHARED_LIBS "Build Shared Library (OFF for Static)" OFF)
OPTION(THREADSAFE "Build libgit2 as threadsafe" ON)
OPTION(BUILD_CLAR "Build Tests using the Clar suite" ON)
OPTION(BUILD_EXAMPLES "Build library usage example apps" OFF)
@@ -61,7 +62,7 @@ OPTION(USE_LEAK_CHECKER "Run tests with leak checker" OFF)
OPTION(VALGRIND "Configure build for valgrind" OFF)
OPTION(DEBUG_POOL "Enable debug pool allocator" OFF)
OPTION(ENABLE_WERROR "Enable compilation with -Werror" OFF)
OPTION(USE_BUNDLED_ZLIB "Use the bundled version of zlib" OFF)
OPTION(USE_BUNDLED_ZLIB "Use the bundled version of zlib" ON)
SET(USE_HTTP_PARSER "" CACHE STRING "Specifies the HTTP Parser implementation; either system or builtin.")
OPTION(DEPRECATE_HARD "Do not include deprecated functions in the library" OFF)
SET(REGEX_BACKEND "" CACHE STRING "Regular expression implementation. One of regcomp_l, pcre2, pcre, regcomp, or builtin.")