Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Move TestProjects.* to src/test. Update resolution of these files to …
Browse files Browse the repository at this point in the history
…go through RepoDirectoriesProvider instead of though a complicated dynamic discovery. (#8641)
  • Loading branch information
jkoritzinsky committed Oct 22, 2019
1 parent 57ce3c5 commit 45647dc
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/test/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
<TestContextVariable Include="MNA_VERSION=$(NETCoreAppRuntimePackageVersion)" />
<TestContextVariable Include="MNA_TFM=$(NETCoreAppFramework)" />
<TestContextVariable Include="DOTNET_SDK_PATH=$(DotNetRoot)" />
<TestContextVariable Include="TEST_PROJECTS_PROPS_TARGETS_FOLDER=$(MSBuildThisFileDirectory)" />
</ItemGroup>

<WriteLinesToFile
Expand Down
6 changes: 4 additions & 2 deletions TestProjects.props → src/test/TestProjects.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
<!--
This file is imported by the test projects from the artifacts dir or the src/tests dir. It
provides basic info needed for restore and build with the vanilla SDK.
Since this file doesn't include the Arcade SDK, we need to find the root eng folder
in a different manner than using the $(RepositoryEngineeringDir) variable.
-->

<Import Project="eng\Versions.props" />
<Import Project="src\test\Assets\TestProjects\MNADeprecationWorkaround.props" />
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory),global.json))\eng\Versions.props" />
<Import Project="Assets\TestProjects\MNADeprecationWorkaround.props" />

<PropertyGroup>
<!--
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions src/test/TestUtils/RepoDirectoriesProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class RepoDirectoriesProvider
public string BuildArchitecture { get; }
public string TargetRID { get; }
public string MicrosoftNETCoreAppVersion { get; }
public string TestProjectsMSBuildFilesFolder { get; }
public string Configuration { get; }
public string RepoRoot { get; }
public string BaseArtifactsFolder { get; }
Expand Down Expand Up @@ -57,6 +58,7 @@ public RepoDirectoriesProvider(
BuildRID = GetTestContextVariable("BUILDRID");
BuildArchitecture = GetTestContextVariable("BUILD_ARCHITECTURE");
MicrosoftNETCoreAppVersion = microsoftNETCoreAppVersion ?? GetTestContextVariable("MNA_VERSION");
TestProjectsMSBuildFilesFolder = GetTestContextVariable("TEST_PROJECTS_PROPS_TARGETS_FOLDER");

Configuration = GetTestContextVariable("BUILD_CONFIGURATION");
string osPlatformConfig = $"{BuildRID}.{Configuration}";
Expand Down
2 changes: 1 addition & 1 deletion src/test/TestUtils/TestProjectFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private void EnsureTestProjectsFileContent(string dir, string type) => EnsureFil
string.Join(
Environment.NewLine,
"<Project>",
$" <Import Project=\"$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), TestProjects.{type}))\\TestProjects.{type}\" />",
$" <Import Project=\"{RepoDirProvider.TestProjectsMSBuildFilesFolder}/TestProjects.{type}\" />",
"</Project>"));

private void EnsureFileWithContent(string path, string content)
Expand Down

0 comments on commit 45647dc

Please sign in to comment.