Skip to content

Commit

Permalink
add infra for adding ref and runtime assemblies
Browse files Browse the repository at this point in the history
delete the project

add a comment

move the warning disable to cenral location

moving props/targets to packaging.props and packaging.targets

use intellisense package for ref and runtime xml files

add comments, flag for ref assemblies, remove xml from runtimes, use outputItem to get the reference assembly

addressing some more feedback

remove ref assemblies

add suppression file and update package validatio
  • Loading branch information
Anipik committed Jul 2, 2021
1 parent 348fefa commit 3f7bb08
Show file tree
Hide file tree
Showing 12 changed files with 76 additions and 36 deletions.
2 changes: 2 additions & 0 deletions NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
<add key="dotnet6" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" />
<add key="dotnet6-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6-transport/nuget/v3/index.json" />
<!-- Used for dotnet pack task -->
<add key="nuget-build" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/nuget-build/nuget/v3/index.json" />
<!-- Used for the Rich Navigation indexing task -->
<add key="richnav" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/vs-buildservices/nuget/v3/index.json" />
</packageSources>
Expand Down
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<MicrosoftDotNetVersionToolsTasksVersion>6.0.0-beta.21329.8</MicrosoftDotNetVersionToolsTasksVersion>
<MicrosoftDotNetPackageTestingVersion>6.0.0-beta.21329.8</MicrosoftDotNetPackageTestingVersion>
<!-- NuGet dependencies -->
<NuGetBuildTasksPackVersion>5.9.0-preview.2</NuGetBuildTasksPackVersion>
<NuGetBuildTasksPackVersion>6.0.0-preview.1.102</NuGetBuildTasksPackVersion>
<!-- Installer dependencies -->
<MicrosoftNETCoreAppVersion>6.0.0-alpha.1.20612.4</MicrosoftNETCoreAppVersion>
<MicrosoftNETCoreDotNetHostVersion>6.0.0-preview.7.21321.2</MicrosoftNETCoreDotNetHostVersion>
Expand Down
10 changes: 6 additions & 4 deletions eng/packaging.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<PackageVersion Condition="'$(PackageVersion)' == '' and '$(MSBuildProjectExtension)' == '.pkgproj'">6.0.0</PackageVersion>
<SkipValidatePackageTargetFramework>true</SkipValidatePackageTargetFramework>
<SkipGenerationCheck>true</SkipGenerationCheck>
<DefaultAllowedOutputExtensionsInPackageBuildOutputFolder>.dll;.exe;.winmd;.json;.pri;</DefaultAllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>

<PropertyGroup Condition="'$(DotNetBuildFromSource)' == 'true'">
Expand All @@ -29,10 +30,6 @@

<Import Condition="Exists('$(PkgDir)baseline\baseline.props') and '$(MSBuildProjectExtension)' == '.pkgproj'" Project="$(PkgDir)baseline\baseline.props" />

<PropertyGroup Condition="'$(IsPackable)' == 'true'">
<PackageDesignerMarkerFile>$(MSBuildThisFileDirectory)useSharedDesignerContext.txt</PackageDesignerMarkerFile>
</PropertyGroup>

<ItemGroup Condition="'$(IsPackable)' == 'true'">
<!-- Add a marker to help the designer optimize & share .NET Core packages -->
<None Include="$(PackageDesignerMarkerFile)"
Expand All @@ -50,4 +47,9 @@
<RuntimeIDs>@(NETCoreApp30RIDs)</RuntimeIDs>
</DefaultValidateFramework>
</ItemGroup>

<!-- TODO: Remove when all required nuget pack features are part of the consumed SDK. -->
<ItemGroup Condition="'$(IsPackable)' == 'true' and '$(IsSourceProject)' == 'true'">
<PackageReference Include="NuGet.Build.Tasks.Pack" Version="$(NuGetBuildTasksPackVersion)" PrivateAssets="all" IsImplicitlyDefined="true" />
</ItemGroup>
</Project>
36 changes: 36 additions & 0 deletions eng/packaging.targets
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
<Project InitialTargets="_OverridePackDependsOnForCsProjToPkgProj">

<PropertyGroup Condition="'$(IsPackable)' == 'true'">
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);AddRuntimeSpecificAssemblies;LibIntellisenseDocs</TargetsForTfmSpecificContentInPackage>
<TargetsForTfmSpecificDebugSymbolsInPackage>$(TargetsForTfmSpecificDebugSymbolsInPackage);AddRuntimeDebugSymbolsWithTfm</TargetsForTfmSpecificDebugSymbolsInPackage>
<IncludeBuildOutput Condition="'$(TargetsAnyOS)' != 'true' or '$(ExcludeFromPackage)' == 'true'">false</IncludeBuildOutput>
<!-- Don't include target platform specific dependencies, since we use the target platform to represent RIDs instead -->
<SuppressDependenciesWhenPacking Condition="'$(ExcludeFromPackage)' == 'true' or ('$(TargetsAnyOS)' != 'true' and $([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net5.0')))">true</SuppressDependenciesWhenPacking>
<PackageDesignerMarkerFile>$(MSBuildThisFileDirectory)useSharedDesignerContext.txt</PackageDesignerMarkerFile>
</PropertyGroup>

<!-- There are some packages where we require only one ref for a specific framework to be present. In order to avoid problems with this package when targetting
dektop with RAR we will make sure there are no exclude=compile references in the package.
For more info, please check issues:
Expand Down Expand Up @@ -42,4 +52,30 @@
<MSBuild Projects="$(PkgProjPath)"
Targets="Build" />
</Target>

<Target Name="AddRuntimeSpecificAssemblies"
DependsOnTargets="BuiltProjectOutputGroup;SatelliteDllsProjectOutputGroup;$(TargetsForTfmSpecificBuildOutput)"
Condition="'$(TargetsAnyOS)' != 'true' and '$(ExcludeFromPackage)' == ''">
<ItemGroup>
<TfmSpecificPackageFile Include="@(SatelliteDllsProjectOutputGroupOutput);
@(BuiltProjectOutputGroupOutput)">
<PackagePath>runtimes/$(_runtimeOS)/lib/$(TargetFrameworkWithoutSuffix)</PackagePath>
</TfmSpecificPackageFile>
</ItemGroup>
</Target>

<!-- Runtime independent symbols are automatically added by the pack task.-->
<Target Name="AddRuntimeDebugSymbolsWithTfm"
Condition="'$(IncludeSymbols)' == 'true' and '$(TargetsAnyOS)' != 'true' and '$(ExcludeFromPackage)' == ''">
<PropertyGroup>
<RuntimeSymbolPath>$([System.IO.Path]::GetDirectoryName($(TargetPath)))\$(TargetName).pdb</RuntimeSymbolPath>
</PropertyGroup>

<ItemGroup Condition="Exists('$(RuntimeSymbolPath)')">
<TfmSpecificDebugSymbolsFile Include="$(RuntimeSymbolPath)">
<TargetPath>/runtimes/$(_runtimeOS)/lib/$(TargetFrameworkWithoutSuffix)/$(TargetName).pdb</TargetPath>
<TargetFramework>$(TargetFrameworkWithoutSuffix)</TargetFramework>
</TfmSpecificDebugSymbolsFile>
</ItemGroup>
</Target>
</Project>
15 changes: 0 additions & 15 deletions src/libraries/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
<NetCoreAppCurrentTestHostPath>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'testhost', '$(NetCoreAppCurrentBuildSettings)'))</NetCoreAppCurrentTestHostPath>
<NetCoreAppCurrentTestHostSharedFrameworkPath>$([MSBuild]::NormalizeDirectory('$(NetCoreAppCurrentTestHostPath)', 'shared', '$(MicrosoftNetCoreAppFrameworkName)', '$(ProductVersion)'))</NetCoreAppCurrentTestHostSharedFrameworkPath>

<TargetsForTfmSpecificContentInPackage Condition="'$(IsPackable)' == 'true'">$(TargetsForTfmSpecificContentInPackage);LibIntellisenseDocs</TargetsForTfmSpecificContentInPackage>
<SymbolPackageOutputPath>$(PackageOutputPath)</SymbolPackageOutputPath>

<NoWarn Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' or '$(TargetFrameworkIdentifier)' == '.NETStandard' or ('$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionLessThan($(TargetFrameworkVersion), '3.0')))">$(NoWarn);nullable</NoWarn>
Expand Down Expand Up @@ -147,7 +146,6 @@

<PropertyGroup>
<PackageValidationBaselineVersion Condition="'$(PackageValidationBaselineVersion)' == ''">$([MSBuild]::Subtract($(MajorVersion), 1)).0.0</PackageValidationBaselineVersion>
<EnablePackageBaselineValidation Condition="'$(IsPackable)' == 'true' and '$(MSBuildProjectExtension)' != '.pkgproj' and '$(EnablePackageBaselineValidation)' == ''">true</EnablePackageBaselineValidation>
</PropertyGroup>

<Target Name="SetGenApiProperties"
Expand Down Expand Up @@ -235,11 +233,6 @@
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\NullableAttributes.cs" Link="System\Diagnostics\CodeAnalysis\NullableAttributes.cs" />
</ItemGroup>

<PropertyGroup Condition="'$(IsCrossTargetingBuild)' != 'true' and '$(DotnetBuildFromSource)' == 'true' and '$(IsPackable)' == 'true' and !$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', '$(NetCoreAppCurrent)')) and '$(TargetFrameworkIdentifier)' != '.NETStandard' and '$(TargetFrameworkVersion)' != 'v2.0'">
<IncludeBuildOutput>false</IncludeBuildOutput>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
</PropertyGroup>

<!-- If a project is downlevel from net5.0 but uses the platform support attributes, then we include the
System.Runtime.Versioning*Platform* annotation attribute classes in the project as internal.
Expand Down Expand Up @@ -292,14 +285,6 @@
</ItemGroup>
</Target>

<!-- TODO: Remove this after https://github.com/NuGet/NuGet.Client/pull/3980 is merged.-->
<Target Name="RemoveXmlFilesFromBuildOutput" BeforeTargets="GenerateNuspec">
<PropertyGroup>
<AllowedOutputExtensionsInPackageBuildOutputFolder>.dll;.exe;.winmd;.json;.pri;</AllowedOutputExtensionsInPackageBuildOutputFolder>
<AllowedOutputExtensionsInSymbolsPackageBuildOutputFolder>.pdb;.mdb;$(AllowedOutputExtensionsInPackageBuildOutputFolder)</AllowedOutputExtensionsInSymbolsPackageBuildOutputFolder>
</PropertyGroup>
</Target>

<PropertyGroup>
<BeforePack>IncludeAnalyzersInPackage;$(BeforePack)</BeforePack>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!-- NETFramework,Version=v4.5.1, .NETStandard,Version=v1.3 and NETStandard,Version=v1.6 are out of support and dropped from the package. -->
<Suppression>
<DiagnosticId>PKV006</DiagnosticId>
<Target>.NETFramework,Version=v4.5.1</Target>
</Suppression>
<Suppression>
<DiagnosticId>PKV006</DiagnosticId>
<Target>.NETStandard,Version=v1.3</Target>
</Suppression>
<Suppression>
<DiagnosticId>PKV006</DiagnosticId>
<Target>.NETStandard,Version=v1.6</Target>
</Suppression>
</Suppressions>
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<EnableDefaultItems>true</EnableDefaultItems>
<!-- PKV006 is due to intentional removal of .NETFramework,Version=v4.5.1, .NETStandard,Version=v1.3 and NETStandard,Version=v1.6 target frameworks from the package as they are no longer supported. -->
<NoWarn>$(NoWarn);PKV006</NoWarn>
<PackageDescription>Abstractions for reading `.deps` files.

Commonly Used Types:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<!-- This is a source package which includes all .cs files by default. -->
<IsSourcePackage>true</IsSourcePackage>
<!-- This is non-shipping package. -->

This comment has been minimized.

Copy link
@ViktorHofer

ViktorHofer Jul 2, 2021

Member

Why is this a non shipping package? I see IsShipping set to false above which you introduced in 3897ee5.

This comment has been minimized.

Copy link
@Anipik

Anipik Jul 3, 2021

Author Contributor

This is just being used by aspnetcore and is not meant for shipping. isShipping was false before my change, it was in pkgproj 3897ee5#diff-e5e58e6bddf9d0a146dcf4b1faedbe9cee9924785f985c816212e744a0f4bd86L4

<EnablePackageBaselineValidation>false</EnablePackageBaselineValidation>
<DisablePackageBaselineValidation>true</DisablePackageBaselineValidation>
<PackageDescription>Internal package for sharing Microsoft.Extensions.Hosting.HostFactoryResolver type.</PackageDescription>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<TargetFrameworks>$(NetCoreAppCurrent);netstandard2.0;net461</TargetFrameworks>
<IsPackable>true</IsPackable>
<!-- TODO: Remove when the package ships with .NET 6. -->
<EnablePackageBaselineValidation>false</EnablePackageBaselineValidation>
<DisablePackageBaselineValidation>true</DisablePackageBaselineValidation>
<PackageDescription>Provides non-cryptographic hash algorithms, such as CRC-32.

Commonly Used Types:
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!-- .NETCoreapp,Version=v3.0 is out of support and dropped from the package. -->
<Suppression>
<DiagnosticId>PKV006</DiagnosticId>
<Target>.NETCoreapp,Version=v3.0</Target>
</Suppression>
<Suppression>
<DiagnosticId>PKV007</DiagnosticId>
<Target>.NETCoreapp,Version=v3.0-win</Target>
</Suppression>
</Suppressions>
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);netcoreapp3.1-windows;netcoreapp3.1</TargetFrameworks>
<IsPackable>true</IsPackable>
</PropertyGroup>
<!-- DesignTimeBuild requires all the TargetFramework Derived Properties to not be present in the first property group. -->
<PropertyGroup Condition="'$(TargetsWindows)' != 'true'">
Expand Down

0 comments on commit 3f7bb08

Please sign in to comment.