536cd135cc
Former-commit-id: 5624ac747d633e885131e8349322922b6a59baaa
170 lines
8.4 KiB
XML
170 lines
8.4 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
|
|
|
<ItemGroup>
|
|
<TestPackages Condition="'$(TestPackages)' != ''" Include="$(TestPackages)" />
|
|
<PackageReports Condition="'@(TestPackages)' == ''" Include="$(PackageReportDir)*.json" />
|
|
<PackageReports Condition="'@(TestPackages)' != ''" Include="@(TestPackages->'$(PackageReportDir)%(Identity).json')" />
|
|
|
|
<!-- support override via commandline -->
|
|
<RuntimesToInclude Condition="'$(RuntimesToInclude)' != ''" Include="$(RuntimesToInclude)" />
|
|
<TargetFrameworksToInclude Condition="'$(TargetFrameworksToInclude)' != ''" Include="$(TargetFrameworksToInclude)" />
|
|
|
|
<!-- restrict restore sources to the current build and publicly shipped packages -->
|
|
<RestoreSource Include="$(PackageOutputPath)" />
|
|
<RestoreSource Include="https:%2F%2Fapi.nuget.org/v3/index.json" />
|
|
|
|
<!-- needed for SQLClient's SNI packages -->
|
|
<RestoreSource Include="https:%2F%2Fdotnet.myget.org/F/dotnet-core/api/v3/index.json" />
|
|
|
|
<!-- we don't build alpine or older OSX versions -->
|
|
<RuntimesToExclude Include="alpine.3.4.3-x64;osx.10.10-x64;osx.10.11-x64" />
|
|
|
|
<!-- no targeting pack was ever shipped for net463 -->
|
|
<TargetFrameworksToExclude Include="net463" />
|
|
<TargetFrameworksToExclude Include="net47" />
|
|
</ItemGroup>
|
|
|
|
<PropertyGroup>
|
|
<TestDir>$(PackageOutputPath)test/</TestDir>
|
|
<TestProjectName>test.msbuild</TestProjectName>
|
|
<TestProject>$(TestDir)$(TestProjectName)</TestProject>
|
|
<TestToolsDir>$(TestDir)tools/</TestToolsDir>
|
|
<TestProjectDir>$(TestDir)projects/</TestProjectDir>
|
|
<TestPackageDir>$(BinDir)testPackages</TestPackageDir>
|
|
<TestDotNetPath>$(TestToolsDir)/dotnet</TestDotNetPath>
|
|
|
|
<ProjectTemplate>project.csproj.template</ProjectTemplate>
|
|
|
|
<TestRestoreCommand>$(TestDotNetPath)</TestRestoreCommand>
|
|
<TestRestoreCommand>$(TestRestoreCommand) restore</TestRestoreCommand>
|
|
<TestRestoreCommand>$(TestRestoreCommand) @(RestoreSource->'-s %(Identity)', ' ')</TestRestoreCommand>
|
|
<TestRestoreCommand>$(TestRestoreCommand) --packages "$(TestPackageDir)"</TestRestoreCommand>
|
|
<TestRestoreCommand Condition="'$(TestPackages)' != ''">$(TestRestoreCommand) /p:TestPackages=$(TestPackages)</TestRestoreCommand>
|
|
|
|
<TestBuildCommand>$(TestDotNetPath)</TestBuildCommand>
|
|
<TestBuildCommand>$(TestBuildCommand) msbuild</TestBuildCommand>
|
|
<TestBuildCommand>$(TestBuildCommand) /t:Test</TestBuildCommand>
|
|
<TestBuildCommand Condition="'$(TestPackages)' != ''">$(TestBuildCommand) /p:TestPackages=$(TestPackages)</TestBuildCommand>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup>
|
|
<TestSupportFiles Include="$(DotnetCliPath)\**\*.*">
|
|
<DestinationFolder>$(TestToolsDir)%(RecursiveDir)</DestinationFolder>
|
|
</TestSupportFiles>
|
|
<TestSupportFiles Include="$(SourceDir)shims\netfxreference.props">
|
|
<DestinationFolder>$(TestToolsDir)</DestinationFolder>
|
|
</TestSupportFiles>
|
|
<TestSupportFiles Include="$(ToolsDir)Packaging.common.targets">
|
|
<DestinationFolder>$(TestToolsDir)</DestinationFolder>
|
|
</TestSupportFiles>
|
|
<TestSupportFiles Include="$(ToolsDir)Microsoft.DotNet.Build.Tasks.Packaging.dll">
|
|
<DestinationFolder>$(TestToolsDir)</DestinationFolder>
|
|
</TestSupportFiles>
|
|
<TestSupportFiles Include="$(ToolsDir)Newtonsoft.Json.dll">
|
|
<DestinationFolder>$(TestToolsDir)</DestinationFolder>
|
|
</TestSupportFiles>
|
|
<TestSupportFiles Include="$(ToolsDir)NuGet.*.dll">
|
|
<DestinationFolder>$(TestToolsDir)</DestinationFolder>
|
|
</TestSupportFiles>
|
|
<TestSupportFiles Include="**\*.targets">
|
|
<DestinationFolder>$(TestDir)%(RecursiveDir)</DestinationFolder>
|
|
</TestSupportFiles>
|
|
<TestSupportFiles Include="$(TestProjectName)">
|
|
<DestinationFolder>$(TestDir)</DestinationFolder>
|
|
</TestSupportFiles>
|
|
</ItemGroup>
|
|
|
|
<Target Name="CreateTestDir"
|
|
Inputs="@(TestSupportFiles)"
|
|
Outputs="@(TestSupportFiles->'%(DestinationFolder)\%(FileName)%(Extension)')">
|
|
<MakeDir Directories="%(TestSupportFiles.DestinationFolder)" />
|
|
<Copy SourceFiles="@(TestSupportFiles)" DestinationFolder="%(TestSupportFiles.DestinationFolder)" />
|
|
</Target>
|
|
|
|
<Target Name="GetSupportedPackages">
|
|
<GetSupportedPackagesFromPackageReports PackageReports="@(PackageReports)">
|
|
<Output TaskParameter="SupportedPackages" ItemName="SupportedPackage"/>
|
|
</GetSupportedPackagesFromPackageReports>
|
|
|
|
<ItemGroup>
|
|
<SupportedPackage>
|
|
<ProjectDir>$(TestProjectDir)%(Identity)/%(TargetFrameworkShort)/</ProjectDir>
|
|
</SupportedPackage>
|
|
<SupportedPackage>
|
|
<ProjectFile>%(ProjectDir)project.csproj</ProjectFile>
|
|
<AssetsFile>%(ProjectDir)obj/project.assets.json</AssetsFile>
|
|
</SupportedPackage>
|
|
</ItemGroup>
|
|
</Target>
|
|
|
|
<Target Name="UpdateTargetFrameworks" AfterTargets="GetSupportedPackages">
|
|
<ItemGroup>
|
|
<_supportedPackageByTargetFramework Include="@(SupportedPackage->'%(TargetFrameworkShort)')">
|
|
<Original>%(Identity)</Original>
|
|
</_supportedPackageByTargetFramework>
|
|
|
|
<_supportedPackageByTargetFrameworkToRemove Include="@(_supportedPackageByTargetFramework)" Exclude="@(TargetFrameworksToInclude)" Condition="'@(TargetFrameworksToInclude)' != ''" />
|
|
<_filteredSupportedPackageByTargetFramework Include="@(_supportedPackageByTargetFramework)" Exclude="@(TargetFrameworksToExclude);@(_supportedPackageByTargetFrameworkToRemove)" />
|
|
|
|
<SupportedPackage Remove="@(SupportedPackage)" />
|
|
<SupportedPackage Include="@(_filteredSupportedPackageByTargetFramework->'%(Original)')" />
|
|
</ItemGroup>
|
|
</Target>
|
|
|
|
<Target Name="UpdateRuntimeIdentifiers"
|
|
AfterTargets="GetSupportedPackages"
|
|
Inputs="%(SupportedPackage.Identity);%(SupportedPackage.TargetFrameworkShort)"
|
|
Outputs="unused">
|
|
<ItemGroup>
|
|
<_supportedPackageRuntimes Remove="@(_supportedPackageRuntimes)" />
|
|
<_supportedPackageRuntimes Include="%(SupportedPackage.RuntimeIdentifiers)" />
|
|
|
|
<_supportedPackageRuntimesToRemove Include="@(_supportedPackageRuntimes)" Exclude="@(RuntimesToInclude)" Condition="'@(RuntimesToInclude)' != ''" />
|
|
<_filteredSupportedPackageRuntimes Include="@(_supportedPackageRuntimes)" Exclude="@(RuntimesToExclude);@(_supportedPackageRuntimesToRemove)" />
|
|
|
|
<SupportedPackage>
|
|
<RuntimeIdentifiers>@(_filteredSupportedPackageRuntimes)</RuntimeIdentifiers>
|
|
</SupportedPackage>
|
|
</ItemGroup>
|
|
</Target>
|
|
|
|
<Target Name="GenerateProjects"
|
|
DependsOnTargets="GetSupportedPackages;CreateTestDir"
|
|
Inputs="@(PackageReports);$(ProjectTemplate)"
|
|
Outputs="%(SupportedPackage.ProjectFile)">
|
|
<PropertyGroup>
|
|
<_projectDir>%(SupportedPackage.ProjectDir)/</_projectDir>
|
|
<_projectFile>%(SupportedPackage.ProjectFile)</_projectFile>
|
|
<_packageId>%(SupportedPackage.Identity)</_packageId>
|
|
<_packageVersion>%(SupportedPackage.Version)</_packageVersion>
|
|
<_projectTFM>%(SupportedPackage.TargetFrameworkShort)</_projectTFM>
|
|
<_projectRIDs>%(SupportedPackage.RuntimeIdentifiers)</_projectRIDs>
|
|
</PropertyGroup>
|
|
|
|
<MakeDir Directories="$(_projectDir)" />
|
|
<!-- Update project.json template -->
|
|
<WriteLinesToFile
|
|
File="$(_projectFile)"
|
|
Lines="$([System.IO.File]::ReadAllText('$(ProjectTemplate)').Replace('{PackageId}', $(_packageId)).Replace('{PackageVersion}', $(_packageVersion)).Replace('{TFM}', $(_projectTFM)).Replace('{RIDs}', '$(_projectRIDs)'))"
|
|
Overwrite="true" />
|
|
<Message Text="Generated $(_projectFile)" />
|
|
</Target>
|
|
|
|
<Target Name="RestoreProjects"
|
|
DependsOnTargets="GenerateProjects">
|
|
<Message Importance="High" Text="*** Restoring ***" />
|
|
<Exec Command="$(TestRestoreCommand) "$(TestProject)"" StandardOutputImportance="High" />
|
|
</Target>
|
|
|
|
<Target Name="BuildProjects"
|
|
DependsOnTargets="RestoreProjects">
|
|
<Message Importance="High" Text="*** Testing ***" />
|
|
<Exec Command="$(TestBuildCommand) "$(TestProject)" /p:TestPackages=%(SupportedPackage.Identity)" StandardOutputImportance="High" />
|
|
</Target>
|
|
|
|
<Target Name="Build" DependsOnTargets="BuildProjects" />
|
|
|
|
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
|
</Project> |