diff options
author | Ignacio Etcheverry <ignalfonsore@gmail.com> | 2020-10-23 09:25:16 +0200 |
---|---|---|
committer | Ignacio Etcheverry <ignalfonsore@gmail.com> | 2020-10-23 10:54:49 +0200 |
commit | 64b5ee701070e26a90702d345a1ee3188024d7ac (patch) | |
tree | 8dbb69f9aab3f7bbf06c92fa76076df433460075 /modules/mono/build_scripts | |
parent | d5073c6b4ce864f169e4e1ad18d411fe5928c766 (diff) |
C#: Make editor create NuGet fallback folder for Godot packages
Main benefits:
- Projects can be built offline. Previously you needed internet
access the first time building to download the packages.
- Changes to packages like Godot.NET.Sdk can be easily tested
before publishing. This was already possible but required
too many manual steps.
- First time builds are a bit faster, as the Sdk package doesn't
need to be downloaded. In practice, the package is very small
so it makes little difference.
Bumped Godot.NET.Sdk to 4.0.0-dev3 in order to enable the
recent changes regarding '.mono/' -> '.godot/mono/'.
Diffstat (limited to 'modules/mono/build_scripts')
-rw-r--r-- | modules/mono/build_scripts/godot_net_sdk_build.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/modules/mono/build_scripts/godot_net_sdk_build.py b/modules/mono/build_scripts/godot_net_sdk_build.py new file mode 100644 index 0000000000..3bfba0f0f6 --- /dev/null +++ b/modules/mono/build_scripts/godot_net_sdk_build.py @@ -0,0 +1,45 @@ +# Build Godot.NET.Sdk solution + +import os + +from SCons.Script import Dir + + +def build_godot_net_sdk(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/Godot.NET.Sdk/Godot.NET.Sdk.sln") + build_config = "Release" + + from .solution_builder import build_solution + + extra_msbuild_args = ["/p:GodotPlatform=" + env["platform"]] + + build_solution(env, solution_path, build_config, extra_msbuild_args) + # No need to copy targets. The Godot.NET.Sdk csproj takes care of copying them. + + +def build(env_mono): + assert env_mono["tools"] + + output_dir = Dir("#bin").abspath + editor_tools_dir = os.path.join(output_dir, "GodotSharp", "Tools") + nupkgs_dir = os.path.join(editor_tools_dir, "nupkgs") + + module_dir = os.getcwd() + + package_version_file = os.path.join( + module_dir, "editor", "Godot.NET.Sdk", "Godot.NET.Sdk", "Godot.NET.Sdk_PackageVersion.txt" + ) + + with open(package_version_file, mode="r") as f: + version = f.read().strip() + + target_filenames = ["Godot.NET.Sdk.%s.nupkg" % version] + + targets = [os.path.join(nupkgs_dir, filename) for filename in target_filenames] + + cmd = env_mono.CommandNoCache(targets, [], build_godot_net_sdk, module_dir=module_dir) + env_mono.AlwaysBuild(cmd) |