-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
BundledManifests.targets
128 lines (107 loc) · 8.7 KB
/
BundledManifests.targets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<Project>
<PropertyGroup>
<NetFeatureBand>8.0.100</NetFeatureBand>
</PropertyGroup>
<ItemGroup>
<BundledManifests Include="Microsoft.NET.Sdk.Android" FeatureBand="$(MauiFeatureBand)" Version="$(XamarinAndroidWorkloadManifestVersion)" Condition="'$(DotNetBuildSourceOnly)' != 'true'" />
<BundledManifests Include="Microsoft.NET.Sdk.iOS" FeatureBand="$(MauiFeatureBand)" Version="$(XamarinIOSWorkloadManifestVersion)" Condition="'$(DotNetBuildSourceOnly)' != 'true'" />
<BundledManifests Include="Microsoft.NET.Sdk.MacCatalyst" FeatureBand="$(MauiFeatureBand)" Version="$(XamarinMacCatalystWorkloadManifestVersion)" Condition="'$(DotNetBuildSourceOnly)' != 'true'" />
<BundledManifests Include="Microsoft.NET.Sdk.macOS" FeatureBand="$(MauiFeatureBand)" Version="$(XamarinMacOSWorkloadManifestVersion)" Condition="'$(DotNetBuildSourceOnly)' != 'true'" />
<BundledManifests Include="Microsoft.NET.Sdk.Maui" FeatureBand="$(MauiFeatureBand)" Version="$(MauiWorkloadManifestVersion)" Condition="'$(DotNetBuildSourceOnly)' != 'true'" />
<BundledManifests Include="Microsoft.NET.Sdk.tvOS" FeatureBand="$(MauiFeatureBand)" Version="$(XamarinTvOSWorkloadManifestVersion)" Condition="'$(DotNetBuildSourceOnly)' != 'true'" />
<!-- Bundled Manifests are ordered by the reference here - verify before altering -->
<BundledManifests Include="Microsoft.NET.Workload.Mono.ToolChain.Current" FeatureBand="$(MonoWorkloadFeatureBand)" Version="$(MonoWorkloadManifestVersion)" />
<BundledManifests Include="Microsoft.NET.Workload.Emscripten.Current" FeatureBand="$(EmscriptenWorkloadFeatureBand)" Version="$(EmscriptenWorkloadManifestVersion)" />
<BundledManifests Include="Microsoft.NET.Workload.Emscripten.net6" FeatureBand="$(EmscriptenWorkloadFeatureBand)" Version="$(EmscriptenWorkloadManifestVersion)" />
<BundledManifests Include="Microsoft.NET.Workload.Emscripten.net7" FeatureBand="$(EmscriptenWorkloadFeatureBand)" Version="$(EmscriptenWorkloadManifestVersion)" />
<BundledManifests Include="Microsoft.NET.Workload.Emscripten.net8" FeatureBand="$(EmscriptenWorkloadFeatureBand)" Version="$(EmscriptenWorkloadManifestVersion)" />
<BundledManifests Include="Microsoft.NET.Workload.Mono.ToolChain.net6" FeatureBand="$(MonoWorkloadFeatureBand)" Version="$(MonoWorkloadManifestVersion)" />
<BundledManifests Include="Microsoft.NET.Workload.Mono.ToolChain.net7" FeatureBand="$(MonoWorkloadFeatureBand)" Version="$(MonoWorkloadManifestVersion)" />
<BundledManifests Include="Microsoft.NET.Workload.Mono.ToolChain.net8" FeatureBand="$(MonoWorkloadFeatureBand)" Version="$(MonoWorkloadManifestVersion)" />
<BundledManifests Include="Microsoft.NET.Sdk.Aspire" FeatureBand="$(AspireFeatureBand)" Version="$(MicrosoftNETSdkAspireManifest80100PackageVersion)" />
</ItemGroup>
<!-- Calculate NuGet package IDs for bundled manifests -->
<PropertyGroup>
<!-- TODO: Not exactly sure how this value should be calculated -->
<!--<MsiArchitectureForWorkloadManifests>$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString().ToLowerInvariant)</MsiArchitectureForWorkloadManifests>-->
<MsiArchitectureForWorkloadManifests>$(Architecture)</MsiArchitectureForWorkloadManifests>
</PropertyGroup>
<ItemGroup>
<BundledManifests Update="@(BundledManifests)">
<NupkgId>%(Identity).Manifest-%(FeatureBand)</NupkgId>
<RestoredNupkgContentPath>$(NuGetPackageRoot)$([MSBuild]::ValueOrDefault('%(NupkgId)', '').ToLower())/$([MSBuild]::ValueOrDefault('%(Version)', '').ToLower())</RestoredNupkgContentPath>
<MsiNupkgId>%(Identity).Manifest-%(FeatureBand).Msi.$(MsiArchitectureForWorkloadManifests)</MsiNupkgId>
<RestoredMsiNupkgContentPath>$(NuGetPackageRoot)$([MSBuild]::ValueOrDefault('%(MsiNupkgId)', '').ToLower())/$([MSBuild]::ValueOrDefault('%(Version)', '').ToLower())</RestoredMsiNupkgContentPath>
</BundledManifests>
</ItemGroup>
<!-- Restore workload manifests via PackageDownload -->
<ItemGroup>
<PackageDownload Include="@(BundledManifests->'%(NupkgId)')">
<Version>[%(Version)]</Version>
</PackageDownload>
</ItemGroup>
<ItemGroup Condition=" '$(OS)' == 'Windows_NT' and '$(Architecture)' != 'arm' ">
<PackageDownload Include="@(BundledManifests->'%(MsiNupkgId)')">
<Version>[%(Version)]</Version>
</PackageDownload>
<PackageReference Include="Microsoft.DotNet.SignCheck" GeneratePathProperty="true" />
</ItemGroup>
<Target Name="ValidateBundledManifestSigning"
Condition=" '$(OS)' == 'Windows_NT' and '$(Architecture)' != 'arm' ">
<PropertyGroup>
<SignCheckExe>$(PkgMicrosoft_DotNet_SignCheck)\tools\Microsoft.DotNet.SignCheck.exe</SignCheckExe>
<SignCheckLog Condition="'$(SignCheckLog)' == ''">$(ArtifactsLogDir)\workloadmanifestsigncheck.log</SignCheckLog>
<SignCheckErrorLog Condition="'$(SignCheckErrorLog)' == ''">$(ArtifactsLogDir)\workloadmanifestsigncheck.errors.log</SignCheckErrorLog>
</PropertyGroup>
<ItemGroup>
<!-- Don't try to validate signing for workload manifests that will be signed as part of post-build signing -->
<BundledManifestsToValidateSigning Include="@(BundledManifests)"
Exclude="Microsoft.NET.Workload.Mono.ToolChain.Current;Microsoft.NET.Workload.Mono.ToolChain.net6;Microsoft.NET.Workload.Mono.ToolChain.net7;Microsoft.NET.Workload.Mono.ToolChain.net8;Microsoft.NET.Workload.Emscripten.Current;Microsoft.NET.Workload.Emscripten.net6;Microsoft.NET.Workload.Emscripten.net7;Microsoft.NET.Workload.Emscripten.net8;Microsoft.NET.Sdk.Aspire">
<RestoredMsiPathInNupkg>$([MSBuild]::NormalizePath($([System.IO.Directory]::GetFiles('%(RestoredMsiNupkgContentPath)/data/', '*$(MsiArchitectureForWorkloadManifests).msi'))))</RestoredMsiPathInNupkg>
</BundledManifestsToValidateSigning>
<SignCheckWorkloadManifestMsiInputFiles Include="@(BundledManifestsToValidateSigning->'%(RestoredMsiPathInNupkg)')" />
</ItemGroup>
<Exec Condition="'@(SignCheckWorkloadManifestMsiInputFiles->Count())' != '0'"
Command="$(SignCheckExe) ^
--recursive ^
-f UnsignedFiles ^
-i @(SignCheckWorkloadManifestMsiInputFiles, ' ') ^
-l $(SignCheckLog) ^
-e $(SignCheckErrorLog)" />
<Error
Text="Signing validation failed for workload manifest MSI. Check $(SignCheckErrorLog) for more information."
Condition="Exists($(SignCheckErrorLog)) and '$([System.IO.File]::ReadAllText($(SignCheckErrorLog)))' != ''" />
<Message
Text="##vso[artifact.upload containerfolder=LogFiles;artifactname=LogFiles]{SignCheckErrorLog}"
Condition="Exists($(SignCheckErrorLog)) and '$([System.IO.File]::ReadAllText($(SignCheckErrorLog)))' != ''" />
</Target>
<Target Name="LayoutManifests"
DependsOnTargets="SetupBundledComponents">
<ItemGroup>
<ManifestContent Include="%(BundledManifests.RestoredNupkgContentPath)\data\*"
Condition="Exists('%(RestoredNupkgContentPath)\data')"
DestinationPath="%(FeatureBand)/$([MSBuild]::ValueOrDefault('%(Identity)', '').ToLower())/%(Version)"
RestoredNupkgContentPath="%(RestoredNupkgContentPath)"
WorkloadManifestId="%(Identity)" />
<ManifestContent Include="%(BundledManifests.RestoredNupkgContentPath)\data\localize\*"
Condition="Exists('%(RestoredNupkgContentPath)\data\localize')"
DestinationPath="%(BundledManifests.FeatureBand)/$([MSBuild]::ValueOrDefault('%(Identity)', '').ToLower())/%(BundledManifests.Version)/localize" />
</ItemGroup>
<Error Text="No workload manifest content found." Condition="'@(ManifestContent->Count())' == '0'" />
<Copy SourceFiles="@(ManifestContent)"
DestinationFolder="$(RedistLayoutPath)sdk-manifests/%(DestinationPath)" />
<PropertyGroup>
<WorkloadSetVersion Condition="'$(DotNetFinalVersionKind)' == 'release'">$(VersionPrefix)-baseline$(_BuildNumberLabels)</WorkloadSetVersion>
<WorkloadSetVersion Condition="'$(DotNetFinalVersionKind)' != 'release'">$(Version)</WorkloadSetVersion>
<RealFormattedManifestPaths>$(RedistLayoutPath)sdk-manifests\$(NetFeatureBand)\workloadsets\$(WorkloadSetVersion)</RealFormattedManifestPaths>
</PropertyGroup>
<ItemGroup>
</ItemGroup>
<ItemGroup>
<FormattedBaselineManifest Include="{" />
<FormattedBaselineManifest Include=""%(BundledManifests.Identity)": "%(BundledManifests.Version)/%(BundledManifests.FeatureBand)"," />
<FormattedBaselineManifest Include="}" />
</ItemGroup>
<WriteLinestoFile File="$(RealFormattedManifestPaths)\baseline.workloadset.json" Lines="@(FormattedBaselineManifest)" />
</Target>
</Project>