Skip to content

Commit

Permalink
Support new artifacts layout in tests and other build logic
Browse files Browse the repository at this point in the history
  • Loading branch information
dsplaisted committed Aug 24, 2017
1 parent ae0aa8e commit 13da213
Show file tree
Hide file tree
Showing 37 changed files with 67 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

This file was deleted.

3 changes: 3 additions & 0 deletions TestAssets/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -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>
6 changes: 0 additions & 6 deletions TestAssets/TestPackages/NuGet.Config

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
<RestoreAdditionalProjectSources Condition="'$(TEST_PACKAGES)' != ''">$(TEST_PACKAGES)</RestoreAdditionalProjectSources>
</PropertyGroup>

<ItemGroup>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<OutputType>Exe</OutputType>
<RestoreAdditionalProjectSources Condition="'$(TEST_PACKAGES)' != ''">$(TEST_PACKAGES)</RestoreAdditionalProjectSources>
</PropertyGroup>

<ItemGroup>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<OutputType>Exe</OutputType>
<RestoreAdditionalProjectSources Condition="'$(TEST_PACKAGES)' != ''">$(TEST_PACKAGES)</RestoreAdditionalProjectSources>
</PropertyGroup>

<ItemGroup>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

This file was deleted.

6 changes: 0 additions & 6 deletions TestAssets/TestProjects/TestAppWithProjDepTool/NuGet.Config

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<RestoreAdditionalProjectSources Condition="'$(TEST_PACKAGES)' != ''">$(TEST_PACKAGES)</RestoreAdditionalProjectSources>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion build.proj
Original file line number Diff line number Diff line change
@@ -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" />
Expand Down
1 change: 1 addition & 0 deletions build/BundledTemplates.proj
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion build/OutputDirectories.props
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
20 changes: 9 additions & 11 deletions build/Test.targets
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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>

Expand Down
1 change: 1 addition & 0 deletions build/buildpipeline/security/syncAzure.proj
Original file line number Diff line number Diff line change
@@ -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>
Expand Down
7 changes: 6 additions & 1 deletion build/test/RunTest.proj
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -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">
Expand Down
4 changes: 4 additions & 0 deletions dir.props
Original file line number Diff line number Diff line change
@@ -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>
2 changes: 1 addition & 1 deletion src/redist/redist.csproj
Original file line number Diff line number Diff line change
@@ -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" />

Expand Down
2 changes: 1 addition & 1 deletion src/tool_fsharp/tool_fsc.csproj
Original file line number Diff line number Diff line change
@@ -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>
Expand Down
2 changes: 1 addition & 1 deletion src/tool_roslyn/tool_roslyn.csproj
Original file line number Diff line number Diff line change
@@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
2 changes: 1 addition & 1 deletion test/dir.props → test/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ private void AddEnvironmentVariablesTo(ProcessStartInfo psi)
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,22 @@ public RepoDirectoriesProvider(
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()
Expand Down
6 changes: 0 additions & 6 deletions test/binding-redirects.Tests/NuGet.Config

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,12 @@ public void TemplateRestoresAndBuildsWithoutWarnings(

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)
Expand Down
5 changes: 5 additions & 0 deletions test/dotnet-new.Tests/dotnet-new.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down
2 changes: 1 addition & 1 deletion test/dotnet.Tests/dotnet.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 3 additions & 0 deletions testAsset.props
Original file line number Diff line number Diff line change
@@ -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>

0 comments on commit 13da213

Please sign in to comment.