Skip to content

Commit bc967b9

Browse files
committed
Added possiblity of not adding /noconfig and similar arguments in C#
1 parent f9fdf52 commit bc967b9

2 files changed

Lines changed: 13 additions & 11 deletions

File tree

prelude/csharp/csharp.bzl

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,18 @@ def csharp_library_impl(ctx: AnalysisContext) -> list[Provider]:
3232
format = "/out:{}",
3333
))
3434

35-
# Don't include any default .NET framework assemblies like "mscorlib" or "System" unless
36-
# explicitly requested with `/reference:{}`. This flag also stops injection of other
37-
# default compiler flags.
38-
cmd.append("/noconfig")
39-
40-
# Don't reference mscorlib.dll unless asked for. This is required for targets that target
41-
# embedded platforms such as Silverlight or WASM. (Originally for Buck1 compatibility.)
42-
cmd.append("/nostdlib")
43-
44-
# Don't search any paths for .NET libraries unless explicitly referenced with `/lib:{}`.
45-
cmd.append("/nosdkpath")
35+
if ctx.attrs.add_hermetic_arguments:
36+
# Don't include any default .NET framework assemblies like "mscorlib" or "System" unless
37+
# explicitly requested with `/reference:{}`. This flag also stops injection of other
38+
# default compiler flags.
39+
cmd.append("/noconfig")
40+
41+
# Don't reference mscorlib.dll unless asked for. This is required for targets that target
42+
# embedded platforms such as Silverlight or WASM. (Originally for Buck1 compatibility.)
43+
cmd.append("/nostdlib")
44+
45+
# Don't search any paths for .NET libraries unless explicitly referenced with `/lib:{}`.
46+
cmd.append("/nosdkpath")
4647

4748
# Let csc know the directory path where it can find system assemblies. This is the path
4849
# that is searched by `/reference:{libname}` if `libname` is just a DLL name.

prelude/decls/dotnet_rules.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ csharp_library = prelude_rule(
7878
"compiler_flags": attrs.list(attrs.string(), default = [], doc = """
7979
The set of additional compiler flags to pass to the compiler.
8080
"""),
81+
"add_hermetic_arguments": attrs.bool(default = True),
8182
} |
8283
buck.licenses_arg() |
8384
buck.labels_arg() |

0 commit comments

Comments
 (0)