Skip to content

Commit 8413993

Browse files
pjcollinsjonpryor
authored andcommitted
[CI] Add nuget to msi conversion and VS insert stage (#6030)
Context: https://github.com/xamarin/yaml-templates/pull/117 A new CI job and stage have been added to facilitate the Visual Studio installer insertion process. The first job named "Convert NuGet to MSI" will convert signed packages to `.msi` installers, and generate Visual Studio manifests for the `.msi` installers. The `.msi` files are signed and converted back to `.nupkg` files for the Windows command line install scenario. These packages are uploaded as pipeline artifacts named `vsdrop-signed`, and `vs-msi-nugets`. The new `vs-workload.props` file contains version information and other metadata used by the convert job to generate a Visual Studio manifest. The `@(ShortNames)` item group is used to avoid path length issues that can arise due to the way VS caches some components when building. The `.msi` conversion tooling uses this to replace strings in the VS component file names and IDs generated for our workload packs. In some cases the semver label generated for our packs can be long, so we replace the full semver version with a more predictable four part version (30.0.100.x). The new "VS Insertion" stage starts with a [manual validation task][0]. This task will pause execution and wait for someone to click a "Resume" or "Reject" button that will appear on the pipeline UI. This task is configured to be rejected after waiting for two days, but it can be manually re-ran any time after being rejected to trigger a VS insertion for an older build. To access the Reume or Reject button, go to the Pipelines page for the commit to be approved, e.g.: 1. https://github.com/xamarin/xamarin-android/commits/main 2. Click the ✅ or ❌ for the commit of interest. This displays an "All checks have passed" or "Some checks were not successful" overlay. 3. Click the **Details** link for **Xamarin.Android** within the overlay shown by (2). 4. At the bottom of the "runs" page, click the **View more details on Azure Pipelines** link. When the manual validation task is approved, a VS Drop will be created containing all .NET 6 `.msi` files. This Drop URL can then be used to update our component versions in Visual Studio. This last piece is currently manual as we will initially be introducing new components, however we should be able to automate VS PR creation in the future. [0]: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/manual-validation?view=azure-devops&tabs=yaml
1 parent 0ab4889 commit 8413993

File tree

4 files changed

+45
-3
lines changed

4 files changed

+45
-3
lines changed

build-tools/automation/azure-pipelines.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,6 +1262,18 @@ stages:
12621262
usePipelineArtifactTasks: true
12631263
condition: eq(variables['MicroBuildSignType'], 'Real')
12641264

1265+
# Check - "Xamarin.Android (.NET 6 Preview Installers Convert NuGet to MSI)"
1266+
- template: nuget-msi-convert/job/v1.yml@yaml
1267+
parameters:
1268+
yamlResourceName: yaml
1269+
dependsOn: signing
1270+
artifactName: nuget-signed
1271+
artifactPatterns: |
1272+
!*Darwin*
1273+
propsArtifactName: nuget-unsigned
1274+
signType: $(MicroBuildSignType)
1275+
condition: eq(variables['MicroBuildSignType'], 'Real')
1276+
12651277
# Check - "Xamarin.Android (.NET 6 Preview Installers Create .pkg)"
12661278
- job: dotnet_create_pkg
12671279
displayName: Create .pkg
@@ -1458,6 +1470,14 @@ stages:
14581470
solution: build-tools\Xamarin.Android.Tools.BootstrapTasks\Xamarin.Android.Tools.BootstrapTasks.csproj
14591471
artifactName: Build Results - .NET 6 Preview .msi
14601472

1473+
# .NET 6 VS Insertion Stage
1474+
# Check - "Xamarin.Android (VS Insertion - Wait For Approval)"
1475+
# Check - "Xamarin.Android (VS Insertion - Create VS Drop and Open PR)"
1476+
- template: vs-insertion/stage/v1.yml@yaml
1477+
parameters:
1478+
dependsOn: dotnet_installers
1479+
condition: eq(variables['MicroBuildSignType'], 'Real')
1480+
14611481
- stage: finalize_installers
14621482
displayName: Finalize Installers
14631483
dependsOn: mac_build

build-tools/create-packs/Directory.Build.targets

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
<UsingTask TaskName="CreateFrameworkListFile" AssemblyFile="$(DotNetSharedFrameworkTaskFile)"/>
1313
<UsingTask TaskName="GenerateBuildManifest" AssemblyFile="$(_MicrosoftDotNetBuildTasksFeedTaskDir)Microsoft.DotNet.Build.Tasks.Feed.dll" />
14+
<UsingTask TaskName="Xamarin.Android.BuildTools.PrepTasks.ReplaceFileContents" AssemblyFile="$(PrepTasksAssembly)" />
1415

1516
<PropertyGroup>
1617
<_MonoAndroidNETOutputDir>$(XAInstallPrefix)xbuild-frameworks\Microsoft.Android\net6.0\</_MonoAndroidNETOutputDir>
@@ -56,7 +57,7 @@
5657
</Target>
5758

5859
<Target Name="CreateAllPacks"
59-
DependsOnTargets="DeleteExtractedWorkloadPacks;_SetGlobalProperties">
60+
DependsOnTargets="DeleteExtractedWorkloadPacks;_SetGlobalProperties;GetXAVersionInfo">
6061
<RemoveDir Directories="$(XamarinAndroidSourcePath)bin\Build$(Configuration)\nuget-unsigned" />
6162
<Exec Command="dotnet pack @(_GlobalProperties, ' ') -p:AndroidRID=android-arm -p:AndroidABI=armeabi-v7a-net6 &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Runtime.proj&quot;" />
6263
<Exec Command="dotnet pack @(_GlobalProperties, ' ') -p:AndroidRID=android-arm64 -p:AndroidABI=arm64-v8a-net6 &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Runtime.proj&quot;" />
@@ -69,6 +70,11 @@
6970
<Exec Command="dotnet pack @(_GlobalProperties, ' ') &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Sdk.BundleTool.proj&quot;" />
7071
<Exec Command="dotnet pack @(_GlobalProperties, ' ') &quot;$(MSBuildThisFileDirectory)Microsoft.NET.Sdk.Android.proj&quot;" />
7172
<Exec Command="dotnet pack @(_GlobalProperties, ' ') &quot;$(XamarinAndroidSourcePath)src\Microsoft.Android.Templates\Microsoft.Android.Templates.csproj&quot;" />
73+
<ReplaceFileContents
74+
SourceFile="vs-workload.in.props"
75+
DestinationFile="$(XamarinAndroidSourcePath)bin\Build$(Configuration)\nuget-unsigned\vs-workload.props"
76+
Replacements="@PACK_VERSION_LONG@=$(AndroidPackVersionLong);@PACK_VERSION_SHORT@=$(AndroidMSIVersion);@WORKLOAD_VERSION@=$(AndroidMSIVersion)"
77+
/>
7278
</Target>
7379

7480
<Target Name="ExtractWorkloadPacks"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project>
3+
<PropertyGroup>
4+
<TargetName>Microsoft.NET.Sdk.Android.Workload</TargetName>
5+
</PropertyGroup>
6+
<ItemGroup>
7+
<!-- Shorten package names to avoid long path caching issues in Visual Studio -->
8+
<ShortNames Include="@PACK_VERSION_LONG@">
9+
<Replacement>@PACK_VERSION_SHORT@</Replacement>
10+
</ShortNames>
11+
<ComponentResources Include="android" Category=".NET" Title=".NET SDK for Android" Description=".NET SDK Workload for building Android applications."/>
12+
<ComponentVersions Include="android" Version="@WORKLOAD_VERSION@" />
13+
<ComponentResources Include="android-aot" Category=".NET" Title=".NET SDK for Android with AOT" Description=".NET SDK Workload for building Android applications with AOT support."/>
14+
<ComponentVersions Include="android-aot" Version="@WORKLOAD_VERSION@" />
15+
</ItemGroup>
16+
</Project>

src/Xamarin.Android.Build.Tasks/Microsoft.NET.Sdk.Android/WorkloadManifest.in.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"version": "@WORKLOAD_VERSION@",
33
"workloads": {
44
"android": {
5-
"description": "Microsoft Android SDK for .NET",
5+
"description": ".NET SDK Workload for building Android applications.",
66
"packs": [
77
"Microsoft.Android.Sdk",
88
"Microsoft.Android.Sdk.BundleTool",
@@ -16,7 +16,7 @@
1616
"extends" : [ "microsoft-net-runtime-android" ]
1717
},
1818
"android-aot": {
19-
"description": "Microsoft Android SDK for .NET with AOT support",
19+
"description": ".NET SDK Workload for building Android applications with AOT support.",
2020
"extends" : [ "android", "microsoft-net-runtime-android-aot" ]
2121
}
2222
},

0 commit comments

Comments
 (0)