Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 96 additions & 29 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ variables:
value: .NETCore
- name: VisualStudioDropName
value: Products/$(System.TeamProject)/$(Build.Repository.Name)/$(Build.SourceBranchName)/$(Build.BuildNumber)
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- name: _DotNetValidationArtifactsCategory
value: .NETCoreValidation
- group: DotNet-FSharp-SDLValidation-Params
- ${{ if and(eq(variables['System.TeamProject'], 'public'), eq(variables['Build.Reason'], 'PullRequest')) }}:
- name: RunningAsPullRequest
value: true
Expand All @@ -75,11 +79,11 @@ stages:
# Signed build #
#-------------------------------------------------------------------------------------------------------------------#
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/release/dev17.2') }}:
- ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/release/dev17.3') }}:
- template: /eng/common/templates/job/onelocbuild.yml
parameters:
MirrorRepo: fsharp
MirrorBranch: release/dev17.2
MirrorBranch: release/dev17.3
LclSource: lclFilesfromPackage
LclPackageId: 'LCL-JUNO-PROD-FSHARP'
- template: /eng/common/templates/jobs/jobs.yml
Expand Down Expand Up @@ -179,6 +183,78 @@ stages:
AccessToken: $(dn-bot-devdiv-drop-rw-code-rw)
condition: succeeded()

#-------------------------------------------------------------------------------------------------------------------#
# PR builds without logs publishing #
#-------------------------------------------------------------------------------------------------------------------#
- ${{ if eq(variables['System.TeamProject'], 'public') }}:
- template: /eng/common/templates/jobs/jobs.yml
parameters:
enableMicrobuild: false
enablePublishBuildArtifacts: false
enablePublishTestResults: false
enablePublishBuildAssets: false
enablePublishUsingPipelines: $(_PublishUsingPipelines)
enableSourceBuild: false
enableTelemetry: true
helixRepo: dotnet/fsharp
jobs:
# Determinism, we want to run it only in PR builds
- job: Determinism_Debug
condition: eq(variables['Build.Reason'], 'PullRequest')
variables:
- name: _SignType
value: Test
pool:
name: NetCore1ESPool-Public
demands: ImageOverride -equals $(WindowsMachineQueueName)
timeoutInMinutes: 90
steps:
- checkout: self
clean: true
- task: UseDotNet@2
displayName: install SDK
inputs:
packageType: sdk
useGlobalJson: true
includePreviewVersions: false
workingDirectory: $(Build.SourcesDirectory)
installationPath: $(Build.SourcesDirectory)/.dotnet
- script: .\eng\test-determinism.cmd -configuration Debug
displayName: Determinism tests with Debug configuration
- task: PublishPipelineArtifact@1
displayName: Publish Determinism Logs
inputs:
targetPath: '$(Build.SourcesDirectory)/artifacts/log/Debug'
artifactName: 'Determinism_Debug Attempt $(System.JobAttempt) Logs'
continueOnError: true
condition: not(succeeded())

# Check code formatting
- job: CheckCodeFormatting
pool:
vmImage: $(UbuntuMachineQueueName)
steps:
- checkout: self
clean: true
- script: dotnet --list-sdks
displayName: Report dotnet SDK versions
- task: UseDotNet@2
displayName: install SDK
inputs:
packageType: sdk
useGlobalJson: true
includePreviewVersions: true
workingDirectory: $(Build.SourcesDirectory)
installationPath: $(Agent.ToolsDirectory)/dotnet
- script: dotnet tool restore
env:
DOTNET_ROLL_FORWARD_TO_PRERELEASE: 1
displayName: Install tools
- script: dotnet fantomas src -r --check
env:
DOTNET_ROLL_FORWARD_TO_PRERELEASE: 1
displayName: Check code formatting (run 'dotnet fantomas src -r' to fix)

#-------------------------------------------------------------------------------------------------------------------#
# PR builds #
#-------------------------------------------------------------------------------------------------------------------#
Expand All @@ -199,7 +275,7 @@ stages:
- job: Windows
pool:
# The PR build definition sets this variable:
# WindowsMachineQueueName=Build.Windows.10.Amd64.VS2019.Open
# WindowsMachineQueueName=Windows.vs2022.amd64.open
# and there is an alternate build definition that sets this to a queue that is always scouting the
# next preview of Visual Studio.
name: NetCore1ESPool-Public
Expand Down Expand Up @@ -356,29 +432,6 @@ stages:
- script: .\tests\EndToEndBuildTests\EndToEndBuildTests.cmd -c Release
displayName: End to end build tests

# Determinism, we want to run it only in PR builds
- job: Determinism_Debug
condition: eq(variables['Build.Reason'], 'PullRequest')
variables:
- name: _SignType
value: Test
pool:
name: NetCore1ESPool-Public
demands: ImageOverride -equals $(WindowsMachineQueueName)
timeoutInMinutes: 90
steps:
- checkout: self
clean: true
- script: .\eng\test-determinism.cmd -configuration Debug
displayName: Determinism tests with Debug configuration
- task: PublishPipelineArtifact@1
displayName: Publish Determinism Logs
inputs:
targetPath: '$(Build.SourcesDirectory)/artifacts/log/Debug'
artifactName: 'Determinism_Debug Attempt $(System.JobAttempt) Logs'
continueOnError: true
condition: not(succeeded())

# Up-to-date - disabled due to it being flaky
#- job: UpToDate_Windows
# pool:
Expand Down Expand Up @@ -420,7 +473,7 @@ stages:
DOTNET_ROLL_FORWARD_TO_PRERELEASE: 1
displayName: Regular rebuild of FSharp.sln
- script: dotnet build .\FSharp.Compiler.Service.sln /bl:\"artifacts/log/$(_BuildConfig)/ServiceRegularBuild.binlog\"
workingDirectory: $(Build.SourcesDirectory)/service
workingDirectory: $(Build.SourcesDirectory)
env:
DOTNET_ROLL_FORWARD_TO_PRERELEASE: 1
displayName: Regular rebuild of FSharp.Compiler.Service.sln
Expand Down Expand Up @@ -452,7 +505,7 @@ stages:
DOTNET_ROLL_FORWARD_TO_PRERELEASE: 1
displayName: Regular rebuild of FSharp.sln
- script: dotnet build ./FSharp.Compiler.Service.sln /bl:\"artifacts/log/$(_BuildConfig)/ServiceRegularBuild.binlog\"
workingDirectory: $(Build.SourcesDirectory)/service
workingDirectory: $(Build.SourcesDirectory)
env:
DOTNET_ROLL_FORWARD_TO_PRERELEASE: 1
displayName: Regular rebuild of FSharp.Compiler.Service.sln
Expand Down Expand Up @@ -484,7 +537,7 @@ stages:
DOTNET_ROLL_FORWARD_TO_PRERELEASE: 1
displayName: Regular rebuild of FSharp.sln
- script: dotnet build ./FSharp.Compiler.Service.sln /bl:\"artifacts/log/$(_BuildConfig)/ServiceRegularBuild.binlog\"
workingDirectory: $(Build.SourcesDirectory)/service
workingDirectory: $(Build.SourcesDirectory)
env:
DOTNET_ROLL_FORWARD_TO_PRERELEASE: 1
displayName: Regular rebuild of FSharp.Compiler.Service.sln
Expand Down Expand Up @@ -515,6 +568,20 @@ stages:
enableSymbolValidation: false
# SourceLink improperly looks for generated files. See https://github.com/dotnet/arcade/issues/3069
enableSourceLinkValidation: false
# Enable SDL validation, passing through values from the 'DotNet-FSharp-SDLValidation-Params' group.
SDLValidationParameters:
enable: true
params: >-
-SourceToolsList @("policheck","credscan")
-TsaInstanceURL $(_TsaInstanceURL)
-TsaProjectName $(_TsaProjectName)
-TsaNotificationEmail $(_TsaNotificationEmail)
-TsaCodebaseAdmin $(_TsaCodebaseAdmin)
-TsaBugAreaPath $(_TsaBugAreaPath)
-TsaIterationPath $(_TsaIterationPath)
-TsaRepositoryName "FSharp"
-TsaCodebaseName "FSharp-GitHub"
-TsaPublish $True

#---------------------------------------------------------------------------------------------------------------------#
# VS Insertion #
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ type internal HackCpsCommandLineChanges
/// This handles commandline change notifications from the Dotnet Project-system
/// Prior to VS 15.7 path contained path to project file, post 15.7 contains target binpath
/// binpath is more accurate because a project file can have multiple in memory projects based on configuration
member _.HandleCommandLineChanges(path:string, sources:ImmutableArray<CommandLineSourceFile>, _references:ImmutableArray<CommandLineReference>, options:ImmutableArray<string>) =
member _.HandleCommandLineChanges(path:string, sources:ImmutableArray<CommandLineSourceFile>, references:ImmutableArray<CommandLineReference>, options:ImmutableArray<string>) =
use _logBlock = Logger.LogBlock(LogEditorFunctionId.LanguageService_HandleCommandLineArgs)

let projectId =
Expand All @@ -363,5 +363,11 @@ type internal HackCpsCommandLineChanges

let sourcePaths = sources |> Seq.map(fun s -> getFullPath s.Path) |> Seq.toArray

let workspaceService = workspace.Services.GetRequiredService<IFSharpWorkspaceService>()
workspaceService.FSharpProjectOptionsManager.SetCommandLineOptions(projectId, sourcePaths, options)
/// Due to an issue in project system, when we close and reopen solution, it sends the CommandLineChanges twice for every project.
/// First time it sends a correct path, sources, references and options.
/// Second time it sends a correct path, empty sources, empty references and empty options, and we rewrite our cache, and fail to colourize the document later.
/// As a workaround, until we have a fix from PS or will move to Roslyn as a source of truth, we will not overwrite the cache in case of empty lists.

if not (sources.IsEmpty && references.IsEmpty && options.IsEmpty) then
let workspaceService = workspace.Services.GetRequiredService<IFSharpWorkspaceService>()
workspaceService.FSharpProjectOptionsManager.SetCommandLineOptions(projectId, sourcePaths, options)