Support new artifacts layout in tests and other build logic
This commit is contained in:
parent
ae0aa8ed24
commit
13da213183
37 changed files with 67 additions and 82 deletions
|
@ -6,6 +6,7 @@
|
|||
<OutputType>Exe</OutputType>
|
||||
<AssetTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">$(AssetTargetFallback);portable-net45+win8;dnxcore50</AssetTargetFallback>
|
||||
<RuntimeIdentifiers>win7-x64;win7-x86;osx.10.10-x64;osx.10.11-x64;ubuntu.14.04-x64;ubuntu.16.04-x64;ubuntu.16.10-x64;centos.7-x64;rhel.7.2-x64;debian.8-x64;fedora.24-x64;opensuse.42.1-x64</RuntimeIdentifiers>
|
||||
<RestoreAdditionalProjectSources Condition="'$(TEST_PACKAGES)' != ''">$(TEST_PACKAGES)</RestoreAdditionalProjectSources>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="test-packages" value="../../../artifacts/testpackages" />
|
||||
</packageSources>
|
||||
</configuration>
|
|
@ -3,6 +3,7 @@
|
|||
<TargetFrameworks>netstandard1.6;net451</TargetFrameworks>
|
||||
<OutputType>Library</OutputType>
|
||||
<AssetTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(AssetTargetFallback);portable-net45+win8;dnxcore50;netcoreapp2.1</AssetTargetFallback>
|
||||
<RestoreAdditionalProjectSources Condition="'$(TEST_PACKAGES)' != ''">$(TEST_PACKAGES)</RestoreAdditionalProjectSources>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="test-packages" value="../../../artifacts/testpackages" />
|
||||
</packageSources>
|
||||
</configuration>
|
3
TestAssets/Directory.Build.props
Normal file
3
TestAssets/Directory.Build.props
Normal file
|
@ -0,0 +1,3 @@
|
|||
<Project>
|
||||
<!-- Empty Directory.Build.props file to prevent test asset projects from picking up the repo's Directory.Build.props' -->
|
||||
</Project>
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="testpackages" value="../../artifacts/testpackages/packages" />
|
||||
</packageSources>
|
||||
</configuration>
|
|
@ -4,6 +4,7 @@
|
|||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp1.1</TargetFramework>
|
||||
<RestoreAdditionalProjectSources Condition="'$(TEST_PACKAGES)' != ''">$(TEST_PACKAGES)</RestoreAdditionalProjectSources>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="test-packages" value="../../../artifacts/testpackages" />
|
||||
</packageSources>
|
||||
</configuration>
|
|
@ -4,6 +4,7 @@
|
|||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RestoreAdditionalProjectSources Condition="'$(TEST_PACKAGES)' != ''">$(TEST_PACKAGES)</RestoreAdditionalProjectSources>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
|
||||
<clear />
|
||||
<add key="test-packages" value="../../../artifacts/testpackages" />
|
||||
</packageSources>
|
||||
</configuration>
|
|
@ -4,6 +4,7 @@
|
|||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RestoreAdditionalProjectSources Condition="'$(TEST_PACKAGES)' != ''">$(TEST_PACKAGES)</RestoreAdditionalProjectSources>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="test-packages" value="../../../artifacts/testpackages" />
|
||||
</packageSources>
|
||||
</configuration>
|
|
@ -8,6 +8,7 @@
|
|||
<OutputType>Exe</OutputType>
|
||||
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
|
||||
<AssetTargetFallback>$(AssetTargetFallback);dnxcore50;portable-net45+win8</AssetTargetFallback>
|
||||
<RestoreAdditionalProjectSources Condition="'$(TEST_PACKAGES)' != ''">$(TEST_PACKAGES)</RestoreAdditionalProjectSources>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="test-packages" value="../../../artifacts/testpackages" />
|
||||
</packageSources>
|
||||
</configuration>
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="test-packages" value="../../../artifacts/testpackages" />
|
||||
</packageSources>
|
||||
</configuration>
|
|
@ -4,6 +4,7 @@
|
|||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<RestoreAdditionalProjectSources Condition="'$(TEST_PACKAGES)' != ''">$(TEST_PACKAGES)</RestoreAdditionalProjectSources>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="BuildTheWholeCli" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<Import Project="Directory.Build.props" />
|
||||
|
||||
<ItemGroup>
|
||||
<DotnetCliBuildFrameworkInputs Include="build_projects/**/*.cs" Exclude="build_projects/**/obj/**/*.cs" />
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<Project ToolsVersion="15.0" DefaultTargets="CopyTemplateToOutput">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.tasks))\dir.tasks" />
|
||||
|
||||
<Target Name="CopyTemplateToOutput"
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<!-- Will this still work now that the stage has been added to the path? -->
|
||||
<AspNetRuntimePackageStorePublishDirectory>$(BaseOutputDirectory)/AspRT</AspNetRuntimePackageStorePublishDirectory>
|
||||
<BackwardsCompatibleSharedFrameworksPublishDirectory>$(IntermediateDirectory)/backwardsCompatibleSharedFrameworksPublish</BackwardsCompatibleSharedFrameworksPublishDirectory>
|
||||
<TestOutputDir>$(BaseOutputDirectory)/testpackages/</TestOutputDir>
|
||||
<TestOutputDir>$(BaseOutputDirectory)/test/</TestOutputDir>
|
||||
<DotnetInOutputDirectory>$(OutputDirectory)/dotnet$(ExeExtension)</DotnetInOutputDirectory>
|
||||
<GeneratedMSBuildExtensionsDirectory>$(IntermediateDirectory)/GeneratedMSBuildExtensions</GeneratedMSBuildExtensionsDirectory>
|
||||
<MSBuildExtensionsLayoutDirectory>$(IntermediateDirectory)/MSBuildExtensionsLayout</MSBuildExtensionsLayoutDirectory>
|
||||
|
|
|
@ -12,24 +12,20 @@
|
|||
<TestResultXmlDir>$(TestOutputDir)/results/</TestResultXmlDir>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<TestTaskEnvironmentVariables Include="TEST_ARTIFACTS=$(TestArtifactsDir)" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<RunTestEnvironmentVariables>@(TestTaskEnvironmentVariables)</RunTestEnvironmentVariables>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="Test"
|
||||
Condition=" '$(CLIBUILD_SKIP_TESTS)' != 'true' "
|
||||
DependsOnTargets="TestsForBuildItself;BuildTests;">
|
||||
|
||||
<!-- Make ure the test packages directory exists so that it's not an error to have it as a package source -->
|
||||
<MakeDir Directories="$(TestPackagesDir)" />
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectsToTest Include="build/test/RunTest.proj">
|
||||
<Properties>
|
||||
CLIBuildDll=$(CLIBuildDll);
|
||||
Configuration=$(Configuration);
|
||||
EnvironmentVariables=$(RunTestEnvironmentVariables);
|
||||
TestArtifactsDir=$(TestArtifactsDir);
|
||||
TestPackagesDir=$(TestPackagesDir);
|
||||
TestProject=%(TestProjects.Identity);
|
||||
TestResultXmlDir=$(TestResultXmlDir);
|
||||
ToolPath=$(OutputDirectory);
|
||||
|
@ -74,14 +70,16 @@
|
|||
|
||||
<DotNetRestore ToolPath="$(OutputDirectory)"
|
||||
WorkingDirectory="$([System.IO.Directory]::GetParent('%(TestPackageProject.ProjectPath)'))"
|
||||
ProjectPath="%(TestPackageProject.ProjectPath)" />
|
||||
ProjectPath="%(TestPackageProject.ProjectPath)"
|
||||
AdditionalParameters="/p:RestoreAdditionalProjectSources=$(TestOutputDir)/packages"
|
||||
/>
|
||||
|
||||
<!-- https://github.com/NuGet/Home/issues/4063 -->
|
||||
<DotNetPack Output="$(TestPackagesDir)"
|
||||
ProjectPath="%(TestPackageProject.ProjectPath)"
|
||||
ToolPath="$(OutputDirectory)"
|
||||
VersionSuffix="%(TestPackageProject.VersionSuffix)"
|
||||
MsbuildArgs="%(TestPackageProject.MsbuildArgs) /p:SdkNuGetVersion=$(SdkNugetVersion)" />
|
||||
MsbuildArgs="%(TestPackageProject.MsbuildArgs) /p:SdkNuGetVersion=$(SdkNugetVersion) /p:RestoreAdditionalProjectSources=$(TestOutputDir)/packages" />
|
||||
|
||||
</Target>
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?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" />
|
||||
|
||||
<PropertyGroup>
|
||||
<CloudTestTasksPath>$(BuildToolsTaskDesktopDir)Microsoft.DotNet.Build.CloudTestTasks.dll</CloudTestTasksPath>
|
||||
|
|
|
@ -11,7 +11,12 @@
|
|||
<UsingTask TaskName="DotNetTest" AssemblyFile="$(CLIBuildDllPath)" />
|
||||
|
||||
<Target Name="RunTest">
|
||||
<DotNetTest EnvironmentVariables="$(EnvironmentVariables)"
|
||||
<ItemGroup>
|
||||
<EnvironmentVariables Include="TEST_ARTIFACTS=$(TestArtifactsDir)" />
|
||||
<EnvironmentVariables Include="TEST_PACKAGES=$(TestPackagesDir)" />
|
||||
</ItemGroup>
|
||||
|
||||
<DotNetTest EnvironmentVariables="@(EnvironmentVariables)"
|
||||
ToolPath="$(ToolPath)"
|
||||
Configuration="$(Configuration)"
|
||||
NoBuild="True"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<Project DefaultTargets="RunValidation">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<Import Project="$(RepoRoot)/build/Microsoft.DotNet.Cli.tasks" />
|
||||
|
||||
<Target Name="RunValidation">
|
||||
|
|
4
dir.props
Normal file
4
dir.props
Normal file
|
@ -0,0 +1,4 @@
|
|||
<Project>
|
||||
<!-- Projects which don't import the common targets can import this dir.props file in order to get the common repo build logic -->
|
||||
<Import Project="Directory.Build.props" />
|
||||
</Project>
|
|
@ -1,5 +1,5 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.tasks" />
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.tasks))\dir.tasks" />
|
||||
<Import Project="$(RepoRoot)/build/compile/LzmaArchive.targets" />
|
||||
<Import Project="$(RepoRoot)/build/MSBuildExtensions.targets" />
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.tasks" />
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.tasks))\dir.tasks" />
|
||||
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>$(CliVersionPrefix)</VersionPrefix>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.tasks" />
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.tasks))\dir.tasks" />
|
||||
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>$(CliVersionPrefix)</VersionPrefix>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<Target Name="PrecompileScript"
|
||||
BeforeTargets="Build"
|
||||
Condition=" '$(IsCrossTargetingBuild)' != 'true' And '$(OS)' == 'Windows_NT'">
|
||||
<Exec Command="$(DotnetInOutputDirectory) publish ../ArgumentsReflector/ArgumentsReflector.csproj --output $(MSBuildThisFileDirectory)/$(OutputPath)" />
|
||||
<Exec Command="$(DotnetInOutputDirectory) publish ../ArgumentsReflector/ArgumentsReflector.csproj --output $(OutputPath)" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\dir.props" />
|
||||
<Import Project="..\Directory.Build.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<DisableImplicitFrameworkReferences>false</DisableImplicitFrameworkReferences>
|
|
@ -238,6 +238,9 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
psi.Environment[item.Key] = item.Value;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Flow the TEST_PACKAGES environment variable to the child process
|
||||
psi.Environment["TEST_PACKAGES"] = System.Environment.GetEnvironmentVariable("TEST_PACKAGES");
|
||||
}
|
||||
|
||||
private void AddWorkingDirectoryTo(ProcessStartInfo psi)
|
||||
|
|
|
@ -99,17 +99,22 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
string corehostDummyPackages = null,
|
||||
string pjDotnet = null)
|
||||
{
|
||||
_artifacts = artifacts ?? Path.Combine(RepoRoot, "artifacts", BuildRid);
|
||||
_artifacts = artifacts ?? Path.Combine(RepoRoot, "artifacts", "stage2", BuildRid);
|
||||
_builtDotnet = builtDotnet ?? Path.Combine(_artifacts, "intermediate", "sharedFrameworkPublish");
|
||||
_nugetPackages = nugetPackages ?? Path.Combine(RepoRoot, ".nuget", "packages");
|
||||
_pjDotnet = pjDotnet ?? GetPjDotnetPath();
|
||||
_stage2Sdk = Directory
|
||||
.EnumerateDirectories(Path.Combine(_artifacts, "stage2", "sdk"))
|
||||
.EnumerateDirectories(Path.Combine(_artifacts, "dotnet", "sdk"))
|
||||
.First(d => !d.Contains("NuGetFallbackFolder"));
|
||||
|
||||
_stage2WithBackwardsCompatibleRuntimesDirectory =
|
||||
Path.Combine(_artifacts, "stage2WithBackwardsCompatibleRuntimes");
|
||||
_testPackages = Path.Combine(RepoRoot, "artifacts", "testpackages", "packages");
|
||||
Path.Combine(_artifacts, "dotnetWithBackwardsCompatibleRuntimes");
|
||||
|
||||
_testPackages = Environment.GetEnvironmentVariable("TEST_PACKAGES");
|
||||
if (string.IsNullOrEmpty(_testPackages))
|
||||
{
|
||||
throw new InvalidOperationException("TEST_PACKAGES environment variable not set");
|
||||
}
|
||||
}
|
||||
|
||||
private string GetPjDotnetPath()
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="test-packages" value="../../artifacts/testpackages" />
|
||||
</packageSources>
|
||||
</configuration>
|
|
@ -6,6 +6,7 @@
|
|||
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
|
||||
<AssemblyName>binding-redirects.Tests</AssemblyName>
|
||||
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4;portable-net451+win8</AssetTargetFallback>
|
||||
<RestoreAdditionalProjectSources>$(TestOutputDir)/packages</RestoreAdditionalProjectSources>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -51,8 +51,12 @@ namespace Microsoft.DotNet.New.Tests
|
|||
|
||||
if (useNuGetConfigForAspNet)
|
||||
{
|
||||
var configFile = new FileInfo(Path.Combine(rootPath, "..", "..", "..", "..", "..", "NuGet.tempaspnetpatch.config"));
|
||||
File.Copy(configFile.FullName, Path.Combine(rootPath, "NuGet.Config"));
|
||||
string resourceName = "dotnet-new.Tests.NuGet.tempaspnetpatch.config";
|
||||
using (Stream input = typeof(GivenThatIWantANewAppWithSpecifiedType).Assembly.GetManifestResourceStream(resourceName))
|
||||
using (Stream output = File.OpenWrite(Path.Combine(rootPath, "NuGet.Config")))
|
||||
{
|
||||
input.CopyTo(output);
|
||||
}
|
||||
}
|
||||
|
||||
if (skipSpaWebpackSteps)
|
||||
|
|
|
@ -7,6 +7,11 @@
|
|||
<AssetTargetFallback>$(AssetTargetFallback);dnxcore50;portable-net45+win8</AssetTargetFallback>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="NuGet.tempaspnetpatch.config" />
|
||||
<EmbeddedResource Include="NuGet.tempaspnetpatch.config" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Microsoft.DotNet.Tools.Tests.Utilities\Microsoft.DotNet.Tools.Tests.Utilities.csproj" />
|
||||
<ProjectReference Include="..\..\src\dotnet\dotnet.csproj" />
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
</Content>
|
||||
<Content Include="..\..\artifacts\*\stage2\sdk\*\.version">
|
||||
<Content Include="$(SdkOutputDirectory)\.version">
|
||||
<Link>.version</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="build/DependencyVersions.props" />
|
||||
<PropertyGroup>
|
||||
<RestoreAdditionalProjectSources Condition="'$(TEST_PACKAGES)' != ''">$(TEST_PACKAGES)</RestoreAdditionalProjectSources>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
Loading…
Reference in a new issue