Skip to content

Commit a8a2761

Browse files
authored
Merge pull request #1 from microsoft/dfederm/official-builds
Add support for official builds
2 parents 47cf00e + c18d961 commit a8a2761

File tree

11 files changed

+120
-11
lines changed

11 files changed

+120
-11
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
variables:
2+
- template: templates\variables.yml
3+
- name: SignType
4+
value: Test
5+
- name: TeamName
6+
value: MSBuild
7+
8+
trigger:
9+
batch: true
10+
branches:
11+
include:
12+
- 'main'
13+
- 'refs/tags/*'
14+
15+
# no PR triggers
16+
pr: none
17+
18+
jobs:
19+
- job: OfficialBuild
20+
displayName: Official Build
21+
variables:
22+
VsInstallDir: $(Build.ArtifactStagingDirectory)/vs
23+
pool:
24+
name: VSEngSS-MicroBuild2022-1ES
25+
steps:
26+
- task: PowerShell@2
27+
displayName: 'Update SignType, Build Number, and Add Build Tag for tagged commits'
28+
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
29+
inputs:
30+
targetType: 'inline'
31+
script: |
32+
Write-Host "Updating SignType to 'Real'"
33+
Write-Host "##vso[task.setvariable variable=SignType;]Real"
34+
Write-Host ""
35+
$buildTag = [System.Text.RegularExpressions.Regex]::Match("$(Build.SourceBranchName)", "v.*")
36+
if($buildTag.Success -eq $true)
37+
{
38+
Write-Host "Updating VSTS build number to ""$buildTag"""
39+
Write-Host "##vso[build.updatebuildnumber]$buildTag"
40+
Write-Host ""
41+
Write-Host "Adding build tag ""$buildTag"""
42+
Write-Host "##vso[build.addbuildtag]$buildTag"
43+
}
44+
45+
- task: MicroBuildSigningPlugin@1
46+
displayName: 'Install MicroBuild Signing Plugin'
47+
inputs:
48+
signType: '$(SignType)'
49+
zipSources: false
50+
51+
- checkout: self
52+
# Fetch all history for versioning
53+
fetchDepth: 0
54+
55+
- template: templates\build.yml
56+
parameters:
57+
RepoRoot: $(Build.SourcesDirectory)
58+
59+
- task: NuGetCommand@2
60+
displayName: 'Push NuGet Packages to nuget.org'
61+
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
62+
inputs:
63+
command: 'push'
64+
packagesToPush: '$(ArtifactsDirectory)/**/*.nupkg'
65+
nuGetFeedType: 'external'
66+
publishFeedCredentials: 'MSBuildCache-Push'
67+
68+
- publish: $(LogDirectory)
69+
displayName: Publish Logs
70+
artifact: '$(System.JobDisplayName) logs'
71+
condition: always()

.azuredevops/pipelines/pr-ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ jobs:
7272
RepoRoot: $(Build.SourcesDirectory)
7373
MSBuildPath: $(VsInstallDir)\MSBuild\Current\Bin\amd64\MSBuild.exe
7474

75+
- publish: $(LogDirectory)
76+
displayName: Publish Logs
77+
artifact: '$(System.JobDisplayName) logs'
78+
condition: always()
79+
7580
- job: BuildMSBuildRepo
7681
displayName: Build using tip of MSBuild repo
7782
variables:
@@ -104,3 +109,8 @@ jobs:
104109
parameters:
105110
RepoRoot: $(Build.SourcesDirectory)/MSBuildCache
106111
MSBuildPath: $(MSBuildLibraries)\MSBuild.exe
112+
113+
- publish: $(LogDirectory)
114+
displayName: Publish Logs
115+
artifact: '$(System.JobDisplayName) logs'
116+
condition: always()

.azuredevops/pipelines/templates/build.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,7 @@ steps:
2626
projects: ${{ parameters.RepoRoot }}/MSBuildCache.sln
2727
arguments: -restore:false --configuration $(BuildConfiguration) -BinaryLogger:$(LogDirectory)/msbuild.binlog
2828

29-
- task: PublishBuildArtifacts@1
30-
displayName: Publish Logs
31-
inputs:
32-
PathtoPublish: $(LogDirectory)
33-
ArtifactName: logs
34-
condition: always()
35-
36-
- task: PublishBuildArtifacts@1
29+
- publish: $(ArtifactsDirectory)
3730
displayName: Publish Artifacts
38-
inputs:
39-
PathtoPublish: $(ArtifactsDirectory)
40-
ArtifactName: artifacts
31+
artifact: '$(System.JobDisplayName) artifacts'
32+
condition: always()

Directory.Build.props

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,30 @@
3535

3636
<!-- BuildXL packages are pre-release but this package itself is not pre-release -->
3737
<NoWarn>$(NoWarn);NU5104</NoWarn>
38+
39+
<!-- Strong-naming -->
40+
<SignAssembly>true</SignAssembly>
41+
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)StrongNameKey.snk</AssemblyOriginatorKeyFile>
42+
<DelaySign Condition="'$(SignType)' != ''">true</DelaySign>
3843
</PropertyGroup>
3944

4045
<!-- Packaging -->
4146
<PropertyGroup>
4247
<Authors>Microsoft</Authors>
48+
<Company>Microsoft</Company>
4349
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
4450
<Description>A project cache plugin for MSBuild</Description>
51+
<PackageLicenseFile>LICENSE</PackageLicenseFile>
52+
<PackageLicensePath>$(MSBuildThisFileDirectory)$(PackageLicenseFile)</PackageLicensePath>
4553
<PackageProjectUrl>https://github.com/microsoft/MSBuildCache</PackageProjectUrl>
4654
<RepositoryUrl>https://github.com/microsoft/MSBuildCache</RepositoryUrl>
4755
</PropertyGroup>
56+
<ItemGroup Condition="'$(IsPackable)' == 'true'">
57+
<None Include="$(PackageLicensePath)"
58+
Pack="true"
59+
PackagePath="."
60+
Visible="false" />
61+
</ItemGroup>
4862

4963
<!-- Source Link (https://github.com/dotnet/sourcelink) -->
5064
<PropertyGroup>

Directory.Build.targets

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,9 @@
22
<ItemGroup>
33
<Compile Include="$(MSBuildThisFileDirectory)build\Attributes\*.cs" Visible="false" />
44
</ItemGroup>
5+
6+
<ItemGroup>
7+
<InternalsVisibleTo Update="@(InternalsVisibleTo)"
8+
Key="002400000480000094000000060200000024000052534131000400000100010005055631641d3e7a8b5c05061f45ebe8c6f4ebecb61014b0e082556e1a9c84ce1cfe610bf2108bd12e088a5fcf9a015766123c9f6d81e69ef71d4deaf3b6f03a298de8a71fa562dd0e4ce2d7eefd4eeb8e7af7ef612d0ca64fed752393abaeeb80621b8097434795d41a0a0b97b592d01e68e979013da944d28e04ceadab30ec" />
9+
</ItemGroup>
510
</Project>

Directory.Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
<PackageVersion Include="System.Threading.Tasks.Dataflow" Version="7.0.0" />
4848
</ItemGroup>
4949
<ItemGroup>
50+
<GlobalPackageReference Include="Microsoft.VisualStudioEng.MicroBuild.Core" Version="1.0.0" />
5051
<GlobalPackageReference Include="Nerdbank.GitVersioning" Version="3.5.113" />
5152
</ItemGroup>
5253
</Project>

StrongNameKey.snk

596 Bytes
Binary file not shown.

src/AzureBlobStorage/Microsoft.MSBuildCache.AzureBlobStorage.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,9 @@
3232
<PackagePath>buildMultiTargeting\</PackagePath>
3333
</None>
3434
</ItemGroup>
35+
<!-- Signing -->
36+
<ItemGroup>
37+
<FilesToSign Include="$(TargetPath)" Authenticode="Microsoft400" StrongName="StrongName" />
38+
</ItemGroup>
3539
<Import Project="$(RepoRoot)build\MSBuildExtensionPackage.targets" />
3640
</Project>

src/AzurePipelines/Microsoft.MSBuildCache.AzurePipelines.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,9 @@
3030
<PackagePath>buildMultiTargeting\</PackagePath>
3131
</None>
3232
</ItemGroup>
33+
<!-- Signing -->
34+
<ItemGroup>
35+
<FilesToSign Include="$(TargetPath)" Authenticode="Microsoft400" StrongName="StrongName" />
36+
</ItemGroup>
3337
<Import Project="$(RepoRoot)build\MSBuildExtensionPackage.targets" />
3438
</Project>

src/Common/Microsoft.MSBuildCache.Common.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,9 @@
2626
<ItemGroup>
2727
<InternalsVisibleTo Include="Microsoft.MSBuildCache.Common.Tests" />
2828
</ItemGroup>
29+
<!-- Signing -->
30+
<ItemGroup>
31+
<FilesToSign Include="$(TargetPath)" Authenticode="Microsoft400" StrongName="StrongName" />
32+
</ItemGroup>
2933
<Import Project="$(RepoRoot)build\MSBuildReference.targets" />
3034
</Project>

0 commit comments

Comments
 (0)