Skip to content

Commit

Permalink
Add support for VSIX and VSTS drop
Browse files Browse the repository at this point in the history
  • Loading branch information
AArnott committed Oct 1, 2024
1 parent 6dec5a7 commit 09de7c6
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 2 deletions.
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<BaseIntermediateOutputPath>$(RepoRootPath)obj\$([MSBuild]::MakeRelative($(RepoRootPath), $(MSBuildProjectDirectory)))\</BaseIntermediateOutputPath>
<BaseOutputPath Condition=" '$(BaseOutputPath)' == '' ">$(RepoRootPath)bin\$(MSBuildProjectName)\</BaseOutputPath>
<PackageOutputPath>$(RepoRootPath)bin\Packages\$(Configuration)\NuGet\</PackageOutputPath>
<VSIXOutputPath>$(RepoRootPath)bin\Packages\$(Configuration)\Vsix\$(Platform)\</VSIXOutputPath>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<AnalysisLevel>latest</AnalysisLevel>
Expand Down
4 changes: 4 additions & 0 deletions Expand-Template.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ try {
'LibraryNoDots' = $LibraryName.Replace('.','');
}

Replace-Placeholders -Path "azure-pipelines/variables/InsertJsonValues.ps1" -Replacements @{
'LibraryName' = $LibraryName;
}

Replace-Placeholders -Path "azure-pipelines/variables/SymbolsFeatureName.ps1" -Replacements @{
'LibraryName' = $LibraryName;
}
Expand Down
2 changes: 2 additions & 0 deletions azure-pipelines/GlobalVariables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ variables:
# These variables are required for MicroBuild tasks
TeamName: VS IDE
TeamEmail: vsidemicrobuild@microsoft.com
# These variables influence insertion pipelines
ContainsVsix: false # This should be true when the repo builds a VSIX that should be inserted to VS.
10 changes: 8 additions & 2 deletions azure-pipelines/artifacts/VSInsertion.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ if (!$BuildConfiguration) {
$BuildConfiguration = 'Debug'
}

$NuGetPackages = "$RepoRoot/bin/Packages/$BuildConfiguration/NuGet"
$PackagesRoot = "$RepoRoot/bin/Packages/$BuildConfiguration"
$NuGetPackages = "$PackagesRoot/NuGet"
$VsixPackages = "$PackagesRoot/Vsix"

if (!(Test-Path $NuGetPackages)) {
Write-Warning "Skipping because NuGet packages haven't been built yet."
Expand All @@ -27,8 +29,12 @@ $result = @{
"$NuGetPackages" = (Get-ChildItem $NuGetPackages -Recurse)
}

if (Test-Path $VsixPackages) {
$result["$PackagesRoot"] += Get-ChildItem $VsixPackages -Recurse
}

if ($env:IsOptProf) {
$VSRepoPackages = "$RepoRoot/bin/Packages/$BuildConfiguration/VSRepo"
$VSRepoPackages = "$PackagesRoot/VSRepo"
$result["$VSRepoPackages"] = (Get-ChildItem "$VSRepoPackages\*.VSInsertionMetadata.*.nupkg");
}

Expand Down
2 changes: 2 additions & 0 deletions azure-pipelines/microbuild.after.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ steps:
- task: MicroBuildCodesignVerify@3
displayName: 🔍 Verify Signed Files
inputs:
ApprovalListPathForSigs: $(Build.SourcesDirectory)\azure-pipelines\no_strongname.txt
ApprovalListPathForCerts: $(Build.SourcesDirectory)\azure-pipelines\no_authenticode.txt
TargetFolders: |
$(Build.SourcesDirectory)/bin/Packages/$(BuildConfiguration)
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
Expand Down
2 changes: 2 additions & 0 deletions azure-pipelines/no_authenticode.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bin\packages\release\vsix\_manifest\manifest.cat,sbom signed
bin\packages\release\vsix\_manifest\spdx_2.2\manifest.cat,sbom signed
Empty file.
18 changes: 18 additions & 0 deletions azure-pipelines/variables/InsertJsonValues.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
$vstsDropNames = & "$PSScriptRoot\VstsDropNames.ps1"
$BuildConfiguration = $env:BUILDCONFIGURATION
if (!$BuildConfiguration) {
$BuildConfiguration = 'Debug'
}

$BasePath = "$PSScriptRoot\..\..\bin\Packages\$BuildConfiguration\Vsix"

if (Test-Path $BasePath) {
$vsmanFiles = @()
Get-ChildItem $BasePath *.vsman -Recurse -File |% {
$version = (Get-Content $_.FullName | ConvertFrom-Json).info.buildVersion
$fn = $_.Name
$vsmanFiles += "LibraryName.vsman{$version}=https://vsdrop.corp.microsoft.com/file/v1/$vstsDropNames;$fn"
}

[string]::join(',',$vsmanFiles)
}
1 change: 1 addition & 0 deletions azure-pipelines/variables/VstsDropNames.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"Products/$env:SYSTEM_TEAMPROJECT/$env:BUILD_REPOSITORY_NAME/$env:BUILD_SOURCEBRANCHNAME/$env:BUILD_BUILDID"
7 changes: 7 additions & 0 deletions azure-pipelines/vs-insertion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ extends:
- download: CI
artifact: VSInsertion-Windows
displayName: 🔻 Download VSInsertion-Windows artifact
- ${{ if eq(variables['ContainsVsix'], 'true') }}:
- task: 1ES.MicroBuildVstsDrop@1
displayName: 🔺 Upload VSTS Drop
inputs:
dropFolder: $(Pipeline.Workspace)/CI/VSInsertion-windows/Vsix
dropName: $(VstsDropNames)
accessToken: $(System.AccessToken)
- task: 1ES.PublishNuget@1
displayName: 📦 Push VS-repo packages to VS feed
inputs:
Expand Down
7 changes: 7 additions & 0 deletions azure-pipelines/vs-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ extends:
- download: current
artifact: VSInsertion-Windows
displayName: 🔻 Download VSInsertion-Windows artifact
- ${{ if eq(variables['ContainsVsix'], 'true') }}:
- task: 1ES.MicroBuildVstsDrop@1
displayName: 🔺 Upload VSTS Drop
inputs:
dropFolder: $(Pipeline.Workspace)/VSInsertion-windows/Vsix
dropName: $(VstsDropNames)
accessToken: $(System.AccessToken)
- task: 1ES.PublishNuget@1
displayName: 📦 Push VS-repo packages to VS feed
inputs:
Expand Down

0 comments on commit 09de7c6

Please sign in to comment.