Skip to content

Commit 12a3277

Browse files
authored
Redo compile before - add fail on plainbuild error (#17103)
* Redo compile before - add fail on plainbuild error * temp * dotnet build it
1 parent b08afc5 commit 12a3277

File tree

5 files changed

+89
-9
lines changed

5 files changed

+89
-9
lines changed

azure-pipelines-PR.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ stages:
713713
- script: dotnet build .\FSharp.Compiler.Service.sln /bl:\"artifacts/log/$(_BuildConfig)/ServiceRegularBuild.binlog\"
714714
workingDirectory: $(Build.SourcesDirectory)
715715
displayName: Regular rebuild of FSharp.Compiler.Service.sln
716-
continueOnError: true
716+
continueOnError: false
717717
condition: always()
718718

719719
# Plain FCS build Linux
@@ -739,7 +739,7 @@ stages:
739739
- script: dotnet build ./FSharp.Compiler.Service.sln /bl:\"artifacts/log/$(_BuildConfig)/ServiceRegularBuild.binlog\"
740740
workingDirectory: $(Build.SourcesDirectory)
741741
displayName: Regular rebuild of FSharp.Compiler.Service.sln
742-
continueOnError: true
742+
continueOnError: false
743743
condition: always()
744744

745745
# Plain FCS build Mac
@@ -765,7 +765,7 @@ stages:
765765
- script: dotnet build ./FSharp.Compiler.Service.sln /bl:\"artifacts/log/$(_BuildConfig)/ServiceRegularBuild.binlog\"
766766
workingDirectory: $(Build.SourcesDirectory)
767767
displayName: Regular rebuild of FSharp.Compiler.Service.sln
768-
continueOnError: true
768+
continueOnError: false
769769
condition: always()
770770

771771
# Build and run fast benchmarks

src/FSharp.Build/Microsoft.FSharp.Targets

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ this file.
235235
</FSharpEmbedResXSource>
236236

237237
<ItemGroup>
238-
<CompileBefore Include="@(_FsGeneratedResXSource)" />
238+
<Compile Include="@(_FsGeneratedResXSource)" CompileOrder="CompileBefore" />
239239
<FsGeneratedSource Include="@(_FsGeneratedResXSource)" />
240240
<FileWrites Include="@(_FsGeneratedResXSource)" />
241241
</ItemGroup>
@@ -247,14 +247,35 @@ this file.
247247
</FSharpEmbedResourceText>
248248

249249
<ItemGroup>
250-
<CompileBefore Include="@(_FsGeneratedTxtSource)" />
250+
<Compile Include="@(_FsGeneratedTxtSource)" CompileOrder="CompileBefore" />
251251
<FsGeneratedSource Include="@(_FsGeneratedTxtSource)" />
252252
<EmbeddedResource Include="@(_FsGeneratedResx)" />
253253
<FileWrites Include="@(_FsGeneratedTxtSource)" />
254254
<FileWrites Include="@(_FsGeneratedResx)" />
255255
</ItemGroup>
256256
</Target>
257257

258+
<Target Name="FSharpSourceCodeCompileOrder">
259+
<!-- implement <CompileOrder>CompileBefore</CompileOrder> -->
260+
<ItemGroup>
261+
<__Sources Remove="@(__Sources)" />
262+
<__Sources Include="@(Compile->WithMetadataValue('CompileOrder', 'CompileFirst'))" />
263+
<__Sources Include="@(CompileBefore)" />
264+
<__Sources Include="@(Compile->WithMetadataValue('CompileOrder', 'CompileBefore'))" />
265+
<__Sources Include="@(Compile->WithMetadataValue('CompileOrder', ''))" />
266+
<__Sources Include="@(Compile->WithMetadataValue('CompileOrder', 'CompileAfter'))" />
267+
<__Sources Include="@(CompileAfter)" />
268+
<__Sources Include="@(Compile->WithMetadataValue('CompileOrder', 'CompileLast'))" />
269+
</ItemGroup>
270+
<ItemGroup>
271+
<Compile Remove="@(Compile)" />
272+
<CompileBefore Remove="@(CompileBefore)" />
273+
<CompileAfter Remove="@(CompileAfter)" />
274+
<Compile Include="@(__Sources)" />
275+
</ItemGroup>
276+
<Message Importance="low" Text="FSharpSourceCodeCompileOrder:Sources: '@(__Sources)'" />
277+
</Target>
278+
258279
<Target
259280
Name="CoreCompile"
260281
Inputs="$(MSBuildAllProjects);
@@ -284,7 +305,7 @@ this file.
284305
$(NonExistentFile);
285306
@(CustomAdditionalCompileOutputs)"
286307
Returns="@(FscCommandLineArgs)"
287-
DependsOnTargets="$(CoreCompileDependsOn)"
308+
DependsOnTargets="$(CoreCompileDependsOn);FSharpSourceCodeCompileOrder"
288309
>
289310

290311
<Error
@@ -321,6 +342,7 @@ this file.
321342
<EmbeddedFiles Include="@(FsGeneratedSource)" KeepDuplicates="false" Condition="'$(SourceLink)'!='' or '$(EmbeddedFiles)'!='' or '$(EmbedAllSources)'!=''" />
322343
</ItemGroup>
323344

345+
324346
<!-- Dotnet SDK requires SimpleResolution to be true Legacy project system build not -->
325347
<PropertyGroup>
326348
<FscOtherFlags Condition="'$(SimpleResolution)' == 'true'">--simpleresolution $(OtherFlags)</FscOtherFlags>
@@ -371,7 +393,7 @@ this file.
371393
Resources="@(ActualEmbeddedResources)"
372394
SkipCompilerExecution="$(SkipCompilerExecution)"
373395
SourceLink="$(SourceLink)"
374-
Sources="@(CompileBefore);@(Compile);@(CompileAfter)"
396+
Sources="@(Compile)"
375397
SubsystemVersion="$(SubsystemVersion)"
376398
Tailcalls="$(Tailcalls)"
377399
TargetType="$(OutputType)"
@@ -434,7 +456,7 @@ this file.
434456
Overwrite="true"/>
435457

436458
<ItemGroup Condition="'$(AdditionalSourcesText)' != ''">
437-
<CompileBefore Include="$(TargetFrameworkMonikerAssemblyAttributesPath)" />
459+
<Compile Include="$(TargetFrameworkMonikerAssemblyAttributesPath)"><CompileOrder>CompileBefore</CompileOrder></Compile>
438460
<_FsGeneratedTfmAttributesSource Include="$(TargetFrameworkMonikerAssemblyAttributesPath)" />
439461
</ItemGroup>
440462
</Target>

src/FSharp.Core/FSharp.Core.fsproj

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,25 @@
6161
</EmbeddedResource>
6262
<EmbeddedResource Include="ILLink.LinkAttributes.xml" LogicalName="ILLink.LinkAttributes.xml" />
6363
<EmbeddedResource Include="ILLink.Substitutions.xml" LogicalName="ILLink.Substitutions.xml" />
64+
</ItemGroup>
65+
<ItemGroup Condition="'$(Configuration)' == 'Proto' or '$(BUILDING_USING_DOTNET)' == 'true'">
66+
<!-- This can be removed once CompileBefore support is shipped in an rtm relase -->
6467
<CompileBefore Include="prim-types-prelude.fsi">
6568
<Link>Primitives/prim-types-prelude.fsi</Link>
6669
</CompileBefore>
6770
<CompileBefore Include="prim-types-prelude.fs">
6871
<Link>Primitives/prim-types-prelude.fs</Link>
6972
</CompileBefore>
73+
</ItemGroup>
74+
<ItemGroup Condition="'$(Configuration)' != 'Proto' and '$(BUILDING_USING_DOTNET)' != 'true'">
75+
<Compile Include="prim-types-prelude.fsi" CompileOrder="CompileFirst">
76+
<Link>Primitives/prim-types-prelude.fsi</Link>
77+
</Compile>
78+
<Compile Include="prim-types-prelude.fs" CompileOrder="CompileFirst">
79+
<Link>Primitives/prim-types-prelude.fs</Link>
80+
</Compile>
81+
</ItemGroup>
82+
<ItemGroup>
7083
<Compile Include="prim-types.fsi">
7184
<Link>Primitives/prim-types.fsi</Link>
7285
</Compile>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<Project ToolsVersion="4.0" DefaultTargets="Test" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
3+
<!-- Initialize Variables -->
4+
<PropertyGroup>
5+
<FSharpCompilerPath></FSharpCompilerPath>
6+
</PropertyGroup>
7+
8+
<!-- Expected Values -->
9+
<PropertyGroup>
10+
<ExpectedFSharpShimPresent>true</ExpectedFSharpShimPresent>
11+
<ExpectedFSharpCompilerPath>/Common7/IDE/CommonExtensions/Microsoft/FSharp/Tools/</ExpectedFSharpCompilerPath>
12+
<ExpectedFscToolExe>fscAnyCpu.exe</ExpectedFscToolExe>
13+
<ExpectedFscToolPath>_VsInstallRoot_/Common7/IDE/CommonExtensions/Microsoft/FSharp/Tools/</ExpectedFscToolPath>
14+
<ExpectedDotnetFscCompilerPath></ExpectedDotnetFscCompilerPath>
15+
<ExpectedCompile>One;Two;Three;Four;Five;Six;Seven;Eight;Nine;Ten;Eleven;Twelve;Thirteen;Fourteen</ExpectedCompile>
16+
</PropertyGroup>
17+
18+
<Import Project="ToolsTest.props" />
19+
20+
<PropertyGroup>
21+
</PropertyGroup>
22+
23+
<ItemGroup>
24+
<CompileAfter Include="Eleven" />
25+
<Compile Include="Thirteen" CompileOrder="CompileLast" />
26+
<CompileBefore Include="Three" />
27+
<CompileAfter Include="Twelve" />
28+
<CompileBefore Include="Four" />
29+
<Compile Include="Seven" />
30+
<Compile Include="Eight" />
31+
<Compile Include="Five" CompileOrder="CompileBefore" />
32+
<Compile Include="One" CompileOrder="CompileFirst" />
33+
<Compile Include="Nine" CompileOrder="CompileAfter" />
34+
<Compile Include="Fourteen" CompileOrder="CompileLast" />
35+
<Compile Include="Ten" CompileOrder="CompileAfter" />
36+
<Compile Include="Two" CompileOrder="CompileFirst" />
37+
<Compile Include="Six" CompileOrder="CompileBefore" />
38+
</ItemGroup>
39+
40+
<Import Project="ToolsTest.targets" />
41+
42+
</Project>

tests/fsharp/SDKTests/tests/ToolsTest.targets

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
<Import Project="$(TargetsDirectory)\Microsoft.FSharp.targets" />
66

7-
<Target Name="Test">
7+
<Target Name="Test" DependsOnTargets="FSharpSourceCodeCompileOrder">
88
<Message Importance="High" Text="===========================================================================================================" />
99
<Message Importance="High" Text="Testing : $(MSBuildProjectName)" />
1010

11+
1112
<!-- check for expected settings -->
1213
<Error Condition="'$(ExpectedFSharpShimPresent)' != '$(FSharp_Shim_Present)'" Text="FSharp_Shim_Present expected:'$(ExpectedFSharpShimPresent)' actual: '$(FSharp_Shim_Present)'" />
1314

@@ -17,6 +18,8 @@
1718

1819
<Error Condition="'$(ExpectedFscToolPath)' != '$(FscToolPath)'" Text="FscToolPath: expected:'$(ExpectedFscToolPath)' actual:'$(FscToolPath)'" />
1920

21+
<Error Condition="'$(ExpectedCompile)' != '' and '$(ExpectedCompile)' != '@(Compile)'" Text="ExpectedCompile: expected:'$(ExpectedCompile)' actual:'@(Compile)'" />
22+
2023
<Error Condition="'$(ExpectedDotnetFscCompilerPath)' == '' and '$(DotnetFscCompilerPath)' != ''" Text="DotnetFscCompilerPath expected to be empty actual:'$(DotnetFscCompilerPath)'" />
2124

2225
<Error Condition="'$(ExpectedDotnetFscCompilerPath)' != '' and $([System.String]::new('$(DotnetFscCompilerPath)').EndsWith('$(ExpectedDotnetFscCompilerPath)')) == true" Text="DotnetFscCompilerPath expected to end with: '$(ExpectedDotnetFscCompilerPath)' actual:'$(DotnetFscCompilerPath)'" />

0 commit comments

Comments
 (0)