Allow setting compiler options on target/toolchain
I was looking to enable the 'TreatWarningsAsErrors' option on a bazel package, but I'm lost trying to find somewhere to put the compiler options on the csharp_binary rule.
Does an attribute exist on csharp_binary like the javacopt on java_binary? Does the csharp compiler make this tricky to do?
This is not possible at the moment but it should be pretty easy to add this so that it can be declared on either the targets themselves or apply it to all targets by specifying them on the toolchain.
I might needs this feature in the not so far future to so I might implement it but it will be a few weeks probably.
This is now possible on the next branch. It can be configured via config settings for global configuration or per target.
The documentation is still not ready but it's the treat_warnings_as_errors, warnings_as_errors, warnings_not_as_errors attributes that can be used to configure this and then the @rules_dotnet//dotnet/settings:<treat_warnings_as_errors/warnings_as_errors/warnings_not_as_errors> config settings for global configuration
I was too quick closing this since we don't allow setting arbitrary compiler flags. I'm not sure if and how we would implement that since a lot of the compiler flags have to be correctly configured just so the build works and allowing arbitrary flags could lead to hard to debug errrors.
You can now add arbitrary compiler flags using the compiler_options attribute on the targets.