diff options
author | Viktor Hofer <viktor.hofer@microsoft.com> | 2020-12-23 00:41:05 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-23 00:41:05 +0300 |
commit | 5232af5760a4c0b0a4009f63e71aa9391eab2cbf (patch) | |
tree | 4762111fa37973dfe16b9695ac4f7232e154783f | |
parent | e00950716d20cac329565e79a16795b08e2f9925 (diff) |
Set IsPackable and validate PackageDescription (#46329)
* Set IsPackable and validate PackageDescription
-rw-r--r-- | Directory.Build.props | 3 | ||||
-rw-r--r-- | Directory.Build.targets | 9 | ||||
-rw-r--r-- | eng/packaging.props | 13 | ||||
-rw-r--r-- | eng/packaging.targets | 17 | ||||
-rw-r--r-- | src/libraries/libraries-packages.proj | 6 |
5 files changed, 35 insertions, 13 deletions
diff --git a/Directory.Build.props b/Directory.Build.props index 6e8d5c5bc0e..5586f4493d4 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -93,6 +93,9 @@ <!-- By default the SDK produces ref assembly for 5.0 or later --> <ProduceReferenceAssembly>false</ProduceReferenceAssembly> + + <!-- Set IsPackable true for all pkgproj as Arcade unconditionally overrides the value. --> + <IsPackable Condition="'$(MSBuildProjectExtension)' == '.pkgproj'">true</IsPackable> </PropertyGroup> <!-- Language configuration --> diff --git a/Directory.Build.targets b/Directory.Build.targets index 7af5848d9af..6b1d21054a2 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,5 +1,4 @@ -<Project> - +<Project InitialTargets="ErrorForMissingPackageDescription"> <PropertyGroup> <!-- For non-SDK projects that import this file and then import Microsoft.Common.targets, @@ -33,4 +32,10 @@ <!-- Keep in sync as required by the Packaging SDK in Arcade. --> <Description>$(PackageDescription)</Description> </PropertyGroup> + + <!-- Remove when https://github.com/NuGet/Home/issues/10405 is implemented and consumed. --> + <Target Name="ErrorForMissingPackageDescription" + Condition="'$(IsPackable)' == 'true' and '$(PackageDescription)' == ''"> + <Error Text="Required property 'PackageDescription' is missing for $(MSBuildProjectName)." /> + </Target> </Project>
\ No newline at end of file diff --git a/eng/packaging.props b/eng/packaging.props index 07b3879a5f0..7d06318fd9d 100644 --- a/eng/packaging.props +++ b/eng/packaging.props @@ -38,9 +38,20 @@ <SkipValidatePackage>true</SkipValidatePackage> </PropertyGroup> + <PropertyGroup> + <PkgProjPath>$(MSBuildProjectDirectory)\..\pkg\$(MSBuildProjectName).pkgproj</PkgProjPath> + <!-- Controls if packages for libraries should be created in (traversal) builds. --> + <PackAllLibraries Condition="'$(PackAllLibraries)' == '' and + ('$(PreReleaseVersionLabel)' != 'servicing' or + '$(BuildAllProjects)' != 'true')">true</PackAllLibraries> + <IsPackable Condition="('$(MSBuildProjectExtension)' == '.pkgproj' or + ('$(IsSourceProject)' == 'true' and Exists('$(PkgProjPath)'))) and + '$(PackAllLibraries)' == 'true'">true</IsPackable> + </PropertyGroup> + <Import Condition="Exists('$(PkgDir)baseline\baseline.props') and '$(MSBuildProjectExtension)' == '.pkgproj'" Project="$(PkgDir)baseline\baseline.props" /> - <PropertyGroup Condition="'$(OsEnvironment)'=='Unix'"> + <PropertyGroup Condition="'$(OsEnvironment)' == 'Unix'"> <!-- Building packages fails for two reasons. First, nuget doesn't like the paths in the nuspec having backslashes as directory separators. diff --git a/eng/packaging.targets b/eng/packaging.targets index 47484ae1f4e..30a8caa5cbc 100644 --- a/eng/packaging.targets +++ b/eng/packaging.targets @@ -1,4 +1,4 @@ -<Project> +<Project InitialTargets="_OverridePackDependsOn"> <!-- 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: @@ -27,12 +27,15 @@ '%(Dependency.Identity)' != '_._'" /> </Target> - <PropertyGroup> - <PkgProjPath>$(MSBuildProjectDirectory)\..\pkg\$(MSBuildProjectName).pkgproj</PkgProjPath> - <!-- Point to our custom pack target which builds the pkgproj instead. --> - <PackDependsOn Condition="'$(IsSourceProject)' == 'true' and - Exists('$(PkgProjPath)')">_BuildPkgProj</PackDependsOn> - </PropertyGroup> + <Target Name="_OverridePackDependsOn" + Condition="'$(IsSourceProject)' == 'true' and + '$(IsPackable)' == 'true' and + Exists('$(PkgProjPath)')"> + <PropertyGroup> + <!-- Point to the custom pack target which invokes the pkgproj. --> + <PackDependsOn>_BuildPkgProj</PackDependsOn> + </PropertyGroup> + </Target> <Target Name="_BuildPkgProj"> <MSBuild Projects="$(PkgProjPath)" diff --git a/src/libraries/libraries-packages.proj b/src/libraries/libraries-packages.proj index 1545e5f6773..491cd148f20 100644 --- a/src/libraries/libraries-packages.proj +++ b/src/libraries/libraries-packages.proj @@ -3,7 +3,6 @@ <PropertyGroup> <TraversalGlobalProperties>BuildAllProjects=true</TraversalGlobalProperties> <AdditionalBuildTargetFrameworks Condition="'$(DotNetBuildFromSource)' == 'true'">$(AdditionalBuildTargetFrameworks);package-$(Configuration)</AdditionalBuildTargetFrameworks> - <BuildAllOOBPackages Condition="'$(BuildAllOOBPackages)' == ''">true</BuildAllOOBPackages> </PropertyGroup> <PropertyGroup> @@ -15,8 +14,9 @@ <ItemGroup> <ProjectReference Include="$(PkgDir)*\*.proj" Exclude="$(PkgDir)test\*" /> - <ProjectReference Include="$(MSBuildThisFileDirectory)*\src\*.*proj" Condition="('$(BuildAllConfigurations)' == 'true' or '$(DotNetBuildFromSource)' == 'true') And '$(BuildAllOOBPackages)' == 'true'" Exclude="$(MSBuildThisFileDirectory)*\src\**\*.shproj"/> - <!-- If setting BuildAllOOBPackages to false, add bellow the individual OOB packages you want to continue to build --> + <ProjectReference Include="$(MSBuildThisFileDirectory)*\src\*.*proj" + Condition="('$(BuildAllConfigurations)' == 'true' or '$(DotNetBuildFromSource)' == 'true')" + Exclude="$(MSBuildThisFileDirectory)*\src\**\*.shproj"/> </ItemGroup> <!-- Need the PackageIndexFile file property from baseline.props --> |