Skip to content

Commit

Permalink
Make sure rid specific libs projs get packaged (dotnet#57193)
Browse files Browse the repository at this point in the history
* Make sure rid specific libs projs get packaged

RID specific runtime.*.runtime.native.System.IO.Ports projects weren't
packaged because the GeneratePackageOnBuild property wasn't set to true
for them. The property was only true during an allconfigurations build.
As these projects are only built outside of an allconfigurations build,
the GeneratePackageOnBuild property needs to account for such as well.

Also updating the NoTargets Sdk to clean the rid specific package up.

Moving the GeneratePackageOnBuild logic into a props file and set it to
false during servicing (or runtimelab) so that devs can set the property
during servicing directly in the project file if a project should be
packaged.

* Remove the GeneratePackage property

That property was intended to enabled incremental servicing but with
now using the NuGet Pack task we can just make use of the publicl
available GeneratePackageOnBuild property.

* Fix IsPackable setting
  • Loading branch information
ViktorHofer authored Aug 11, 2021
1 parent c0662e8 commit 85441ce
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 44 deletions.
6 changes: 0 additions & 6 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,6 @@
<IsShippingAssembly Condition="$(IsExperimentalAssembly)">false</IsShippingAssembly>
<!-- We don't want Private packages to be shipped to NuGet.org -->
<IsShippingPackage Condition="$(MSBuildProjectName.Contains('Private')) or $(IsExperimentalAssembly)">false</IsShippingPackage>
<!-- A package isn't generated if in servicing or in runtimelab. Intended to be overridden at project level.
Excluding .sfxprojs as they have their own incremental servicing infra. -->
<GeneratePackage Condition="'$(GeneratePackage)' == ''">true</GeneratePackage>
<GeneratePackage Condition="(('$(PreReleaseVersionLabel)' == 'servicing' or
'$(GitHubRepositoryName)' == 'runtimelab') and
'$(MSBuildProjectExtension)' != '.sfxproj')">false</GeneratePackage>
<PlaceholderFile>$(RepositoryEngineeringDir)_._</PlaceholderFile>
</PropertyGroup>

Expand Down
18 changes: 1 addition & 17 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project InitialTargets="_OverridePackDependsOn">
<Project>
<PropertyGroup>
<!--
For non-SDK projects that import this file and then import Microsoft.Common.targets,
Expand Down Expand Up @@ -54,24 +54,8 @@
<PackageDescription Condition="'$(PackageDescription)' == '' and '$(UseRuntimePackageDisclaimer)' == 'true'">$(RuntimePackageDisclaimer)</PackageDescription>
<!-- Keep in sync as required by the Packaging SDK in Arcade. -->
<Description>$(PackageDescription)</Description>
<GenerateNuspecDependsOn>ErrorForMissingPackageDescription;$(GenerateNuspecDependsOn)</GenerateNuspecDependsOn>
</PropertyGroup>

<!-- Remove when https://github.com/NuGet/Home/issues/10405 is implemented and consumed. -->
<Target Name="ErrorForMissingPackageDescription"
Condition="'$(PackageDescription)' == ''">
<Error Text="Required property 'PackageDescription' is missing for $(MSBuildProjectName)." />
</Target>

<!-- <GeneratePackage /> controls if a package should be created by clearing out <PackDependsOn />. -->
<Target Name="_OverridePackDependsOn"
Condition="'$(IsPackable)' == 'true' and
'$(GeneratePackage)' != 'true'">
<PropertyGroup>
<PackDependsOn />
</PropertyGroup>
</Target>

<!--
Arcade SDK versioning is defined by static properties in a targets file: work around this by
moving properties based on versioning into a target.
Expand Down
9 changes: 0 additions & 9 deletions eng/packaging.props

This file was deleted.

14 changes: 12 additions & 2 deletions eng/packaging.targets
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,25 @@
<!-- Don't restore prebuilt packages during sourcebuild. -->
<DisablePackageBaselineValidation Condition="'$(DotNetBuildFromSource)' == 'true'">true</DisablePackageBaselineValidation>
<PackageValidationBaselineVersion Condition="'$(PackageValidationBaselineVersion)' == ''">$([MSBuild]::Subtract($(MajorVersion), 1)).0.0</PackageValidationBaselineVersion>
<!-- PackDependsOn is the right hook in a targets file if the NuGet.Build.Tasks.Pack nuget package is used, otherwise
BeforePack must be used. Setting both to ensure that we are always running before other targets. -->
<PackDependsOn>AddNETStandardCompatErrorFileForPackaging;IncludeAnalyzersInPackage;$(PackDependsOn)</PackDependsOn>
<BeforePack>AddNETStandardCompatErrorFileForPackaging;IncludeAnalyzersInPackage;$(BeforePack)</BeforePack>
<SymbolPackageOutputPath>$(PackageOutputPath)</SymbolPackageOutputPath>
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);AddRuntimeSpecificFilesToPackage</TargetsForTfmSpecificContentInPackage>
<TargetsForTfmSpecificDebugSymbolsInPackage>$(TargetsForTfmSpecificDebugSymbolsInPackage);AddRuntimeSpecificSymbolToPackage</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>
<!-- Generate packages in the allconfigurations build. -->
<GeneratePackageOnBuild Condition="'$(BuildAllConfigurations)' == 'true'">true</GeneratePackageOnBuild>
<!-- Generate packages for rid specific projects or for allconfigurations during build. -->
<!-- A package isn't generated if in servicing or in runtimelab. Intended to be overridden at project level. -->
<IsRIDSpecificProject Condition="$(MSBuildProjectName.StartsWith('runtime.')) and
!$(MSBuildProjectName.StartsWith('runtime.native'))">true</IsRIDSpecificProject>
<GeneratePackageOnBuild Condition="('$(BuildAllConfigurations)' == 'true' or
'$(IsRIDSpecificProject)' == 'true') and
'$(PreReleaseVersionLabel)' != 'servicing' and
'$(GitHubRepositoryName)' != 'runtimelab'">true</GeneratePackageOnBuild>
<!-- Search for the documentation file in the intellisense package and otherwise pick up the generated one. -->
<LibIntellisenseDocumentationFilePath>$(XmlDocFileRoot)1033\$(AssemblyName).xml</LibIntellisenseDocumentationFilePath>
<UseIntellisenseDocumentationFile Condition="'$(UseIntellisenseDocumentationFile)' == '' and Exists('$(LibIntellisenseDocumentationFilePath)')">true</UseIntellisenseDocumentationFile>
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21405.3",
"Microsoft.DotNet.Helix.Sdk": "6.0.0-beta.21407.1",
"Microsoft.DotNet.SharedFramework.Sdk": "6.0.0-beta.21405.3",
"Microsoft.Build.NoTargets": "3.0.4",
"Microsoft.Build.NoTargets": "3.1.0",
"Microsoft.Build.Traversal": "3.0.23",
"Microsoft.NET.Sdk.IL": "6.0.0-rc.1.21401.3"
}
Expand Down
1 change: 0 additions & 1 deletion src/libraries/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
</ItemGroup>

<Import Project="NetCoreAppLibrary.props" />
<Import Project="$(RepositoryEngineeringDir)packaging.props" Condition="'$(IsSourceProject)' == 'true'" />
<Import Project="$(RepositoryEngineeringDir)referenceAssemblies.props" Condition="'$(IsReferenceAssembly)' == 'true'" />
<Import Project="$(RepositoryEngineeringDir)targetframeworksuffix.props" Condition="'$(DesignTimeBuild)' != 'true'" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<IncludeBuildOutput>true</IncludeBuildOutput>
<DebugSymbols>false</DebugSymbols>
<DebugType>none</DebugType>
<IsPackable>true</IsPackable>
<AllowedOutputExtensionsInSymbolsPackageBuildOutputFolder>$(SymbolsSuffix)</AllowedOutputExtensionsInSymbolsPackageBuildOutputFolder>
<TargetsForTfmSpecificDebugSymbolsInPackage>$(TargetsForTfmSpecificDebugSymbolsInPackage);AddRuntimeSpecificNativeSymbolToPackage</TargetsForTfmSpecificDebugSymbolsInPackage>
<UseRuntimePackageDisclaimer>true</UseRuntimePackageDisclaimer>
Expand All @@ -26,12 +27,4 @@
TargetFramework="$(TargetFramework)" />
</ItemGroup>
</Target>

<!-- This is necessary as NuGet reads from this item when IncludeBuildOutput is set to true.
Remove when https://github.com/microsoft/MSBuildSdks/pull/276 is merged and a new version is consumed. -->
<Target Name="ClearBuiltProjectOutputGroupKeyOutput" BeforeTargets="_WalkEachTargetPerFramework;BuiltProjectOutputGroup">
<ItemGroup>
<BuiltProjectOutputGroupKeyOutput Remove="@(BuiltProjectOutputGroupKeyOutput)" />
</ItemGroup>
</Target>
</Project>

0 comments on commit 85441ce

Please sign in to comment.