@@ -44,14 +44,16 @@ public class CSharpAutobuilder : Autobuilder<CSharpAutobuildOptions>
44
44
public override BuildScript GetBuildScript ( )
45
45
{
46
46
var attempt = BuildScript . Failure ;
47
- switch ( BuildStrategy )
47
+ switch ( GetCSharpBuildStrategy ( ) )
48
48
{
49
49
case CSharpBuildStrategy . CustomBuildCommand :
50
50
attempt = new BuildCommandRule ( DotNetRule . WithDotNet ) . Analyse ( this , false ) & CheckExtractorRun ( true ) ;
51
51
break ;
52
52
case CSharpBuildStrategy . Buildless :
53
53
// No need to check that the extractor has been executed in buildless mode
54
- attempt = new StandaloneBuildRule ( ) . Analyse ( this , false ) ;
54
+ attempt = BuildScript . Bind (
55
+ AddBuildlessStartedDiagnostic ( ) & new StandaloneBuildRule ( ) . Analyse ( this , false ) ,
56
+ AddBuildlessEndedDiagnostic ) ;
55
57
break ;
56
58
case CSharpBuildStrategy . MSBuild :
57
59
attempt = new MsBuildRule ( ) . Analyse ( this , false ) & CheckExtractorRun ( true ) ;
@@ -86,6 +88,52 @@ public BuildScript CheckExtractorRun(bool warnOnFailure) =>
86
88
return 1 ;
87
89
} ) ;
88
90
91
+ private BuildScript AddBuildlessStartedDiagnostic ( )
92
+ {
93
+ return BuildScript . Create ( actions =>
94
+ {
95
+ AddDiagnostic ( new DiagnosticMessage (
96
+ Options . Language ,
97
+ "buildless/mode-active" ,
98
+ "C# with build-mode set to 'none'" ,
99
+ visibility : new DiagnosticMessage . TspVisibility ( statusPage : true , cliSummaryTable : true , telemetry : true ) ,
100
+ markdownMessage : "C# with build-mode set to 'none'. This means that all C# source in the working directory will be scanned, with build tools, such as Nuget and Dotnet CLIs, only contributing information about external dependencies." ,
101
+ severity : DiagnosticMessage . TspSeverity . Note
102
+ ) ) ;
103
+ return 0 ;
104
+ } ) ;
105
+ }
106
+
107
+ private BuildScript AddBuildlessEndedDiagnostic ( int buildResult )
108
+ {
109
+ return BuildScript . Create ( actions =>
110
+ {
111
+ if ( buildResult == 0 )
112
+ {
113
+ AddDiagnostic ( new DiagnosticMessage (
114
+ Options . Language ,
115
+ "buildless/complete" ,
116
+ "C# analysis with build-mode 'none' completed" ,
117
+ visibility : new DiagnosticMessage . TspVisibility ( statusPage : false , cliSummaryTable : true , telemetry : true ) ,
118
+ markdownMessage : "C# analysis with build-mode 'none' completed." ,
119
+ severity : DiagnosticMessage . TspSeverity . Unknown
120
+ ) ) ;
121
+ }
122
+ else
123
+ {
124
+ AddDiagnostic ( new DiagnosticMessage (
125
+ Options . Language ,
126
+ "buildless/failed" ,
127
+ "C# analysis with build-mode 'none' failed" ,
128
+ visibility : new DiagnosticMessage . TspVisibility ( statusPage : true , cliSummaryTable : true , telemetry : true ) ,
129
+ markdownMessage : "C# analysis with build-mode 'none' failed." ,
130
+ severity : DiagnosticMessage . TspSeverity . Error
131
+ ) ) ;
132
+ }
133
+ return buildResult ;
134
+ } ) ;
135
+ }
136
+
89
137
protected override void AutobuildFailureDiagnostic ( )
90
138
{
91
139
// if `ScriptPath` is not null here, the `BuildCommandAuto` rule was
@@ -218,10 +266,6 @@ private CSharpBuildStrategy GetCSharpBuildStrategy()
218
266
return CSharpBuildStrategy . Auto ;
219
267
}
220
268
221
- private CSharpBuildStrategy ? buildStrategy = null ;
222
- private CSharpBuildStrategy BuildStrategy => buildStrategy ??= GetCSharpBuildStrategy ( ) ;
223
- public override bool IsBuildless => BuildStrategy == CSharpBuildStrategy . Buildless ;
224
-
225
269
private enum CSharpBuildStrategy
226
270
{
227
271
CustomBuildCommand ,
0 commit comments