diff options
author | Viktor Hofer <viktor.hofer@microsoft.com> | 2021-08-06 13:01:36 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-06 13:01:36 +0300 |
commit | 22cee85aa08061e5b2c1e893797a860e3c642e6c (patch) | |
tree | b9ff616897363d8612cc8d59cec9a51ab75eb32c /eng/packaging.targets | |
parent | 3602be5ae29b6df849519743ba53c2752ec6d6d6 (diff) |
Clean-up pkgproj leftovers in libs and apply fixes (#56899)
* Clean-up pkgproj leftovers in libs and apply fixes
Remove any pkgproj infrastructure that was only used by src/libraries
(which is the majority). Delete the packageindex *YAY*.
Update the documentation that covered the packageindex and the pkgprojs.
Avoid any incremental builds during packaging by removing
libraries-packages.proj and use src.proj for packaging instead. Make use
of the `GeneratePackageOnBuild` property to build package during the
allconfigurations without requiring a different entry target.
Fix the addition of the DocumentationFile during packaging when
`GeneratePackageOnBuid` is used by hooking onto the
`DocumentationProjectOutputGroup` that NuGet uses and replacing the
generated documentation file with the one that comes via the
intellisense package.
Also introduce a property to choose the generated documentation file
over the one from the intellisense package:
<UseIntellisenseDocumentationFile>false</UseIntellisenseDocumentationFile>
Removing a few leftover PackageDescription properties from the projects'
Directory.Build.props file.
Cleaning up properties in Directory.Build.props & Directory.Build.targets
files.
* Actually run packaging during the allconfigurations build
* Update docs
* make runtime specific pkgs non packable
* io.ports native pkg fixes
Diffstat (limited to 'eng/packaging.targets')
-rw-r--r-- | eng/packaging.targets | 106 |
1 files changed, 23 insertions, 83 deletions
diff --git a/eng/packaging.targets b/eng/packaging.targets index fcde29af5a3..30d7ef75d98 100644 --- a/eng/packaging.targets +++ b/eng/packaging.targets @@ -1,18 +1,23 @@ -<Project InitialTargets="_OverridePackDependsOnForCsProjToPkgProj"> - - <PropertyGroup Condition="'$(IsPackable)' == 'true'"> - <EnablePackageValidation Condition="'$(IsSourceProject)' == 'true' and !Exists('$(PkgProjPath)')">true</EnablePackageValidation> +<Project> + + <PropertyGroup> + <EnablePackageValidation>true</EnablePackageValidation> <!-- Don't restore prebuilt packages during sourcebuild. --> <DisablePackageBaselineValidation Condition="'$(DotNetBuildFromSource)' == 'true'">true</DisablePackageBaselineValidation> <PackageValidationBaselineVersion Condition="'$(PackageValidationBaselineVersion)' == ''">$([MSBuild]::Subtract($(MajorVersion), 1)).0.0</PackageValidationBaselineVersion> <SymbolPackageOutputPath>$(PackageOutputPath)</SymbolPackageOutputPath> - <TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);AddDocumentationFileToPackage;AddRuntimeSpecificFilesToPackage</TargetsForTfmSpecificContentInPackage> + <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> <GenerateNuspecDependsOn>IncludeAnalyzersInPackage;$(GenerateNuspecDependsOn)</GenerateNuspecDependsOn> + <!-- Generate packages in the allconfigurations build. --> + <GeneratePackageOnBuild Condition="'$(BuildAllConfigurations)' == 'true'">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> </PropertyGroup> <ItemGroup Condition="'$(EnablePackageValidation)' == 'true'"> @@ -29,8 +34,7 @@ </ItemGroup> <Choose> - <When Condition="'$(IsPackable)' == 'true' and - ('$(AddXamarinPlaceholderFilesToPackage)' == 'true' or '$(AddNETFrameworkPlaceholderFileToPackage)' == 'true')"> + <When Condition="'$(AddXamarinPlaceholderFilesToPackage)' == 'true' or '$(AddNETFrameworkPlaceholderFileToPackage)' == 'true'"> <PropertyGroup> <!-- Placeholders don't need a dependency group. --> <NoWarn>$(NoWarn);NU5128</NoWarn> @@ -50,77 +54,28 @@ </When> </Choose> - <!-- 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: - - https://github.com/dotnet/runtime/issues/27470 -> Why reference assets were removed from the package - - https://github.com/dotnet/aspnetcore/issues/11206 -> Why ASP.NET required a ref to be added back for netcoreapp - - https://github.com/dotnet/runtime/issues/29966 -> Issue tracking to work of readding a ref to netcoreapp --> - <Target Name="RemoveExcludeCompileFromPackageDependencies" Condition="'$(RemoveExcludeCompileFromPackageDependencies)' == 'true'" DependsOnTargets="GetPackageDependencies" BeforeTargets="ValidateExcludeCompileDesktop"> + <!-- TODO: Remove this target when no library relies on the intellisense documentation file anymore.--> + <Target Name="ChangeDocumentationFileForPackaging" + AfterTargets="DocumentationProjectOutputGroup" + Condition="'$(ExcludeFromPackage)' != 'true' and + '$(UseIntellisenseDocumentationFile)' == 'true'"> <ItemGroup> - <Dependency> - <Exclude></Exclude> - </Dependency> - </ItemGroup> - </Target> - - <Target Name="ValidateExcludeCompileDesktop" - AfterTargets="GetPackageDependencies" - Inputs="%(Dependency.Identity);%(Dependency.TargetFramework)" - Outputs="unused" - Condition="'$(SkipValidatePackage)' != 'true'"> - <PropertyGroup> - <_excludeCompile Condition="@(Dependency->WithMetadataValue('Exclude', 'Compile')->Count()) == @(Dependency->Count())">true</_excludeCompile> - </PropertyGroup> - <Error Text="Cannot have Exclude=Compile dependencies when targeting a desktop TFM. @(Dependency). You can exclude the reference asset in the package by setting the ExcludeReferenceAssets property to true in your project." - Condition="$([System.String]::Copy('%(Dependency.TargetFramework)').StartsWith('net4')) and - '$(_excludeCompile)' == 'true' and - '%(Dependency.Identity)' != '_._'" /> - </Target> - - <!-- Point to the custom pack target which invokes the pkgproj from a source csproj. --> - <Target Name="_OverridePackDependsOnForCsProjToPkgProj" - Condition="'$(GeneratePackage)' == 'true' and - '$(IsSourceProject)' == 'true' and - Exists('$(PkgProjPath)')"> - <PropertyGroup> - <IsPackable>true</IsPackable> - <PackDependsOn>_BuildPkgProj</PackDependsOn> - </PropertyGroup> - </Target> - - <Target Name="_BuildPkgProj"> - <MSBuild Projects="$(PkgProjPath)" - Targets="Build" /> - </Target> - - <Target Name="AddDocumentationFileToPackage" - Condition="'$(ExcludeFromPackage)' != 'true'"> - <PropertyGroup> - <!-- Search for the documentation file in the intellisense package and otherwise pick up the generated one. --> - <_documentationFileToPackage Condition="Exists('$(XmlDocFileRoot)1033\$(TargetName).xml')">$(XmlDocFileRoot)1033\$(TargetName).xml</_documentationFileToPackage> - <_documentationFileToPackage Condition="'$(_documentationFileToPackage)' == '' and Exists('$(DocumentationFile)')">$(DocumentationFile)</_documentationFileToPackage> - </PropertyGroup> - <ItemGroup Condition="'$(_documentationFileToPackage)' != ''"> - <!-- Place the documentation file into the lib or runtimes/lib folder depending on if the build is runtime agnostic or specific. --> - <TfmSpecificPackageFile Include="$(_documentationFileToPackage)" - PackagePath="$([MSBuild]::ValueOrDefault('$(BuildOutputTargetFolder)', 'lib'))/$(TargetFrameworkWithoutSuffix)" - Condition="'$(TargetsAnyOS)' == 'true'" /> - <TfmRuntimeSpecificPackageFile Include="$(_documentationFileToPackage)" - Condition="'$(TargetsAnyOS)' != 'true'" /> + <DocumentationProjectOutputGroupOutput Remove="@(DocumentationProjectOutputGroupOutput)" /> + <DocumentationProjectOutputGroupOutput Include="$(LibIntellisenseDocumentationFilePath)" /> </ItemGroup> </Target> <Target Name="AddRuntimeSpecificFilesToPackage" DependsOnTargets="BuiltProjectOutputGroup; + DocumentationProjectOutputGroup; SatelliteDllsProjectOutputGroup; - $(TargetsForTfmSpecificBuildOutput); - AddDocumentationFileToPackage" + $(TargetsForTfmSpecificBuildOutput)" Condition="'$(ExcludeFromPackage)' != 'true' and '$(TargetsAnyOS)' != 'true'"> <ItemGroup> - <TfmRuntimeSpecificPackageFile Include="@(BuiltProjectOutputGroupOutput); - @(SatelliteDllsProjectOutputGroupOutput)" /> + <TfmRuntimeSpecificPackageFile Include="@(SatelliteDllsProjectOutputGroupOutput); + @(BuiltProjectOutputGroupOutput); + @(DocumentationProjectOutputGroupOutput)" /> <TfmSpecificPackageFile Include="@(TfmRuntimeSpecificPackageFile)" PackagePath="runtimes/$(PackageTargetRuntime)/lib/$(TargetFrameworkWithoutSuffix)" /> <!-- Copy runtime specific assemblies into the rid agnostic 'lib' folder if the ridless tfm doesn't exist on .NETFramework. @@ -172,19 +127,4 @@ </ItemGroup> </Target> - <Target Name="GetAnalyzerPackFiles" - DependsOnTargets="$(GenerateNuspecDependsOn)" - Returns="@(_AnalyzerPackFile)"> - <PropertyGroup> - <_analyzerPath>analyzers/dotnet</_analyzerPath> - <_analyzerPath Condition="'$(AnalyzerLanguage)' != ''">$(_analyzerPath)/$(AnalyzerLanguage)</_analyzerPath> - </PropertyGroup> - <ItemGroup> - <_AnalyzerPackFile Include="@(_BuildOutputInPackage)" IsSymbol="false" /> - <_AnalyzerPackFile Include="@(_TargetPathsToSymbols)" IsSymbol="true" /> - <_AnalyzerPackFile PackagePath="$(_analyzerPath)/%(TargetPath)" /> - </ItemGroup> - <Error Condition="'%(_AnalyzerPackFile.TargetFramework)' != 'netstandard2.0'" - Text="Analyzers must only target netstandard2.0 since they run in the compiler which targets netstandard2.0. The following files were found to target '%(_AnalyzerPackFile.TargetFramework)': @(_AnalyzerPackFile)" /> - </Target> </Project> |