Skip to content

Commit

Permalink
Add Infra for porting lib only packages to use dotnet pack instead of…
Browse files Browse the repository at this point in the history
… pkgprojs (dotnet#51765)

* add infra and move projects to use dotnet pack

* adddress feedback

* address feedback

* donot include buildoutput from netfx during sourcebuild

* some more feedback points

* add  SuppressDependenciesWhenPacking as well

* Apply suggestions from code review

Co-authored-by: Viktor Hofer <[email protected]>

* Update src/libraries/Directory.Build.targets

Co-authored-by: Viktor Hofer <[email protected]>

* remove warn

* Update src/libraries/Directory.Build.targets

Co-authored-by: Viktor Hofer <[email protected]>

* donot set includebuild output in outerbuild

Co-authored-by: Viktor Hofer <[email protected]>
  • Loading branch information
Anipik and ViktorHofer authored Apr 29, 2021
1 parent e8aa061 commit 28b9c72
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 10 deletions.
2 changes: 2 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,11 @@
<RepositoryUrl>https://github.com/dotnet/$(GitHubRepositoryName)</RepositoryUrl>
<PackageProjectUrl>https://dot.net</PackageProjectUrl>
<Owners>microsoft,dotnetframework</Owners>
<IncludeSymbols>true</IncludeSymbols>
<RuntimeIdGraphDefinitionFile>$([MSBuild]::NormalizePath('$(LibrariesProjectRoot)', 'Microsoft.NETCore.Platforms', 'src', 'runtime.json'))</RuntimeIdGraphDefinitionFile>
<LicenseFile>$(MSBuildThisFileDirectory)LICENSE.TXT</LicenseFile>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<Copyright>$(CopyrightNetFoundation)</Copyright>
<PackageThirdPartyNoticesFile>$(MSBuildThisFileDirectory)THIRD-PARTY-NOTICES.TXT</PackageThirdPartyNoticesFile>
<PackageReleaseNotes>https://go.microsoft.com/fwlink/?LinkID=799421</PackageReleaseNotes>
Expand Down
1 change: 1 addition & 0 deletions eng/packaging.props
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
</PropertyGroup>

<PropertyGroup>
<NuSpecOutputPath Condition="'$(NuSpecOutputPath)' == ''">$([MSBuild]::NormalizeDirectory('$(ArtifactsPackagesDir)', 'specs'))</NuSpecOutputPath>
<PkgProjPath>$(MSBuildProjectDirectory)\..\pkg\$(MSBuildProjectName).pkgproj</PkgProjPath>
</PropertyGroup>

Expand Down
23 changes: 23 additions & 0 deletions src/libraries/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<Import Project="..\..\Directory.Build.targets" />

<PropertyGroup>
<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>
<NoWarn Condition="'$(GeneratePlatformNotSupportedAssembly)' == 'true' or '$(GeneratePlatformNotSupportedAssemblyMessage)' != ''">$(NoWarn);nullable;CA1052</NoWarn>
Expand Down Expand Up @@ -229,6 +230,11 @@
<ExcludeFromPackage Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', '$(NetCoreAppCurrent)')) and '$(ExcludeCurrentNetCoreAppFromPackage)' == 'true'">true</ExcludeFromPackage>
</PropertyGroup>

<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 @@ -272,4 +278,21 @@
</ItemGroup>
</When>
</Choose>

<Target Name="LibIntellisenseDocs" Condition="'$(IncludeBuildOutput)' == 'true'">
<ItemGroup>
<TfmSpecificPackageFile Include="$(XmlDocFileRoot)1033\$(TargetName).xml"
Condition="Exists('$(XmlDocFileRoot)1033\$(TargetName).xml')"
PackagePath="lib/$(TargetFramework)" />
</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>

</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project>
<Import Project="..\Directory.Build.props" />
<PropertyGroup>
<PackageDescription>Environment variables configuration provider implementation for Microsoft.Extensions.Configuration.</PackageDescription>
<IsAspNetCoreApp>true</IsAspNetCoreApp>
</PropertyGroup>
</Project>

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<IsPackable>true</IsPackable>
<EnableDefaultItems>true</EnableDefaultItems>
<PackageDescription>Environment variables configuration provider implementation for Microsoft.Extensions.Configuration.</PackageDescription>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<IsSourceProject>false</IsSourceProject>
<IsPackable>true</IsPackable>
<IncludeBuildOutput>false</IncludeBuildOutput>
<IncludeSymbols>false</IncludeSymbols>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
<NoWarn>$(NoWarn);NU5128</NoWarn> <!-- No Dependencies-->
<PackageDescription>Provides runtime information required to resolve target framework, platform, and runtime specific implementations of .NETCore packages.</PackageDescription>
Expand Down

0 comments on commit 28b9c72

Please sign in to comment.