From 702b8e77f5fbfe21e6743324c1750503e02f182d Mon Sep 17 00:00:00 2001 From: Vlad Zarytovskii Date: Wed, 29 Jun 2022 11:01:17 +0200 Subject: [PATCH 1/2] Cherry-pick #13313 to 17.2 (#13399) Co-authored-by: Petr Semkin --- azure-pipelines.yml | 23 ------------------- .../LanguageService/LanguageService.fs | 12 +++++++--- 2 files changed, 9 insertions(+), 26 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0efb6990d57..c5bd115e2bb 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -356,29 +356,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: diff --git a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs index 777215a3e83..b50277c019b 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs @@ -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, _references:ImmutableArray, options:ImmutableArray) = + member _.HandleCommandLineChanges(path:string, sources:ImmutableArray, references:ImmutableArray, options:ImmutableArray) = use _logBlock = Logger.LogBlock(LogEditorFunctionId.LanguageService_HandleCommandLineArgs) let projectId = @@ -363,5 +363,11 @@ type internal HackCpsCommandLineChanges let sourcePaths = sources |> Seq.map(fun s -> getFullPath s.Path) |> Seq.toArray - let workspaceService = workspace.Services.GetRequiredService() - 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() + workspaceService.FSharpProjectOptionsManager.SetCommandLineOptions(projectId, sourcePaths, options) From 66de8f5728ec0cbe8a806ae4fc24cf312fccf50a Mon Sep 17 00:00:00 2001 From: Vlad Zarytovskii Date: Wed, 29 Jun 2022 12:55:32 +0200 Subject: [PATCH 2/2] Update azure-pipelines.yml --- azure-pipelines.yml | 102 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 96 insertions(+), 6 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c5bd115e2bb..384ee54c0fa 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -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 @@ -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 @@ -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 # #-------------------------------------------------------------------------------------------------------------------# @@ -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 @@ -397,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 @@ -429,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 @@ -461,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 @@ -492,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 #