C# Assemblies can now be built with deprecated=no

This commit is contained in:
Felix Bytow 2024-09-04 17:10:25 +02:00
parent b6223c0df0
commit e9762b3eaf
No known key found for this signature in database
GPG Key ID: 465AA9A268AAF0CE
3 changed files with 18 additions and 5 deletions

View File

@ -194,7 +194,7 @@ def run_msbuild(tools: ToolsLocation, sln: str, chdir_to: str, msbuild_args: Opt
return subprocess.call(args, env=msbuild_env, cwd=chdir_to)
def build_godot_api(msbuild_tool, module_dir, output_dir, push_nupkgs_local, precision):
def build_godot_api(msbuild_tool, module_dir, output_dir, push_nupkgs_local, precision, no_deprecated):
target_filenames = [
"GodotSharp.dll",
"GodotSharp.pdb",
@ -217,6 +217,8 @@ def build_godot_api(msbuild_tool, module_dir, output_dir, push_nupkgs_local, pre
args += ["/p:ClearNuGetLocalCache=true", "/p:PushNuGetToLocalSource=" + push_nupkgs_local]
if precision == "double":
args += ["/p:GodotFloat64=true"]
if no_deprecated:
args += ["/p:GodotNoDeprecated=true"]
sln = os.path.join(module_dir, "glue/GodotSharp/GodotSharp.sln")
exit_code = run_msbuild(msbuild_tool, sln=sln, chdir_to=module_dir, msbuild_args=args)
@ -336,12 +338,14 @@ def generate_sdk_package_versions():
f.write(constants)
def build_all(msbuild_tool, module_dir, output_dir, godot_platform, dev_debug, push_nupkgs_local, precision):
def build_all(
msbuild_tool, module_dir, output_dir, godot_platform, dev_debug, push_nupkgs_local, precision, no_deprecated
):
# Generate SdkPackageVersions.props and VersionDocsUrl constant
generate_sdk_package_versions()
# Godot API
exit_code = build_godot_api(msbuild_tool, module_dir, output_dir, push_nupkgs_local, precision)
exit_code = build_godot_api(msbuild_tool, module_dir, output_dir, push_nupkgs_local, precision, no_deprecated)
if exit_code != 0:
return exit_code
@ -364,6 +368,8 @@ def build_all(msbuild_tool, module_dir, output_dir, godot_platform, dev_debug, p
args += ["/p:ClearNuGetLocalCache=true", "/p:PushNuGetToLocalSource=" + push_nupkgs_local]
if precision == "double":
args += ["/p:GodotFloat64=true"]
if no_deprecated:
args += ["/p:GodotNoDeprecated=true"]
sln = os.path.join(module_dir, "editor/Godot.NET.Sdk/Godot.NET.Sdk.sln")
exit_code = run_msbuild(msbuild_tool, sln=sln, chdir_to=module_dir, msbuild_args=args)
if exit_code != 0:
@ -390,6 +396,12 @@ def main():
parser.add_argument(
"--precision", type=str, default="single", choices=["single", "double"], help="Floating-point precision level"
)
parser.add_argument(
"--no-deprecated",
action="store_true",
default=False,
help="Build GodotSharp without using deprecated features. This is required, if the engine was built with 'deprecated=no'.",
)
args = parser.parse_args()
@ -414,6 +426,7 @@ def main():
args.dev_debug,
push_nupkgs_local,
args.precision,
args.no_deprecated,
)
sys.exit(exit_code)

View File

@ -135,7 +135,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<!-- Compat Sources -->
<ItemGroup>
<ItemGroup Condition=" '$(GodotNoDeprecated)' == '' ">
<Compile Include="Compat.cs" />
</ItemGroup>
<!--

View File

@ -36,7 +36,7 @@
</ProjectReference>
</ItemGroup>
<!-- Compat Sources -->
<ItemGroup>
<ItemGroup Condition=" '$(GodotNoDeprecated)' == '' ">
<Compile Include="Compat.cs" />
</ItemGroup>
<!--