-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30282 from neikeq/editor_in_cs_equals_win
Re-write mono module editor code in C#
- Loading branch information
Showing
97 changed files
with
5,703 additions
and
4,120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Build the Godot API solution | ||
|
||
import os | ||
|
||
from SCons.Script import Dir | ||
|
||
|
||
def build_api_solution(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'] | ||
|
||
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'?") | ||
|
||
build_config = env['solution_build_config'] | ||
|
||
extra_msbuild_args = ['/p:NoWarn=1591'] # Ignore missing documentation warnings | ||
|
||
from .solution_builder import build_solution | ||
build_solution(env, solution_path, build_config, extra_msbuild_args=extra_msbuild_args) | ||
|
||
# Copy targets | ||
|
||
core_src_dir = os.path.abspath(os.path.join(solution_path, os.pardir, 'GodotSharp', 'bin', build_config)) | ||
editor_src_dir = os.path.abspath(os.path.join(solution_path, os.pardir, 'GodotSharpEditor', '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) | ||
|
||
src_path = os.path.join(core_src_dir, filename) | ||
if not os.path.isfile(src_path): | ||
src_path = os.path.join(editor_src_dir, filename) | ||
|
||
copy(src_path, target_path) | ||
|
||
for scons_target in target: | ||
copy_target(str(scons_target)) | ||
|
||
|
||
def build(env_mono): | ||
assert env_mono['tools'] | ||
|
||
target_filenames = [ | ||
'GodotSharp.dll', 'GodotSharp.pdb', 'GodotSharp.xml', | ||
'GodotSharpEditor.dll', 'GodotSharpEditor.pdb', 'GodotSharpEditor.xml' | ||
] | ||
|
||
for build_config in ['Debug', 'Release']: | ||
output_dir = Dir('#bin').abspath | ||
editor_api_dir = os.path.join(output_dir, 'GodotSharp', 'Api', build_config) | ||
|
||
targets = [os.path.join(editor_api_dir, filename) for filename in target_filenames] | ||
|
||
cmd = env_mono.CommandNoCache(targets, [], build_api_solution, | ||
module_dir=os.getcwd(), solution_build_config=build_config) | ||
env_mono.AlwaysBuild(cmd) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
# Build GodotTools solution | ||
|
||
import os | ||
|
||
from SCons.Script import Dir | ||
|
||
|
||
def build_godot_tools(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'] | ||
|
||
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' | ||
|
||
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)) | ||
|
||
|
||
def build(env_mono): | ||
assert env_mono['tools'] | ||
|
||
output_dir = Dir('#bin').abspath | ||
editor_tools_dir = os.path.join(output_dir, 'GodotSharp', 'Tools') | ||
editor_api_dir = os.path.join(output_dir, 'GodotSharp', 'Api', 'Debug') | ||
|
||
source_filenames = ['GodotSharp.dll', 'GodotSharpEditor.dll'] | ||
sources = [os.path.join(editor_api_dir, filename) for filename in source_filenames] | ||
|
||
target_filenames = ['GodotTools.dll', 'GodotTools.BuildLogger.dll', 'GodotTools.ProjectEditor.dll', 'DotNet.Glob.dll', 'GodotTools.Core.dll'] | ||
|
||
if env_mono['target'] == 'debug': | ||
target_filenames += ['GodotTools.pdb', 'GodotTools.BuildLogger.dll', 'GodotTools.ProjectEditor.dll', 'GodotTools.Core.dll'] | ||
|
||
targets = [os.path.join(editor_tools_dir, filename) for filename in target_filenames] | ||
|
||
cmd = env_mono.CommandNoCache(targets, sources, 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'] | ||
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) |
Oops, something went wrong.