From 71f251ea42fdaef3c0d9d3640cb0481ff78f5f14 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 11 Apr 2026 02:09:31 +0000 Subject: [PATCH 1/2] Initial commit for subscription b472297a-0d16-41ea-91af-ee5ed4325178 From 4ed10c23f31abd2da4ad6ea78c39f2e12836debf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Sat, 11 Apr 2026 13:33:58 +0200 Subject: [PATCH 2/2] Source code update from dotnet/dotnet --- eng/Version.Details.props | 78 ++--- eng/Version.Details.xml | 140 ++++---- eng/common/core-templates/job/job.yml | 5 +- .../job/publish-build-assets.yml | 12 +- eng/common/core-templates/job/renovate.yml | 2 +- eng/common/core-templates/jobs/jobs.yml | 5 - .../post-build/common-variables.yml | 2 + .../core-templates/post-build/post-build.yml | 132 +++---- .../post-build/setup-maestro-vars.yml | 5 +- .../steps/component-governance.yml | 16 + .../core-templates/steps/generate-sbom.yml | 60 +++- .../core-templates/steps/publish-logs.yml | 10 +- .../core-templates/steps/source-build.yml | 2 +- eng/common/darc-init.ps1 | 8 +- eng/common/darc-init.sh | 4 +- eng/common/generate-sbom-prep.ps1 | 29 ++ eng/common/generate-sbom-prep.sh | 39 +++ eng/common/post-build/redact-logs.ps1 | 4 +- .../post-build/sourcelink-validation.ps1 | 327 ++++++++++++++++++ eng/common/sdk-task.ps1 | 15 +- eng/common/template-guidance.md | 2 + eng/common/templates-official/job/job.yml | 57 ++- .../steps/component-governance.yml | 7 + .../steps/publish-pipeline-artifacts.yml | 4 +- eng/common/templates/job/job.yml | 53 ++- .../templates/steps/component-governance.yml | 7 + eng/common/tools.ps1 | 87 ++++- eng/common/tools.sh | 6 +- global.json | 4 +- .../Microsoft.DotNet.Arcade.Sdk.csproj | 9 +- src/Microsoft.DotNet.Arcade.Sdk/sdk/Sdk.props | 12 +- .../sdk/Sdk.targets | 19 +- .../tools/BuildStep.props | 9 - .../tools/BuildTasks.props | 19 + .../tools/DefaultVersions.props | 5 +- .../tools/Directory.Build.props | 11 - .../tools/Empty.targets | 47 ++- .../tools/EmptyDisableRestore.targets | 16 + ...cludeFromBuild.BeforeCommonTargets.targets | 3 +- .../tools/GenerateChecksums.targets | 2 - .../tools/GenerateResxSource.targets | 2 - .../tools/OptimizationData.targets | 4 - .../tools/RepositoryInfo.targets | 33 +- .../tools/RepositoryValidation.proj | 3 - ...ifierInference.BeforeNETSdkTargets.targets | 3 - .../tools/SdkTasks/Directory.Build.props | 14 - .../tools/SdkTasks/Versions.props | 23 -- .../tools/StrongName.props | 6 +- .../tools/StrongName.targets | 12 +- .../tools/Tools.proj | 115 ------ .../tools/Version.targets | 2 - .../tools/VisualStudio.VsixBuild.targets | 2 - .../tools/VisualStudio.props | 4 - .../{tools => toolset}/AfterSigning.proj | 40 +-- .../AfterSolutionBuild.proj | 17 +- .../{tools => toolset}/Build.proj | 18 +- .../BuildReleasePackages.targets | 9 +- .../CreateBaselineUpdatePR.proj | 3 +- .../toolset/Directory.Build.props | 25 ++ .../toolset/Directory.Build.targets | 6 + .../toolset/Directory.Packages.props | 22 ++ .../InstallDotNetCore.targets | 8 +- .../{tools => toolset}/Publish.proj | 27 +- .../PublishArtifactsInManifest.proj | 13 +- .../PublishBuildAssets.proj | 9 +- .../PublishSignedAssets.proj | 17 +- .../PublishToSymbolServers.proj | 11 +- .../{tools => toolset}/Sign.proj | 33 +- .../{tools => toolset}/Sign.props | 4 +- .../SigningValidation.proj | 3 +- .../toolset/Tools.proj | 61 ++++ .../TrackPrebuiltUsage.targets | 7 +- ...sualStudio.AcquireOptimizationData.targets | 10 +- ...isualStudio.BuildIbcTrainingInputs.targets | 9 +- ...VisualStudio.BuildIbcTrainingSettings.proj | 12 +- .../VisualStudio.IbcTraining.runsettings | 0 .../VisualStudio.InsertionManifests.targets | 7 +- .../VisualStudio.SetupPackage.vsmanproj | 8 +- .../acquisition/acquire-wix/acquire-wix.proj | 6 +- ...soft.DotNet.Build.Tasks.VisualStudio.props | 16 + .../Microsoft.DotNet.NuGetRepack.Tasks.props | 11 + .../src/SignToolTask.cs | 4 +- 82 files changed, 1169 insertions(+), 744 deletions(-) create mode 100644 eng/common/core-templates/steps/component-governance.yml create mode 100644 eng/common/generate-sbom-prep.ps1 create mode 100644 eng/common/generate-sbom-prep.sh create mode 100644 eng/common/post-build/sourcelink-validation.ps1 create mode 100644 eng/common/templates-official/steps/component-governance.yml create mode 100644 eng/common/templates/steps/component-governance.yml delete mode 100644 src/Microsoft.DotNet.Arcade.Sdk/tools/BuildStep.props delete mode 100644 src/Microsoft.DotNet.Arcade.Sdk/tools/Directory.Build.props create mode 100644 src/Microsoft.DotNet.Arcade.Sdk/tools/EmptyDisableRestore.targets delete mode 100644 src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/Directory.Build.props delete mode 100644 src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/Versions.props delete mode 100644 src/Microsoft.DotNet.Arcade.Sdk/tools/Tools.proj rename src/Microsoft.DotNet.Arcade.Sdk/{tools => toolset}/AfterSigning.proj (54%) rename src/Microsoft.DotNet.Arcade.Sdk/{tools => toolset}/AfterSolutionBuild.proj (54%) rename src/Microsoft.DotNet.Arcade.Sdk/{tools => toolset}/Build.proj (95%) rename src/Microsoft.DotNet.Arcade.Sdk/{tools => toolset}/BuildReleasePackages.targets (79%) rename src/Microsoft.DotNet.Arcade.Sdk/{tools/SdkTasks => toolset}/CreateBaselineUpdatePR.proj (78%) create mode 100644 src/Microsoft.DotNet.Arcade.Sdk/toolset/Directory.Build.props create mode 100644 src/Microsoft.DotNet.Arcade.Sdk/toolset/Directory.Build.targets create mode 100644 src/Microsoft.DotNet.Arcade.Sdk/toolset/Directory.Packages.props rename src/Microsoft.DotNet.Arcade.Sdk/{tools => toolset}/InstallDotNetCore.targets (72%) rename src/Microsoft.DotNet.Arcade.Sdk/{tools => toolset}/Publish.proj (96%) rename src/Microsoft.DotNet.Arcade.Sdk/{tools/SdkTasks => toolset}/PublishArtifactsInManifest.proj (98%) rename src/Microsoft.DotNet.Arcade.Sdk/{tools/SdkTasks => toolset}/PublishBuildAssets.proj (83%) rename src/Microsoft.DotNet.Arcade.Sdk/{tools/SdkTasks => toolset}/PublishSignedAssets.proj (96%) rename src/Microsoft.DotNet.Arcade.Sdk/{tools/SdkTasks => toolset}/PublishToSymbolServers.proj (95%) rename src/Microsoft.DotNet.Arcade.Sdk/{tools => toolset}/Sign.proj (79%) rename src/Microsoft.DotNet.Arcade.Sdk/{tools => toolset}/Sign.props (96%) rename src/Microsoft.DotNet.Arcade.Sdk/{tools/SdkTasks => toolset}/SigningValidation.proj (94%) create mode 100644 src/Microsoft.DotNet.Arcade.Sdk/toolset/Tools.proj rename src/Microsoft.DotNet.Arcade.Sdk/{tools => toolset}/TrackPrebuiltUsage.targets (87%) rename src/Microsoft.DotNet.Arcade.Sdk/{tools => toolset}/VisualStudio.AcquireOptimizationData.targets (93%) rename src/Microsoft.DotNet.Arcade.Sdk/{tools => toolset}/VisualStudio.BuildIbcTrainingInputs.targets (68%) rename src/Microsoft.DotNet.Arcade.Sdk/{tools/SdkTasks => toolset}/VisualStudio.BuildIbcTrainingSettings.proj (81%) rename src/Microsoft.DotNet.Arcade.Sdk/{tools/SdkTasks => toolset}/VisualStudio.IbcTraining.runsettings (100%) rename src/Microsoft.DotNet.Arcade.Sdk/{tools => toolset}/VisualStudio.InsertionManifests.targets (99%) rename src/Microsoft.DotNet.Arcade.Sdk/{tools => toolset}/VisualStudio.SetupPackage.vsmanproj (97%) create mode 100644 src/Microsoft.DotNet.Build.Tasks.VisualStudio/build/Microsoft.DotNet.Build.Tasks.VisualStudio.props create mode 100644 src/Microsoft.DotNet.NuGetRepack/tasks/build/Microsoft.DotNet.NuGetRepack.Tasks.props diff --git a/eng/Version.Details.props b/eng/Version.Details.props index 8d0cdd0e2e3..f8d51f45553 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -5,77 +5,63 @@ This file should be imported by eng/Versions.props --> - - 11.0.0-beta.26209.2 - 11.0.0-beta.26209.2 1.1.0-beta.26202.1 1.1.0-beta.26202.1 - - 2.0.3 - - 2.0.0-preview.1.24305.1 8.0.0-preview.24461.2 1.1.0-beta.26201.2 - - 17.12.50 - 17.12.50 - 17.12.50 - 17.12.50 - - 4.8.0 - 4.8.0 - - 10.0.3 - 10.0.3 - 10.0.3 - 10.0.3 - 10.0.3 - 10.0.3 - 10.0.3 - 10.0.3 - 10.0.3 - 10.0.3 - 10.0.3 - - 9.0.100-preview.6.24328.19 + + 18.6.0-preview-26210-111 + 18.6.0-preview-26210-111 + 18.6.0-preview-26210-111 + 18.6.0-preview-26210-111 + 5.7.0-1.26210.111 + 2.0.0-preview.1.26210.111 + 11.0.0-beta.26210.111 + 11.0.0-beta.26210.111 + 11.0.0-preview.4.26210.111 + 11.0.0-preview.4.26210.111 + 11.0.0-preview.4.26210.111 + 11.0.0-preview.4.26210.111 + 11.0.0-preview.4.26210.111 + 11.0.0-preview.4.26210.111 + 11.0.0-preview.4.26210.111 + 5.7.0-1.26210.111 + 11.0.100-preview.4.26210.111 + 11.0.100-preview.4.26210.111 + 3.0.0-preview.4.26210.111 + 11.0.0-preview.4.26210.111 + 11.0.0-preview.4.26210.111 + 11.0.0-preview.4.26210.111 + 11.0.0-preview.4.26210.111 1.1.0-beta2-19575-01 1.1.0-beta2-19575-01 2.0.0-preview.1.23470.14 - - 10.0.100-preview.4.25220.1 11.0.0-prerelease.26181.1 - - $(MicrosoftDotNetArcadeSdkPackageVersion) - $(MicrosoftDotNetHelixSdkPackageVersion) $(MicrosoftDotNetDarcLibPackageVersion) $(MicrosoftDotNetProductConstructionServiceClientPackageVersion) - - $(SystemCommandLinePackageVersion) - - $(MicrosoftDeploymentDotNetReleasesPackageVersion) $(MicrosoftSymbolManifestGeneratorPackageVersion) $(MicrosoftDncEngSecretManagerPackageVersion) - + $(MicrosoftBuildPackageVersion) $(MicrosoftBuildFrameworkPackageVersion) $(MicrosoftBuildTasksCorePackageVersion) $(MicrosoftBuildUtilitiesCorePackageVersion) - $(MicrosoftCodeAnalysisCSharpPackageVersion) - $(MicrosoftNetCompilersToolsetPackageVersion) - + $(MicrosoftDeploymentDotNetReleasesPackageVersion) + $(MicrosoftDotNetArcadeSdkPackageVersion) + $(MicrosoftDotNetHelixSdkPackageVersion) $(MicrosoftExtensionsDependencyInjectionPackageVersion) $(MicrosoftExtensionsDependencyInjectionAbstractionsPackageVersion) $(MicrosoftExtensionsDependencyModelPackageVersion) @@ -83,19 +69,19 @@ This file should be imported by eng/Versions.props $(MicrosoftExtensionsFileSystemGlobbingPackageVersion) $(MicrosoftExtensionsHttpPackageVersion) $(MicrosoftExtensionsLoggingConsolePackageVersion) + $(MicrosoftNetCompilersToolsetPackageVersion) + $(MicrosoftNETSdkWorkloadManifestReaderPackageVersion) + $(MicrosoftTemplateEngineAuthoringTasksPackageVersion) + $(SystemCommandLinePackageVersion) $(SystemCompositionPackageVersion) $(SystemIOPackagingPackageVersion) $(SystemSecurityCryptographyPkcsPackageVersion) $(SystemSecurityCryptographyXmlPackageVersion) - - $(MicrosoftNETSdkWorkloadManifestReaderPackageVersion) $(MicrosoftDiaSymReaderConverterPackageVersion) $(MicrosoftDiaSymReaderPdb2PdbPackageVersion) $(MicrosoftSymbolUploaderBuildTaskPackageVersion) - - $(MicrosoftTemplateEngineAuthoringTasksPackageVersion) $(MicrosoftDotNetXHarnessCLIPackageVersion) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d1209a81306..dffe37c8afc 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,28 +1,28 @@ - + - - https://github.com/dotnet/roslyn - e091728607ca0fc9efca55ccfb3e59259c6b5a0a + + https://github.com/dotnet/dotnet + 5bed4499b04cbbaec57ac4209ae993acca3648cc https://dev.azure.com/dnceng/internal/_git/dotnet-symuploader d617bc8ed2787c235a57cf0dcdfd087b86ff9521 - - https://github.com/dotnet/templating - 43b5827697e501c442eb75ffff832cd4df2514fe + + https://github.com/dotnet/dotnet + 5bed4499b04cbbaec57ac4209ae993acca3648cc - - https://github.com/dotnet/arcade - 9a0904d8bee73aecc93c8300e6cd8144ab285a3e + + https://github.com/dotnet/dotnet + 5bed4499b04cbbaec57ac4209ae993acca3648cc - - https://github.com/dotnet/arcade - 9a0904d8bee73aecc93c8300e6cd8144ab285a3e + + https://github.com/dotnet/dotnet + 5bed4499b04cbbaec57ac4209ae993acca3648cc https://github.com/dotnet/arcade-services @@ -36,9 +36,9 @@ https://github.com/dotnet/xharness 3d43498414571f4f63c4dd14241c46404e8c60f9 - - https://github.com/dotnet/roslyn - e091728607ca0fc9efca55ccfb3e59259c6b5a0a + + https://github.com/dotnet/dotnet + 5bed4499b04cbbaec57ac4209ae993acca3648cc https://github.com/dotnet/symreader-converter @@ -54,92 +54,92 @@ - - https://github.com/dotnet/runtime - dc5fd7a8dce8309e4add8fd4bd5d8718f221b15a + + https://github.com/dotnet/dotnet + 5bed4499b04cbbaec57ac4209ae993acca3648cc - - https://github.com/dotnet/runtime - dc5fd7a8dce8309e4add8fd4bd5d8718f221b15a + + https://github.com/dotnet/dotnet + 5bed4499b04cbbaec57ac4209ae993acca3648cc - - https://github.com/dotnet/runtime - dc5fd7a8dce8309e4add8fd4bd5d8718f221b15a + + https://github.com/dotnet/dotnet + 5bed4499b04cbbaec57ac4209ae993acca3648cc - - https://github.com/dotnet/runtime - dc5fd7a8dce8309e4add8fd4bd5d8718f221b15a + + https://github.com/dotnet/dotnet + 5bed4499b04cbbaec57ac4209ae993acca3648cc - - https://github.com/dotnet/runtime - dc5fd7a8dce8309e4add8fd4bd5d8718f221b15a + + https://github.com/dotnet/dotnet + 5bed4499b04cbbaec57ac4209ae993acca3648cc - - https://github.com/dotnet/runtime - dc5fd7a8dce8309e4add8fd4bd5d8718f221b15a + + https://github.com/dotnet/dotnet + 5bed4499b04cbbaec57ac4209ae993acca3648cc - - https://github.com/dotnet/runtime - dc5fd7a8dce8309e4add8fd4bd5d8718f221b15a + + https://github.com/dotnet/dotnet + 5bed4499b04cbbaec57ac4209ae993acca3648cc - - https://github.com/dotnet/runtime - dc5fd7a8dce8309e4add8fd4bd5d8718f221b15a + + https://github.com/dotnet/dotnet + 5bed4499b04cbbaec57ac4209ae993acca3648cc - - https://github.com/dotnet/deployment-tools - d882ae4af9fb09a89e36487a9c8cb7dfde713927 + + https://github.com/dotnet/dotnet + 5bed4499b04cbbaec57ac4209ae993acca3648cc - - https://github.com/dotnet/sdk - ef4c24166691977558e5312758df4313ab310dc0 + + https://github.com/dotnet/dotnet + 5bed4499b04cbbaec57ac4209ae993acca3648cc - - https://github.com/dotnet/command-line-api - c7b5e07cfed85e88c162dc1c916efaff03742e6e + + https://github.com/dotnet/dotnet + 5bed4499b04cbbaec57ac4209ae993acca3648cc - - https://github.com/dotnet/runtime - dc5fd7a8dce8309e4add8fd4bd5d8718f221b15a + + https://github.com/dotnet/dotnet + 5bed4499b04cbbaec57ac4209ae993acca3648cc - - https://github.com/dotnet/runtime - dc5fd7a8dce8309e4add8fd4bd5d8718f221b15a + + https://github.com/dotnet/dotnet + 5bed4499b04cbbaec57ac4209ae993acca3648cc - - https://github.com/dotnet/runtime - dc5fd7a8dce8309e4add8fd4bd5d8718f221b15a + + https://github.com/dotnet/dotnet + 5bed4499b04cbbaec57ac4209ae993acca3648cc https://github.com/dotnet/dnceng b3251c7824454aedcabfd2c27c4938bb2dad0d2b - - https://github.com/dotnet/msbuild - d1cce8d7cc03c23a4f1bad8e9240714fd9d199a3 + + https://github.com/dotnet/dotnet + 5bed4499b04cbbaec57ac4209ae993acca3648cc - - https://github.com/dotnet/msbuild - d1cce8d7cc03c23a4f1bad8e9240714fd9d199a3 + + https://github.com/dotnet/dotnet + 5bed4499b04cbbaec57ac4209ae993acca3648cc - - https://github.com/dotnet/msbuild - d1cce8d7cc03c23a4f1bad8e9240714fd9d199a3 + + https://github.com/dotnet/dotnet + 5bed4499b04cbbaec57ac4209ae993acca3648cc - - https://github.com/dotnet/msbuild - d1cce8d7cc03c23a4f1bad8e9240714fd9d199a3 + + https://github.com/dotnet/dotnet + 5bed4499b04cbbaec57ac4209ae993acca3648cc diff --git a/eng/common/core-templates/job/job.yml b/eng/common/core-templates/job/job.yml index 66c7988f222..748c4f07a64 100644 --- a/eng/common/core-templates/job/job.yml +++ b/eng/common/core-templates/job/job.yml @@ -26,12 +26,12 @@ parameters: enablePublishBuildArtifacts: false enablePublishBuildAssets: false enablePublishTestResults: false - enablePublishing: false enableBuildRetry: false mergeTestResults: false testRunTitle: '' testResultsFormat: '' name: '' + componentGovernanceSteps: [] preSteps: [] artifactPublishSteps: [] runAsPublic: false @@ -152,6 +152,9 @@ jobs: - ${{ each step in parameters.steps }}: - ${{ step }} + - ${{ each step in parameters.componentGovernanceSteps }}: + - ${{ step }} + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - template: /eng/common/core-templates/steps/cleanup-microbuild.yml parameters: diff --git a/eng/common/core-templates/job/publish-build-assets.yml b/eng/common/core-templates/job/publish-build-assets.yml index 700f7711465..9d7490518c4 100644 --- a/eng/common/core-templates/job/publish-build-assets.yml +++ b/eng/common/core-templates/job/publish-build-assets.yml @@ -172,18 +172,17 @@ jobs: targetPath: '$(Build.ArtifactStagingDirectory)/MergedManifest.xml' artifactName: AssetManifests displayName: 'Publish Merged Manifest' - retryCountOnTaskFailure: 10 # for any files being locked - isProduction: false # just metadata for publishing + retryCountOnTaskFailure: 10 # for any logs being locked + sbomEnabled: false # we don't need SBOM for logs - - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml + - template: /eng/common/core-templates/steps/publish-build-artifacts.yml parameters: is1ESPipeline: ${{ parameters.is1ESPipeline }} args: displayName: Publish ReleaseConfigs Artifact - targetPath: '$(Build.StagingDirectory)/ReleaseConfigs' + pathToPublish: '$(Build.StagingDirectory)/ReleaseConfigs' + publishLocation: Container artifactName: ReleaseConfigs - retryCountOnTaskFailure: 10 # for any files being locked - isProduction: false # just metadata for publishing - ${{ if or(eq(parameters.publishAssetsImmediately, 'true'), eq(parameters.isAssetlessBuild, 'true')) }}: - template: /eng/common/core-templates/post-build/setup-maestro-vars.yml @@ -219,5 +218,4 @@ jobs: - template: /eng/common/core-templates/steps/publish-logs.yml parameters: is1ESPipeline: ${{ parameters.is1ESPipeline }} - StageLabel: 'BuildAssetRegistry' JobLabel: 'Publish_Artifacts_Logs' diff --git a/eng/common/core-templates/job/renovate.yml b/eng/common/core-templates/job/renovate.yml index ff86c80b468..ab233539b5d 100644 --- a/eng/common/core-templates/job/renovate.yml +++ b/eng/common/core-templates/job/renovate.yml @@ -135,7 +135,7 @@ jobs: condition: succeededOrFailed() targetPath: $(Build.ArtifactStagingDirectory) artifactName: $(Agent.JobName)_Logs_Attempt$(System.JobAttempt) - isProduction: false # logs are non-production artifacts + sbomEnabled: false steps: - checkout: self diff --git a/eng/common/core-templates/jobs/jobs.yml b/eng/common/core-templates/jobs/jobs.yml index cc8cce45278..01ada747665 100644 --- a/eng/common/core-templates/jobs/jobs.yml +++ b/eng/common/core-templates/jobs/jobs.yml @@ -43,10 +43,6 @@ parameters: artifacts: {} is1ESPipeline: '' - - # Publishing version w/default. - publishingVersion: 3 - repositoryAlias: self officialBuildId: '' @@ -106,7 +102,6 @@ jobs: parameters: is1ESPipeline: ${{ parameters.is1ESPipeline }} continueOnError: ${{ parameters.continueOnError }} - publishingVersion: ${{ parameters.publishingVersion }} dependsOn: - ${{ if ne(parameters.publishBuildAssetsDependsOn, '') }}: - ${{ each job in parameters.publishBuildAssetsDependsOn }}: diff --git a/eng/common/core-templates/post-build/common-variables.yml b/eng/common/core-templates/post-build/common-variables.yml index db298ae16ba..d5627a994ae 100644 --- a/eng/common/core-templates/post-build/common-variables.yml +++ b/eng/common/core-templates/post-build/common-variables.yml @@ -11,6 +11,8 @@ variables: - name: MaestroApiVersion value: "2020-02-20" + - name: SourceLinkCLIVersion + value: 3.0.0 - name: SymbolToolVersion value: 1.0.1 - name: BinlogToolVersion diff --git a/eng/common/core-templates/post-build/post-build.yml b/eng/common/core-templates/post-build/post-build.yml index fcf40d1d2e6..0994189969f 100644 --- a/eng/common/core-templates/post-build/post-build.yml +++ b/eng/common/core-templates/post-build/post-build.yml @@ -9,7 +9,6 @@ parameters: default: 3 values: - 3 - - 4 - name: BARBuildId displayName: BAR Build Id @@ -131,30 +130,16 @@ stages: PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} is1ESPipeline: ${{ parameters.is1ESPipeline }} - - ${{ if ne(parameters.publishingInfraVersion, 4) }}: - - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: specific - buildVersionToDownload: specific - project: $(AzDOProjectName) - pipeline: $(AzDOPipelineId) - buildId: $(AzDOBuildId) - artifactName: PackageArtifacts - checkDownloadedFiles: true - - ${{ if eq(parameters.publishingInfraVersion, 4) }}: - - task: DownloadPipelineArtifact@2 - displayName: Download Pipeline Artifacts (V4) - inputs: - itemPattern: '*/packages/**/*.nupkg' - targetPath: '$(Build.ArtifactStagingDirectory)/PipelineArtifactsDownload' - - task: CopyFiles@2 - displayName: Flatten packages to PackageArtifacts - inputs: - SourceFolder: '$(Build.ArtifactStagingDirectory)/PipelineArtifactsDownload' - Contents: '**/*.nupkg' - TargetFolder: '$(Build.ArtifactStagingDirectory)/PackageArtifacts' - flattenFolders: true + - task: DownloadBuildArtifacts@0 + displayName: Download Package Artifacts + inputs: + buildType: specific + buildVersionToDownload: specific + project: $(AzDOProjectName) + pipeline: $(AzDOPipelineId) + buildId: $(AzDOBuildId) + artifactName: PackageArtifacts + checkDownloadedFiles: true - task: PowerShell@2 displayName: Validate @@ -188,30 +173,16 @@ stages: PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} is1ESPipeline: ${{ parameters.is1ESPipeline }} - - ${{ if ne(parameters.publishingInfraVersion, 4) }}: - - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: specific - buildVersionToDownload: specific - project: $(AzDOProjectName) - pipeline: $(AzDOPipelineId) - buildId: $(AzDOBuildId) - artifactName: PackageArtifacts - checkDownloadedFiles: true - - ${{ if eq(parameters.publishingInfraVersion, 4) }}: - - task: DownloadPipelineArtifact@2 - displayName: Download Pipeline Artifacts (V4) - inputs: - itemPattern: '*/packages/**/*.nupkg' - targetPath: '$(Build.ArtifactStagingDirectory)/PipelineArtifactsDownload' - - task: CopyFiles@2 - displayName: Flatten packages to PackageArtifacts - inputs: - SourceFolder: '$(Build.ArtifactStagingDirectory)/PipelineArtifactsDownload' - Contents: '**/*.nupkg' - TargetFolder: '$(Build.ArtifactStagingDirectory)/PackageArtifacts' - flattenFolders: true + - task: DownloadBuildArtifacts@0 + displayName: Download Package Artifacts + inputs: + buildType: specific + buildVersionToDownload: specific + project: $(AzDOProjectName) + pipeline: $(AzDOPipelineId) + buildId: $(AzDOBuildId) + artifactName: PackageArtifacts + checkDownloadedFiles: true # This is necessary whenever we want to publish/restore to an AzDO private feed # Since sdk-task.ps1 tries to restore packages we need to do this authentication here @@ -237,20 +208,53 @@ stages: JobLabel: 'Signing' BinlogToolVersion: $(BinlogToolVersion) - # SourceLink validation has been removed — the underlying CLI tool - # (targeting netcoreapp2.1) has not functioned for years. - # The enableSourceLinkValidation parameter is kept but ignored so - # existing pipelines that pass it are not broken. - # See https://github.com/dotnet/arcade/issues/16647 - - ${{ if eq(parameters.enableSourceLinkValidation, 'true') }}: - - job: - displayName: 'SourceLink Validation Removed - please remove enableSourceLinkValidation from your pipeline' - pool: server - steps: - - task: Delay@1 - displayName: 'Warning: SourceLink validation removed (see https://github.com/dotnet/arcade/issues/16647)' - inputs: - delayForMinutes: '0' + - job: + displayName: SourceLink Validation + condition: eq( ${{ parameters.enableSourceLinkValidation }}, 'true') + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: AzurePipelines-EO + image: 1ESPT-Windows2025 + demands: Cmd + os: windows + # If it's not devdiv, it's dnceng + ${{ else }}: + ${{ if eq(parameters.is1ESPipeline, true) }}: + name: $(DncEngInternalBuildPool) + image: windows.vs2026.amd64 + os: windows + ${{ else }}: + name: $(DncEngInternalBuildPool) + demands: ImageOverride -equals windows.vs2026.amd64 + steps: + - template: /eng/common/core-templates/post-build/setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + is1ESPipeline: ${{ parameters.is1ESPipeline }} + + - task: DownloadBuildArtifacts@0 + displayName: Download Blob Artifacts + inputs: + buildType: specific + buildVersionToDownload: specific + project: $(AzDOProjectName) + pipeline: $(AzDOPipelineId) + buildId: $(AzDOBuildId) + artifactName: BlobArtifacts + checkDownloadedFiles: true + + - task: PowerShell@2 + displayName: Validate + inputs: + filePath: $(System.DefaultWorkingDirectory)/eng/common/post-build/sourcelink-validation.ps1 + arguments: -InputPath $(Build.ArtifactStagingDirectory)/BlobArtifacts/ + -ExtractPath $(Agent.BuildDirectory)/Extract/ + -GHRepoName $(Build.Repository.Name) + -GHCommit $(Build.SourceVersion) + -SourcelinkCliVersion $(SourceLinkCLIVersion) + continueOnError: true - ${{ if ne(parameters.publishAssetsImmediately, 'true') }}: - stage: publish_using_darc @@ -313,7 +317,7 @@ stages: scriptPath: $(System.DefaultWorkingDirectory)/eng/common/post-build/publish-using-darc.ps1 arguments: > -BuildId $(BARBuildId) - -PublishingInfraVersion 3 + -PublishingInfraVersion ${{ parameters.publishingInfraVersion }} -AzdoToken '$(System.AccessToken)' -WaitPublishingFinish true -RequireDefaultChannels ${{ parameters.requireDefaultChannels }} diff --git a/eng/common/core-templates/post-build/setup-maestro-vars.yml b/eng/common/core-templates/post-build/setup-maestro-vars.yml index 6dfa99ec5e3..a7abd58c4bb 100644 --- a/eng/common/core-templates/post-build/setup-maestro-vars.yml +++ b/eng/common/core-templates/post-build/setup-maestro-vars.yml @@ -8,11 +8,12 @@ steps: - 'Illegal entry point, is1ESPipeline is not defined. Repository yaml should not directly reference templates in core-templates folder.': error - ${{ if eq(coalesce(parameters.PromoteToChannelIds, 0), 0) }}: - - task: DownloadPipelineArtifact@2 + - task: DownloadBuildArtifacts@0 displayName: Download Release Configs inputs: + buildType: current artifactName: ReleaseConfigs - targetPath: '$(Build.StagingDirectory)/ReleaseConfigs' + checkDownloadedFiles: true - task: AzureCLI@2 name: setReleaseVars diff --git a/eng/common/core-templates/steps/component-governance.yml b/eng/common/core-templates/steps/component-governance.yml new file mode 100644 index 00000000000..cf0649aa956 --- /dev/null +++ b/eng/common/core-templates/steps/component-governance.yml @@ -0,0 +1,16 @@ +parameters: + disableComponentGovernance: false + componentGovernanceIgnoreDirectories: '' + is1ESPipeline: false + displayName: 'Component Detection' + +steps: +- ${{ if eq(parameters.disableComponentGovernance, 'true') }}: + - script: echo "##vso[task.setvariable variable=skipComponentGovernanceDetection]true" + displayName: Set skipComponentGovernanceDetection variable +- ${{ if ne(parameters.disableComponentGovernance, 'true') }}: + - task: ComponentGovernanceComponentDetection@0 + continueOnError: true + displayName: ${{ parameters.displayName }} + inputs: + ignoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} diff --git a/eng/common/core-templates/steps/generate-sbom.yml b/eng/common/core-templates/steps/generate-sbom.yml index aad0a8aeda3..003f7eae0fa 100644 --- a/eng/common/core-templates/steps/generate-sbom.yml +++ b/eng/common/core-templates/steps/generate-sbom.yml @@ -1,14 +1,54 @@ +# BuildDropPath - The root folder of the drop directory for which the manifest file will be generated. +# PackageName - The name of the package this SBOM represents. +# PackageVersion - The version of the package this SBOM represents. +# ManifestDirPath - The path of the directory where the generated manifest files will be placed +# IgnoreDirectories - Directories to ignore for SBOM generation. This will be passed through to the CG component detector. + parameters: - PackageVersion: unused - BuildDropPath: unused - PackageName: unused - ManifestDirPath: unused - IgnoreDirectories: unused - sbomContinueOnError: unused - is1ESPipeline: unused - publishArtifacts: unused + PackageVersion: 11.0.0 + BuildDropPath: '$(System.DefaultWorkingDirectory)/artifacts' + PackageName: '.NET' + ManifestDirPath: $(Build.ArtifactStagingDirectory)/sbom + IgnoreDirectories: '' + sbomContinueOnError: true + is1ESPipeline: false + # disable publishArtifacts if some other step is publishing the artifacts (like job.yml). + publishArtifacts: true steps: +- task: PowerShell@2 + displayName: Prep for SBOM generation in (Non-linux) + condition: or(eq(variables['Agent.Os'], 'Windows_NT'), eq(variables['Agent.Os'], 'Darwin')) + inputs: + filePath: ./eng/common/generate-sbom-prep.ps1 + arguments: ${{parameters.manifestDirPath}} + +# Chmodding is a workaround for https://github.com/dotnet/arcade/issues/8461 - script: | - echo "##vso[task.logissue type=warning]Including generate-sbom.yml is deprecated, SBOM generation is handled 1ES PT now. Remove this include." - displayName: Issue generate-sbom.yml deprecation warning + chmod +x ./eng/common/generate-sbom-prep.sh + ./eng/common/generate-sbom-prep.sh ${{parameters.manifestDirPath}} + displayName: Prep for SBOM generation in (Linux) + condition: eq(variables['Agent.Os'], 'Linux') + continueOnError: ${{ parameters.sbomContinueOnError }} + +- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0 + displayName: 'Generate SBOM manifest' + continueOnError: ${{ parameters.sbomContinueOnError }} + inputs: + PackageName: ${{ parameters.packageName }} + BuildDropPath: ${{ parameters.buildDropPath }} + PackageVersion: ${{ parameters.packageVersion }} + ManifestDirPath: ${{ parameters.manifestDirPath }}/$(ARTIFACT_NAME) + ${{ if ne(parameters.IgnoreDirectories, '') }}: + AdditionalComponentDetectorArgs: '--IgnoreDirectories ${{ parameters.IgnoreDirectories }}' + +- ${{ if eq(parameters.publishArtifacts, 'true')}}: + - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + args: + displayName: Publish SBOM manifest + continueOnError: ${{parameters.sbomContinueOnError}} + targetPath: '${{ parameters.manifestDirPath }}' + artifactName: $(ARTIFACT_NAME) + diff --git a/eng/common/core-templates/steps/publish-logs.yml b/eng/common/core-templates/steps/publish-logs.yml index 84a1922c73f..a9ea99ba6aa 100644 --- a/eng/common/core-templates/steps/publish-logs.yml +++ b/eng/common/core-templates/steps/publish-logs.yml @@ -50,15 +50,13 @@ steps: TargetFolder: '$(Build.ArtifactStagingDirectory)/PostBuildLogs' condition: always() -- template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml +- template: /eng/common/core-templates/steps/publish-build-artifacts.yml parameters: is1ESPipeline: ${{ parameters.is1ESPipeline }} args: displayName: Publish Logs - targetPath: '$(Build.ArtifactStagingDirectory)/PostBuildLogs' - artifactName: PostBuildLogs_${{ parameters.StageLabel }}_${{ parameters.JobLabel }}_Attempt$(System.JobAttempt) + pathToPublish: '$(Build.ArtifactStagingDirectory)/PostBuildLogs' + publishLocation: Container + artifactName: PostBuildLogs continueOnError: true condition: always() - retryCountOnTaskFailure: 10 # for any files being locked - isProduction: false # logs are non-production artifacts - diff --git a/eng/common/core-templates/steps/source-build.yml b/eng/common/core-templates/steps/source-build.yml index b75f59c428d..acf16ed3496 100644 --- a/eng/common/core-templates/steps/source-build.yml +++ b/eng/common/core-templates/steps/source-build.yml @@ -62,4 +62,4 @@ steps: artifactName: BuildLogs_SourceBuild_${{ parameters.platform.name }}_Attempt$(System.JobAttempt) continueOnError: true condition: succeededOrFailed() - isProduction: false # logs are non-production artifacts + sbomEnabled: false # we don't need SBOM for logs diff --git a/eng/common/darc-init.ps1 b/eng/common/darc-init.ps1 index a5be41db690..e3374310563 100644 --- a/eng/common/darc-init.ps1 +++ b/eng/common/darc-init.ps1 @@ -29,11 +29,11 @@ function InstallDarcCli ($darcVersion, $toolpath) { Write-Host "Installing Darc CLI version $darcVersion..." Write-Host 'You may need to restart your command window if this is the first dotnet tool you have installed.' if (-not $toolpath) { - Write-Host "'$dotnet' tool install $darcCliPackageName --version $darcVersion --source '$arcadeServicesSource' -v $verbosity -g" - & "$dotnet" tool install $darcCliPackageName --version $darcVersion --source "$arcadeServicesSource" -v $verbosity -g + Write-Host "'$dotnet' tool install $darcCliPackageName --version $darcVersion --add-source '$arcadeServicesSource' -v $verbosity -g" + & "$dotnet" tool install $darcCliPackageName --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity -g }else { - Write-Host "'$dotnet' tool install $darcCliPackageName --version $darcVersion --source '$arcadeServicesSource' -v $verbosity --tool-path '$toolpath'" - & "$dotnet" tool install $darcCliPackageName --version $darcVersion --source "$arcadeServicesSource" -v $verbosity --tool-path "$toolpath" + Write-Host "'$dotnet' tool install $darcCliPackageName --version $darcVersion --add-source '$arcadeServicesSource' -v $verbosity --tool-path '$toolpath'" + & "$dotnet" tool install $darcCliPackageName --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity --tool-path "$toolpath" } } diff --git a/eng/common/darc-init.sh b/eng/common/darc-init.sh index b56d40e5706..9f5ad6b763b 100755 --- a/eng/common/darc-init.sh +++ b/eng/common/darc-init.sh @@ -73,9 +73,9 @@ function InstallDarcCli { echo "Installing Darc CLI version $darcVersion..." echo "You may need to restart your command shell if this is the first dotnet tool you have installed." if [ -z "$toolpath" ]; then - echo $($dotnet_root/dotnet tool install $darc_cli_package_name --version $darcVersion --source "$arcadeServicesSource" -v $verbosity -g) + echo $($dotnet_root/dotnet tool install $darc_cli_package_name --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity -g) else - echo $($dotnet_root/dotnet tool install $darc_cli_package_name --version $darcVersion --source "$arcadeServicesSource" -v $verbosity --tool-path "$toolpath") + echo $($dotnet_root/dotnet tool install $darc_cli_package_name --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity --tool-path "$toolpath") fi } diff --git a/eng/common/generate-sbom-prep.ps1 b/eng/common/generate-sbom-prep.ps1 new file mode 100644 index 00000000000..a0c7d792a76 --- /dev/null +++ b/eng/common/generate-sbom-prep.ps1 @@ -0,0 +1,29 @@ +Param( + [Parameter(Mandatory=$true)][string] $ManifestDirPath # Manifest directory where sbom will be placed +) + +. $PSScriptRoot\pipeline-logging-functions.ps1 + +# Normally - we'd listen to the manifest path given, but 1ES templates will overwrite if this level gets uploaded directly +# with their own overwriting ours. So we create it as a sub directory of the requested manifest path. +$ArtifactName = "${env:SYSTEM_STAGENAME}_${env:AGENT_JOBNAME}_SBOM" +$SafeArtifactName = $ArtifactName -replace '["/:<>\\|?@*"() ]', '_' +$SbomGenerationDir = Join-Path $ManifestDirPath $SafeArtifactName + +Write-Host "Artifact name before : $ArtifactName" +Write-Host "Artifact name after : $SafeArtifactName" + +Write-Host "Creating dir $ManifestDirPath" + +# create directory for sbom manifest to be placed +if (!(Test-Path -path $SbomGenerationDir)) +{ + New-Item -ItemType Directory -path $SbomGenerationDir + Write-Host "Successfully created directory $SbomGenerationDir" +} +else{ + Write-PipelineTelemetryError -category 'Build' "Unable to create sbom folder." +} + +Write-Host "Updating artifact name" +Write-Host "##vso[task.setvariable variable=ARTIFACT_NAME]$SafeArtifactName" diff --git a/eng/common/generate-sbom-prep.sh b/eng/common/generate-sbom-prep.sh new file mode 100644 index 00000000000..b8ecca72bbf --- /dev/null +++ b/eng/common/generate-sbom-prep.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" + +# resolve $SOURCE until the file is no longer a symlink +while [[ -h $source ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" +. $scriptroot/pipeline-logging-functions.sh + + +# replace all special characters with _, some builds use special characters like : in Agent.Jobname, that is not a permissible name while uploading artifacts. +artifact_name=$SYSTEM_STAGENAME"_"$AGENT_JOBNAME"_SBOM" +safe_artifact_name="${artifact_name//["/:<>\\|?@*$" ]/_}" +manifest_dir=$1 + +# Normally - we'd listen to the manifest path given, but 1ES templates will overwrite if this level gets uploaded directly +# with their own overwriting ours. So we create it as a sub directory of the requested manifest path. +sbom_generation_dir="$manifest_dir/$safe_artifact_name" + +if [ ! -d "$sbom_generation_dir" ] ; then + mkdir -p "$sbom_generation_dir" + echo "Sbom directory created." $sbom_generation_dir +else + Write-PipelineTelemetryError -category 'Build' "Unable to create sbom folder." +fi + +echo "Artifact name before : "$artifact_name +echo "Artifact name after : "$safe_artifact_name +export ARTIFACT_NAME=$safe_artifact_name +echo "##vso[task.setvariable variable=ARTIFACT_NAME]$safe_artifact_name" + +exit 0 diff --git a/eng/common/post-build/redact-logs.ps1 b/eng/common/post-build/redact-logs.ps1 index 672f4e2652e..fc0218a013d 100644 --- a/eng/common/post-build/redact-logs.ps1 +++ b/eng/common/post-build/redact-logs.ps1 @@ -49,8 +49,8 @@ try { Write-Host "Installing Binlog redactor CLI..." Write-Host "'$dotnet' new tool-manifest" & "$dotnet" new tool-manifest - Write-Host "'$dotnet' tool install $packageName --local --source '$PackageFeed' -v $verbosity --version $BinlogToolVersion" - & "$dotnet" tool install $packageName --local --source "$PackageFeed" -v $verbosity --version $BinlogToolVersion + Write-Host "'$dotnet' tool install $packageName --local --add-source '$PackageFeed' -v $verbosity --version $BinlogToolVersion" + & "$dotnet" tool install $packageName --local --add-source "$PackageFeed" -v $verbosity --version $BinlogToolVersion if (Test-Path $TokensFilePath) { Write-Host "Adding additional sensitive data for redaction from file: " $TokensFilePath diff --git a/eng/common/post-build/sourcelink-validation.ps1 b/eng/common/post-build/sourcelink-validation.ps1 new file mode 100644 index 00000000000..1976ef70fb8 --- /dev/null +++ b/eng/common/post-build/sourcelink-validation.ps1 @@ -0,0 +1,327 @@ +param( + [Parameter(Mandatory=$true)][string] $InputPath, # Full path to directory where Symbols.NuGet packages to be checked are stored + [Parameter(Mandatory=$true)][string] $ExtractPath, # Full path to directory where the packages will be extracted during validation + [Parameter(Mandatory=$false)][string] $GHRepoName, # GitHub name of the repo including the Org. E.g., dotnet/arcade + [Parameter(Mandatory=$false)][string] $GHCommit, # GitHub commit SHA used to build the packages + [Parameter(Mandatory=$true)][string] $SourcelinkCliVersion # Version of SourceLink CLI to use +) + +$ErrorActionPreference = 'Stop' +Set-StrictMode -Version 2.0 + +# `tools.ps1` checks $ci to perform some actions. Since the post-build +# scripts don't necessarily execute in the same agent that run the +# build.ps1/sh script this variable isn't automatically set. +$ci = $true +$disableConfigureToolsetImport = $true +. $PSScriptRoot\..\tools.ps1 + +# Cache/HashMap (File -> Exist flag) used to consult whether a file exist +# in the repository at a specific commit point. This is populated by inserting +# all files present in the repo at a specific commit point. +$global:RepoFiles = @{} + +# Maximum number of jobs to run in parallel +$MaxParallelJobs = 16 + +$MaxRetries = 5 +$RetryWaitTimeInSeconds = 30 + +# Wait time between check for system load +$SecondsBetweenLoadChecks = 10 + +if (!$InputPath -or !(Test-Path $InputPath)){ + Write-Host "No files to validate." + ExitWithExitCode 0 +} + +$ValidatePackage = { + param( + [string] $PackagePath # Full path to a Symbols.NuGet package + ) + + . $using:PSScriptRoot\..\tools.ps1 + + # Ensure input file exist + if (!(Test-Path $PackagePath)) { + Write-Host "Input file does not exist: $PackagePath" + return [pscustomobject]@{ + result = 1 + packagePath = $PackagePath + } + } + + # Extensions for which we'll look for SourceLink information + # For now we'll only care about Portable & Embedded PDBs + $RelevantExtensions = @('.dll', '.exe', '.pdb') + + Write-Host -NoNewLine 'Validating ' ([System.IO.Path]::GetFileName($PackagePath)) '...' + + $PackageId = [System.IO.Path]::GetFileNameWithoutExtension($PackagePath) + $ExtractPath = Join-Path -Path $using:ExtractPath -ChildPath $PackageId + $FailedFiles = 0 + + Add-Type -AssemblyName System.IO.Compression.FileSystem + + [System.IO.Directory]::CreateDirectory($ExtractPath) | Out-Null + + try { + $zip = [System.IO.Compression.ZipFile]::OpenRead($PackagePath) + + $zip.Entries | + Where-Object {$RelevantExtensions -contains [System.IO.Path]::GetExtension($_.Name)} | + ForEach-Object { + $FileName = $_.FullName + $Extension = [System.IO.Path]::GetExtension($_.Name) + $FakeName = -Join((New-Guid), $Extension) + $TargetFile = Join-Path -Path $ExtractPath -ChildPath $FakeName + + # We ignore resource DLLs + if ($FileName.EndsWith('.resources.dll')) { + return [pscustomobject]@{ + result = 0 + packagePath = $PackagePath + } + } + + [System.IO.Compression.ZipFileExtensions]::ExtractToFile($_, $TargetFile, $true) + + $ValidateFile = { + param( + [string] $FullPath, # Full path to the module that has to be checked + [string] $RealPath, + [ref] $FailedFiles + ) + + $sourcelinkExe = "$env:USERPROFILE\.dotnet\tools" + $sourcelinkExe = Resolve-Path "$sourcelinkExe\sourcelink.exe" + $SourceLinkInfos = & $sourcelinkExe print-urls $FullPath | Out-String + + if ($LASTEXITCODE -eq 0 -and -not ([string]::IsNullOrEmpty($SourceLinkInfos))) { + $NumFailedLinks = 0 + + # We only care about Http addresses + $Matches = (Select-String '(http[s]?)(:\/\/)([^\s,]+)' -Input $SourceLinkInfos -AllMatches).Matches + + if ($Matches.Count -ne 0) { + $Matches.Value | + ForEach-Object { + $Link = $_ + $CommitUrl = "https://raw.githubusercontent.com/${using:GHRepoName}/${using:GHCommit}/" + + $FilePath = $Link.Replace($CommitUrl, "") + $Status = 200 + $Cache = $using:RepoFiles + + $attempts = 0 + + while ($attempts -lt $using:MaxRetries) { + if ( !($Cache.ContainsKey($FilePath)) ) { + try { + $Uri = $Link -as [System.URI] + + if ($Link -match "submodules") { + # Skip submodule links until sourcelink properly handles submodules + $Status = 200 + } + elseif ($Uri.AbsoluteURI -ne $null -and ($Uri.Host -match 'github' -or $Uri.Host -match 'githubusercontent')) { + # Only GitHub links are valid + $Status = (Invoke-WebRequest -Uri $Link -UseBasicParsing -Method HEAD -TimeoutSec 5).StatusCode + } + else { + # If it's not a github link, we want to break out of the loop and not retry. + $Status = 0 + $attempts = $using:MaxRetries + } + } + catch { + Write-Host $_ + $Status = 0 + } + } + + if ($Status -ne 200) { + $attempts++ + + if ($attempts -lt $using:MaxRetries) + { + $attemptsLeft = $using:MaxRetries - $attempts + Write-Warning "Download failed, $attemptsLeft attempts remaining, will retry in $using:RetryWaitTimeInSeconds seconds" + Start-Sleep -Seconds $using:RetryWaitTimeInSeconds + } + else { + if ($NumFailedLinks -eq 0) { + if ($FailedFiles.Value -eq 0) { + Write-Host + } + + Write-Host "`tFile $RealPath has broken links:" + } + + Write-Host "`t`tFailed to retrieve $Link" + + $NumFailedLinks++ + } + } + else { + break + } + } + } + } + + if ($NumFailedLinks -ne 0) { + $FailedFiles.value++ + $global:LASTEXITCODE = 1 + } + } + } + + &$ValidateFile $TargetFile $FileName ([ref]$FailedFiles) + } + } + catch { + Write-Host $_ + } + finally { + $zip.Dispose() + } + + if ($FailedFiles -eq 0) { + Write-Host 'Passed.' + return [pscustomobject]@{ + result = 0 + packagePath = $PackagePath + } + } + else { + Write-PipelineTelemetryError -Category 'SourceLink' -Message "$PackagePath has broken SourceLink links." + return [pscustomobject]@{ + result = 1 + packagePath = $PackagePath + } + } +} + +function CheckJobResult( + $result, + $packagePath, + [ref]$ValidationFailures, + [switch]$logErrors) { + if ($result -ne '0') { + if ($logErrors) { + Write-PipelineTelemetryError -Category 'SourceLink' -Message "$packagePath has broken SourceLink links." + } + $ValidationFailures.Value++ + } +} + +function ValidateSourceLinkLinks { + if ($GHRepoName -ne '' -and !($GHRepoName -Match '^[^\s\/]+/[^\s\/]+$')) { + if (!($GHRepoName -Match '^[^\s-]+-[^\s]+$')) { + Write-PipelineTelemetryError -Category 'SourceLink' -Message "GHRepoName should be in the format / or -. '$GHRepoName'" + ExitWithExitCode 1 + } + else { + $GHRepoName = $GHRepoName -replace '^([^\s-]+)-([^\s]+)$', '$1/$2'; + } + } + + if ($GHCommit -ne '' -and !($GHCommit -Match '^[0-9a-fA-F]{40}$')) { + Write-PipelineTelemetryError -Category 'SourceLink' -Message "GHCommit should be a 40 chars hexadecimal string. '$GHCommit'" + ExitWithExitCode 1 + } + + if ($GHRepoName -ne '' -and $GHCommit -ne '') { + $RepoTreeURL = -Join('http://api.github.com/repos/', $GHRepoName, '/git/trees/', $GHCommit, '?recursive=1') + $CodeExtensions = @('.cs', '.vb', '.fs', '.fsi', '.fsx', '.fsscript') + + try { + # Retrieve the list of files in the repo at that particular commit point and store them in the RepoFiles hash + $Data = Invoke-WebRequest $RepoTreeURL -UseBasicParsing | ConvertFrom-Json | Select-Object -ExpandProperty tree + + foreach ($file in $Data) { + $Extension = [System.IO.Path]::GetExtension($file.path) + + if ($CodeExtensions.Contains($Extension)) { + $RepoFiles[$file.path] = 1 + } + } + } + catch { + Write-Host "Problems downloading the list of files from the repo. Url used: $RepoTreeURL . Execution will proceed without caching." + } + } + elseif ($GHRepoName -ne '' -or $GHCommit -ne '') { + Write-Host 'For using the http caching mechanism both GHRepoName and GHCommit should be informed.' + } + + if (Test-Path $ExtractPath) { + Remove-Item $ExtractPath -Force -Recurse -ErrorAction SilentlyContinue + } + + $ValidationFailures = 0 + + # Process each NuGet package in parallel + Get-ChildItem "$InputPath\*.symbols.nupkg" | + ForEach-Object { + Write-Host "Starting $($_.FullName)" + Start-Job -ScriptBlock $ValidatePackage -ArgumentList $_.FullName | Out-Null + $NumJobs = @(Get-Job -State 'Running').Count + + while ($NumJobs -ge $MaxParallelJobs) { + Write-Host "There are $NumJobs validation jobs running right now. Waiting $SecondsBetweenLoadChecks seconds to check again." + sleep $SecondsBetweenLoadChecks + $NumJobs = @(Get-Job -State 'Running').Count + } + + foreach ($Job in @(Get-Job -State 'Completed')) { + $jobResult = Wait-Job -Id $Job.Id | Receive-Job + CheckJobResult $jobResult.result $jobResult.packagePath ([ref]$ValidationFailures) -LogErrors + Remove-Job -Id $Job.Id + } + } + + foreach ($Job in @(Get-Job)) { + $jobResult = Wait-Job -Id $Job.Id | Receive-Job + CheckJobResult $jobResult.result $jobResult.packagePath ([ref]$ValidationFailures) + Remove-Job -Id $Job.Id + } + if ($ValidationFailures -gt 0) { + Write-PipelineTelemetryError -Category 'SourceLink' -Message "$ValidationFailures package(s) failed validation." + ExitWithExitCode 1 + } +} + +function InstallSourcelinkCli { + $sourcelinkCliPackageName = 'sourcelink' + + $dotnetRoot = InitializeDotNetCli -install:$true + $dotnet = "$dotnetRoot\dotnet.exe" + $toolList = & "$dotnet" tool list --global + + if (($toolList -like "*$sourcelinkCliPackageName*") -and ($toolList -like "*$sourcelinkCliVersion*")) { + Write-Host "SourceLink CLI version $sourcelinkCliVersion is already installed." + } + else { + Write-Host "Installing SourceLink CLI version $sourcelinkCliVersion..." + Write-Host 'You may need to restart your command window if this is the first dotnet tool you have installed.' + & "$dotnet" tool install $sourcelinkCliPackageName --version $sourcelinkCliVersion --verbosity "minimal" --global + } +} + +try { + InstallSourcelinkCli + + foreach ($Job in @(Get-Job)) { + Remove-Job -Id $Job.Id + } + + ValidateSourceLinkLinks +} +catch { + Write-Host $_.Exception + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Category 'SourceLink' -Message $_ + ExitWithExitCode 1 +} diff --git a/eng/common/sdk-task.ps1 b/eng/common/sdk-task.ps1 index 64fd2f8abec..b64b66a6275 100644 --- a/eng/common/sdk-task.ps1 +++ b/eng/common/sdk-task.ps1 @@ -66,7 +66,20 @@ try { if( $msbuildEngine -eq "vs") { # Ensure desktop MSBuild is available for sdk tasks. - $global:_MSBuildExe = InitializeVisualStudioMSBuild + if( -not ($GlobalJson.tools.PSObject.Properties.Name -contains "vs" )) { + $GlobalJson.tools | Add-Member -Name "vs" -Value (ConvertFrom-Json "{ `"version`": `"16.5`" }") -MemberType NoteProperty + } + if( -not ($GlobalJson.tools.PSObject.Properties.Name -match "xcopy-msbuild" )) { + $GlobalJson.tools | Add-Member -Name "xcopy-msbuild" -Value "18.0.0" -MemberType NoteProperty + } + if ($GlobalJson.tools."xcopy-msbuild".Trim() -ine "none") { + $xcopyMSBuildToolsFolder = InitializeXCopyMSBuild $GlobalJson.tools."xcopy-msbuild" -install $true + } + if ($xcopyMSBuildToolsFolder -eq $null) { + throw 'Unable to get xcopy downloadable version of msbuild' + } + + $global:_MSBuildExe = "$($xcopyMSBuildToolsFolder)\MSBuild\Current\Bin\MSBuild.exe" } $taskProject = GetSdkTaskProject $task diff --git a/eng/common/template-guidance.md b/eng/common/template-guidance.md index f772aa3d78f..cdc62e72b07 100644 --- a/eng/common/template-guidance.md +++ b/eng/common/template-guidance.md @@ -81,6 +81,7 @@ eng\common\ publish-build-artifacts.yml (logic) publish-pipeline-artifacts.yml (logic) component-governance.yml (shim) + generate-sbom.yml (shim) publish-logs.yml (shim) retain-build.yml (shim) send-to-helix.yml (shim) @@ -103,6 +104,7 @@ eng\common\ setup-maestro-vars.yml (logic) steps\ component-governance.yml (logic) + generate-sbom.yml (logic) publish-build-artifacts.yml (redirect) publish-logs.yml (logic) publish-pipeline-artifacts.yml (redirect) diff --git a/eng/common/templates-official/job/job.yml b/eng/common/templates-official/job/job.yml index d68e9fbc265..f70224eaa45 100644 --- a/eng/common/templates-official/job/job.yml +++ b/eng/common/templates-official/job/job.yml @@ -1,15 +1,24 @@ parameters: +# Sbom related params + enableSbom: true runAsPublic: false -# Sbom related params, unused now and can eventually be removed - enableSbom: unused - PackageVersion: unused - BuildDropPath: unused + PackageVersion: 9.0.0 + BuildDropPath: '$(System.DefaultWorkingDirectory)/artifacts' jobs: - template: /eng/common/core-templates/job/job.yml parameters: is1ESPipeline: true + componentGovernanceSteps: + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.enableSbom, 'true')) }}: + - template: /eng/common/templates/steps/generate-sbom.yml + parameters: + PackageVersion: ${{ parameters.packageVersion }} + BuildDropPath: ${{ parameters.buildDropPath }} + ManifestDirPath: $(Build.ArtifactStagingDirectory)/sbom + publishArtifacts: false + # publish artifacts # for 1ES managed templates, use the templateContext.output to handle multiple outputs. templateContext: @@ -17,19 +26,12 @@ jobs: outputs: - ${{ if ne(parameters.artifacts.publish, '') }}: - ${{ if and(ne(parameters.artifacts.publish.artifacts, 'false'), ne(parameters.artifacts.publish.artifacts, '')) }}: - - output: pipelineArtifact - displayName: Publish pipeline artifacts - targetPath: '$(Build.ArtifactStagingDirectory)/artifacts' - artifactName: ${{ coalesce(parameters.artifacts.publish.artifacts.name , 'Artifacts_$(Agent.Os)_$(_BuildConfig)') }} - condition: succeeded() - retryCountOnTaskFailure: 10 # for any files being locked - continueOnError: true - - output: pipelineArtifact + - output: buildArtifacts displayName: Publish pipeline artifacts - targetPath: '$(Build.ArtifactStagingDirectory)/artifacts' - artifactName: ${{ coalesce(parameters.artifacts.publish.artifacts.name , 'Artifacts_$(Agent.Os)_$(_BuildConfig)') }}_Attempt$(System.JobAttempt) - condition: not(succeeded()) - retryCountOnTaskFailure: 10 # for any files being locked + PathtoPublish: '$(Build.ArtifactStagingDirectory)/artifacts' + ArtifactName: ${{ coalesce(parameters.artifacts.publish.artifacts.name , 'Artifacts_$(Agent.Os)_$(_BuildConfig)') }} + condition: always() + retryCountOnTaskFailure: 10 # for any logs being locked continueOnError: true - ${{ if and(ne(parameters.artifacts.publish.logs, 'false'), ne(parameters.artifacts.publish.logs, '')) }}: - output: pipelineArtifact @@ -38,8 +40,8 @@ jobs: displayName: 'Publish logs' continueOnError: true condition: always() - retryCountOnTaskFailure: 10 # for any files being locked - isProduction: false # logs are non-production artifacts + retryCountOnTaskFailure: 10 # for any logs being locked + sbomEnabled: false # we don't need SBOM for logs - ${{ if eq(parameters.enablePublishBuildArtifacts, true) }}: - output: pipelineArtifact @@ -48,8 +50,7 @@ jobs: artifactName: ${{ coalesce(parameters.enablePublishBuildArtifacts.artifactName, '$(Agent.Os)_$(Agent.JobName)_Attempt$(System.JobAttempt)' ) }} continueOnError: true condition: always() - retryCountOnTaskFailure: 10 # for any files being locked - isProduction: false # logs are non-production artifacts + sbomEnabled: false # we don't need SBOM for logs - ${{ if eq(parameters.enableBuildRetry, 'true') }}: - output: pipelineArtifact @@ -57,20 +58,14 @@ jobs: artifactName: 'BuildConfiguration' displayName: 'Publish build retry configuration' continueOnError: true - retryCountOnTaskFailure: 10 # for any files being locked - isProduction: false # BuildConfiguration is a non-production artifact + sbomEnabled: false # we don't need SBOM for BuildConfiguration - # V4 publishing: automatically publish staged artifacts as a pipeline artifact. - # The artifact name matches the SDK's FutureArtifactName ($(System.PhaseName)_Artifacts), - # which is encoded in the asset manifest for downstream publishing to discover. - # Jobs can opt in by setting enablePublishing: true. - - ${{ if and(eq(parameters.publishingVersion, 4), eq(parameters.enablePublishing, 'true')) }}: + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.enableSbom, 'true')) }}: - output: pipelineArtifact - displayName: 'Publish V4 pipeline artifacts' - targetPath: '$(Build.ArtifactStagingDirectory)/artifacts' - artifactName: '$(System.PhaseName)_Artifacts' + displayName: Publish SBOM manifest continueOnError: true - retryCountOnTaskFailure: 10 # for any files being locked + targetPath: $(Build.ArtifactStagingDirectory)/sbom + artifactName: $(ARTIFACT_NAME) # add any outputs provided via root yaml - ${{ if ne(parameters.templateContext.outputs, '') }}: diff --git a/eng/common/templates-official/steps/component-governance.yml b/eng/common/templates-official/steps/component-governance.yml new file mode 100644 index 00000000000..30bb3985ca2 --- /dev/null +++ b/eng/common/templates-official/steps/component-governance.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/component-governance.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/steps/publish-pipeline-artifacts.yml b/eng/common/templates-official/steps/publish-pipeline-artifacts.yml index 9e5981365e5..172f9f0fdc9 100644 --- a/eng/common/templates-official/steps/publish-pipeline-artifacts.yml +++ b/eng/common/templates-official/steps/publish-pipeline-artifacts.yml @@ -24,7 +24,5 @@ steps: artifactName: ${{ parameters.args.artifactName }} ${{ if parameters.args.properties }}: properties: ${{ parameters.args.properties }} - ${{ if ne(parameters.args.sbomEnabled, '') }}: + ${{ if parameters.args.sbomEnabled }}: sbomEnabled: ${{ parameters.args.sbomEnabled }} - ${{ if ne(parameters.args.isProduction, '') }}: - isProduction: ${{ parameters.args.isProduction }} diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index 5e261f34db4..7f1b5d97d1a 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -1,12 +1,12 @@ parameters: enablePublishBuildArtifacts: false + disableComponentGovernance: '' + componentGovernanceIgnoreDirectories: '' +# Sbom related params + enableSbom: true runAsPublic: false -# CG related params, unused now and can eventually be removed - disableComponentGovernance: unused -# Sbom related params, unused now and can eventually be removed - enableSbom: unused - PackageVersion: unused - BuildDropPath: unused + PackageVersion: 9.0.0 + BuildDropPath: '$(System.DefaultWorkingDirectory)/artifacts' jobs: - template: /eng/common/core-templates/job/job.yml @@ -21,34 +21,32 @@ jobs: - ${{ each step in parameters.steps }}: - ${{ step }} - # we don't run CG in public - - ${{ if eq(variables['System.TeamProject'], 'public') }}: - - script: echo "##vso[task.setvariable variable=skipComponentGovernanceDetection]true" - displayName: Set skipComponentGovernanceDetection variable + componentGovernanceSteps: + - template: /eng/common/templates/steps/component-governance.yml + parameters: + ${{ if eq(parameters.disableComponentGovernance, '') }}: + ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.runAsPublic, 'false'), or(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/dotnet/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/microsoft/'), eq(variables['Build.SourceBranch'], 'refs/heads/main'))) }}: + disableComponentGovernance: false + ${{ else }}: + disableComponentGovernance: true + ${{ else }}: + disableComponentGovernance: ${{ parameters.disableComponentGovernance }} + componentGovernanceIgnoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} artifactPublishSteps: - ${{ if ne(parameters.artifacts.publish, '') }}: - ${{ if and(ne(parameters.artifacts.publish.artifacts, 'false'), ne(parameters.artifacts.publish.artifacts, '')) }}: - - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml + - template: /eng/common/core-templates/steps/publish-build-artifacts.yml parameters: is1ESPipeline: false args: displayName: Publish pipeline artifacts - targetPath: '$(Build.ArtifactStagingDirectory)/artifacts' + pathToPublish: '$(Build.ArtifactStagingDirectory)/artifacts' + publishLocation: Container artifactName: ${{ coalesce(parameters.artifacts.publish.artifacts.name , 'Artifacts_$(Agent.Os)_$(_BuildConfig)') }} continueOnError: true - condition: succeeded() - retryCountOnTaskFailure: 10 # for any files being locked - - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml - parameters: - is1ESPipeline: false - args: - displayName: Publish pipeline artifacts - targetPath: '$(Build.ArtifactStagingDirectory)/artifacts' - artifactName: ${{ coalesce(parameters.artifacts.publish.artifacts.name , 'Artifacts_$(Agent.Os)_$(_BuildConfig)') }}_Attempt$(System.JobAttempt) - continueOnError: true - condition: not(succeeded()) - retryCountOnTaskFailure: 10 # for any files being locked + condition: always() + retryCountOnTaskFailure: 10 # for any logs being locked - ${{ if and(ne(parameters.artifacts.publish.logs, 'false'), ne(parameters.artifacts.publish.logs, '')) }}: - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml parameters: @@ -59,7 +57,8 @@ jobs: displayName: 'Publish logs' continueOnError: true condition: always() - retryCountOnTaskFailure: 10 # for any files being locked + retryCountOnTaskFailure: 10 # for any logs being locked + sbomEnabled: false # we don't need SBOM for logs - ${{ if ne(parameters.enablePublishBuildArtifacts, 'false') }}: - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml @@ -71,7 +70,7 @@ jobs: artifactName: ${{ coalesce(parameters.enablePublishBuildArtifacts.artifactName, '$(Agent.Os)_$(Agent.JobName)_Attempt$(System.JobAttempt)' ) }} continueOnError: true condition: always() - retryCountOnTaskFailure: 10 # for any files being locked + sbomEnabled: false - ${{ if eq(parameters.enableBuildRetry, 'true') }}: - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml @@ -82,4 +81,4 @@ jobs: artifactName: 'BuildConfiguration' displayName: 'Publish build retry configuration' continueOnError: true - retryCountOnTaskFailure: 10 # for any files being locked + sbomEnabled: false # we don't need SBOM for BuildConfiguration diff --git a/eng/common/templates/steps/component-governance.yml b/eng/common/templates/steps/component-governance.yml new file mode 100644 index 00000000000..c12a5f8d21d --- /dev/null +++ b/eng/common/templates/steps/component-governance.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/component-governance.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index e28db6c7c8f..2b593af51ce 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -185,11 +185,7 @@ function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) { if ((-not $globalJsonHasRuntimes) -and (-not [string]::IsNullOrEmpty($env:DOTNET_INSTALL_DIR)) -and (Test-Path(Join-Path $env:DOTNET_INSTALL_DIR "sdk\$dotnetSdkVersion"))) { $dotnetRoot = $env:DOTNET_INSTALL_DIR } else { - if (-not [string]::IsNullOrEmpty($env:DOTNET_GLOBAL_INSTALL_DIR)) { - $dotnetRoot = $env:DOTNET_GLOBAL_INSTALL_DIR - } else { - $dotnetRoot = Join-Path $RepoRoot '.dotnet' - } + $dotnetRoot = Join-Path $RepoRoot '.dotnet' if (-not (Test-Path(Join-Path $dotnetRoot "sdk\$dotnetSdkVersion"))) { if ($install) { @@ -379,11 +375,12 @@ function InstallDotNet([string] $dotnetRoot, # # 1. MSBuild from an active VS command prompt # 2. MSBuild from a compatible VS installation +# 3. MSBuild from the xcopy tool package # # Returns full path to msbuild.exe. # Throws on failure. # -function InitializeVisualStudioMSBuild([object]$vsRequirements = $null) { +function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = $null) { if (-not (IsWindowsPlatform)) { throw "Cannot initialize Visual Studio on non-Windows" } @@ -393,7 +390,13 @@ function InitializeVisualStudioMSBuild([object]$vsRequirements = $null) { } # Minimum VS version to require. - $vsMinVersionReqdStr = '18.0' + $vsMinVersionReqdStr = '17.7' + $vsMinVersionReqd = [Version]::new($vsMinVersionReqdStr) + + # If the version of msbuild is going to be xcopied, + # use this version. Version matches a package here: + # https://dev.azure.com/dnceng/public/_artifacts/feed/dotnet-eng/NuGet/Microsoft.DotNet.Arcade.MSBuild.Xcopy/versions/18.0.0 + $defaultXCopyMSBuildVersion = '18.0.0' if (!$vsRequirements) { if (Get-Member -InputObject $GlobalJson.tools -Name 'vs') { @@ -423,16 +426,46 @@ function InitializeVisualStudioMSBuild([object]$vsRequirements = $null) { } } - # Locate Visual Studio installation. + # Locate Visual Studio installation or download x-copy msbuild. $vsInfo = LocateVisualStudio $vsRequirements - if ($vsInfo -ne $null) { + if ($vsInfo -ne $null -and $env:ForceUseXCopyMSBuild -eq $null) { # Ensure vsInstallDir has a trailing slash $vsInstallDir = Join-Path $vsInfo.installationPath "\" $vsMajorVersion = $vsInfo.installationVersion.Split('.')[0] InitializeVisualStudioEnvironmentVariables $vsInstallDir $vsMajorVersion } else { - throw 'Unable to find Visual Studio that has required version and components installed' + if (Get-Member -InputObject $GlobalJson.tools -Name 'xcopy-msbuild') { + $xcopyMSBuildVersion = $GlobalJson.tools.'xcopy-msbuild' + $vsMajorVersion = $xcopyMSBuildVersion.Split('.')[0] + } else { + #if vs version provided in global.json is incompatible (too low) then use the default version for xcopy msbuild download + if($vsMinVersion -lt $vsMinVersionReqd){ + Write-Host "Using xcopy-msbuild version of $defaultXCopyMSBuildVersion since VS version $vsMinVersionStr provided in global.json is not compatible" + $xcopyMSBuildVersion = $defaultXCopyMSBuildVersion + $vsMajorVersion = $xcopyMSBuildVersion.Split('.')[0] + } + else{ + # If the VS version IS compatible, look for an xcopy msbuild package + # with a version matching VS. + # Note: If this version does not exist, then an explicit version of xcopy msbuild + # can be specified in global.json. This will be required for pre-release versions of msbuild. + $vsMajorVersion = $vsMinVersion.Major + $vsMinorVersion = $vsMinVersion.Minor + $xcopyMSBuildVersion = "$vsMajorVersion.$vsMinorVersion.0" + } + } + + $vsInstallDir = $null + if ($xcopyMSBuildVersion.Trim() -ine "none") { + $vsInstallDir = InitializeXCopyMSBuild $xcopyMSBuildVersion $install + if ($vsInstallDir -eq $null) { + throw "Could not xcopy msbuild. Please check that package 'Microsoft.DotNet.Arcade.MSBuild.Xcopy @ $xcopyMSBuildVersion' exists on feed 'dotnet-eng'." + } + } + if ($vsInstallDir -eq $null) { + throw 'Unable to find Visual Studio that has required version and components installed' + } } $msbuildVersionDir = if ([int]$vsMajorVersion -lt 16) { "$vsMajorVersion.0" } else { "Current" } @@ -459,6 +492,38 @@ function InitializeVisualStudioEnvironmentVariables([string] $vsInstallDir, [str } } +function InstallXCopyMSBuild([string]$packageVersion) { + return InitializeXCopyMSBuild $packageVersion -install $true +} + +function InitializeXCopyMSBuild([string]$packageVersion, [bool]$install) { + $packageName = 'Microsoft.DotNet.Arcade.MSBuild.Xcopy' + $packageDir = Join-Path $ToolsDir "msbuild\$packageVersion" + $packagePath = Join-Path $packageDir "$packageName.$packageVersion.nupkg" + + if (!(Test-Path $packageDir)) { + if (!$install) { + return $null + } + + Create-Directory $packageDir + + Write-Host "Downloading $packageName $packageVersion" + $ProgressPreference = 'SilentlyContinue' # Don't display the console progress UI - it's a huge perf hit + Retry({ + Invoke-WebRequest "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/flat2/$packageName/$packageVersion/$packageName.$packageVersion.nupkg" -UseBasicParsing -OutFile $packagePath + }) + + if (!(Test-Path $packagePath)) { + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "See https://dev.azure.com/dnceng/internal/_wiki/wikis/DNCEng%20Services%20Wiki/1074/Updating-Microsoft.DotNet.Arcade.MSBuild.Xcopy-WAS-RoslynTools.MSBuild-(xcopy-msbuild)-generation?anchor=troubleshooting for help troubleshooting issues with XCopy MSBuild" + throw + } + Unzip $packagePath $packageDir + } + + return Join-Path $packageDir 'tools' +} + # # Locates Visual Studio instance that meets the minimal requirements specified by tools.vs object in global.json. # @@ -568,7 +633,7 @@ function InitializeBuildTool() { $buildTool = @{ Path = $dotnetPath; Command = 'msbuild'; Tool = 'dotnet'; Framework = 'net' } } elseif ($msbuildEngine -eq "vs") { try { - $msbuildPath = InitializeVisualStudioMSBuild + $msbuildPath = InitializeVisualStudioMSBuild -install:$restore } catch { Write-PipelineTelemetryError -Category 'InitializeToolset' -Message $_ ExitWithExitCode 1 diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 1e37fd95b21..80d2dbd0fe3 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -148,11 +148,7 @@ function InitializeDotNetCli { if [[ $global_json_has_runtimes == false && -n "${DOTNET_INSTALL_DIR:-}" && -d "$DOTNET_INSTALL_DIR/sdk/$dotnet_sdk_version" ]]; then dotnet_root="$DOTNET_INSTALL_DIR" else - if [[ -n "${DOTNET_GLOBAL_INSTALL_DIR:-}" ]]; then - dotnet_root="$DOTNET_GLOBAL_INSTALL_DIR" - else - dotnet_root="${repo_root}.dotnet" - fi + dotnet_root="${repo_root}.dotnet" export DOTNET_INSTALL_DIR="$dotnet_root" diff --git a/global.json b/global.json index ba640d15ea5..8c1b79d45a1 100644 --- a/global.json +++ b/global.json @@ -12,8 +12,8 @@ "dotnet": "11.0.100-preview.3.26170.106" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "11.0.0-beta.26209.2", - "Microsoft.DotNet.Helix.Sdk": "11.0.0-beta.26209.2", + "Microsoft.DotNet.Arcade.Sdk": "11.0.0-beta.26210.111", + "Microsoft.DotNet.Helix.Sdk": "11.0.0-beta.26210.111", "Microsoft.Build.NoTargets": "3.7.0" } } diff --git a/src/Microsoft.DotNet.Arcade.Sdk/Microsoft.DotNet.Arcade.Sdk.csproj b/src/Microsoft.DotNet.Arcade.Sdk/Microsoft.DotNet.Arcade.Sdk.csproj index 861028474b9..dddba69cd4d 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/Microsoft.DotNet.Arcade.Sdk.csproj +++ b/src/Microsoft.DotNet.Arcade.Sdk/Microsoft.DotNet.Arcade.Sdk.csproj @@ -17,7 +17,7 @@ false <_GeneratedVersionFilePath>$(IntermediateOutputPath)DefaultVersions.Generated.props - $(NoWarn);3021;NU5105;NU5111;SYSLIB0013 + $(NoWarn);3021;NU5100;NU5105;NU5111;SYSLIB0013 @@ -40,6 +40,9 @@ + @@ -84,10 +87,10 @@ + PackagePath="toolset\net\Microsoft.DotNet.ArcadeLogging.dll" /> diff --git a/src/Microsoft.DotNet.Arcade.Sdk/sdk/Sdk.props b/src/Microsoft.DotNet.Arcade.Sdk/sdk/Sdk.props index 10e1fe67ea4..b560dbf5b65 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/sdk/Sdk.props +++ b/src/Microsoft.DotNet.Arcade.Sdk/sdk/Sdk.props @@ -1,16 +1,6 @@ - - - <_SuppressSdkImports>false - <_SuppressSdkImports Condition="'$(__ToolsetLocationOutputFile)' != ''">true - - - + diff --git a/src/Microsoft.DotNet.Arcade.Sdk/sdk/Sdk.targets b/src/Microsoft.DotNet.Arcade.Sdk/sdk/Sdk.targets index 11708bccc85..a55e12a0efc 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/sdk/Sdk.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/sdk/Sdk.targets @@ -10,21 +10,10 @@ <_BeforeCommonTargetsHookUsed Condition="'$(_ArcadeBeforeCommonTargetsImported)' != 'true'">false - - + + - - - - - - - - - - + + diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/BuildStep.props b/src/Microsoft.DotNet.Arcade.Sdk/tools/BuildStep.props deleted file mode 100644 index a48dd077e84..00000000000 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/BuildStep.props +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/BuildTasks.props b/src/Microsoft.DotNet.Arcade.Sdk/tools/BuildTasks.props index 9a51d5b4cb9..370a4fd9754 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/BuildTasks.props +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/BuildTasks.props @@ -15,4 +15,23 @@ $(MSBuildThisFileDirectory)net\Microsoft.DotNet.Arcade.Sdk.dll + + + + + + + + + + + + + + + + + + + diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/DefaultVersions.props b/src/Microsoft.DotNet.Arcade.Sdk/tools/DefaultVersions.props index b56d1efedb2..05ea58edf90 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/DefaultVersions.props +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/DefaultVersions.props @@ -93,8 +93,6 @@ $(MSTestVersion) $(ArcadeSdkVersion) $(ArcadeSdkVersion) - - 3.1.7 1.0.0 $(ArcadeSdkVersion) $(ArcadeSdkVersion) @@ -103,6 +101,9 @@ 1.1.286 3.14.1-11027.2914512 5.0.2-dotnet.2811440 + + $(ArcadeSdkVersion) + $(ArcadeSdkVersion) diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/Directory.Build.props b/src/Microsoft.DotNet.Arcade.Sdk/tools/Directory.Build.props deleted file mode 100644 index baea506b124..00000000000 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/Directory.Build.props +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - false - false - - - diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/Empty.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/Empty.targets index fd18c0474aa..e1a79f00fbd 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/Empty.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/Empty.targets @@ -1,5 +1,5 @@ - + - - false + true + false + false + false + false + false + true + false + false + true + true + false + false + false + None + false + false - - - - + + + + + + + + - + + + + + + + + + + + diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/EmptyDisableRestore.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/EmptyDisableRestore.targets new file mode 100644 index 00000000000..9ece989244e --- /dev/null +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/EmptyDisableRestore.targets @@ -0,0 +1,16 @@ + + + + + + false + + + + + + + + diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/ExcludeFromBuild.BeforeCommonTargets.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/ExcludeFromBuild.BeforeCommonTargets.targets index 3e7006260e8..d196db8678a 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/ExcludeFromBuild.BeforeCommonTargets.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/ExcludeFromBuild.BeforeCommonTargets.targets @@ -46,7 +46,6 @@ avoid building tests in certain product build scenarios. --> - <_SuppressAllTargets>false <_SuppressAllTargets Condition="'$(DotNetBuildSourceOnly)' == 'true' and '$(ExcludeFromSourceOnlyBuild)' == 'true'">true <_SuppressAllTargets Condition="'$(DotNetBuild)' == 'true' and '$(ExcludeFromDotNetBuild)' == 'true'">true @@ -57,7 +56,7 @@ which will avoid importing the restore targets inside the .NET SDK. If the restore targets exist, then static graph restore will attempt tpo execute. --> true - $(MSBuildThisFileDirectory)NoRestore.targets + $(MSBuildThisFileDirectory)NoRestore.targets false diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/GenerateChecksums.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/GenerateChecksums.targets index b625b3e70e9..02089e3a6d1 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/GenerateChecksums.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/GenerateChecksums.targets @@ -1,8 +1,6 @@ - - diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/GenerateResxSource.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/GenerateResxSource.targets index e7f105c21d0..d031f0d797f 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/GenerateResxSource.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/GenerateResxSource.targets @@ -6,8 +6,6 @@ The source file is generated to intermediate output dir to avoid polluting the source tree. See https://github.com/dotnet/sdk/issues/94 that tracks productization of this code. --> - - diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/OptimizationData.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/OptimizationData.targets index 24ef2781aa1..d20874ec3e4 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/OptimizationData.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/OptimizationData.targets @@ -13,10 +13,6 @@ OptimizeAssembly Set of assemblies to apply Partial NGEN optimization data to. --> - - - - $(IntermediateOutputPath)$(TargetFileName).pcbm diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/RepositoryInfo.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/RepositoryInfo.targets index f3f1dc0a5d9..36233e7cd88 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/RepositoryInfo.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/RepositoryInfo.targets @@ -56,7 +56,6 @@ Condition="'$(DisableSourceLinkUrlTranslation)' == 'false'" DependsOnTargets="$(SourceControlManagerUrlTranslationTargets)" BeforeTargets="SourceControlManagerPublishTranslatedUrls"> - @@ -78,7 +77,6 @@ Generates and adds {PackageId}.SourceLink.targets file to the build directory of the source package. --> - $(BeforePack);_AddSourcePackageSourceLinkFile @@ -119,14 +117,31 @@ - - + + + + + + + + + <_LicenseExpression>$(PackageLicenseExpression) + <_LicenseExpression Condition="'$(_LicenseExpression)' == ''">$(PackageLicenseExpressionInternal) + + <_ExpectedLicensePath>$(MSBuildThisFileDirectory)Licenses\$(_LicenseExpression).txt + + + + + + + + + diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/RepositoryValidation.proj b/src/Microsoft.DotNet.Arcade.Sdk/tools/RepositoryValidation.proj index 5efc4b438dd..b45d2f307ab 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/RepositoryValidation.proj +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/RepositoryValidation.proj @@ -8,9 +8,6 @@ - - - diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/RuntimeIdentifierInference.BeforeNETSdkTargets.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/RuntimeIdentifierInference.BeforeNETSdkTargets.targets index e0d310a92a4..4840877b1ad 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/RuntimeIdentifierInference.BeforeNETSdkTargets.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/RuntimeIdentifierInference.BeforeNETSdkTargets.targets @@ -86,9 +86,6 @@ <_FilterRuntimeIdentifier Condition="'$(PortableTargetRid)' != ''">$(PortableTargetRid) - - <_SuppressAllTargets Condition="'$(DisableArcadeExcludeFromBuildSupport)' != 'true' and $(_ExplicitlySpecifiedRuntimeIdentifiers.Contains(';$(_FilterRuntimeIdentifier);')) == 'false'">true - $(RuntimeIdentifier) diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/Directory.Build.props b/src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/Directory.Build.props deleted file mode 100644 index a889329a529..00000000000 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/Directory.Build.props +++ /dev/null @@ -1,14 +0,0 @@ - - - - - $([System.IO.Path]::GetFullPath('$(RepoRoot)/')) - - - - - - - - - diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/Versions.props b/src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/Versions.props deleted file mode 100644 index d99f8045360..00000000000 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/Versions.props +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - $(ArcadeSdkVersion) - $(ArcadeSdkVersion) - $(ArcadeSdkVersion) - $(ArcadeSdkVersion) - $(MicrosoftSymbolUploaderBuildTaskVersion) - - - - - $(RestoreAdditionalProjectSources); - https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json; - https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json; - https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json; - - - - diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/StrongName.props b/src/Microsoft.DotNet.Arcade.Sdk/tools/StrongName.props index 045bb042595..7e183cc1d35 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/StrongName.props +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/StrongName.props @@ -19,8 +19,12 @@ throwing an exception. For more details and an example, see https://github.com/dotnet/runtime/issues/65874. --> - false + + + $(MSBuildThisFileDirectory)snk\ + + diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/StrongName.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/StrongName.targets index 91c801d48ba..94ea2d76039 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/StrongName.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/StrongName.targets @@ -31,21 +31,21 @@ - $(MSBuildThisFileDirectory)snk/MSFT.snk + $(ArcadeSdkSnkDir)MSFT.snk $(MicrosoftPublicKey) b03f5f7f11d50a3a - $(MSBuildThisFileDirectory)snk/35MSSharedLib1024.snk + $(ArcadeSdkSnkDir)35MSSharedLib1024.snk $(MicrosoftSharedPublicKey) 31BF3856AD364E35 - $(MSBuildThisFileDirectory)snk/AspNetCore.snk + $(ArcadeSdkSnkDir)AspNetCore.snk $(MicrosoftAspNetCorePublicKey) adb9793829ddae60 false @@ -53,7 +53,7 @@ - $(MSBuildThisFileDirectory)snk/ECMA.snk + $(ArcadeSdkSnkDir)ECMA.snk $(ECMAPublicKey) b77a5c561934e089 @@ -65,7 +65,7 @@ --> - $(MSBuildThisFileDirectory)snk/Open.snk + $(ArcadeSdkSnkDir)Open.snk $(OpenPublicKey) cc7b13ffcd2ddd51 false @@ -74,7 +74,7 @@ - $(MSBuildThisFileDirectory)snk/SilverlightPlatformPublicKey.snk + $(ArcadeSdkSnkDir)SilverlightPlatformPublicKey.snk $(SilverlightPlatformPublicKey) 7cec85d7bea7798e diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/Tools.proj b/src/Microsoft.DotNet.Arcade.Sdk/tools/Tools.proj deleted file mode 100644 index c5ba4421054..00000000000 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/Tools.proj +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - - net472 - - 5 - .NETFramework - .NETFramework,Version=v4.7.2 - $(BaseIntermediateOutputPath) - - PackageReference - true - - - - true - Restore - - - - - $(RepoRoot)NuGet.config - $(RepoRoot)NuGet.Config - $(RepoRoot)nuget.config - - - - - - - - - - - <_ImportOrUseTooling Condition="'$(_ImportOrUseTooling)' == '' and '$(DotNetBuildSourceOnly)' != 'true'">true - $(Publish) - - - - - - - - - - - - - - - - - - - - - - - <_RepoToolManifest>$([MSBuild]::NormalizePath('$(RepoRoot)', '.config', 'dotnet-tools.json')) - - - - - - - - - --configfile "$(RestoreConfigFile)" - - - - - - - - - $(RepoRoot)eng/common/internal/Tools.csproj - $(RepoRoot)eng/common/internal/NuGet.config - - - - - - - - - - - - - - - - diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/Version.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/Version.targets index fab5620c279..4b6b9e42679 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/Version.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/Version.targets @@ -8,8 +8,6 @@ SemanticVersioningV1 "true" if the Version needs to respect SemVer 1.0. Default is false, which means format following SemVer 2.0. --> - - diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/VisualStudio.VsixBuild.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/VisualStudio.VsixBuild.targets index 5a654f5e468..3c4a7e19972 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/VisualStudio.VsixBuild.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/VisualStudio.VsixBuild.targets @@ -19,8 +19,6 @@ Writes a stub file to component intermediate directory. --> - - - - $(NuGetPackageRoot)microsoft.dotnet.build.tasks.visualstudio\$(MicrosoftDotNetBuildTasksVisualStudioVersion)\tools\net\Microsoft.DotNet.Build.Tasks.VisualStudio.dll - - diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/AfterSigning.proj b/src/Microsoft.DotNet.Arcade.Sdk/toolset/AfterSigning.proj similarity index 54% rename from src/Microsoft.DotNet.Arcade.Sdk/tools/AfterSigning.proj rename to src/Microsoft.DotNet.Arcade.Sdk/toolset/AfterSigning.proj index be73c83cef3..74f91d51b5e 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/AfterSigning.proj +++ b/src/Microsoft.DotNet.Arcade.Sdk/toolset/AfterSigning.proj @@ -1,43 +1,5 @@ - - - - true - - - - - - - - - - BeforeBuild; - CoreBuild; - AfterBuild - - - - - - - - - - - - BeforePack; - CorePack; - AfterPack - - - - - - - - - + - - - - - true - - - - - - - - - - - + diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/Build.proj b/src/Microsoft.DotNet.Arcade.Sdk/toolset/Build.proj similarity index 95% rename from src/Microsoft.DotNet.Arcade.Sdk/tools/Build.proj rename to src/Microsoft.DotNet.Arcade.Sdk/toolset/Build.proj index 802e0962075..ad5e7b9b478 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/Build.proj +++ b/src/Microsoft.DotNet.Arcade.Sdk/toolset/Build.proj @@ -1,5 +1,5 @@ - + - true @@ -49,9 +47,6 @@ - - - @@ -153,12 +148,8 @@ <_RestoreToolsProps Include="@(_CommonProps)"/> - <_RestoreToolsProps Include="BaseIntermediateOutputPath=$(ArtifactsToolsetDir)Common"/> <_RestoreToolsProps Include="ExcludeRestorePackageImports=true"/> - <_RestoreToolsProps Include="_NuGetRestoreTargets=$(_NuGetRestoreTargets)"/> - - - <_RestoreToolsProps Include="Publish=$(Publish)"/> + <_RestoreToolsProps Condition="'@(_SolutionBuildTargets)' != ''" Include="_SolutionBuildTargets=true"/> - diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/BuildReleasePackages.targets b/src/Microsoft.DotNet.Arcade.Sdk/toolset/BuildReleasePackages.targets similarity index 79% rename from src/Microsoft.DotNet.Arcade.Sdk/tools/BuildReleasePackages.targets rename to src/Microsoft.DotNet.Arcade.Sdk/toolset/BuildReleasePackages.targets index 048dcff3db1..31bfb572a10 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/BuildReleasePackages.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/toolset/BuildReleasePackages.targets @@ -1,15 +1,12 @@ - - <_NuGetRepackAssembly>$(NuGetPackageRoot)microsoft.dotnet.nugetrepack.tasks\$(MicrosoftDotnetNuGetRepackTasksVersion)\tools\net\Microsoft.DotNet.NuGetRepack.Tasks.dll - - - + + + - diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/CreateBaselineUpdatePR.proj b/src/Microsoft.DotNet.Arcade.Sdk/toolset/CreateBaselineUpdatePR.proj similarity index 78% rename from src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/CreateBaselineUpdatePR.proj rename to src/Microsoft.DotNet.Arcade.Sdk/toolset/CreateBaselineUpdatePR.proj index c3c1920baaa..30d5b7300c8 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/CreateBaselineUpdatePR.proj +++ b/src/Microsoft.DotNet.Arcade.Sdk/toolset/CreateBaselineUpdatePR.proj @@ -2,12 +2,11 @@ - $(BundledNETCoreAppTargetFramework) Publish - + diff --git a/src/Microsoft.DotNet.Arcade.Sdk/toolset/Directory.Build.props b/src/Microsoft.DotNet.Arcade.Sdk/toolset/Directory.Build.props new file mode 100644 index 00000000000..1849d9c37b6 --- /dev/null +++ b/src/Microsoft.DotNet.Arcade.Sdk/toolset/Directory.Build.props @@ -0,0 +1,25 @@ + + + + + toolset\$(MSBuildProjectName) + + + + + + $(BundledNETCoreAppTargetFramework) + + + true + + <_SuppressAllTargets>true + <_SuppressSdkImports>false + <_NoSuppressRestoreTarget>false + + + false + false + + + diff --git a/src/Microsoft.DotNet.Arcade.Sdk/toolset/Directory.Build.targets b/src/Microsoft.DotNet.Arcade.Sdk/toolset/Directory.Build.targets new file mode 100644 index 00000000000..1b623e82d8f --- /dev/null +++ b/src/Microsoft.DotNet.Arcade.Sdk/toolset/Directory.Build.targets @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/Microsoft.DotNet.Arcade.Sdk/toolset/Directory.Packages.props b/src/Microsoft.DotNet.Arcade.Sdk/toolset/Directory.Packages.props new file mode 100644 index 00000000000..c86d56ee87e --- /dev/null +++ b/src/Microsoft.DotNet.Arcade.Sdk/toolset/Directory.Packages.props @@ -0,0 +1,22 @@ + + + + + true + + $(NoWarn);NU1507 + + + + + + + + + + + + + + + diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/InstallDotNetCore.targets b/src/Microsoft.DotNet.Arcade.Sdk/toolset/InstallDotNetCore.targets similarity index 72% rename from src/Microsoft.DotNet.Arcade.Sdk/tools/InstallDotNetCore.targets rename to src/Microsoft.DotNet.Arcade.Sdk/toolset/InstallDotNetCore.targets index aba176e26b2..27bccaf4b26 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/InstallDotNetCore.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/toolset/InstallDotNetCore.targets @@ -1,17 +1,13 @@ - - - + <_DotNetInstallScript>$(RepositoryEngineeringDir)common\dotnet-install.cmd <_DotNetInstallScript Condition="'$(OS)' != 'Windows_NT'">$(RepositoryEngineeringDir)common\dotnet-install.sh - + - + - - - true - - - - - + + + - @@ -72,7 +65,7 @@ - BeforePublish;AutoGenerateSymbolPackages + GatherPublishItems;AutoGenerateSymbolPackages assets/symbols/ $(SymbolPackageBaseRelativeBlobPath)$(BUILD_REPOSITORY_NAME)/ @@ -132,11 +125,9 @@ - - - + - + <_ExistingSymbolPackage Include="@(Artifact)" Condition="'%(Artifact.SkipPublish)' != 'true' and $([System.String]::Copy('%(Filename)%(Extension)').EndsWith('.symbols.nupkg'))"> @@ -183,7 +174,7 @@ - + $(ArtifactsTmpDir)SymbolPackages\ @@ -348,7 +339,7 @@ true - + diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/PublishArtifactsInManifest.proj b/src/Microsoft.DotNet.Arcade.Sdk/toolset/PublishArtifactsInManifest.proj similarity index 98% rename from src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/PublishArtifactsInManifest.proj rename to src/Microsoft.DotNet.Arcade.Sdk/toolset/PublishArtifactsInManifest.proj index 1c09e11e205..e551d8cf8f3 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/PublishArtifactsInManifest.proj +++ b/src/Microsoft.DotNet.Arcade.Sdk/toolset/PublishArtifactsInManifest.proj @@ -75,14 +75,16 @@ --> - $(BundledNETCoreAppTargetFramework) Publish false - + + + + @@ -158,12 +160,7 @@ StreamingPublishingMaxClients="$(StreamingPublishingMaxClients)" NonStreamingPublishingMaxClients="$(NonStreamingPublishingMaxClients)" FeedKeys="@(FeedKey)" - FeedOverrides="@(FeedOverride)" - /> + FeedOverrides="@(FeedOverride)" /> - - - - diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/PublishBuildAssets.proj b/src/Microsoft.DotNet.Arcade.Sdk/toolset/PublishBuildAssets.proj similarity index 83% rename from src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/PublishBuildAssets.proj rename to src/Microsoft.DotNet.Arcade.Sdk/toolset/PublishBuildAssets.proj index 851fbaaae10..67f34a5607a 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/PublishBuildAssets.proj +++ b/src/Microsoft.DotNet.Arcade.Sdk/toolset/PublishBuildAssets.proj @@ -13,18 +13,11 @@ true - - - - - - - $(BundledNETCoreAppTargetFramework) Publish - + diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/PublishSignedAssets.proj b/src/Microsoft.DotNet.Arcade.Sdk/toolset/PublishSignedAssets.proj similarity index 96% rename from src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/PublishSignedAssets.proj rename to src/Microsoft.DotNet.Arcade.Sdk/toolset/PublishSignedAssets.proj index 64464f4785c..668da283373 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/PublishSignedAssets.proj +++ b/src/Microsoft.DotNet.Arcade.Sdk/toolset/PublishSignedAssets.proj @@ -1,10 +1,5 @@ - - - Publish - $(BundledNETCoreAppTargetFramework) - + + Publish + + + + + + - - - - diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/PublishToSymbolServers.proj b/src/Microsoft.DotNet.Arcade.Sdk/toolset/PublishToSymbolServers.proj similarity index 95% rename from src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/PublishToSymbolServers.proj rename to src/Microsoft.DotNet.Arcade.Sdk/toolset/PublishToSymbolServers.proj index a3e199b3ae5..ae826422510 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/PublishToSymbolServers.proj +++ b/src/Microsoft.DotNet.Arcade.Sdk/toolset/PublishToSymbolServers.proj @@ -18,10 +18,13 @@ --> - $(BundledNETCoreAppTargetFramework) Publish + + + + @@ -39,7 +42,7 @@ 3650 @@ -111,8 +114,4 @@ TreatPdbConversionIssuesAsInfo="$(TreatPdbConversionIssuesAsInfo)"/> - - - - diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/Sign.proj b/src/Microsoft.DotNet.Arcade.Sdk/toolset/Sign.proj similarity index 79% rename from src/Microsoft.DotNet.Arcade.Sdk/tools/Sign.proj rename to src/Microsoft.DotNet.Arcade.Sdk/toolset/Sign.proj index 8049677420e..d20dbd7f502 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/Sign.proj +++ b/src/Microsoft.DotNet.Arcade.Sdk/toolset/Sign.proj @@ -1,5 +1,5 @@ - + - - - true - + + + - - - - + + + + + - - - - - - $(NuGetPackageRoot)sn\$(SNVersion)\sn.exe + + $(NuGetPackageRoot)sn\$(SNVersion)\sn.exe + $(NuGetPackageRoot)microsoft.wixtoolset.sdk\$(MicrosoftWixToolsetSdkVersion)\tools\net472\x64 @@ -91,7 +88,7 @@ SNBinaryPath="$(SNBinaryPath)" MicroBuildCorePath="$(NuGetPackageRoot)microsoft.visualstudioeng.microbuild.core\$(MicrosoftVisualStudioEngMicroBuildCoreVersion)" Wix3ToolsPath="$(WixInstallPath)" - WixToolsPath="$(NuGetPackageRoot)microsoft.wixtoolset.sdk\$(MicrosoftWixToolsetSdkVersion)\tools\net472\x64" + WixToolsPath="$(WixToolsPath)" PkgToolPath="@(MacOSPkgCliItem)" RepackParallelism="$(SignToolRepackParallelism)" MaximumParallelFileSize="$(SignToolRepackMaximumParallelFileSize)" diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/Sign.props b/src/Microsoft.DotNet.Arcade.Sdk/toolset/Sign.props similarity index 96% rename from src/Microsoft.DotNet.Arcade.Sdk/tools/Sign.props rename to src/Microsoft.DotNet.Arcade.Sdk/toolset/Sign.props index 7b7439e02b8..73388d13fdf 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/Sign.props +++ b/src/Microsoft.DotNet.Arcade.Sdk/toolset/Sign.props @@ -71,8 +71,8 @@ - - + + + + + + <_RepoToolManifest>$([MSBuild]::NormalizePath('$(RepoRoot)', '.config', 'dotnet-tools.json')) + + + true + Restore + + + + + + + + + + + + + + + --configfile "$(RestoreConfigFile)" + + + + + + + + + $(RepoRoot)eng/common/internal/Tools.csproj + $(RepoRoot)eng/common/internal/NuGet.config + + + + + + + + + + + + + + + + + + + diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/TrackPrebuiltUsage.targets b/src/Microsoft.DotNet.Arcade.Sdk/toolset/TrackPrebuiltUsage.targets similarity index 87% rename from src/Microsoft.DotNet.Arcade.Sdk/tools/TrackPrebuiltUsage.targets rename to src/Microsoft.DotNet.Arcade.Sdk/toolset/TrackPrebuiltUsage.targets index fc4578574cd..cd835109501 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/TrackPrebuiltUsage.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/toolset/TrackPrebuiltUsage.targets @@ -1,10 +1,9 @@ - - $(NuGetPackageRoot)microsoft.dotnet.sourcebuild.tasks\$(MicrosoftDotNetSourceBuildTasksVersion)\build\ - - + + + diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/VisualStudio.AcquireOptimizationData.targets b/src/Microsoft.DotNet.Arcade.Sdk/toolset/VisualStudio.AcquireOptimizationData.targets similarity index 93% rename from src/Microsoft.DotNet.Arcade.Sdk/tools/VisualStudio.AcquireOptimizationData.targets rename to src/Microsoft.DotNet.Arcade.Sdk/toolset/VisualStudio.AcquireOptimizationData.targets index 33704816096..4159bf8f19f 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/VisualStudio.AcquireOptimizationData.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/toolset/VisualStudio.AcquireOptimizationData.targets @@ -9,12 +9,10 @@ Otherwise, the most recent drop of name that matches 'OptimizationData/$(VisualStudioIbcRepositoryName)/$(VisualStudioIbcSourceBranchName)/*' is used. VisualStudioIbcDrop The explicit drop to use. Overrides VisualStudioIbcSourceBranchName and VisualStudioIbcDropId --> - - - <_VisualStudioBuildTasksAssembly>$(NuGetPackageRoot)microsoft.dotnet.build.tasks.visualstudio\$(MicrosoftDotNetBuildTasksVisualStudioVersion)\tools\net\Microsoft.DotNet.Build.Tasks.VisualStudio.dll - - - + + + + true diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/VisualStudio.BuildIbcTrainingInputs.targets b/src/Microsoft.DotNet.Arcade.Sdk/toolset/VisualStudio.BuildIbcTrainingInputs.targets similarity index 68% rename from src/Microsoft.DotNet.Arcade.Sdk/tools/VisualStudio.BuildIbcTrainingInputs.targets rename to src/Microsoft.DotNet.Arcade.Sdk/toolset/VisualStudio.BuildIbcTrainingInputs.targets index 39949cff687..cbdfb7189e0 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/VisualStudio.BuildIbcTrainingInputs.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/toolset/VisualStudio.BuildIbcTrainingInputs.targets @@ -6,13 +6,10 @@ RepositoryName Current repository name (e.g. 'dotnet/roslyn'). VisualStudioDropName Product drop name, e.g. 'Products/$(System.TeamProject)/$(Build.Repository.Name)/$(Build.SourceBranchName)/$(Build.BuildNumber)' --> - - - <_VisualStudioBuildTasksAssembly>$(NuGetPackageRoot)microsoft.dotnet.build.tasks.visualstudio\$(MicrosoftDotNetBuildTasksVisualStudioVersion)\tools\net\Microsoft.DotNet.Build.Tasks.VisualStudio.dll - - - + + + - + - - - - <_VisualStudioBuildTasksAssembly>$(NuGetPackageRoot)microsoft.dotnet.build.tasks.visualstudio\$(MicrosoftDotNetBuildTasksVisualStudioVersion)\tools\net\Microsoft.DotNet.Build.Tasks.VisualStudio.dll - - - + + + <_OutputFilePath>$(VisualStudioSetupInsertionPath)OptProf\Training.runsettings diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/VisualStudio.IbcTraining.runsettings b/src/Microsoft.DotNet.Arcade.Sdk/toolset/VisualStudio.IbcTraining.runsettings similarity index 100% rename from src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/VisualStudio.IbcTraining.runsettings rename to src/Microsoft.DotNet.Arcade.Sdk/toolset/VisualStudio.IbcTraining.runsettings diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/VisualStudio.InsertionManifests.targets b/src/Microsoft.DotNet.Arcade.Sdk/toolset/VisualStudio.InsertionManifests.targets similarity index 99% rename from src/Microsoft.DotNet.Arcade.Sdk/tools/VisualStudio.InsertionManifests.targets rename to src/Microsoft.DotNet.Arcade.Sdk/toolset/VisualStudio.InsertionManifests.targets index e79964b9cd8..7c548d8d5b9 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/VisualStudio.InsertionManifests.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/toolset/VisualStudio.InsertionManifests.targets @@ -1,14 +1,15 @@ + + false + + <_StubFiles Include="$(VisualStudioSetupIntermediateOutputPath)**\*.stub"/> <_StubDirs Include="@(_StubFiles->'%(RecursiveDir)')"/> - - false - - - + + + + $(MSBuildThisFileDirectory)..\tools\net\Microsoft.DotNet.Build.Tasks.VisualStudio.dll + + + + + + + + + + + diff --git a/src/Microsoft.DotNet.NuGetRepack/tasks/build/Microsoft.DotNet.NuGetRepack.Tasks.props b/src/Microsoft.DotNet.NuGetRepack/tasks/build/Microsoft.DotNet.NuGetRepack.Tasks.props new file mode 100644 index 00000000000..45e612f79d3 --- /dev/null +++ b/src/Microsoft.DotNet.NuGetRepack/tasks/build/Microsoft.DotNet.NuGetRepack.Tasks.props @@ -0,0 +1,11 @@ + + + + + $(MSBuildThisFileDirectory)..\tools\net\Microsoft.DotNet.NuGetRepack.Tasks.dll + + + + + + diff --git a/src/Microsoft.DotNet.SignTool/src/SignToolTask.cs b/src/Microsoft.DotNet.SignTool/src/SignToolTask.cs index 7767fcbd5b7..7669d9f4245 100644 --- a/src/Microsoft.DotNet.SignTool/src/SignToolTask.cs +++ b/src/Microsoft.DotNet.SignTool/src/SignToolTask.cs @@ -209,11 +209,11 @@ public void ExecuteImpl() Log.LogError($"PkgToolPath ('{PkgToolPath}') does not exist & is required for unpacking, repacking, and notarizing .pkg files and .app bundles on MacOS."); } } - if(Wix3ToolsPath != null && !Directory.Exists(Wix3ToolsPath)) + if(!string.IsNullOrEmpty(Wix3ToolsPath) && !Directory.Exists(Wix3ToolsPath)) { Log.LogError($"Wix3ToolsPath ('{Wix3ToolsPath}') does not exist."); } - if(WixToolsPath != null && !Directory.Exists(WixToolsPath)) + if(!string.IsNullOrEmpty(WixToolsPath) && !Directory.Exists(WixToolsPath)) { Log.LogError($"WixToolsPath ('{WixToolsPath}') does not exist."); }