Skip to content

Commit 6c806f9

Browse files
authored
Add option for only packing runtime-specific packages (#11116)
* Add option for only packing runtime-specific packages * Remove Microsoft.AspNetCore.Blazor.Templates.dll from the Blazor VSIX * Cleanup implementation of ANCMSymbols packaging
1 parent dd2e218 commit 6c806f9

13 files changed

+65
-82
lines changed

.azure/pipelines/ci.yml

Lines changed: 24 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ jobs:
7575
-NoRestore
7676
-BuildNative
7777
/t:BuildSharedFx
78+
/p:OnlyPackPlatformSpecificPackages=true
7879
/p:DisableCodeSigning=true
7980
/bl:artifacts/log/build.x86.binlog
8081
$(_BuildArgs)
@@ -151,15 +152,12 @@ jobs:
151152
buildArgs: -arch arm
152153
-NoBuildNodeJS
153154
-NoBuildJava
155+
/p:OnlyPackPlatformSpecificPackages=true
154156
/p:SignType=$(_SignType)
155157
/bl:artifacts/log/build.win-arm.binlog
156158
$(_BuildArgs)
157159
installNodeJs: false
158160
installJdk: false
159-
afterBuild:
160-
# Remove packages that are not rid-specific.
161-
# TODO add a flag so builds only produce runtime packages
162-
- powershell: gci artifacts/packages/ -recurse -exclude 'runtime.*', 'Microsoft.AspNetCore.App.Runtime.*' -file | rm -ea ignore
163161
artifacts:
164162
- name: Windows_arm_Packages
165163
path: artifacts/packages/
@@ -180,14 +178,10 @@ jobs:
180178
buildScript: ./eng/scripts/cibuild.sh
181179
buildArgs: --no-build-nodejs
182180
--no-build-java
183-
/bl:artifacts/log/build.macos.binlog
181+
-p:OnlyPackPlatformSpecificPackages=true
182+
-bl:artifacts/log/build.macos.binlog
184183
$(_BuildArgs)
185184
installNodeJs: false
186-
afterBuild:
187-
# Remove packages that are not rid-specific.
188-
# TODO add a flag so macOS/Linux builds only produce runtime packages
189-
- script: if [ -d 'artifacts/packages' ]; then find artifacts/packages/ -type f -not -name 'runtime.*' -not -name 'Microsoft.AspNetCore.App.Runtime.*' -delete; fi
190-
condition: always()
191185
artifacts:
192186
- name: MacOS_x64_Packages
193187
path: artifacts/packages/
@@ -214,7 +208,8 @@ jobs:
214208
--arch x64
215209
--no-build-nodejs
216210
--no-build-java
217-
/bl:artifacts/log/build.linux-x64.binlog
211+
-p:OnlyPackPlatformSpecificPackages=true
212+
-bl:artifacts/log/build.linux-x64.binlog
218213
$(_BuildArgs)
219214
displayName: Run cibuild.sh
220215
- script: |
@@ -226,10 +221,11 @@ jobs:
226221
-e KOREBUILD_SKIP_INSTALL_NETFX=0 \
227222
--no-restore \
228223
--no-build-deps \
229-
/t:BuildSharedFx \
230-
/p:BuildRuntimeArchive=false \
231-
/p:LinuxInstallerType=deb \
232-
/bl:artifacts/log/build.deb.binlog \
224+
-t:BuildSharedFx \
225+
-p:OnlyPackPlatformSpecificPackages=true \
226+
-p:BuildRuntimeArchive=false \
227+
-p:LinuxInstallerType=deb \
228+
-bl:artifacts/log/build.deb.binlog \
233229
$(_BuildArgs)
234230
displayName: Build Debian installers
235231
- script: |
@@ -241,17 +237,13 @@ jobs:
241237
-e KOREBUILD_SKIP_INSTALL_NETFX=0 \
242238
--no-restore \
243239
--no-build-deps \
244-
/t:BuildSharedFx \
245-
/p:BuildRuntimeArchive=false \
246-
/p:LinuxInstallerType=rpm \
247-
/bl:artifacts/log/build.rpm.binlog \
240+
-t:BuildSharedFx \
241+
-p:OnlyPackPlatformSpecificPackages=true \
242+
-p:BuildRuntimeArchive=false \
243+
-p:LinuxInstallerType=rpm \
244+
-bl:artifacts/log/build.rpm.binlog \
248245
$(_BuildArgs)
249246
displayName: Build RPM installers
250-
afterBuild:
251-
# Remove packages that are not rid-specific.
252-
# TODO add a flag so macOS/Linux builds only produce runtime packages
253-
- script: if [ -d 'artifacts/packages' ]; then find artifacts/packages/ -type f -not -name 'runtime.*' -not -name 'Microsoft.AspNetCore.App.Runtime.*' -delete; fi
254-
condition: always()
255247
artifacts:
256248
- name: Linux_x64_Packages
257249
path: artifacts/packages/
@@ -276,14 +268,10 @@ jobs:
276268
buildArgs: --arch arm
277269
--no-build-nodejs
278270
--no-build-java
279-
/bl:artifacts/log/build.linux-arm.binlog
271+
-p:OnlyPackPlatformSpecificPackages=true
272+
-bl:artifacts/log/build.linux-arm.binlog
280273
$(_BuildArgs)
281274
installNodeJs: false
282-
afterBuild:
283-
# Remove packages that are not rid-specific.
284-
# TODO add a flag so macOS/Linux builds only produce runtime packages
285-
- script: if [ -d 'artifacts/packages' ]; then find artifacts/packages/ -type f -not -name 'runtime.*' -not -name 'Microsoft.AspNetCore.App.Runtime.*' -delete; fi
286-
condition: always()
287275
artifacts:
288276
- name: Linux_arm_Packages
289277
path: artifacts/packages/
@@ -308,14 +296,10 @@ jobs:
308296
buildArgs: --arch arm64
309297
--no-build-nodejs
310298
--no-build-java
311-
/bl:artifacts/log/build.arm64.binlog
299+
-p:OnlyPackPlatformSpecificPackages=true
300+
-bl:artifacts/log/build.arm64.binlog
312301
$(_BuildArgs)
313302
installNodeJs: false
314-
afterBuild:
315-
# Remove packages that are not rid-specific.
316-
# TODO add a flag so macOS/Linux builds only produce runtime packages
317-
- script: if [ -d 'artifacts/packages' ]; then find artifacts/packages/ -type f -not -name 'runtime.*' -not -name 'Microsoft.AspNetCore.App.Runtime.*' -delete; fi
318-
condition: always()
319303
artifacts:
320304
- name: Linux_arm64_Packages
321305
path: artifacts/packages/
@@ -345,14 +329,10 @@ jobs:
345329
--os-name linux-musl
346330
--no-build-nodejs
347331
--no-build-java
348-
/bl:artifacts/log/build.musl.binlog
332+
-p:OnlyPackPlatformSpecificPackages=true
333+
-bl:artifacts/log/build.musl.binlog
349334
$(_BuildArgs)
350335
installNodeJs: false
351-
afterBuild:
352-
# Remove packages that are not rid-specific.
353-
# TODO add a flag so macOS/Linux builds only produce runtime packages
354-
- script: if [ -d 'artifacts/packages' ]; then find artifacts/packages/ -type f -not -name 'runtime.*' -not -name 'Microsoft.AspNetCore.App.Runtime.*' -delete; fi
355-
condition: always()
356336
artifacts:
357337
- name: Linux_musl_x64_Packages
358338
path: artifacts/packages/
@@ -382,14 +362,10 @@ jobs:
382362
--os-name linux-musl
383363
--no-build-nodejs
384364
--no-build-java
385-
/bl:artifacts/log/build.musl.binlog
365+
-p:OnlyPackPlatformSpecificPackages=true
366+
-bl:artifacts/log/build.musl.binlog
386367
$(_BuildArgs)
387368
installNodeJs: false
388-
afterBuild:
389-
# Remove packages that are not rid-specific.
390-
# TODO add a flag so macOS/Linux builds only produce runtime packages
391-
- script: if [ -d 'artifacts/packages' ]; then find artifacts/packages/ -type f -not -name 'runtime.*' -not -name 'Microsoft.AspNetCore.App.Runtime.*' -delete; fi
392-
condition: always()
393369
artifacts:
394370
- name: Linux_musl_arm64_Packages
395371
path: artifacts/packages/

Directory.Build.targets

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<Project>
22

33
<PropertyGroup>
4+
<!-- When OnlyPackPlatformSpecificPackages is set, only produce packages for projects which set RuntimeIdentifier. -->
5+
<IsPackable Condition=" '$(OnlyPackPlatformSpecificPackages)' == 'true' AND '$(IsPackable)' != 'false' AND '$(RuntimeIdentifier)' == '' ">false</IsPackable>
6+
47
<!--
58
By default, all projects which produce packages are not intended to ship to NuGet.org as a product package.
69
Packages which are intended to ship to NuGet.org must opt-in by setting this to true in the project file.

eng/ProjectReferences.props

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Identity.UI" ProjectPath="$(RepoRoot)src\Identity\UI\src\Microsoft.AspNetCore.Identity.UI.csproj" RefProjectPath="$(RepoRoot)src\Identity\UI\ref\Microsoft.AspNetCore.Identity.UI.csproj" />
5353
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Connections.Abstractions" ProjectPath="$(RepoRoot)src\Servers\Connections.Abstractions\src\Microsoft.AspNetCore.Connections.Abstractions.csproj" RefProjectPath="$(RepoRoot)src\Servers\Connections.Abstractions\ref\Microsoft.AspNetCore.Connections.Abstractions.csproj" />
5454
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Server.HttpSys" ProjectPath="$(RepoRoot)src\Servers\HttpSys\src\Microsoft.AspNetCore.Server.HttpSys.csproj" RefProjectPath="$(RepoRoot)src\Servers\HttpSys\ref\Microsoft.AspNetCore.Server.HttpSys.csproj" />
55-
<ProjectReferenceProvider Include="Microsoft.AspNetCore.ANCMSymbols" ProjectPath="$(RepoRoot)src\Servers\IIS\AspNetCoreModuleV2\Symbols\Microsoft.AspNetCore.ANCMSymbols.csproj" RefProjectPath="$(RepoRoot)src\Servers\IIS\AspNetCoreModuleV2\ref\Microsoft.AspNetCore.ANCMSymbols.csproj" />
5655
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Server.IISIntegration" ProjectPath="$(RepoRoot)src\Servers\IIS\IISIntegration\src\Microsoft.AspNetCore.Server.IISIntegration.csproj" RefProjectPath="$(RepoRoot)src\Servers\IIS\IISIntegration\ref\Microsoft.AspNetCore.Server.IISIntegration.csproj" />
5756
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Server.IIS" ProjectPath="$(RepoRoot)src\Servers\IIS\IIS\src\Microsoft.AspNetCore.Server.IIS.csproj" RefProjectPath="$(RepoRoot)src\Servers\IIS\IIS\ref\Microsoft.AspNetCore.Server.IIS.csproj" />
5857
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Server.Kestrel.Core" ProjectPath="$(RepoRoot)src\Servers\Kestrel\Core\src\Microsoft.AspNetCore.Server.Kestrel.Core.csproj" RefProjectPath="$(RepoRoot)src\Servers\Kestrel\Core\ref\Microsoft.AspNetCore.Server.Kestrel.Core.csproj" />

eng/targets/Packaging.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
<Target Name="_GetPackageVersionInfo" DependsOnTargets="$(GetPackageVersionDependsOn)"
1212
Returns="@(_ProjectPathWithVersion)">
1313
<ItemGroup>
14-
<_ProjectPathWithVersion Include="$(MSBuildProjectFullPath)" Condition="'$(IsPackable)' == 'true'">
14+
<_ProjectPathWithVersion Include="$(MSBuildProjectFullPath)">
1515
<PackageId>$(PackageId)</PackageId>
16-
<PackageVersion Condition="'$(PackageVersion)' != ''">$(PackageVersion)</PackageVersion>
16+
<PackageVersion>$(PackageVersion)</PackageVersion>
1717
<VersionVariableName>$(PackageId.Replace('.',''))PackageVersion</VersionVariableName>
1818
</_ProjectPathWithVersion>
1919
</ItemGroup>

src/Components/Blazor/BlazorExtension/src/Microsoft.VisualStudio.BlazorExtension.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
<CopyOutputSymbolsToOutputDirectory>true</CopyOutputSymbolsToOutputDirectory>
5353
</PropertyGroup>
5454

55-
<Target Name="PreCreateVsixContainer" BeforeTargets="GetVsixSourceItems">
55+
<Target Name="PreCreateVsixContainer" BeforeTargets="GetVsixSourceItems" Condition="'$(IsPackable)' == 'true'">
5656
<ItemGroup>
5757
<_TemplatePackage Include="$(ArtifactsShippingPackagesDir)Microsoft.AspNetCore.Blazor.Templates.*.nupkg" />
5858
</ItemGroup>
@@ -97,7 +97,8 @@
9797
<ProjectReference
9898
Include="..\..\Templates\src\Microsoft.AspNetCore.Blazor.Templates.csproj"
9999
ReferenceOutputAssembly="false"
100-
Targets="Pack" />
100+
Private="false"
101+
Targets="Build;Pack" />
101102
</ItemGroup>
102103

103104
<ItemGroup>

src/Components/Blazor/Templates/src/Microsoft.AspNetCore.Blazor.Templates.csproj

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project>
2+
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
23
<PropertyGroup>
34
<TargetFramework>netstandard2.0</TargetFramework>
45
<NuspecFile>Microsoft.AspNetCore.Blazor.Templates.nuspec</NuspecFile>
56
<IsShippingPackage>true</IsShippingPackage>
67
<EnableDefaultItems>False</EnableDefaultItems>
78
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
89
<IncludeBuildOutput>False</IncludeBuildOutput>
10+
<CopyBuildOutputToOutputDirectory>false</CopyBuildOutputToOutputDirectory>
11+
<DebugType>none</DebugType>
12+
<GenerateDocumentationFile>false</GenerateDocumentationFile>
913
<NoWarn>$(NoWarn);2008</NoWarn>
1014
<Description>Templates for ASP.NET Core Blazor projects.</Description>
1115
<PackageTags>aspnet;templates;blazor;spa</PackageTags>
@@ -45,4 +49,8 @@
4549
<Output TaskParameter="OutputPath" ItemName="Content" />
4650
</GenerateFileFromTemplate>
4751
</Target>
52+
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
53+
<!-- Override SDK targets. This project does not produce a .dll. -->
54+
<Target Name="CoreCompile" />
55+
<Target Name="GetTargetPath" />
4856
</Project>

src/Components/Directory.Build.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<Project>
2-
<PropertyGroup Condition="'$(IsPackable)' == 'true'">
2+
<PropertyGroup Condition="'$(IsUnitTestProject)' != 'true'">
33
<GenerateDocumentationFile Condition="'$(GenerateDocumentationFile)' == ''">true</GenerateDocumentationFile>
44
</PropertyGroup>
55

src/Framework/ref/Microsoft.AspNetCore.App.Ref.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ This package is an internal implementation of the .NET Core SDK and is not meant
6363

6464
<PropertyGroup>
6565
<!-- If this project won't produce a package, don't bother building anything. -->
66-
<BuildDependsOn Condition="'$(IsPackable)' != 'false'">
66+
<BuildDependsOn Condition="'$(IsTargetingPackBuilding)' != 'false'">
6767
$(BuildDependsOn);
6868
GeneratePackageConflictManifest;
6969
_ResolveTargetingPackContent;
@@ -161,7 +161,8 @@ This package is an internal implementation of the .NET Core SDK and is not meant
161161

162162
<Target Name="_CreateTargetingPackArchive"
163163
Inputs="@(RefPackContent)"
164-
Outputs="$(ArchiveOutputPath)">
164+
Outputs="$(ArchiveOutputPath)"
165+
Condition="'$(IsPackable)' == 'true'">
165166
<ZipDirectory
166167
SourceDirectory="$(TargetingPackLayoutRoot)"
167168
DestinationFile="$(ArchiveOutputPath)"
Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project>
2+
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
23
<Import Project="..\..\build\assets.props" />
34

45
<PropertyGroup>
56
<TargetFramework>netcoreapp3.0</TargetFramework>
7+
<PackageId>$(MSBuildProjectName).$(TargetRuntimeIdentifier)</PackageId>
68
<IncludeBuildOutput>true</IncludeBuildOutput>
79
<IsPackable>$(PackNativeAssets)</IsPackable>
810
<IsShippingPackage>false</IsShippingPackage>
911
<BuildOutputTargetFolder>runtimes/$(TargetRuntimeIdentifier)/native/</BuildOutputTargetFolder>
12+
<RuntimeIdentifier>$(TargetRuntimeIdentifier)</RuntimeIdentifier>
13+
<DebugType>none</DebugType>
14+
<CopyBuildOutputToOutputDirectory>false</CopyBuildOutputToOutputDirectory>
15+
<GenerateDocumentationFile>false</GenerateDocumentationFile>
16+
<HasReferenceAssembly>false</HasReferenceAssembly>
17+
<IsProjectReferenceProvider>false</IsProjectReferenceProvider>
1018
<TargetsForTfmSpecificBuildOutput>
1119
$(TargetsForTfmSpecificBuildOutput);
1220
AddPackNativeComponents
1321
</TargetsForTfmSpecificBuildOutput>
14-
<PackageId>$(MSBuildProjectName).$(TargetRuntimeIdentifier)</PackageId>
1522
</PropertyGroup>
1623

1724
<ItemGroup Condition="'$(BuildIisNativeProjects)' == 'true' AND '$(VCTargetsPath)' != ''">
@@ -22,16 +29,17 @@
2229
<Target Name="AddPackNativeComponents" AfterTargets="_CalculateInputsOutputsForPack" Condition="'$(BuildIisNativeProjects)' == 'true' AND '$(PackNativeAssets)' == 'true'">
2330
<ItemGroup>
2431
<!-- RunShimComponents is based on the current runtime (NativePlatform) which should be the same as TargetRuntimeIdentifier -->
25-
<BuiltProjectOutputGroupOutput Remove="@(BuiltProjectOutputGroupOutput)" />
26-
<DebugSymbolsProjectOutputGroupOutput Remove="@(DebugSymbolsProjectOutputGroupOutput)" />
2732
<BuiltProjectOutputGroupOutput Include="%(RunShimComponents.DllLocation)" />
2833
<BuiltProjectOutputGroupOutput Include="%(RunShimComponents.PdbLocation)" />
29-
34+
3035
<NuGetPackInput Include="@(BuiltProjectOutputGroupOutput)" />
3136
</ItemGroup>
3237
</Target>
38+
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
3339

3440
<!-- This project does not produce a binary. Disable the compiler. -->
35-
<Target Name="Compile" />
36-
<Target Name="CopyFilesToOutputDirectory" />
41+
<Target Name="CoreCompile" />
42+
<ItemGroup>
43+
<BuiltProjectOutputGroupKeyOutput Remove="@(BuiltProjectOutputGroupKeyOutput)" />
44+
</ItemGroup>
3745
</Project>

src/Servers/IIS/AspNetCoreModuleV2/ref/Microsoft.AspNetCore.ANCMSymbols.csproj

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/Servers/IIS/AspNetCoreModuleV2/ref/Microsoft.AspNetCore.ANCMSymbols.netcoreapp3.0.cs

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/SiteExtensions/LoggingBranch/LoggingBranch.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TrimmedVersion>$(VersionPrefix.Substring(0, $(VersionPrefix.LastIndexOf('.'))))</TrimmedVersion>
54
<title>ASP.NET Core Extensions</title>
65
<Description>This extension enables additional functionality for ASP.NET Core on Azure WebSites, such as enabling Azure logging.</Description>
76
<TargetFramework>net461</TargetFramework>
87
<GenerateDocumentationFile>false</GenerateDocumentationFile>
98
<PackageTags>aspnet;logging;aspnetcore;AzureSiteExtension;keyvault;configuration;dataprotection</PackageTags>
109
<ContentTargetFolders>content</ContentTargetFolders>
11-
<PackageId>Microsoft.AspNetCore.AzureAppServices.SiteExtension.$(TrimmedVersion).$(TargetArchitecture)</PackageId>
10+
<PackageId>Microsoft.AspNetCore.AzureAppServices.SiteExtension.$(AspNetCoreMajorMinorVersion).$(TargetArchitecture)</PackageId>
11+
<RuntimeIdentifier>$(TargetRuntimeIdentifier)</RuntimeIdentifier>
1212
<HostingStartupRuntimeFrameworkVersion>$(MicrosoftNETCoreAppPackageVersion)</HostingStartupRuntimeFrameworkVersion>
1313

1414
<TargetFramework>net461</TargetFramework>

src/SiteExtensions/Runtime/Microsoft.AspNetCore.Runtime.SiteExtension.pkgproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
<PackageType>AzureSiteExtension</PackageType>
66
<ContentTargetFolders>content</ContentTargetFolders>
77

8-
<TrimmedVersion>$(VersionPrefix.Substring(0, $(VersionPrefix.LastIndexOf('.'))))</TrimmedVersion>
9-
<Title>ASP.NET Core $(TrimmedVersion) ($(TargetArchitecture)) Runtime </Title>
8+
<Title>ASP.NET Core $(AspNetCoreMajorMinorVersion) ($(TargetArchitecture)) Runtime </Title>
109
<Description>This site extension installs Microsoft.AspNetCore.App and Microsoft.NetCore.App shared runtimes.</Description>
1110
<PackageTags>aspnetcore;AzureSiteExtension</PackageTags>
12-
<PackageId>AspNetCoreRuntime.$(TrimmedVersion).$(TargetArchitecture)</PackageId>
11+
<PackageId>AspNetCoreRuntime.$(AspNetCoreMajorMinorVersion).$(TargetArchitecture)</PackageId>
12+
<RuntimeIdentifier>$(TargetRuntimeIdentifier)</RuntimeIdentifier>
1313
<NoPackageAnalysis>true</NoPackageAnalysis>
1414
<DotNetUnpackFolder>$(RedistSharedFrameworkLayoutRoot)</DotNetUnpackFolder>
1515
<IsShippingPackage>true</IsShippingPackage>

0 commit comments

Comments
 (0)