Skip to content

Commit 254efcb

Browse files
CI leg to build with langverion=preview (#15637)
* CI leg to build with langverion=preview * Fix unit tests * fix msbuild prop * Only run release --------- Co-authored-by: Kevin Ransom (msft) <[email protected]>
1 parent 786a33b commit 254efcb

File tree

10 files changed

+218
-168
lines changed

10 files changed

+218
-168
lines changed

Directory.Build.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<Project>
22

33
<PropertyGroup>
4+
<LangVersion Condition="'$(FSharpLangVersion)' != ''">$(FSharpLangVersion)</LangVersion>
45
<RepoRoot Condition="'$(RepoRoot)' == ''">$(MSBuildThisFileDirectory)</RepoRoot>
56
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
67
</PropertyGroup>

azure-pipelines.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,32 @@ stages:
321321
helixRepo: dotnet/fsharp
322322
jobs:
323323

324+
- job: WindowsLangVersionPreview
325+
pool:
326+
# The PR build definition sets this variable:
327+
# WindowsMachineQueueName=Windows.vs2022.amd64.open
328+
# and there is an alternate build definition that sets this to a queue that is always scouting the
329+
# next preview of Visual Studio.
330+
name: $(DncEngPublicBuildPool)
331+
demands: ImageOverride -equals $(WindowsMachineQueueName)
332+
timeoutInMinutes: 120
333+
steps:
334+
- checkout: self
335+
clean: true
336+
337+
- script: eng\CIBuild.cmd -compressallmetadata -configuration Release /p:FSharpLangVersion=preview
338+
displayName: Build
339+
340+
- task: PublishBuildArtifacts@1
341+
displayName: Publish Build BinLog
342+
condition: always()
343+
continueOnError: true
344+
inputs:
345+
PathToPublish: '$(Build.SourcesDirectory)\artifacts\log/Release\Build.VisualFSharp.sln.binlog'
346+
ArtifactName: 'Windows Release build binlogs'
347+
ArtifactType: Container
348+
parallel: true
349+
324350
# Windows With Compressed Metadata
325351
- job: WindowsCompressedMetadata
326352
variables:
@@ -371,7 +397,7 @@ stages:
371397
displayName: Build / Integration Test
372398
continueOnError: true
373399
condition: eq(variables['_testKind'], 'testIntegration')
374-
400+
375401
- task: PublishTestResults@2
376402
displayName: Publish Test Results
377403
inputs:

eng/Build.ps1

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ function BuildSolution([string] $solutionName, $nopack) {
280280
/v:$verbosity `
281281
$suppressExtensionDeployment `
282282
@properties
283-
283+
284284
$env:BUILDING_USING_DOTNET=$BUILDING_USING_DOTNET_ORIG
285285
}
286286

@@ -340,15 +340,15 @@ function TestUsingMSBuild([string] $testProject, [string] $targetFramework, [str
340340
if ($env:RunningAsPullRequest -ne "true" -and $noTestFilter -eq $false) {
341341
$args += " --filter TestCategory!=PullRequest"
342342
}
343-
343+
344344
if ($asBackgroundJob) {
345345
Write-Host("Starting on the background: $args")
346346
Write-Host("------------------------------------")
347-
$bgJob = Start-Job -ScriptBlock {
347+
$bgJob = Start-Job -ScriptBlock {
348348
& $using:dotnetExe test $using:testProject -c $using:configuration -f $using:targetFramework -v n --test-adapter-path $using:testadapterpath --logger "nunit;LogFilePath=$using:testLogPath" /bl:$using:testBinLogPath --blame --results-directory $using:ArtifactsDir\TestResults\$using:configuration
349-
if ($LASTEXITCODE -ne 0) {
350-
throw "Command failed to execute with exit code $($LASTEXITCODE): $using:dotnetExe $using:args"
351-
}
349+
if ($LASTEXITCODE -ne 0) {
350+
throw "Command failed to execute with exit code $($LASTEXITCODE): $using:dotnetExe $using:args"
351+
}
352352
}
353353
return $bgJob
354354
} else{
@@ -570,10 +570,10 @@ try {
570570
TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Private.Scripting.UnitTests\"
571571
TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Build.UnitTests\FSharp.Build.UnitTests.fsproj" -targetFramework $coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Build.UnitTests\"
572572
TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Core.UnitTests\"
573-
573+
574574
# Collect output from background jobs
575575
Wait-job $bgJob | out-null
576-
Receive-Job $bgJob -ErrorAction Stop
576+
Receive-Job $bgJob -ErrorAction Stop
577577
}
578578

579579
if ($testDesktop) {
@@ -585,7 +585,7 @@ try {
585585
TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Private.Scripting.UnitTests\"
586586
TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Build.UnitTests\FSharp.Build.UnitTests.fsproj" -targetFramework $desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Build.UnitTests\"
587587
TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Core.UnitTests\"
588-
588+
589589
# Collect output from background jobs
590590
Wait-job $bgJob | out-null
591591
Receive-Job $bgJob -ErrorAction Stop

vsintegration/src/FSharp.ProjectSystem.PropertyPages/FSharp.ProjectSystem.PropertyPages.vbproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<OutputType>Library</OutputType>
66
<RootNamespace>
77
</RootNamespace>
8+
<LangVersion>latest</LangVersion>
89
<AssemblyAttributeComVisible>true</AssemblyAttributeComVisible>
910
<AssemblyName>FSharp.ProjectSystem.PropertyPages</AssemblyName>
1011
<UseVsVersion>true</UseVsVersion>

vsintegration/tests/Salsa/salsa.fs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,17 @@ module internal Salsa =
299299
newProjectSite
300300

301301
/// Token types.
302-
type TokenType = Text | Keyword | Comment | Identifier | String | Number | InactiveCode | PreprocessorKeyword | Operator
303-
with override this.ToString() =
302+
type TokenType =
303+
| Text
304+
| Keyword
305+
| Comment
306+
| Identifier
307+
| String
308+
| Number
309+
| InactiveCode
310+
| PreprocessorKeyword
311+
| Operator
312+
override this.ToString() =
304313
match this with
305314
| Text -> "Text"
306315
| Keyword -> "Keyword"

vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorList.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ type UsingMSBuild() as this =
4040
let errorList = GetErrors(project)
4141
[for error in errorList do
4242
if (error.Severity = Microsoft.VisualStudio.FSharp.LanguageService.Severity.Warning) then
43-
yield error]
43+
yield error]
4444

4545
let CheckErrorList (content : string) f : unit =
4646
let (_, project, file) = this.CreateSingleFileProject(content)

vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorRecovery.fs

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -244,25 +244,26 @@ type UsingMSBuild() =
244244
[<Test>]
245245
member public this.``ErrorRecovery.5878_1``() =
246246
Helper.AssertMemberDataTipContainsInOrder
247-
(this.TestRunner,
248-
(*code *)
249-
[
250-
"module Module ="
251-
" /// Union comment"
252-
" type Union ="
253-
" /// Case comment"
254-
" | Case of int"
255-
"Module."
256-
] ,
257-
(* marker *)
258-
"Module.",
259-
(* completed item *)
260-
"Case",
261-
(* expect to see in order... *)
262-
[
263-
"union case Module.Union.Case: int -> Module.Union";
264-
"Case comment";
265-
]
247+
(
248+
this.TestRunner,
249+
(*code *)
250+
[
251+
"module Module ="
252+
" /// Union comment"
253+
" type Union ="
254+
" /// Case comment"
255+
" | Case of int"
256+
"Module."
257+
] ,
258+
(* marker *)
259+
"Module.",
260+
(* completed item *)
261+
"Case",
262+
(* expect to see in order... *)
263+
[
264+
"union case Module.Union.Case: int -> Module.Union";
265+
"Case comment";
266+
]
266267
)
267268

268269

vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.GotoDefinition.fs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,10 @@ type UsingMSBuild() =
216216
// A0(*ColumnMarker*)1234567890
217217
// B01234567890
218218
// C01234567890 """,
219-
"T(*GotoValDef*)",
220-
"// A0(*ColumnMarker*)1234567890",
221-
PathRelativeToTestAssembly(@"DefinitionLocationAttribute.dll"),
222-
"(*ColumnMarker*)")
219+
"T(*GotoValDef*)",
220+
"// A0(*ColumnMarker*)1234567890",
221+
PathRelativeToTestAssembly(@"DefinitionLocationAttribute.dll"),
222+
"(*ColumnMarker*)")
223223

224224
// This test case checks the type with space in between like N.``T T`` for GotoDefinition
225225
let ``Type.SpaceInTheType``() =
@@ -228,10 +228,10 @@ type UsingMSBuild() =
228228
// A0(*ColumnMarker*)1234567890
229229
// B01234567890
230230
// C01234567890 """,
231-
"T``",
232-
"// A0(*ColumnMarker*)1234567890",
233-
PathRelativeToTestAssembly(@"DefinitionLocationAttributeWithSpaceInTheType.dll"),
234-
"(*ColumnMarker*)")
231+
"T``",
232+
"// A0(*ColumnMarker*)1234567890",
233+
PathRelativeToTestAssembly(@"DefinitionLocationAttributeWithSpaceInTheType.dll"),
234+
"(*ColumnMarker*)")
235235

236236
// Basic scenario on a provided Constructor
237237
let ``Constructor.BasicScenario``() =
@@ -241,10 +241,10 @@ type UsingMSBuild() =
241241
// A0(*ColumnMarker*)1234567890
242242
// B01234567890
243243
// C01234567890 """,
244-
"T(*GotoValDef*)",
245-
"// A0(*ColumnMarker*)1234567890",
246-
PathRelativeToTestAssembly(@"DefinitionLocationAttribute.dll"),
247-
"(*ColumnMarker*)")
244+
"T(*GotoValDef*)",
245+
"// A0(*ColumnMarker*)1234567890",
246+
PathRelativeToTestAssembly(@"DefinitionLocationAttribute.dll"),
247+
"(*ColumnMarker*)")
248248

249249
// Basic scenario on a provided Method
250250
let ``Method.BasicScenario``() =
@@ -253,10 +253,10 @@ type UsingMSBuild() =
253253
// A0(*ColumnMarker*)1234567890
254254
// B01234567890
255255
// C01234567890 """,
256-
"M(*GotoValDef*)",
257-
"// A0(*ColumnMarker*)1234567890",
258-
PathRelativeToTestAssembly(@"DefinitionLocationAttribute.dll"),
259-
"(*ColumnMarker*)")
256+
"M(*GotoValDef*)",
257+
"// A0(*ColumnMarker*)1234567890",
258+
PathRelativeToTestAssembly(@"DefinitionLocationAttribute.dll"),
259+
"(*ColumnMarker*)")
260260

261261
// Basic scenario on a provided Property
262262
let ``Property.BasicScenario``() =
@@ -265,10 +265,10 @@ type UsingMSBuild() =
265265
// A0(*ColumnMarker*)1234567890
266266
// B01234567890
267267
// C01234567890 """,
268-
"StaticProp(*GotoValDef*)",
269-
"// A0(*ColumnMarker*)1234567890",
270-
PathRelativeToTestAssembly(@"DefinitionLocationAttribute.dll"),
271-
"(*ColumnMarker*)")
268+
"StaticProp(*GotoValDef*)",
269+
"// A0(*ColumnMarker*)1234567890",
270+
PathRelativeToTestAssembly(@"DefinitionLocationAttribute.dll"),
271+
"(*ColumnMarker*)")
272272

273273
// Basic scenario on a provided Event
274274
let ``Event.BasicScenario``() =
@@ -278,10 +278,10 @@ type UsingMSBuild() =
278278
// A0(*ColumnMarker*)1234567890
279279
// B01234567890
280280
// C01234567890 """,
281-
"Event1(*GotoValDef*)",
282-
"// A0(*ColumnMarker*)1234567890",
283-
PathRelativeToTestAssembly(@"DefinitionLocationAttribute.dll"),
284-
"(*ColumnMarker*)")
281+
"Event1(*GotoValDef*)",
282+
"// A0(*ColumnMarker*)1234567890",
283+
PathRelativeToTestAssembly(@"DefinitionLocationAttribute.dll"),
284+
"(*ColumnMarker*)")
285285

286286
// Actually execute all the scenarios...
287287
``Type.BasicScenario``()

vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Miscellaneous.fs

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -496,42 +496,45 @@ type Miscellaneous() =
496496

497497
[<Test>]
498498
member this.``MSBuildExtensibility.BrokenCompileDependsOn.WithRecovery`` () =
499-
this.MakeProjectAndDoWithProjectFileAndConfigChangeNotifier(["foo.fs";"bar.fs"], [],
500-
// define a legal 'Foo' configuration
501-
@"<PropertyGroup Condition="" '$(Configuration)|$(Platform)' == 'Foo|AnyCPU' "">
502-
<DebugSymbols>true</DebugSymbols>
503-
<DebugType>full</DebugType>
504-
<Optimize>false</Optimize>
505-
<OutputPath>bin\Debug\</OutputPath>
506-
<DefineConstants>DEBUG;TRACE</DefineConstants>
507-
<ErrorReport>prompt</ErrorReport>
508-
<WarningLevel>3</WarningLevel>
509-
</PropertyGroup>", fun project configChangeNotifier projFile ->
510-
let projFileText = File.ReadAllText(projFile)
511-
// We need to add text _after_ the import of Microsoft.FSharp.Targets.
512-
let i = projFileText.IndexOf("<Import Project=")
513-
let i = projFileText.IndexOf(">", i)
514-
let newProjFileText = projFileText.Insert(i+1, @"
515-
<PropertyGroup>
516-
<CompileDependsOn>MyTarget;$(CompileDependsOn)</CompileDependsOn>
517-
</PropertyGroup>
518-
<Target Name=""MyTarget"">
519-
<Error Condition="" '$(Configuration)'!='Foo' "" Text=""This is my error message."" ContinueOnError=""false"" />
520-
</Target>")
521-
File.WriteAllText(projFile, newProjFileText)
522-
project.Reload()
523-
// Ensure we are not in 'Foo' config, and thus expect failure
524-
let curCfgCanonicalName = this.GetCurrentConfigCanonicalName(project)
525-
Assert.IsFalse(curCfgCanonicalName.StartsWith("Foo"), sprintf "default config should not be 'Foo'! in fact it had canonical name '%s'" curCfgCanonicalName)
526-
// Now the project system is in a state where ComputeSourcesAndFlags will fail.
527-
// Our goal is to at least be able to open individual source files and treat them like 'files outside a project' with regards to intellisense, etc.
528-
// Also, if the user does 'Build', he will get an error which will help diagnose the problem.
529-
let ipps = project :> IProvideProjectSite
530-
let ips = ipps.GetProjectSite()
531-
let expected = [| |] // Ideal behavior is [|"foo.fs";"bar.fs"|], and we could choose to improve this in the future. For now we are just happy to now throw/crash.
532-
let actual = ips.CompilationSourceFiles
533-
Assert.AreEqual(expected, actual, "project site did not report expected set of source files")
534-
)
499+
this.MakeProjectAndDoWithProjectFileAndConfigChangeNotifier(
500+
["foo.fs";"bar.fs"],
501+
[],
502+
// define a legal 'Foo' configuration
503+
@"<PropertyGroup Condition="" '$(Configuration)|$(Platform)' == 'Foo|AnyCPU' "">
504+
<DebugSymbols>true</DebugSymbols>
505+
<DebugType>full</DebugType>
506+
<Optimize>false</Optimize>
507+
<OutputPath>bin\Debug\</OutputPath>
508+
<DefineConstants>DEBUG;TRACE</DefineConstants>
509+
<ErrorReport>prompt</ErrorReport>
510+
<WarningLevel>3</WarningLevel>
511+
</PropertyGroup>",
512+
fun project configChangeNotifier projFile ->
513+
let projFileText = File.ReadAllText(projFile)
514+
// We need to add text _after_ the import of Microsoft.FSharp.Targets.
515+
let i = projFileText.IndexOf("<Import Project=")
516+
let i = projFileText.IndexOf(">", i)
517+
let newProjFileText = projFileText.Insert(i+1, @"
518+
<PropertyGroup>
519+
<CompileDependsOn>MyTarget;$(CompileDependsOn)</CompileDependsOn>
520+
</PropertyGroup>
521+
<Target Name=""MyTarget"">
522+
<Error Condition="" '$(Configuration)'!='Foo' "" Text=""This is my error message."" ContinueOnError=""false"" />
523+
</Target>")
524+
File.WriteAllText(projFile, newProjFileText)
525+
project.Reload()
526+
// Ensure we are not in 'Foo' config, and thus expect failure
527+
let curCfgCanonicalName = this.GetCurrentConfigCanonicalName(project)
528+
Assert.IsFalse(curCfgCanonicalName.StartsWith("Foo"), sprintf "default config should not be 'Foo'! in fact it had canonical name '%s'" curCfgCanonicalName)
529+
// Now the project system is in a state where ComputeSourcesAndFlags will fail.
530+
// Our goal is to at least be able to open individual source files and treat them like 'files outside a project' with regards to intellisense, etc.
531+
// Also, if the user does 'Build', he will get an error which will help diagnose the problem.
532+
let ipps = project :> IProvideProjectSite
533+
let ips = ipps.GetProjectSite()
534+
let expected = [| |] // Ideal behavior is [|"foo.fs";"bar.fs"|], and we could choose to improve this in the future. For now we are just happy to now throw/crash.
535+
let actual = ips.CompilationSourceFiles
536+
Assert.AreEqual(expected, actual, "project site did not report expected set of source files")
537+
)
535538

536539
[<Test>]
537540
member public this.TestBuildActions () =

0 commit comments

Comments
 (0)