Skip to content

Commit edc8aaa

Browse files
authored
[mono] Use lax Roslyn and analyzers settings for samples (#43769)
* [mono] Use lax Roslyn and analyzers settings for samples The samples are often used for debugging runtime problems by modifying the code to reproduce issues. The code analyzers and warnings-as-errors add a papercut before a modified sample can run. * [mono] Make HelloWorld sample Makefile settings overridable allow MONO_CONFIG and MONO_ENV_OPTIONS to be set from the outside
1 parent bc4cca2 commit edc8aaa

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project>
2+
<PropertyGroup>
3+
<RunAnalyzers>false</RunAnalyzers>
4+
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
5+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
6+
</PropertyGroup>
7+
<Import Project="..\..\Directory.Build.props"/>
8+
</Project>

src/mono/netcore/sample/HelloWorld/Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ TOP=../../../../../
22
DOTNET:=$(TOP)./dotnet.sh
33
DOTNET_Q_ARGS=--nologo -v:q -consoleloggerparameters:NoSummary
44

5-
MONO_CONFIG=Release
5+
MONO_CONFIG ?=Release
66
MONO_ARCH=x64
77

88
OS := $(shell uname -s)
@@ -12,12 +12,14 @@ else
1212
TARGET_OS=linux
1313
endif
1414

15+
MONO_ENV_OPTIONS ?=--llvm
16+
1517
publish:
1618
$(DOTNET) publish -c $(MONO_CONFIG) -r $(TARGET_OS)-$(MONO_ARCH)
1719

1820
run: publish
1921
COMPlus_DebugWriteToStdErr=1 \
20-
MONO_ENV_OPTIONS="--llvm" \
22+
MONO_ENV_OPTIONS="$(MONO_ENV_OPTIONS)" \
2123
$(TOP)artifacts/bin/HelloWorld/$(MONO_ARCH)/$(MONO_CONFIG)/$(TARGET_OS)-$(MONO_ARCH)/publish/HelloWorld
2224

2325
clean:

0 commit comments

Comments
 (0)