Skip to content

Commit 852c4ca

Browse files
committed
Done
1 parent 214abda commit 852c4ca

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,26 @@ public void Execute(GeneratorExecutionContext context)
2626
var opts = context.AnalyzerConfigOptions.GlobalOptions;
2727
var properties = opts.Keys.Where(x => x.StartsWith("build_property.")).ToList();
2828
if (properties.Count == 0)
29+
{
2930
return;
31+
}
3032

31-
if (opts.TryGetValue("build_property.SentryDisableSourceGenerator", out var disable) && disable.Equals("true", StringComparison.InvariantCultureIgnoreCase))
33+
if (opts.TryGetValue("build_property.SentryDisableSourceGenerator", out var disable) &&
34+
disable.Equals("true", StringComparison.InvariantCultureIgnoreCase))
35+
{
3236
return;
37+
}
3338

3439
// we only want to generate code where host setup takes place
3540
if (!opts.TryGetValue("build_property.outputtype", out var outputType))
41+
{
3642
return;
43+
}
3744

3845
if (!outputType.Equals("exe", StringComparison.InvariantCultureIgnoreCase))
46+
{
3947
return;
48+
}
4049

4150
var sb = new StringBuilder();
4251
sb
@@ -49,9 +58,6 @@ public void Execute(GeneratorExecutionContext context)
4958
// </auto-generated>
5059
5160
#if NET8_0_OR_GREATER
52-
using System;
53-
using System.Collections.Generic;
54-
5561
namespace Sentry;
5662
5763
[global::System.Runtime.CompilerServices.CompilerGenerated]

test/Sentry.Tests/Sentry.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.1" />
4444
</ItemGroup>
4545

46-
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0' OR '$(TargetFramework)' == 'net8.0'">
46+
<ItemGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
4747
<ProjectReference Include="..\..\src\Sentry.SourceGenerators\Sentry.SourceGenerators.csproj"/>
4848
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" PrivateAssets="all"/>
4949
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" PrivateAssets="all"/>

0 commit comments

Comments
 (0)