mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
C#: Add option to treat warnings as errors
This commit is contained in:
parent
6395450b10
commit
8642e970c5
3 changed files with 13 additions and 5 deletions
2
.github/workflows/linux_builds.yml
vendored
2
.github/workflows/linux_builds.yml
vendored
|
@ -176,7 +176,7 @@ jobs:
|
||||||
if: matrix.build-mono
|
if: matrix.build-mono
|
||||||
run: |
|
run: |
|
||||||
dotnet --info
|
dotnet --info
|
||||||
./modules/mono/build_scripts/build_assemblies.py --godot-output-dir=./bin --godot-platform=linuxbsd
|
./modules/mono/build_scripts/build_assemblies.py --godot-output-dir=./bin --godot-platform=linuxbsd --werror
|
||||||
|
|
||||||
- name: Prepare artifact
|
- name: Prepare artifact
|
||||||
if: matrix.artifact
|
if: matrix.artifact
|
||||||
|
|
|
@ -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)
|
return subprocess.call(args, env=msbuild_env, cwd=chdir_to)
|
||||||
|
|
||||||
|
|
||||||
def build_godot_api(msbuild_tool, module_dir, output_dir, push_nupkgs_local, precision, no_deprecated):
|
def build_godot_api(msbuild_tool, module_dir, output_dir, push_nupkgs_local, precision, no_deprecated, werror):
|
||||||
target_filenames = [
|
target_filenames = [
|
||||||
"GodotSharp.dll",
|
"GodotSharp.dll",
|
||||||
"GodotSharp.pdb",
|
"GodotSharp.pdb",
|
||||||
|
@ -219,6 +219,8 @@ def build_godot_api(msbuild_tool, module_dir, output_dir, push_nupkgs_local, pre
|
||||||
args += ["/p:GodotFloat64=true"]
|
args += ["/p:GodotFloat64=true"]
|
||||||
if no_deprecated:
|
if no_deprecated:
|
||||||
args += ["/p:GodotNoDeprecated=true"]
|
args += ["/p:GodotNoDeprecated=true"]
|
||||||
|
if werror:
|
||||||
|
args += ["/p:TreatWarningsAsErrors=true"]
|
||||||
|
|
||||||
sln = os.path.join(module_dir, "glue/GodotSharp/GodotSharp.sln")
|
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)
|
exit_code = run_msbuild(msbuild_tool, sln=sln, chdir_to=module_dir, msbuild_args=args)
|
||||||
|
@ -339,13 +341,15 @@ def generate_sdk_package_versions():
|
||||||
|
|
||||||
|
|
||||||
def build_all(
|
def build_all(
|
||||||
msbuild_tool, module_dir, output_dir, godot_platform, dev_debug, push_nupkgs_local, precision, no_deprecated
|
msbuild_tool, module_dir, output_dir, godot_platform, dev_debug, push_nupkgs_local, precision, no_deprecated, werror
|
||||||
):
|
):
|
||||||
# Generate SdkPackageVersions.props and VersionDocsUrl constant
|
# Generate SdkPackageVersions.props and VersionDocsUrl constant
|
||||||
generate_sdk_package_versions()
|
generate_sdk_package_versions()
|
||||||
|
|
||||||
# Godot API
|
# Godot API
|
||||||
exit_code = build_godot_api(msbuild_tool, module_dir, output_dir, push_nupkgs_local, precision, no_deprecated)
|
exit_code = build_godot_api(
|
||||||
|
msbuild_tool, module_dir, output_dir, push_nupkgs_local, precision, no_deprecated, werror
|
||||||
|
)
|
||||||
if exit_code != 0:
|
if exit_code != 0:
|
||||||
return exit_code
|
return exit_code
|
||||||
|
|
||||||
|
@ -402,6 +406,7 @@ def main():
|
||||||
default=False,
|
default=False,
|
||||||
help="Build GodotSharp without using deprecated features. This is required, if the engine was built with 'deprecated=no'.",
|
help="Build GodotSharp without using deprecated features. This is required, if the engine was built with 'deprecated=no'.",
|
||||||
)
|
)
|
||||||
|
parser.add_argument("--werror", action="store_true", default=False, help="Treat compiler warnings as errors.")
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
@ -427,6 +432,7 @@ def main():
|
||||||
push_nupkgs_local,
|
push_nupkgs_local,
|
||||||
args.precision,
|
args.precision,
|
||||||
args.no_deprecated,
|
args.no_deprecated,
|
||||||
|
args.werror,
|
||||||
)
|
)
|
||||||
sys.exit(exit_code)
|
sys.exit(exit_code)
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,8 @@ namespace Godot.Bridge;
|
||||||
|
|
||||||
public static partial class ScriptManagerBridge
|
public static partial class ScriptManagerBridge
|
||||||
{
|
{
|
||||||
|
[SuppressMessage("Design", "CA1001", MessageId = "Types that own disposable fields should be disposable",
|
||||||
|
Justification = "Not applicable. The class functions as a persistent singleton.")]
|
||||||
private class ScriptTypeBiMap
|
private class ScriptTypeBiMap
|
||||||
{
|
{
|
||||||
public readonly ReaderWriterLockSlim ReadWriteLock = new(LockRecursionPolicy.SupportsRecursion);
|
public readonly ReaderWriterLockSlim ReadWriteLock = new(LockRecursionPolicy.SupportsRecursion);
|
||||||
|
@ -66,7 +68,7 @@ public static partial class ScriptManagerBridge
|
||||||
private System.Collections.Generic.Dictionary<string, Type> _pathTypeMap = new();
|
private System.Collections.Generic.Dictionary<string, Type> _pathTypeMap = new();
|
||||||
private System.Collections.Generic.Dictionary<Type, string> _typePathMap = new();
|
private System.Collections.Generic.Dictionary<Type, string> _typePathMap = new();
|
||||||
|
|
||||||
public IReadOnlyCollection<string> Paths => _pathTypeMap.Keys;
|
public System.Collections.Generic.Dictionary<string, Type>.KeyCollection Paths => _pathTypeMap.Keys;
|
||||||
|
|
||||||
public void Add(string scriptPath, Type scriptType)
|
public void Add(string scriptPath, Type scriptType)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue