Skip to content

Commit

Permalink
use packages instead of package report for packageInstallation and cl…
Browse files Browse the repository at this point in the history
…osure verification (dotnet#49315)

* use packages instead of package report for packageInstallation and closure verification

* add the package dependency

* correct the names

* excluding freebsd from testing

* Update Versions.props

* update the package versions, add support for exclude pakcages and packages to test

* update the package validation version

* Make package testing work indepent of version

* testpackages -> testpackagesPath

* fix restore or when no packages are produced

* correct the no packages produced condition

* use regex instead of major version
  • Loading branch information
Anipik authored Mar 22, 2021
1 parent 7012cd7 commit 6f73cce
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 8 deletions.
1 change: 1 addition & 0 deletions eng/Tools.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.DotNet.Build.Tasks.Packaging" Version="$(MicrosoftDotNetBuildTasksPackagingVersion)" />
<PackageReference Include="Microsoft.DotNet.PackageValidation" Version="$(MicrosoftDotNetPackageValidationVersion)" />
<!-- enable source link in pkgproj -->
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="$(MicrosoftSourceLinkVersion)" PrivateAssets="all" IsImplicitlyDefined="true" />
<PackageReference Include="Microsoft.SourceLink.AzureRepos.Git" Version="$(MicrosoftSourceLinkVersion)" PrivateAssets="all" IsImplicitlyDefined="true" />
Expand Down
4 changes: 4 additions & 0 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -206,5 +206,9 @@
<Uri>https://github.com/dotnet/xharness</Uri>
<Sha>dfce3c1b43968f7e172b9a2ead777999ea0a94b2</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.PackageValidation" Version="6.0.0-beta.21167.3">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>0ca849f0b71866b007fedaaa938cee63f8d056a6</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
1 change: 1 addition & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
<MicrosoftDotNetBuildTasksInstallersVersion>6.0.0-beta.21167.3</MicrosoftDotNetBuildTasksInstallersVersion>
<MicrosoftDotNetRemoteExecutorVersion>6.0.0-beta.21167.3</MicrosoftDotNetRemoteExecutorVersion>
<MicrosoftDotNetVersionToolsTasksVersion>6.0.0-beta.21167.3</MicrosoftDotNetVersionToolsTasksVersion>
<MicrosoftDotNetPackageValidationVersion>6.0.0-beta.21167.3</MicrosoftDotNetPackageValidationVersion>
<!-- NuGet dependencies -->
<NuGetBuildTasksPackVersion>5.9.0-preview.2</NuGetBuildTasksPackVersion>
<!-- Installer dependencies -->
Expand Down
30 changes: 22 additions & 8 deletions src/libraries/pkg/test/testPackages.proj
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
<Project DefaultTargets="Build">
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props))" />

<PropertyGroup>
<PackageNamePattern>[a-zA-z\.]*\.</PackageNamePattern>
</PropertyGroup>

<ItemGroup>
<PackagesToTest Condition="'$(PackagesToTest)' != ''" Include="$(PackagesToTest)" />
<!-- transport package not expected to be closure complete -->
<ExcludePackages Include="Microsoft.AspNetCore.Internal.Transport" />
<ExcludePackages Include="$(ExcludePackages)" />

<PackageReports Condition="'@(PackagesToTest)' == ''" Include="$(PackageReportDir)*.json" Exclude="@(ExcludePackages->'$(PackageReportDir)%(Identity).json')"/>
<PackageReports Condition="'@(PackagesToTest)' != ''" Include="@(PackagesToTest->'$(PackageReportDir)%(Identity).json')" />

<!-- support override via commandline -->
<RuntimesToInclude Condition="'$(RuntimesToInclude)' != ''" Include="$(RuntimesToInclude)" />
<TargetFrameworksToInclude Condition="'$(TargetFrameworksToInclude)' != ''" Include="$(TargetFrameworksToInclude)" />
<SymbolsPackages Include="$(LibrariesAllConfigShippingPackagesDir)*.symbols.nupkg" />

<AllPackagesFilePath Include="$(LibrariesAllConfigShippingPackagesDir)*.nupkg" Exclude="@(SymbolsPackages)" Condition="Exists('$(LibrariesAllConfigShippingPackagesDir)')">
<PackageName>$([System.String]::new($([System.Text.RegularExpressions.Regex]::Match($([System.IO.Path]::GetFileNameWithoutExtension('%(Identity)')), $(PackageNamePattern)))).TrimEnd('.'))</PackageName>
<PackagePath>%(Identity)</PackagePath>
</AllPackagesFilePath>
<AllPackages Include="@(AllPackagesFilePath->'%(PackageName)')" />

<ExcludePackages Condition="'$(PackagesToTest)' != ''" Include="@(AllPackages)" Exclude="@(PackagesToTest)" />
<TestPackages Include="@(AllPackages)" Exclude="@(ExcludePackages)"/>
<TestPackagesPath Include="@(TestPackages->'%(PackagePath)')" />

<!-- we don't build alpine or older OSX versions -->
<RuntimesToExclude Include="alpine.3.4.3-x64;osx.10.10-x64;osx.10.11-x64" />
<RuntimesToExclude Include="alpine.3.4.3-x64;osx.10.10-x64;osx.10.11-x64;freebsd-x64" />

<!-- no targeting pack was ever shipped for net463 -->
<TargetFrameworksToExclude Include="net463" />
Expand Down Expand Up @@ -70,10 +82,12 @@
<Copy SourceFiles="@(TestSupportFiles)" DestinationFolder="%(TestSupportFiles.DestinationFolder)" />
</Target>

<UsingTask TaskName="GetCompatiblePackageTargetFrameworks" AssemblyFile="$(DotNetPackageValidationAssembly)"/>

<Target Name="GetSupportedPackages">
<GetSupportedPackagesFromPackageReports PackageReports="@(PackageReports)">
<Output TaskParameter="SupportedPackages" ItemName="SupportedPackage"/>
</GetSupportedPackagesFromPackageReports>
<GetCompatiblePackageTargetFrameworks PackagePaths="@(TestPackagesPath)">
<Output TaskParameter="TestProjects" ItemName="SupportedPackage" />
</GetCompatiblePackageTargetFrameworks>

<ItemGroup>
<SupportedPackage>
Expand Down Expand Up @@ -119,7 +133,7 @@

<Target Name="GenerateProjects"
DependsOnTargets="GetSupportedPackages;CreateTestDir"
Inputs="@(PackageReports);$(ProjectTemplate)"
Inputs="@(TestPackagesPath);$(ProjectTemplate)"
Outputs="%(SupportedPackage.ProjectFile)">
<PropertyGroup>
<_projectDir>%(SupportedPackage.ProjectDir)/</_projectDir>
Expand Down

0 comments on commit 6f73cce

Please sign in to comment.