summaryrefslogtreecommitdiff
path: root/modules/mono
diff options
context:
space:
mode:
authorIgnacio Etcheverry <ignalfonsore@gmail.com>2019-12-28 19:12:32 +0100
committerIgnacio Etcheverry <ignalfonsore@gmail.com>2019-12-28 20:48:55 +0100
commit86274b9fc9e63c0eb6112bf4d87d67dd97fb0b86 (patch)
tree36b9c9909da20b9c7f0310a506542474bf2d1cba /modules/mono
parent318c69351624f7794c51b5385d252af397c0404a (diff)
Mono/C#: Re-structure API solution and GodotTools post-build target
Previously we had a placeholder solution called 'Managed' to benefit from tooling while editing the a part of the C# API. Later the bindings generator would create the final 'GodotSharp' solution including these C# files as well as the auto-generated C# API. Now we replaced the 'Managed' solution with the final 'GodotSharp' solution which is no longer auto-generated, and the bindings generator only takes care of the auto-generated C# API. This has the following benefits: - It's less confusing as there will no longer be two versions of the same file (the original and a generated copy of it). Now there's only one. - We no longer need placeholder for auto-generated API classes, like Node or Resource. We used them for benefiting from tooling. Now we can just use the auto-generated API itself. - Simplifies the build system and bindings generator. Removed lot of code that is not needed anymore. Also added a post-build target to the GodotTools project to copy the output to the data dir. This makes it easy to iterate when doing changes to GodotTools, as SCons doesn't have to be executed anymore just to copy these new files.
Diffstat (limited to 'modules/mono')
-rw-r--r--modules/mono/SCsub26
-rw-r--r--modules/mono/build_scripts/api_solution_build.py5
-rw-r--r--modules/mono/build_scripts/gen_cs_glue_version.py20
-rw-r--r--modules/mono/build_scripts/godot_tools_build.py90
-rw-r--r--modules/mono/build_scripts/make_cs_compressed_header.py62
-rw-r--r--modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ApiSolutionGenerator.cs52
-rw-r--r--modules/mono/editor/GodotTools/GodotTools.ProjectEditor/GodotTools.ProjectEditor.csproj9
-rw-r--r--modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectGenerator.cs73
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj22
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Internals/BindingsGenerator.cs87
-rw-r--r--modules/mono/editor/bindings_generator.cpp126
-rw-r--r--modules/mono/editor/bindings_generator.h4
-rw-r--r--modules/mono/editor/csharp_project.cpp48
-rw-r--r--modules/mono/editor/csharp_project.h3
-rw-r--r--modules/mono/glue/GodotSharp/.gitignore3
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp.sln24
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs (renamed from modules/mono/glue/Managed/Files/AABB.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs (renamed from modules/mono/glue/Managed/Files/Array.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ExportAttribute.cs (renamed from modules/mono/glue/Managed/Files/Attributes/ExportAttribute.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/GodotMethodAttribute.cs (renamed from modules/mono/glue/Managed/Files/Attributes/GodotMethodAttribute.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/RPCAttributes.cs (renamed from modules/mono/glue/Managed/Files/Attributes/RPCAttributes.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/SignalAttribute.cs (renamed from modules/mono/glue/Managed/Files/Attributes/SignalAttribute.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ToolAttribute.cs (renamed from modules/mono/glue/Managed/Files/Attributes/ToolAttribute.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs (renamed from modules/mono/glue/Managed/Files/Basis.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs (renamed from modules/mono/glue/Managed/Files/Color.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Colors.cs (renamed from modules/mono/glue/Managed/Files/Colors.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/DebuggingUtils.cs (renamed from modules/mono/glue/Managed/Files/DebuggingUtils.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Dictionary.cs (renamed from modules/mono/glue/Managed/Files/Dictionary.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Dispatcher.cs (renamed from modules/mono/glue/Managed/Files/Dispatcher.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/DynamicObject.cs (renamed from modules/mono/glue/Managed/Files/DynamicObject.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/NodeExtensions.cs (renamed from modules/mono/glue/Managed/Files/Extensions/NodeExtensions.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/ObjectExtensions.cs (renamed from modules/mono/glue/Managed/Files/Extensions/ObjectExtensions.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/ResourceLoaderExtensions.cs (renamed from modules/mono/glue/Managed/Files/Extensions/ResourceLoaderExtensions.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs (renamed from modules/mono/glue/Managed/Files/GD.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/GodotSynchronizationContext.cs (renamed from modules/mono/glue/Managed/Files/GodotSynchronizationContext.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/GodotTaskScheduler.cs (renamed from modules/mono/glue/Managed/Files/GodotTaskScheduler.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/GodotTraceListener.cs (renamed from modules/mono/glue/Managed/Files/GodotTraceListener.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Interfaces/IAwaitable.cs (renamed from modules/mono/glue/Managed/Files/Interfaces/IAwaitable.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Interfaces/IAwaiter.cs (renamed from modules/mono/glue/Managed/Files/Interfaces/IAwaiter.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Interfaces/ISerializationListener.cs (renamed from modules/mono/glue/Managed/Files/Interfaces/ISerializationListener.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/MarshalUtils.cs (renamed from modules/mono/glue/Managed/Files/MarshalUtils.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs (renamed from modules/mono/glue/Managed/Files/Mathf.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/MathfEx.cs (renamed from modules/mono/glue/Managed/Files/MathfEx.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/NodePath.cs (renamed from modules/mono/glue/Managed/Files/NodePath.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Object.base.cs (renamed from modules/mono/glue/Managed/Files/Object.base.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs (renamed from modules/mono/glue/Managed/Files/Plane.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Quat.cs (renamed from modules/mono/glue/Managed/Files/Quat.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/RID.cs (renamed from modules/mono/glue/Managed/Files/RID.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs (renamed from modules/mono/glue/Managed/Files/Rect2.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/SignalAwaiter.cs (renamed from modules/mono/glue/Managed/Files/SignalAwaiter.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs (renamed from modules/mono/glue/Managed/Files/StringExtensions.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Transform.cs (renamed from modules/mono/glue/Managed/Files/Transform.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs (renamed from modules/mono/glue/Managed/Files/Transform2D.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs (renamed from modules/mono/glue/Managed/Files/Vector2.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs (renamed from modules/mono/glue/Managed/Files/Vector3.cs)0
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj85
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Properties/AssemblyInfo.cs27
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharpEditor/GodotSharpEditor.csproj45
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharpEditor/Properties/AssemblyInfo.cs (renamed from modules/mono/glue/Managed/Properties/AssemblyInfo.cs)5
-rw-r--r--modules/mono/glue/Managed/.gitignore2
-rw-r--r--modules/mono/glue/Managed/IgnoredFiles/Enums.cs21
-rw-r--r--modules/mono/glue/Managed/IgnoredFiles/FuncRef.cs17
-rw-r--r--modules/mono/glue/Managed/IgnoredFiles/Node.cs29
-rw-r--r--modules/mono/glue/Managed/IgnoredFiles/Resource.cs7
-rw-r--r--modules/mono/glue/Managed/IgnoredFiles/ResourceLoader.cs12
-rw-r--r--modules/mono/glue/Managed/IgnoredFiles/Variant.cs11
-rw-r--r--modules/mono/glue/Managed/IgnoredFiles/WeakRef.cs7
-rw-r--r--modules/mono/glue/Managed/Managed.csproj41
-rw-r--r--modules/mono/glue/Managed/Managed.sln17
-rw-r--r--modules/mono/glue/Managed/README.md5
-rw-r--r--modules/mono/utils/path_utils.cpp37
-rw-r--r--modules/mono/utils/path_utils.h2
72 files changed, 350 insertions, 674 deletions
diff --git a/modules/mono/SCsub b/modules/mono/SCsub
index 457edfaeed..41be367f2f 100644
--- a/modules/mono/SCsub
+++ b/modules/mono/SCsub
@@ -8,14 +8,10 @@ Import('env_modules')
env_mono = env_modules.Clone()
-if env['tools']:
+if env_mono['tools']:
# NOTE: It is safe to generate this file here, since this is still executed serially
- import build_scripts.make_cs_compressed_header as make_cs_compressed_header
- make_cs_compressed_header.generate_header(
- 'glue/Managed/Files',
- 'glue/cs_compressed.gen.h',
- 'glue/cs_glue_version.gen.h'
- )
+ import build_scripts.gen_cs_glue_version as gen_cs_glue_version
+ gen_cs_glue_version.generate_header('glue/GodotSharp', 'glue/cs_glue_version.gen.h')
# Glue sources
if env_mono['mono_glue']:
@@ -38,24 +34,14 @@ env_mono = conf.Finish()
mono_configure.configure(env, env_mono)
-# Build Godot API solution
-
if env_mono['tools'] and env_mono['mono_glue']:
+ # Build Godot API solution
import build_scripts.api_solution_build as api_solution_build
api_sln_cmd = api_solution_build.build(env_mono)
-# Build GodotTools
-
-if env_mono['tools']:
+ # Build GodotTools
import build_scripts.godot_tools_build as godot_tools_build
- if env_mono['mono_glue']:
- godot_tools_build.build(env_mono, api_sln_cmd)
- else:
- # Building without the glue sources so the Godot API solution may be missing.
- # GodotTools depends on the Godot API solution. As such, we will only build
- # GodotTools.ProjectEditor which doesn't depend on the Godot API solution and
- # is required by the bindings generator in order to be able to generated it.
- godot_tools_build.build_project_editor_only(env_mono)
+ godot_tools_build.build(env_mono, api_sln_cmd)
# Add sources
diff --git a/modules/mono/build_scripts/api_solution_build.py b/modules/mono/build_scripts/api_solution_build.py
index be54d0a679..639197c285 100644
--- a/modules/mono/build_scripts/api_solution_build.py
+++ b/modules/mono/build_scripts/api_solution_build.py
@@ -10,10 +10,7 @@ def build_api_solution(source, target, env):
module_dir = env['module_dir']
- solution_path = os.path.join(module_dir, 'glue/Managed/Generated/GodotSharp.sln')
-
- if not os.path.isfile(solution_path):
- raise RuntimeError("Godot API solution not found. Did you forget to run '--generate-mono-glue'?")
+ solution_path = os.path.join(module_dir, 'glue/GodotSharp/GodotSharp.sln')
build_config = env['solution_build_config']
diff --git a/modules/mono/build_scripts/gen_cs_glue_version.py b/modules/mono/build_scripts/gen_cs_glue_version.py
new file mode 100644
index 0000000000..5d1056c2fc
--- /dev/null
+++ b/modules/mono/build_scripts/gen_cs_glue_version.py
@@ -0,0 +1,20 @@
+
+def generate_header(solution_dir, version_header_dst):
+ import os
+ latest_mtime = 0
+ for root, dirs, files in os.walk(solution_dir, topdown=True):
+ dirs[:] = [d for d in dirs if d not in ['Generated']] # Ignored generated files
+ files = [f for f in files if f.endswith('.cs')]
+ for file in files:
+ filepath = os.path.join(root, file)
+ mtime = os.path.getmtime(filepath)
+ latest_mtime = mtime if mtime > latest_mtime else latest_mtime
+
+ glue_version = int(latest_mtime) # The latest modified time will do for now
+
+ with open(version_header_dst, 'w') as version_header:
+ version_header.write('/* THIS FILE IS GENERATED DO NOT EDIT */\n')
+ version_header.write('#ifndef CS_GLUE_VERSION_H\n')
+ version_header.write('#define CS_GLUE_VERSION_H\n\n')
+ version_header.write('#define CS_GLUE_VERSION UINT32_C(' + str(glue_version) + ')\n')
+ version_header.write('\n#endif // CS_GLUE_VERSION_H\n')
diff --git a/modules/mono/build_scripts/godot_tools_build.py b/modules/mono/build_scripts/godot_tools_build.py
index 6e5273f5e0..6846a86240 100644
--- a/modules/mono/build_scripts/godot_tools_build.py
+++ b/modules/mono/build_scripts/godot_tools_build.py
@@ -13,65 +13,13 @@ def build_godot_tools(source, target, env):
solution_path = os.path.join(module_dir, 'editor/GodotTools/GodotTools.sln')
build_config = 'Debug' if env['target'] == 'debug' else 'Release'
- from . solution_builder import build_solution, nuget_restore
- nuget_restore(env, solution_path)
- build_solution(env, solution_path, build_config)
-
- # Copy targets
-
- solution_dir = os.path.abspath(os.path.join(solution_path, os.pardir))
-
- src_dir = os.path.join(solution_dir, 'GodotTools', 'bin', build_config)
- dst_dir = os.path.abspath(os.path.join(str(target[0]), os.pardir))
-
- if not os.path.isdir(dst_dir):
- assert not os.path.isfile(dst_dir)
- os.makedirs(dst_dir)
-
- def copy_target(target_path):
- from shutil import copy
- filename = os.path.basename(target_path)
- copy(os.path.join(src_dir, filename), target_path)
-
- for scons_target in target:
- copy_target(str(scons_target))
-
-
-def build_godot_tools_project_editor(source, target, env):
- # source and target elements are of type SCons.Node.FS.File, hence why we convert them to str
-
- module_dir = env['module_dir']
-
- project_name = 'GodotTools.ProjectEditor'
-
- csproj_dir = os.path.join(module_dir, 'editor/GodotTools', project_name)
- csproj_path = os.path.join(csproj_dir, project_name + '.csproj')
- build_config = 'Debug' if env['target'] == 'debug' else 'Release'
+ # Custom build target to make sure output is always copied to the data dir.
+ extra_build_args = ['/Target=BuildAlwaysCopyToDataDir']
from . solution_builder import build_solution, nuget_restore
-
- # Make sure to restore NuGet packages in the project directory for the project to find it
- nuget_restore(env, os.path.join(csproj_dir, 'packages.config'), '-PackagesDirectory',
- os.path.join(csproj_dir, 'packages'))
-
- build_solution(env, csproj_path, build_config)
-
- # Copy targets
-
- src_dir = os.path.join(csproj_dir, 'bin', build_config)
- dst_dir = os.path.abspath(os.path.join(str(target[0]), os.pardir))
-
- if not os.path.isdir(dst_dir):
- assert not os.path.isfile(dst_dir)
- os.makedirs(dst_dir)
-
- def copy_target(target_path):
- from shutil import copy
- filename = os.path.basename(target_path)
- copy(os.path.join(src_dir, filename), target_path)
-
- for scons_target in target:
- copy_target(str(scons_target))
+ nuget_restore(env, solution_path)
+ build_solution(env, solution_path, build_config, extra_build_args)
+ # No need to copy targets. The GodotTools csproj takes care of copying them.
def build(env_mono, api_sln_cmd):
@@ -80,36 +28,12 @@ def build(env_mono, api_sln_cmd):
output_dir = Dir('#bin').abspath
editor_tools_dir = os.path.join(output_dir, 'GodotSharp', 'Tools')
- target_filenames = [
- 'GodotTools.dll', 'GodotTools.IdeConnection.dll', 'GodotTools.BuildLogger.dll',
- 'GodotTools.ProjectEditor.dll', 'DotNet.Glob.dll', 'GodotTools.Core.dll',
- 'JetBrains.Annotations.dll', 'Newtonsoft.Json.dll'
- ]
+ target_filenames = ['GodotTools.dll']
if env_mono['target'] == 'debug':
- target_filenames += [
- 'GodotTools.pdb', 'GodotTools.IdeConnection.pdb', 'GodotTools.BuildLogger.pdb',
- 'GodotTools.ProjectEditor.pdb', 'GodotTools.Core.pdb'
- ]
+ target_filenames += ['GodotTools.pdb']
targets = [os.path.join(editor_tools_dir, filename) for filename in target_filenames]
cmd = env_mono.CommandNoCache(targets, api_sln_cmd, build_godot_tools, module_dir=os.getcwd())
env_mono.AlwaysBuild(cmd)
-
-
-def build_project_editor_only(env_mono):
- assert env_mono['tools']
-
- output_dir = Dir('#bin').abspath
- editor_tools_dir = os.path.join(output_dir, 'GodotSharp', 'Tools')
-
- target_filenames = ['GodotTools.ProjectEditor.dll', 'DotNet.Glob.dll', 'GodotTools.Core.dll']
-
- if env_mono['target'] == 'debug':
- target_filenames += ['GodotTools.ProjectEditor.pdb', 'GodotTools.Core.pdb']
-
- targets = [os.path.join(editor_tools_dir, filename) for filename in target_filenames]
-
- cmd = env_mono.CommandNoCache(targets, [], build_godot_tools_project_editor, module_dir=os.getcwd())
- env_mono.AlwaysBuild(cmd)
diff --git a/modules/mono/build_scripts/make_cs_compressed_header.py b/modules/mono/build_scripts/make_cs_compressed_header.py
deleted file mode 100644
index ed49db5bb2..0000000000
--- a/modules/mono/build_scripts/make_cs_compressed_header.py
+++ /dev/null
@@ -1,62 +0,0 @@
-
-def generate_header(src, dst, version_dst):
- from compat import byte_to_str
-
- with open(dst, 'w') as header:
- header.write('/* THIS FILE IS GENERATED DO NOT EDIT */\n')
- header.write('#ifndef CS_COMPRESSED_H\n')
- header.write('#define CS_COMPRESSED_H\n\n')
- header.write('#ifdef TOOLS_ENABLED\n\n')
- header.write('#include "core/map.h"\n')
- header.write('#include "core/ustring.h"\n')
- inserted_files = ''
- import os
- latest_mtime = 0
- cs_file_count = 0
- for root, _, files in os.walk(src):
- files = [f for f in files if f.endswith('.cs')]
- for file in files:
- cs_file_count += 1
- filepath = os.path.join(root, file)
- filepath_src_rel = os.path.relpath(filepath, src)
- mtime = os.path.getmtime(filepath)
- latest_mtime = mtime if mtime > latest_mtime else latest_mtime
- with open(filepath, 'rb') as f:
- buf = f.read()
- decompr_size = len(buf)
- import zlib
- buf = zlib.compress(buf)
- compr_size = len(buf)
- name = str(cs_file_count)
- header.write('\n')
- header.write('// ' + filepath_src_rel + '\n')
- header.write('static const int _cs_' + name + '_compressed_size = ' + str(compr_size) + ';\n')
- header.write('static const int _cs_' + name + '_uncompressed_size = ' + str(decompr_size) + ';\n')
- header.write('static const unsigned char _cs_' + name + '_compressed[] = { ')
- for i, buf_idx in enumerate(range(compr_size)):
- if i > 0:
- header.write(', ')
- header.write(byte_to_str(buf[buf_idx]))
- header.write(' };\n')
- inserted_files += '\tr_files.insert("' + filepath_src_rel.replace('\\', '\\\\') + '", ' \
- 'GodotCsCompressedFile(_cs_' + name + '_compressed_size, ' \
- '_cs_' + name + '_uncompressed_size, ' \
- '_cs_' + name + '_compressed));\n'
- header.write('\nstruct GodotCsCompressedFile\n' '{\n'
- '\tint compressed_size;\n' '\tint uncompressed_size;\n' '\tconst unsigned char* data;\n'
- '\n\tGodotCsCompressedFile(int p_comp_size, int p_uncomp_size, const unsigned char* p_data)\n'
- '\t{\n' '\t\tcompressed_size = p_comp_size;\n' '\t\tuncompressed_size = p_uncomp_size;\n'
- '\t\tdata = p_data;\n' '\t}\n' '\n\tGodotCsCompressedFile() {}\n' '};\n'
- '\nvoid get_compressed_files(Map<String, GodotCsCompressedFile>& r_files)\n' '{\n' + inserted_files + '}\n'
- )
- header.write('\n#endif // TOOLS_ENABLED\n')
- header.write('\n#endif // CS_COMPRESSED_H\n')
-
- glue_version = int(latest_mtime) # The latest modified time will do for now
-
- with open(version_dst, 'w') as version_header:
- version_header.write('/* THIS FILE IS GENERATED DO NOT EDIT */\n')
- version_header.write('#ifndef CS_GLUE_VERSION_H\n')
- version_header.write('#define CS_GLUE_VERSION_H\n\n')
- version_header.write('#define CS_GLUE_VERSION UINT32_C(' + str(glue_version) + ')\n')
- version_header.write('\n#endif // CS_GLUE_VERSION_H\n')
diff --git a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ApiSolutionGenerator.cs b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ApiSolutionGenerator.cs
deleted file mode 100644
index bfae2afc13..0000000000
--- a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ApiSolutionGenerator.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-using System.Collections.Generic;
-using System.IO;
-
-namespace GodotTools.ProjectEditor
-{
- public static class ApiSolutionGenerator
- {
- public static void GenerateApiSolution(string solutionDir,
- string coreProjDir, IEnumerable<string> coreCompileItems,
- string editorProjDir, IEnumerable<string> editorCompileItems)
- {
- var solution = new DotNetSolution(ApiAssemblyNames.SolutionName);
-
- solution.DirectoryPath = solutionDir;
-
- // GodotSharp project
-
- const string coreApiAssemblyName = ApiAssemblyNames.Core;
-
- string coreGuid = ProjectGenerator.GenCoreApiProject(coreProjDir, coreCompileItems);
-
- var coreProjInfo = new DotNetSolution.ProjectInfo
- {
- Guid = coreGuid,
- PathRelativeToSolution = Path.Combine(coreApiAssemblyName, $"{coreApiAssemblyName}.csproj")
- };
- coreProjInfo.Configs.Add("Debug");
- coreProjInfo.Configs.Add("Release");
-
- solution.AddNewProject(coreApiAssemblyName, coreProjInfo);
-
- // GodotSharpEditor project
-
- const string editorApiAssemblyName = ApiAssemblyNames.Editor;
-
- string editorGuid = ProjectGenerator.GenEditorApiProject(editorProjDir,
- $"../{coreApiAssemblyName}/{coreApiAssemblyName}.csproj", editorCompileItems);
-
- var editorProjInfo = new DotNetSolution.ProjectInfo();
- editorProjInfo.Guid = editorGuid;
- editorProjInfo.PathRelativeToSolution = Path.Combine(editorApiAssemblyName, $"{editorApiAssemblyName}.csproj");
- editorProjInfo.Configs.Add("Debug");
- editorProjInfo.Configs.Add("Release");
-
- solution.AddNewProject(editorApiAssemblyName, editorProjInfo);
-
- // Save solution
-
- solution.Save();
- }
- }
-}
diff --git a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/GodotTools.ProjectEditor.csproj b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/GodotTools.ProjectEditor.csproj
index ab3a5d1aea..ae727e8789 100644
--- a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/GodotTools.ProjectEditor.csproj
+++ b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/GodotTools.ProjectEditor.csproj
@@ -32,18 +32,11 @@
<Reference Include="System" />
<Reference Include="Microsoft.Build" />
<Reference Include="DotNet.Glob, Version=2.1.1.0, Culture=neutral, PublicKeyToken=b68cc888b4f632d1, processorArchitecture=MSIL">
- <!--
- When building Godot with 'mono_glue=no' SCons will build this project alone instead of the
- entire solution. $(SolutionDir) is not defined in that case, so we need to workaround that.
- We make SCons restore the NuGet packages in the project directory instead in this case.
- -->
- <HintPath Condition=" '$(SolutionDir)' != '' And Exists('$(SolutionDir)\packages\DotNet.Glob.2.1.1\lib\net45\DotNet.Glob.dll') ">$(SolutionDir)\packages\DotNet.Glob.2.1.1\lib\net45\DotNet.Glob.dll</HintPath>
- <HintPath Condition=" '$(SolutionDir)' == '' Or !Exists('$(SolutionDir)\packages\DotNet.Glob.2.1.1\lib\net45\DotNet.Glob.dll') ">$(ProjectDir)\packages\DotNet.Glob.2.1.1\lib\net45\DotNet.Glob.dll</HintPath>
+ <HintPath>packages\DotNet.Glob.2.1.1\lib\net45\DotNet.Glob.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="ApiAssembliesInfo.cs" />
- <Compile Include="ApiSolutionGenerator.cs" />
<Compile Include="DotNetSolution.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="IdentifierUtils.cs" />
diff --git a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectGenerator.cs b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectGenerator.cs
index b40d985d51..22a0074580 100644
--- a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectGenerator.cs
+++ b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectGenerator.cs
@@ -10,68 +10,13 @@ namespace GodotTools.ProjectEditor
{
private const string CoreApiProjectName = "GodotSharp";
private const string EditorApiProjectName = "GodotSharpEditor";
- private const string CoreApiProjectGuid = "{AEBF0036-DA76-4341-B651-A3F2856AB2FA}";
- private const string EditorApiProjectGuid = "{8FBEC238-D944-4074-8548-B3B524305905}";
-
- public static string GenCoreApiProject(string dir, IEnumerable<string> compileItems)
- {
- string path = Path.Combine(dir, CoreApiProjectName + ".csproj");
-
- ProjectPropertyGroupElement mainGroup;
- var root = CreateLibraryProject(CoreApiProjectName, out mainGroup);
-
- mainGroup.AddProperty("DocumentationFile", Path.Combine("$(OutputPath)", "$(AssemblyName).xml"));
- mainGroup.SetProperty("RootNamespace", "Godot");
- mainGroup.SetProperty("ProjectGuid", CoreApiProjectGuid);
- mainGroup.SetProperty("BaseIntermediateOutputPath", "obj");
-
- GenAssemblyInfoFile(root, dir, CoreApiProjectName,
- new[] { "[assembly: InternalsVisibleTo(\"" + EditorApiProjectName + "\")]" },
- new[] { "System.Runtime.CompilerServices" });
-
- foreach (var item in compileItems)
- {
- root.AddItem("Compile", item.RelativeToPath(dir).Replace("/", "\\"));
- }
-
- root.Save(path);
-
- return CoreApiProjectGuid;
- }
-
- public static string GenEditorApiProject(string dir, string coreApiProjPath, IEnumerable<string> compileItems)
- {
- string path = Path.Combine(dir, EditorApiProjectName + ".csproj");
-
- ProjectPropertyGroupElement mainGroup;
- var root = CreateLibraryProject(EditorApiProjectName, out mainGroup);
-
- mainGroup.AddProperty("DocumentationFile", Path.Combine("$(OutputPath)", "$(AssemblyName).xml"));
- mainGroup.SetProperty("RootNamespace", "Godot");
- mainGroup.SetProperty("ProjectGuid", EditorApiProjectGuid);
- mainGroup.SetProperty("BaseIntermediateOutputPath", "obj");
-
- GenAssemblyInfoFile(root, dir, EditorApiProjectName);
-
- foreach (var item in compileItems)
- {
- root.AddItem("Compile", item.RelativeToPath(dir).Replace("/", "\\"));
- }
-
- var coreApiRef = root.AddItem("ProjectReference", coreApiProjPath.Replace("/", "\\"));
- coreApiRef.AddMetadata("Private", "False");
-
- root.Save(path);
-
- return EditorApiProjectGuid;
- }
public static string GenGameProject(string dir, string name, IEnumerable<string> compileItems)
{
string path = Path.Combine(dir, name + ".csproj");
ProjectPropertyGroupElement mainGroup;
- var root = CreateLibraryProject(name, out mainGroup);
+ var root = CreateLibraryProject(name, "Tools", out mainGroup);
mainGroup.SetProperty("OutputPath", Path.Combine(".mono", "temp", "bin", "$(Configuration)"));
mainGroup.SetProperty("BaseIntermediateOutputPath", Path.Combine(".mono", "temp", "obj"));
@@ -110,7 +55,7 @@ namespace GodotTools.ProjectEditor
return root.GetGuid().ToString().ToUpper();
}
- public static void GenAssemblyInfoFile(ProjectRootElement root, string dir, string name, string[] assemblyLines = null, string[] usingDirectives = null)
+ private static void GenAssemblyInfoFile(ProjectRootElement root, string dir, string name, string[] assemblyLines = null, string[] usingDirectives = null)
{
string propertiesDir = Path.Combine(dir, "Properties");
if (!Directory.Exists(propertiesDir))
@@ -138,7 +83,7 @@ namespace GodotTools.ProjectEditor
root.AddItem("Compile", assemblyInfoFile.RelativeToPath(dir).Replace("/", "\\"));
}
- public static ProjectRootElement CreateLibraryProject(string name, out ProjectPropertyGroupElement mainGroup)
+ public static ProjectRootElement CreateLibraryProject(string name, string defaultConfig, out ProjectPropertyGroupElement mainGroup)
{
if (string.IsNullOrEmpty(name))
throw new ArgumentException($"{nameof(name)} cannot be empty", nameof(name));
@@ -147,7 +92,7 @@ namespace GodotTools.ProjectEditor
root.DefaultTargets = "Build";
mainGroup = root.AddPropertyGroup();
- mainGroup.AddProperty("Configuration", "Debug").Condition = " '$(Configuration)' == '' ";
+ mainGroup.AddProperty("Configuration", defaultConfig).Condition = " '$(Configuration)' == '' ";
mainGroup.AddProperty("Platform", "AnyCPU").Condition = " '$(Platform)' == '' ";
mainGroup.AddProperty("ProjectGuid", "{" + Guid.NewGuid().ToString().ToUpper() + "}");
mainGroup.AddProperty("OutputType", "Library");
@@ -184,16 +129,6 @@ namespace GodotTools.ProjectEditor
return root;
}
- private static void AddItems(ProjectRootElement elem, string groupName, params string[] items)
- {
- var group = elem.AddItemGroup();
-
- foreach (var item in items)
- {
- group.AddItem(groupName, item);
- }
- }
-
private const string AssemblyInfoTemplate =
@"using System.Reflection;{0}
diff --git a/modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj b/modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj
index 15b9e50a8d..618527f916 100644
--- a/modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj
+++ b/modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj
@@ -9,6 +9,7 @@
<AssemblyName>GodotTools</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<GodotSourceRootPath>$(SolutionDir)/../../../../</GodotSourceRootPath>
+ <DataDirToolsOutputPath>$(GodotSourceRootPath)/bin/GodotSharp/Tools</DataDirToolsOutputPath>
<GodotApiConfiguration>Debug</GodotApiConfiguration>
<LangVersion>7</LangVersion>
</PropertyGroup>
@@ -41,9 +42,11 @@
<Reference Include="System" />
<Reference Include="GodotSharp">
<HintPath>$(GodotSourceRootPath)/bin/GodotSharp/Api/$(GodotApiConfiguration)/GodotSharp.dll</HintPath>
+ <Private>False</Private>
</Reference>
<Reference Include="GodotSharpEditor">
<HintPath>$(GodotSourceRootPath)/bin/GodotSharp/Api/$(GodotApiConfiguration)/GodotSharpEditor.dll</HintPath>
+ <Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
@@ -56,7 +59,6 @@
<Compile Include="Ides\MonoDevelop\Instance.cs" />
<Compile Include="Ides\Rider\RiderPathLocator.cs" />
<Compile Include="Ides\Rider\RiderPathManager.cs" />
- <Compile Include="Internals\BindingsGenerator.cs" />
<Compile Include="Internals\EditorProgress.cs" />
<Compile Include="Internals\GodotSharpDirs.cs" />
<Compile Include="Internals\Internal.cs" />
@@ -99,5 +101,21 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
+ <Target Name="CopyToDataDir" AfterTargets="Build">
+ <ItemGroup>
+ <GodotToolsCopy Include="$(OutputPath)\GodotTools*.dll" />
+ <GodotToolsCopy Include="$(OutputPath)\Newtonsoft.Json.dll" />
+ <GodotToolsCopy Include="$(OutputPath)\DotNet.Glob.dll" />
+ </ItemGroup>
+ <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
+ <GodotToolsCopy Include="$(OutputPath)\GodotTools*.pdb" />
+ </ItemGroup>
+ <Copy SourceFiles="@(GodotToolsCopy)" DestinationFolder="$(DataDirToolsOutputPath)" ContinueOnError="false" />
+ </Target>
+ <Target Name="BuildAlwaysCopyToDataDir">
+ <!-- Custom target run by SCons to make sure the CopyToDataDir target is always executed, without having to use DisableFastUpToDateCheck -->
+ <CallTarget Targets="Build" />
+ <CallTarget Targets="CopyToDataDir" />
+ </Target>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
-</Project> \ No newline at end of file
+</Project>
diff --git a/modules/mono/editor/GodotTools/GodotTools/Internals/BindingsGenerator.cs b/modules/mono/editor/GodotTools/GodotTools/Internals/BindingsGenerator.cs
deleted file mode 100644
index 1daa5e138e..0000000000
--- a/modules/mono/editor/GodotTools/GodotTools/Internals/BindingsGenerator.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-namespace GodotTools.Internals
-{
- public class BindingsGenerator : IDisposable
- {
- class BindingsGeneratorSafeHandle : SafeHandle
- {
- public BindingsGeneratorSafeHandle(IntPtr handle) : base(IntPtr.Zero, true)
- {
- this.handle = handle;
- }
-
- public override bool IsInvalid => handle == IntPtr.Zero;
-
- protected override bool ReleaseHandle()
- {
- internal_Dtor(handle);
- return true;
- }
- }
-
- private BindingsGeneratorSafeHandle safeHandle;
- private bool disposed = false;
-
- public bool LogPrintEnabled
- {
- get => internal_LogPrintEnabled(GetPtr());
- set => internal_SetLogPrintEnabled(GetPtr(), value);
- }
-
- public static uint Version => internal_Version();
- public static uint CsGlueVersion => internal_CsGlueVersion();
-
- public Godot.Error GenerateCsApi(string outputDir) => internal_GenerateCsApi(GetPtr(), outputDir);
-
- internal IntPtr GetPtr()
- {
- if (disposed)
- throw new ObjectDisposedException(GetType().FullName);
-
- return safeHandle.DangerousGetHandle();
- }
-
- public void Dispose()
- {
- if (disposed)
- return;
-
- if (safeHandle != null && !safeHandle.IsInvalid)
- {
- safeHandle.Dispose();
- safeHandle = null;
- }
-
- disposed = true;
- }
-
- public BindingsGenerator()
- {
- safeHandle = new BindingsGeneratorSafeHandle(internal_Ctor());
- }
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern IntPtr internal_Ctor();
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void internal_Dtor(IntPtr handle);
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern bool internal_LogPrintEnabled(IntPtr handle);
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void internal_SetLogPrintEnabled(IntPtr handle, bool enabled);
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern Godot.Error internal_GenerateCsApi(IntPtr handle, string outputDir);
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern uint internal_Version();
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern uint internal_CsGlueVersion();
- }
-}
diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp
index 2252f7676d..5b135e97e9 100644
--- a/modules/mono/editor/bindings_generator.cpp
+++ b/modules/mono/editor/bindings_generator.cpp
@@ -40,7 +40,6 @@
#include "core/os/os.h"
#include "core/ucaps.h"
-#include "../glue/cs_compressed.gen.h"
#include "../glue/cs_glue_version.gen.h"
#include "../godotsharp_defs.h"
#include "../mono_gd/gd_mono_marshal.h"
@@ -874,7 +873,7 @@ void BindingsGenerator::_generate_global_constants(StringBuilder &p_output) {
p_output.append("\n#pragma warning restore CS1591\n");
}
-Error BindingsGenerator::generate_cs_core_project(const String &p_proj_dir, Vector<String> &r_compile_items) {
+Error BindingsGenerator::generate_cs_core_project(const String &p_proj_dir) {
ERR_FAIL_COND_V(!initialized, ERR_UNCONFIGURED);
@@ -887,22 +886,24 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_proj_dir, Vect
}
da->change_dir(p_proj_dir);
- da->make_dir("Core");
- da->make_dir("ObjectType");
+ da->make_dir("Generated");
+ da->make_dir("Generated/GodotObjects");
- String core_dir = path::join(p_proj_dir, "Core");
- String obj_type_dir = path::join(p_proj_dir, "ObjectType");
+ String base_gen_dir = path::join(p_proj_dir, "Generated");
+ String godot_objects_gen_dir = path::join(base_gen_dir, "GodotObjects");
+
+ Vector<String> compile_items;
// Generate source file for global scope constants and enums
{
StringBuilder constants_source;
_generate_global_constants(constants_source);
- String output_file = path::join(core_dir, BINDINGS_GLOBAL_SCOPE_CLASS "_constants.cs");
+ String output_file = path::join(base_gen_dir, BINDINGS_GLOBAL_SCOPE_CLASS "_constants.cs");
Error save_err = _save_file(output_file, constants_source);
if (save_err != OK)
return save_err;
- r_compile_items.push_back(output_file);
+ compile_items.push_back(output_file);
}
for (OrderedHashMap<StringName, TypeInterface>::Element E = obj_types.front(); E; E = E.next()) {
@@ -911,7 +912,7 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_proj_dir, Vect
if (itype.api_type == ClassDB::API_EDITOR)
continue;
- String output_file = path::join(obj_type_dir, itype.proxy_name + ".cs");
+ String output_file = path::join(godot_objects_gen_dir, itype.proxy_name + ".cs");
Error err = _generate_cs_type(itype, output_file);
if (err == ERR_SKIP)
@@ -920,39 +921,11 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_proj_dir, Vect
if (err != OK)
return err;
- r_compile_items.push_back(output_file);
+ compile_items.push_back(output_file);
}
// Generate sources from compressed files
- Map<String, GodotCsCompressedFile> compressed_files;
- get_compressed_files(compressed_files);
-
- for (Map<String, GodotCsCompressedFile>::Element *E = compressed_files.front(); E; E = E->next()) {
- const String &file_name = E->key();
- const GodotCsCompressedFile &file_data = E->value();
-
- String output_file = path::join(core_dir, file_name);
-
- Vector<uint8_t> data;
- data.resize(file_data.uncompressed_size);
- Compression::decompress(data.ptrw(), file_data.uncompressed_size, file_data.data, file_data.compressed_size, Compression::MODE_DEFLATE);
-
- String output_dir = output_file.get_base_dir();
-
- if (!DirAccess::exists(output_dir)) {
- Error err = da->make_dir_recursive(ProjectSettings::get_singleton()->globalize_path(output_dir));
- ERR_FAIL_COND_V(err != OK, ERR_CANT_CREATE);
- }
-
- FileAccessRef file = FileAccess::open(output_file, FileAccess::WRITE);
- ERR_FAIL_COND_V(!file, ERR_FILE_CANT_WRITE);
- file->store_buffer(data.ptr(), data.size());
- file->close();
-
- r_compile_items.push_back(output_file);
- }
-
StringBuilder cs_icalls_content;
cs_icalls_content.append("using System;\n"
@@ -986,18 +959,36 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_proj_dir, Vect
cs_icalls_content.append(INDENT1 CLOSE_BLOCK CLOSE_BLOCK);
- String internal_methods_file = path::join(core_dir, BINDINGS_CLASS_NATIVECALLS ".cs");
+ String internal_methods_file = path::join(base_gen_dir, BINDINGS_CLASS_NATIVECALLS ".cs");
Error err = _save_file(internal_methods_file, cs_icalls_content);
if (err != OK)
return err;
- r_compile_items.push_back(internal_methods_file);
+ compile_items.push_back(internal_methods_file);
+
+ StringBuilder includes_props_content;
+ includes_props_content.append("<Project>\n"
+ " <ItemGroup>\n");
+
+ for (int i = 0; i < compile_items.size(); i++) {
+ String include = path::relative_to(compile_items[i], p_proj_dir).replace("/", "\\");
+ includes_props_content.append(" <Compile Include=\"" + include + "\" />\n");
+ }
+
+ includes_props_content.append(" </ItemGroup>\n"
+ "</Project>\n");
+
+ String includes_props_file = path::join(base_gen_dir, "GeneratedIncludes.props");
+
+ err = _save_file(includes_props_file, includes_props_content);
+ if (err != OK)
+ return err;
return OK;
}
-Error BindingsGenerator::generate_cs_editor_project(const String &p_proj_dir, Vector<String> &r_compile_items) {
+Error BindingsGenerator::generate_cs_editor_project(const String &p_proj_dir) {
ERR_FAIL_COND_V(!initialized, ERR_UNCONFIGURED);
@@ -1010,11 +1001,13 @@ Error BindingsGenerator::generate_cs_editor_project(const String &p_proj_dir, Ve
}
da->change_dir(p_proj_dir);
- da->make_dir("Core");
- da->make_dir("ObjectType");
+ da->make_dir("Generated");
+ da->make_dir("Generated/GodotObjects");
+
+ String base_gen_dir = path::join(p_proj_dir, "Generated");
+ String godot_objects_gen_dir = path::join(base_gen_dir, "GodotObjects");
- String core_dir = path::join(p_proj_dir, "Core");
- String obj_type_dir = path::join(p_proj_dir, "ObjectType");
+ Vector<String> compile_items;
for (OrderedHashMap<StringName, TypeInterface>::Element E = obj_types.front(); E; E = E.next()) {
const TypeInterface &itype = E.get();
@@ -1022,7 +1015,7 @@ Error BindingsGenerator::generate_cs_editor_project(const String &p_proj_dir, Ve
if (itype.api_type != ClassDB::API_EDITOR)
continue;
- String output_file = path::join(obj_type_dir, itype.proxy_name + ".cs");
+ String output_file = path::join(godot_objects_gen_dir, itype.proxy_name + ".cs");
Error err = _generate_cs_type(itype, output_file);
if (err == ERR_SKIP)
@@ -1031,7 +1024,7 @@ Error BindingsGenerator::generate_cs_editor_project(const String &p_proj_dir, Ve
if (err != OK)
return err;
- r_compile_items.push_back(output_file);
+ compile_items.push_back(output_file);
}
StringBuilder cs_icalls_content;
@@ -1068,13 +1061,31 @@ Error BindingsGenerator::generate_cs_editor_project(const String &p_proj_dir, Ve
cs_icalls_content.append(INDENT1 CLOSE_BLOCK CLOSE_BLOCK);
- String internal_methods_file = path::join(core_dir, BINDINGS_CLASS_NATIVECALLS_EDITOR ".cs");
+ String internal_methods_file = path::join(base_gen_dir, BINDINGS_CLASS_NATIVECALLS_EDITOR ".cs");
Error err = _save_file(internal_methods_file, cs_icalls_content);
if (err != OK)
return err;
- r_compile_items.push_back(internal_methods_file);
+ compile_items.push_back(internal_methods_file);
+
+ StringBuilder includes_props_content;
+ includes_props_content.append("<Project>\n"
+ " <ItemGroup>\n");
+
+ for (int i = 0; i < compile_items.size(); i++) {
+ String include = path::relative_to(compile_items[i], p_proj_dir).replace("/", "\\");
+ includes_props_content.append(" <Compile Include=\"" + include + "\" />\n");
+ }
+
+ includes_props_content.append(" </ItemGroup>\n"
+ "</Project>\n");
+
+ String includes_props_file = path::join(base_gen_dir, "GeneratedIncludes.props");
+
+ err = _save_file(includes_props_file, includes_props_content);
+ if (err != OK)
+ return err;
return OK;
}
@@ -1098,9 +1109,8 @@ Error BindingsGenerator::generate_cs_api(const String &p_output_dir) {
// Generate GodotSharp source files
String core_proj_dir = output_dir.plus_file(CORE_API_ASSEMBLY_NAME);
- Vector<String> core_compile_items;
- proj_err = generate_cs_core_project(core_proj_dir, core_compile_items);
+ proj_err = generate_cs_core_project(core_proj_dir);
if (proj_err != OK) {
ERR_PRINT("Generation of the Core API C# project failed.");
return proj_err;
@@ -1109,22 +1119,14 @@ Error BindingsGenerator::generate_cs_api(const String &p_output_dir) {
// Generate GodotSharpEditor source files
String editor_proj_dir = output_dir.plus_file(EDITOR_API_ASSEMBLY_NAME);
- Vector<String> editor_compile_items;
- proj_err = generate_cs_editor_project(editor_proj_dir, editor_compile_items);
+ proj_err = generate_cs_editor_project(editor_proj_dir);
if (proj_err != OK) {
ERR_PRINT("Generation of the Editor API C# project failed.");
return proj_err;
}
- // Generate solution
-
- if (!CSharpProject::generate_api_solution(output_dir,
- core_proj_dir, core_compile_items, editor_proj_dir, editor_compile_items)) {
- return ERR_CANT_CREATE;
- }
-
- _log("The solution for the Godot API was generated successfully\n");
+ _log("The Godot API sources were successfully generated\n");
return OK;
}
@@ -3170,7 +3172,7 @@ void BindingsGenerator::handle_cmdline_args(const List<String> &p_cmdline_args)
if (bindings_generator.generate_glue(glue_dir_path) != OK)
ERR_PRINTS(generate_all_glue_option + ": Failed to generate the C++ glue.");
- if (bindings_generator.generate_cs_api(glue_dir_path.plus_file("Managed/Generated")) != OK)
+ if (bindings_generator.generate_cs_api(glue_dir_path.plus_file(API_SOLUTION_NAME)) != OK)
ERR_PRINTS(generate_all_glue_option + ": Failed to generate the C# API.");
}
diff --git a/modules/mono/editor/bindings_generator.h b/modules/mono/editor/bindings_generator.h
index 07918a2d03..7323e8f635 100644
--- a/modules/mono/editor/bindings_generator.h
+++ b/modules/mono/editor/bindings_generator.h
@@ -635,8 +635,8 @@ class BindingsGenerator {
void _initialize();
public:
- Error generate_cs_core_project(const String &p_proj_dir, Vector<String> &r_compile_files);
- Error generate_cs_editor_project(const String &p_proj_dir, Vector<String> &r_compile_items);
+ Error generate_cs_core_project(const String &p_proj_dir);
+ Error generate_cs_editor_project(const String &p_proj_dir);
Error generate_cs_api(const String &p_output_dir);
Error generate_glue(const String &p_output_dir);
diff --git a/modules/mono/editor/csharp_project.cpp b/modules/mono/editor/csharp_project.cpp
index 748447005f..ef3644acfd 100644
--- a/modules/mono/editor/csharp_project.cpp
+++ b/modules/mono/editor/csharp_project.cpp
@@ -44,54 +44,6 @@
namespace CSharpProject {
-bool generate_api_solution_impl(const String &p_solution_dir, const String &p_core_proj_dir, const Vector<String> &p_core_compile_items,
- const String &p_editor_proj_dir, const Vector<String> &p_editor_compile_items,
- GDMonoAssembly *p_tools_project_editor_assembly) {
-
- GDMonoClass *klass = p_tools_project_editor_assembly->get_class("GodotTools.ProjectEditor", "ApiSolutionGenerator");
-
- Variant solution_dir = p_solution_dir;
- Variant core_proj_dir = p_core_proj_dir;
- Variant core_compile_items = p_core_compile_items;
- Variant editor_proj_dir = p_editor_proj_dir;
- Variant editor_compile_items = p_editor_compile_items;
- const Variant *args[5] = { &solution_dir, &core_proj_dir, &core_compile_items, &editor_proj_dir, &editor_compile_items };
- MonoException *exc = NULL;
- klass->get_method("GenerateApiSolution", 5)->invoke(NULL, args, &exc);
-
- if (exc) {
- GDMonoUtils::debug_print_unhandled_exception(exc);
- ERR_FAIL_V(false);
- }
-
- return true;
-}
-
-bool generate_api_solution(const String &p_solution_dir, const String &p_core_proj_dir, const Vector<String> &p_core_compile_items,
- const String &p_editor_proj_dir, const Vector<String> &p_editor_compile_items) {
-
- if (GDMono::get_singleton()->get_tools_project_editor_assembly()) {
- return generate_api_solution_impl(p_solution_dir, p_core_proj_dir, p_core_compile_items,
- p_editor_proj_dir, p_editor_compile_items,
- GDMono::get_singleton()->get_tools_project_editor_assembly());
- } else {
- MonoDomain *temp_domain = GDMonoUtils::create_domain("GodotEngine.Domain.ApiSolutionGeneration");
- CRASH_COND(temp_domain == NULL);
- _GDMONO_SCOPE_EXIT_DOMAIN_UNLOAD_(temp_domain);
-
- _GDMONO_SCOPE_DOMAIN_(temp_domain);
-
- GDMonoAssembly *tools_project_editor_asm = NULL;
-
- bool assembly_loaded = GDMono::get_singleton()->load_assembly(TOOLS_PROJECT_EDITOR_ASM_NAME, &tools_project_editor_asm);
- ERR_FAIL_COND_V_MSG(!assembly_loaded, false, "Failed to load assembly: '" TOOLS_PROJECT_EDITOR_ASM_NAME "'.");
-
- return generate_api_solution_impl(p_solution_dir, p_core_proj_dir, p_core_compile_items,
- p_editor_proj_dir, p_editor_compile_items,
- tools_project_editor_asm);
- }
-}
-
void add_item(const String &p_project_path, const String &p_item_type, const String &p_include) {
if (!GLOBAL_DEF("mono/project/auto_update_project", true))
diff --git a/modules/mono/editor/csharp_project.h b/modules/mono/editor/csharp_project.h
index b42762cea2..cc1d68c3b5 100644
--- a/modules/mono/editor/csharp_project.h
+++ b/modules/mono/editor/csharp_project.h
@@ -35,9 +35,6 @@
namespace CSharpProject {
-bool generate_api_solution(const String &p_solution_dir, const String &p_core_proj_dir, const Vector<String> &p_core_compile_items,
- const String &p_editor_proj_dir, const Vector<String> &p_editor_compile_items);
-
void add_item(const String &p_project_path, const String &p_item_type, const String &p_include);
} // namespace CSharpProject
diff --git a/modules/mono/glue/GodotSharp/.gitignore b/modules/mono/glue/GodotSharp/.gitignore
new file mode 100644
index 0000000000..aa9f614a9d
--- /dev/null
+++ b/modules/mono/glue/GodotSharp/.gitignore
@@ -0,0 +1,3 @@
+# Generated Godot API sources directories
+GodotSharp/Generated
+GodotSharpEditor/Generated
diff --git a/modules/mono/glue/GodotSharp/GodotSharp.sln b/modules/mono/glue/GodotSharp/GodotSharp.sln
new file mode 100644
index 0000000000..a496e36da3
--- /dev/null
+++ b/modules/mono/glue/GodotSharp/GodotSharp.sln
@@ -0,0 +1,24 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2012
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GodotSharp", "GodotSharp\GodotSharp.csproj", "{AEBF0036-DA76-4341-B651-A3F2856AB2FA}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GodotSharpEditor", "GodotSharpEditor\GodotSharpEditor.csproj", "{8FBEC238-D944-4074-8548-B3B524305905}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {AEBF0036-DA76-4341-B651-A3F2856AB2FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {AEBF0036-DA76-4341-B651-A3F2856AB2FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {AEBF0036-DA76-4341-B651-A3F2856AB2FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {AEBF0036-DA76-4341-B651-A3F2856AB2FA}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8FBEC238-D944-4074-8548-B3B524305905}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8FBEC238-D944-4074-8548-B3B524305905}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8FBEC238-D944-4074-8548-B3B524305905}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8FBEC238-D944-4074-8548-B3B524305905}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+EndGlobal
diff --git a/modules/mono/glue/Managed/Files/AABB.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs
index 6a4f785551..6a4f785551 100644
--- a/modules/mono/glue/Managed/Files/AABB.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs
diff --git a/modules/mono/glue/Managed/Files/Array.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs
index aba1065498..aba1065498 100644
--- a/modules/mono/glue/Managed/Files/Array.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs
diff --git a/modules/mono/glue/Managed/Files/Attributes/ExportAttribute.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ExportAttribute.cs
index 6adf044886..6adf044886 100644
--- a/modules/mono/glue/Managed/Files/Attributes/ExportAttribute.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ExportAttribute.cs
diff --git a/modules/mono/glue/Managed/Files/Attributes/GodotMethodAttribute.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/GodotMethodAttribute.cs
index 55848769d5..55848769d5 100644
--- a/modules/mono/glue/Managed/Files/Attributes/GodotMethodAttribute.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/GodotMethodAttribute.cs
diff --git a/modules/mono/glue/Managed/Files/Attributes/RPCAttributes.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/RPCAttributes.cs
index 1bf6d5199a..1bf6d5199a 100644
--- a/modules/mono/glue/Managed/Files/Attributes/RPCAttributes.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/RPCAttributes.cs
diff --git a/modules/mono/glue/Managed/Files/Attributes/SignalAttribute.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/SignalAttribute.cs
index 3957387be9..3957387be9 100644
--- a/modules/mono/glue/Managed/Files/Attributes/SignalAttribute.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/SignalAttribute.cs
diff --git a/modules/mono/glue/Managed/Files/Attributes/ToolAttribute.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ToolAttribute.cs
index d0437409af..d0437409af 100644
--- a/modules/mono/glue/Managed/Files/Attributes/ToolAttribute.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ToolAttribute.cs
diff --git a/modules/mono/glue/Managed/Files/Basis.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs
index c5e62b77c8..c5e62b77c8 100644
--- a/modules/mono/glue/Managed/Files/Basis.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs
diff --git a/modules/mono/glue/Managed/Files/Color.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs
index df817e47e9..df817e47e9 100644
--- a/modules/mono/glue/Managed/Files/Color.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs
diff --git a/modules/mono/glue/Managed/Files/Colors.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Colors.cs
index f41f5e9fc8..f41f5e9fc8 100644
--- a/modules/mono/glue/Managed/Files/Colors.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Colors.cs
diff --git a/modules/mono/glue/Managed/Files/DebuggingUtils.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/DebuggingUtils.cs
index edfe3464ec..edfe3464ec 100644
--- a/modules/mono/glue/Managed/Files/DebuggingUtils.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/DebuggingUtils.cs
diff --git a/modules/mono/glue/Managed/Files/Dictionary.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Dictionary.cs
index d72109de92..d72109de92 100644
--- a/modules/mono/glue/Managed/Files/Dictionary.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Dictionary.cs
diff --git a/modules/mono/glue/Managed/Files/Dispatcher.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Dispatcher.cs
index 072e0f20ff..072e0f20ff 100644
--- a/modules/mono/glue/Managed/Files/Dispatcher.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Dispatcher.cs
diff --git a/modules/mono/glue/Managed/Files/DynamicObject.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/DynamicObject.cs
index a0f105d55e..a0f105d55e 100644
--- a/modules/mono/glue/Managed/Files/DynamicObject.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/DynamicObject.cs
diff --git a/modules/mono/glue/Managed/Files/Extensions/NodeExtensions.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/NodeExtensions.cs
index 5023725f17..5023725f17 100644
--- a/modules/mono/glue/Managed/Files/Extensions/NodeExtensions.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/NodeExtensions.cs
diff --git a/modules/mono/glue/Managed/Files/Extensions/ObjectExtensions.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/ObjectExtensions.cs
index 9ef0959750..9ef0959750 100644
--- a/modules/mono/glue/Managed/Files/Extensions/ObjectExtensions.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/ObjectExtensions.cs
diff --git a/modules/mono/glue/Managed/Files/Extensions/ResourceLoaderExtensions.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/ResourceLoaderExtensions.cs
index 684d160b57..684d160b57 100644
--- a/modules/mono/glue/Managed/Files/Extensions/ResourceLoaderExtensions.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/ResourceLoaderExtensions.cs
diff --git a/modules/mono/glue/Managed/Files/GD.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs
index 19962d418a..19962d418a 100644
--- a/modules/mono/glue/Managed/Files/GD.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs
diff --git a/modules/mono/glue/Managed/Files/GodotSynchronizationContext.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotSynchronizationContext.cs
index 4b5e3f8761..4b5e3f8761 100644
--- a/modules/mono/glue/Managed/Files/GodotSynchronizationContext.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotSynchronizationContext.cs
diff --git a/modules/mono/glue/Managed/Files/GodotTaskScheduler.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotTaskScheduler.cs
index 8eaeea50dc..8eaeea50dc 100644
--- a/modules/mono/glue/Managed/Files/GodotTaskScheduler.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotTaskScheduler.cs
diff --git a/modules/mono/glue/Managed/Files/GodotTraceListener.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotTraceListener.cs
index f1a00ae0fa..f1a00ae0fa 100644
--- a/modules/mono/glue/Managed/Files/GodotTraceListener.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotTraceListener.cs
diff --git a/modules/mono/glue/Managed/Files/Interfaces/IAwaitable.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Interfaces/IAwaitable.cs
index 0397957d00..0397957d00 100644
--- a/modules/mono/glue/Managed/Files/Interfaces/IAwaitable.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Interfaces/IAwaitable.cs
diff --git a/modules/mono/glue/Managed/Files/Interfaces/IAwaiter.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Interfaces/IAwaiter.cs
index d3be9d781c..d3be9d781c 100644
--- a/modules/mono/glue/Managed/Files/Interfaces/IAwaiter.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Interfaces/IAwaiter.cs
diff --git a/modules/mono/glue/Managed/Files/Interfaces/ISerializationListener.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Interfaces/ISerializationListener.cs
index c3fa2f3e82..c3fa2f3e82 100644
--- a/modules/mono/glue/Managed/Files/Interfaces/ISerializationListener.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Interfaces/ISerializationListener.cs
diff --git a/modules/mono/glue/Managed/Files/MarshalUtils.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/MarshalUtils.cs
index a1d63a62ef..a1d63a62ef 100644
--- a/modules/mono/glue/Managed/Files/MarshalUtils.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/MarshalUtils.cs
diff --git a/modules/mono/glue/Managed/Files/Mathf.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs
index 54821fe790..54821fe790 100644
--- a/modules/mono/glue/Managed/Files/Mathf.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs
diff --git a/modules/mono/glue/Managed/Files/MathfEx.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/MathfEx.cs
index 1b7fd4906f..1b7fd4906f 100644
--- a/modules/mono/glue/Managed/Files/MathfEx.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/MathfEx.cs
diff --git a/modules/mono/glue/Managed/Files/NodePath.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NodePath.cs
index 8c5872ba5a..8c5872ba5a 100644
--- a/modules/mono/glue/Managed/Files/NodePath.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NodePath.cs
diff --git a/modules/mono/glue/Managed/Files/Object.base.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Object.base.cs
index de80f7fddc..de80f7fddc 100644
--- a/modules/mono/glue/Managed/Files/Object.base.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Object.base.cs
diff --git a/modules/mono/glue/Managed/Files/Plane.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs
index 885845e3a4..885845e3a4 100644
--- a/modules/mono/glue/Managed/Files/Plane.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs
diff --git a/modules/mono/glue/Managed/Files/Quat.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Quat.cs
index 8f60867ac3..8f60867ac3 100644
--- a/modules/mono/glue/Managed/Files/Quat.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Quat.cs
diff --git a/modules/mono/glue/Managed/Files/RID.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/RID.cs
index 94761531b1..94761531b1 100644
--- a/modules/mono/glue/Managed/Files/RID.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/RID.cs
diff --git a/modules/mono/glue/Managed/Files/Rect2.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs
index 91e614dc7b..91e614dc7b 100644
--- a/modules/mono/glue/Managed/Files/Rect2.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs
diff --git a/modules/mono/glue/Managed/Files/SignalAwaiter.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/SignalAwaiter.cs
index 9483b6ffb4..9483b6ffb4 100644
--- a/modules/mono/glue/Managed/Files/SignalAwaiter.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/SignalAwaiter.cs
diff --git a/modules/mono/glue/Managed/Files/StringExtensions.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs
index b926037e5a..b926037e5a 100644
--- a/modules/mono/glue/Managed/Files/StringExtensions.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs
diff --git a/modules/mono/glue/Managed/Files/Transform.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform.cs
index 0b84050f07..0b84050f07 100644
--- a/modules/mono/glue/Managed/Files/Transform.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform.cs
diff --git a/modules/mono/glue/Managed/Files/Transform2D.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs
index 77ea3e5830..77ea3e5830 100644
--- a/modules/mono/glue/Managed/Files/Transform2D.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs
diff --git a/modules/mono/glue/Managed/Files/Vector2.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs
index f92453f546..f92453f546 100644
--- a/modules/mono/glue/Managed/Files/Vector2.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs
diff --git a/modules/mono/glue/Managed/Files/Vector3.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs
index 025b09199f..025b09199f 100644
--- a/modules/mono/glue/Managed/Files/Vector3.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj b/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj
new file mode 100644
index 0000000000..5419cd06e6
--- /dev/null
+++ b/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{AEBF0036-DA76-4341-B651-A3F2856AB2FA}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <OutputPath>bin/$(Configuration)</OutputPath>
+ <RootNamespace>Godot</RootNamespace>
+ <AssemblyName>GodotSharp</AssemblyName>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <DocumentationFile>$(OutputPath)/$(AssemblyName).xml</DocumentationFile>
+ <BaseIntermediateOutputPath>obj</BaseIntermediateOutputPath>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>portable</DebugType>
+ <Optimize>false</Optimize>
+ <DefineConstants>$(GodotDefineConstants);GODOT;DEBUG;</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ConsolePause>false</ConsolePause>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>portable</DebugType>
+ <Optimize>true</Optimize>
+ <DefineConstants>$(GodotDefineConstants);GODOT;</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ConsolePause>false</ConsolePause>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Core\AABB.cs" />
+ <Compile Include="Core\Array.cs" />
+ <Compile Include="Core\Attributes\ExportAttribute.cs" />
+ <Compile Include="Core\Attributes\GodotMethodAttribute.cs" />
+ <Compile Include="Core\Attributes\RPCAttributes.cs" />
+ <Compile Include="Core\Attributes\SignalAttribute.cs" />
+ <Compile Include="Core\Attributes\ToolAttribute.cs" />
+ <Compile Include="Core\Basis.cs" />
+ <Compile Include="Core\Color.cs" />
+ <Compile Include="Core\Colors.cs" />
+ <Compile Include="Core\DebuggingUtils.cs" />
+ <Compile Include="Core\Dictionary.cs" />
+ <Compile Include="Core\Dispatcher.cs" />
+ <Compile Include="Core\DynamicObject.cs" />
+ <Compile Include="Core\Extensions\NodeExtensions.cs" />
+ <Compile Include="Core\Extensions\ObjectExtensions.cs" />
+ <Compile Include="Core\Extensions\ResourceLoaderExtensions.cs" />
+ <Compile Include="Core\GD.cs" />
+ <Compile Include="Core\GodotSynchronizationContext.cs" />
+ <Compile Include="Core\GodotTaskScheduler.cs" />
+ <Compile Include="Core\GodotTraceListener.cs" />
+ <Compile Include="Core\Interfaces\IAwaitable.cs" />
+ <Compile Include="Core\Interfaces\IAwaiter.cs" />
+ <Compile Include="Core\Interfaces\ISerializationListener.cs" />
+ <Compile Include="Core\MarshalUtils.cs" />
+ <Compile Include="Core\Mathf.cs" />
+ <Compile Include="Core\MathfEx.cs" />
+ <Compile Include="Core\NodePath.cs" />
+ <Compile Include="Core\Object.base.cs" />
+ <Compile Include="Core\Plane.cs" />
+ <Compile Include="Core\Quat.cs" />
+ <Compile Include="Core\Rect2.cs" />
+ <Compile Include="Core\RID.cs" />
+ <Compile Include="Core\SignalAwaiter.cs" />
+ <Compile Include="Core\StringExtensions.cs" />
+ <Compile Include="Core\Transform.cs" />
+ <Compile Include="Core\Transform2D.cs" />
+ <Compile Include="Core\Vector2.cs" />
+ <Compile Include="Core\Vector3.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <!--
+ We import a props file with auto-generated includes. This works well with Rider.
+ However, Visual Studio and MonoDevelop won't list them in the solution explorer.
+ We can't use wildcards as there may be undesired old files still hanging around.
+ Fortunately code completion, go to definition and such still work.
+ -->
+ <Import Project="Generated\GeneratedIncludes.props" />
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+</Project>
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Properties/AssemblyInfo.cs b/modules/mono/glue/GodotSharp/GodotSharp/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000..f84e0183f6
--- /dev/null
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Properties/AssemblyInfo.cs
@@ -0,0 +1,27 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following attributes.
+// Change them to the values specific to your project.
+
+[assembly: AssemblyTitle("GodotSharp")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
+
+[assembly: AssemblyVersion("1.0.*")]
+
+// The following attributes are used to specify the signing key for the assembly,
+// if desired. See the Mono documentation for more information about signing.
+
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile("")]
+[assembly: InternalsVisibleTo("GodotSharpEditor")]
diff --git a/modules/mono/glue/GodotSharp/GodotSharpEditor/GodotSharpEditor.csproj b/modules/mono/glue/GodotSharp/GodotSharpEditor/GodotSharpEditor.csproj
new file mode 100644
index 0000000000..22853797c1
--- /dev/null
+++ b/modules/mono/glue/GodotSharp/GodotSharpEditor/GodotSharpEditor.csproj
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{8FBEC238-D944-4074-8548-B3B524305905}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <OutputPath>bin/$(Configuration)</OutputPath>
+ <RootNamespace>Godot</RootNamespace>
+ <AssemblyName>GodotSharpEditor</AssemblyName>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <DocumentationFile>$(OutputPath)/$(AssemblyName).xml</DocumentationFile>
+ <BaseIntermediateOutputPath>obj</BaseIntermediateOutputPath>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>portable</DebugType>
+ <Optimize>false</Optimize>
+ <DefineConstants>$(GodotDefineConstants);GODOT;DEBUG;</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ConsolePause>false</ConsolePause>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>portable</DebugType>
+ <Optimize>true</Optimize>
+ <DefineConstants>$(GodotDefineConstants);GODOT;</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ConsolePause>false</ConsolePause>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <Import Project="Generated\GeneratedIncludes.props" />
+ <ItemGroup>
+ <ProjectReference Include="..\GodotSharp\GodotSharp.csproj">
+ <Private>False</Private>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+</Project>
diff --git a/modules/mono/glue/Managed/Properties/AssemblyInfo.cs b/modules/mono/glue/GodotSharp/GodotSharpEditor/Properties/AssemblyInfo.cs
index 77b3774e81..3684b7a3cb 100644
--- a/modules/mono/glue/Managed/Properties/AssemblyInfo.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharpEditor/Properties/AssemblyInfo.cs
@@ -1,10 +1,9 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
+using System.Reflection;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
-[assembly: AssemblyTitle("Managed")]
+[assembly: AssemblyTitle("GodotSharpEditor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
diff --git a/modules/mono/glue/Managed/.gitignore b/modules/mono/glue/Managed/.gitignore
deleted file mode 100644
index 146421cac8..0000000000
--- a/modules/mono/glue/Managed/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Generated Godot API solution folder
-Generated
diff --git a/modules/mono/glue/Managed/IgnoredFiles/Enums.cs b/modules/mono/glue/Managed/IgnoredFiles/Enums.cs
deleted file mode 100644
index 05f1abcf93..0000000000
--- a/modules/mono/glue/Managed/IgnoredFiles/Enums.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-
-namespace Godot
-{
- public enum Margin
- {
- Left = 0,
- Top = 1,
- Right = 2,
- Bottom = 3
- }
-
- public enum Error
- {
- Ok = 0
- }
-
- public enum PropertyHint
- {
- None = 0
- }
-}
diff --git a/modules/mono/glue/Managed/IgnoredFiles/FuncRef.cs b/modules/mono/glue/Managed/IgnoredFiles/FuncRef.cs
deleted file mode 100644
index 83504fe49f..0000000000
--- a/modules/mono/glue/Managed/IgnoredFiles/FuncRef.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System;
-
-namespace Godot
-{
- public partial class FuncRef
- {
- public void SetInstance(Object instance)
- {
- throw new NotImplementedException();
- }
-
- public void SetFunction(string name)
- {
- throw new NotImplementedException();
- }
- }
-}
diff --git a/modules/mono/glue/Managed/IgnoredFiles/Node.cs b/modules/mono/glue/Managed/IgnoredFiles/Node.cs
deleted file mode 100644
index cff61b1e0b..0000000000
--- a/modules/mono/glue/Managed/IgnoredFiles/Node.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-
-using System;
-
-namespace Godot
-{
- public partial class Node
- {
- public Node GetChild(int idx)
- {
- throw new NotImplementedException();
- }
-
- public Node GetNode(NodePath path)
- {
- throw new NotImplementedException();
- }
-
- public Node Owner
- {
- get => throw new NotImplementedException();
- set => throw new NotImplementedException();
- }
-
- public Node GetParent()
- {
- throw new NotImplementedException();
- }
- }
-}
diff --git a/modules/mono/glue/Managed/IgnoredFiles/Resource.cs b/modules/mono/glue/Managed/IgnoredFiles/Resource.cs
deleted file mode 100644
index cc0a5555b1..0000000000
--- a/modules/mono/glue/Managed/IgnoredFiles/Resource.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace Godot
-{
- public partial class Resource
- {
-
- }
-}
diff --git a/modules/mono/glue/Managed/IgnoredFiles/ResourceLoader.cs b/modules/mono/glue/Managed/IgnoredFiles/ResourceLoader.cs
deleted file mode 100644
index 6461d35146..0000000000
--- a/modules/mono/glue/Managed/IgnoredFiles/ResourceLoader.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-
-namespace Godot
-{
- public partial class ResourceLoader
- {
- public static Resource Load(string path, string typeHint = "", bool pNoCache = false)
- {
- throw new NotImplementedException();
- }
- }
-}
diff --git a/modules/mono/glue/Managed/IgnoredFiles/Variant.cs b/modules/mono/glue/Managed/IgnoredFiles/Variant.cs
deleted file mode 100644
index 802140b062..0000000000
--- a/modules/mono/glue/Managed/IgnoredFiles/Variant.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-
-namespace Godot
-{
- public static class Variant
- {
- public enum Type
- {
-
- }
- }
-}
diff --git a/modules/mono/glue/Managed/IgnoredFiles/WeakRef.cs b/modules/mono/glue/Managed/IgnoredFiles/WeakRef.cs
deleted file mode 100644
index 1498b7836b..0000000000
--- a/modules/mono/glue/Managed/IgnoredFiles/WeakRef.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace Godot
-{
- public partial class WeakRef
- {
-
- }
-}
diff --git a/modules/mono/glue/Managed/Managed.csproj b/modules/mono/glue/Managed/Managed.csproj
deleted file mode 100644
index 8bde3b6d22..0000000000
--- a/modules/mono/glue/Managed/Managed.csproj
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
- <ProjectGuid>{DAA3DEF8-5112-407C-A5E5-6C608CF5F955}</ProjectGuid>
- <OutputType>Library</OutputType>
- <RootNamespace>Managed</RootNamespace>
- <AssemblyName>Managed</AssemblyName>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
- <LangVersion>7</LangVersion>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>portable</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug</OutputPath>
- <DefineConstants>DEBUG;</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <ExternalConsole>true</ExternalConsole>
- <PlatformTarget>x86</PlatformTarget>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
- <Optimize>true</Optimize>
- <OutputPath>bin\Release</OutputPath>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <ExternalConsole>true</ExternalConsole>
- <PlatformTarget>x86</PlatformTarget>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Files\**\*.cs" />
- <Compile Include="IgnoredFiles\**\*.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
-</Project> \ No newline at end of file
diff --git a/modules/mono/glue/Managed/Managed.sln b/modules/mono/glue/Managed/Managed.sln
deleted file mode 100644
index 61ddde0fb7..0000000000
--- a/modules/mono/glue/Managed/Managed.sln
+++ /dev/null
@@ -1,17 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2012
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Managed", "Managed.csproj", "{DAA3DEF8-5112-407C-A5E5-6C608CF5F955}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|x86 = Debug|x86
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {DAA3DEF8-5112-407C-A5E5-6C608CF5F955}.Debug|x86.ActiveCfg = Debug|x86
- {DAA3DEF8-5112-407C-A5E5-6C608CF5F955}.Debug|x86.Build.0 = Debug|x86
- {DAA3DEF8-5112-407C-A5E5-6C608CF5F955}.Release|x86.ActiveCfg = Release|x86
- {DAA3DEF8-5112-407C-A5E5-6C608CF5F955}.Release|x86.Build.0 = Release|x86
- EndGlobalSection
-EndGlobal
diff --git a/modules/mono/glue/Managed/README.md b/modules/mono/glue/Managed/README.md
deleted file mode 100644
index 65e63cae37..0000000000
--- a/modules/mono/glue/Managed/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-The directory `Files` contains C# files from the core assembly project that are not part of the generated API. Any file with the `.cs` extension in this directory will be added to the core assembly project.
-
-A dummy solution and project is provided to get tooling help while editing these files, like code completion and name refactoring.
-
-The directory `IgnoredFiles` contains C# files that are needed to build the dummy project but must not be added to the core assembly project. They contain placeholders for the declarations that are part of the generated API.
diff --git a/modules/mono/utils/path_utils.cpp b/modules/mono/utils/path_utils.cpp
index 20863b1afe..a7bbc75e29 100644
--- a/modules/mono/utils/path_utils.cpp
+++ b/modules/mono/utils/path_utils.cpp
@@ -170,4 +170,41 @@ String join(const String &p_a, const String &p_b, const String &p_c, const Strin
return path::join(path::join(path::join(p_a, p_b), p_c), p_d);
}
+String relative_to_impl(const String &p_path, const String &p_relative_to) {
+ // This function assumes arguments are normalized and absolute paths
+
+ if (p_path.begins_with(p_relative_to)) {
+ return p_path.substr(p_relative_to.length() + 1);
+ } else {
+ String base_dir = p_relative_to.get_base_dir();
+
+ if (base_dir.length() <= 2 && (base_dir.empty() || base_dir.ends_with(":")))
+ return p_path;
+
+ return String("..").plus_file(relative_to_impl(p_path, base_dir));
+ }
+}
+
+#ifdef WINDOWS_ENABLED
+String get_drive_letter(const String &p_norm_path) {
+ int idx = p_norm_path.find(":/");
+ if (idx != -1 && idx < p_norm_path.find("/"))
+ return p_norm_path.substr(0, idx + 1);
+ return String();
+}
+#endif
+
+String relative_to(const String &p_path, const String &p_relative_to) {
+ String relative_to_abs_norm = abspath(p_relative_to);
+ String path_abs_norm = abspath(p_path);
+
+#ifdef WINDOWS_ENABLED
+ if (get_drive_letter(relative_to_abs_norm) != get_drive_letter(path_abs_norm)) {
+ return path_abs_norm;
+ }
+#endif
+
+ return relative_to_impl(path_abs_norm, relative_to_abs_norm);
+}
+
} // namespace path
diff --git a/modules/mono/utils/path_utils.h b/modules/mono/utils/path_utils.h
index ca25bc09f7..7e868d2b5a 100644
--- a/modules/mono/utils/path_utils.h
+++ b/modules/mono/utils/path_utils.h
@@ -57,6 +57,8 @@ String abspath(const String &p_path);
*/
String realpath(const String &p_path);
+String relative_to(const String &p_path, const String &p_relative_to);
+
} // namespace path
#endif // PATH_UTILS_H