Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored projects to use PackageReference. #830

Merged
merged 1 commit into from May 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions TestFx.sln
Expand Up @@ -119,6 +119,10 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlatformServices.Portable.Unit.Tests", "test\UnitTests\PlatformServices.Portable.Unit.Tests\PlatformServices.Portable.Unit.Tests.csproj", "{E3C630FE-AF89-4C95-B1B9-2409B1107208}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlatformServices.Universal.Unit.Tests", "test\UnitTests\PlatformServices.Universal.Unit.Tests\PlatformServices.Universal.Unit.Tests.csproj", "{FA7C719F-A400-45AF-8091-7C23435617A8}"
ProjectSection(ProjectDependencies) = postProject
{DF131865-84EE-4540-8112-E88ACEBDEA09} = {DF131865-84EE-4540-8112-E88ACEBDEA09}
{5D153CAA-80C2-4551-9549-6C406FCEEFB1} = {5D153CAA-80C2-4551-9549-6C406FCEEFB1}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MSTest.Core.Unit.Tests", "test\UnitTests\MSTest.Core.Unit.Tests\MSTest.Core.Unit.Tests.csproj", "{0A4A76DD-FEE1-4D04-926B-38E1A24A7ED2}"
EndProject
Expand Down
5 changes: 3 additions & 2 deletions samples/FxExtensibility/FxExtensibility.csproj
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TestFxRoot Condition="$(TestFxRoot) == ''">..\..\</TestFxRoot>
<TestFxRoot Condition=" '$(TestFxRoot)' == '' ">..\..\</TestFxRoot>
</PropertyGroup>
<Import Project="$(TestFxRoot)scripts\build\TestFx.Settings.targets" />

<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand Down Expand Up @@ -39,7 +40,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\TestFramework\MSTest.Core\MSTest.Core.csproj">
<ProjectReference Include="$(TestFxRoot)src\TestFramework\MSTest.Core\MSTest.Core.csproj">
<Project>{7252d9e3-267d-442c-96bc-c73aef3241d6}</Project>
<Name>MSTest.Core</Name>
</ProjectReference>
Expand Down
67 changes: 7 additions & 60 deletions scripts/Build.ps1
Expand Up @@ -82,22 +82,6 @@ $TFB_Solutions = @(
"TestFx.sln"
)

$TFB_NetCoreProjects = @(
"src\Adapter\PlatformServices.NetCore\PlatformServices.NetCore.csproj"

"test\ComponentTests\TestAssets\TestProjectForAssemblyResolution\TestProjectForAssemblyResolution.csproj"
"test\E2ETests\TestAssets\CompatTestProject\CompatTestProject.csproj"
"test\E2ETests\TestAssets\DataRowTestProject\DataRowTestProject.csproj"
"test\E2ETests\TestAssets\DataSourceTestProject\DataSourceTestProject.csproj"
"test\E2ETests\TestAssets\DeploymentTestProject\DeploymentTestProject.csproj"
"test\E2ETests\TestAssets\DeploymentTestProjectNetCore\DeploymentTestProjectNetCore.csproj"
"test\E2ETests\TestAssets\DoNotParallelizeTestProject\DoNotParallelizeTestProject.csproj"
"test\E2ETests\TestAssets\FSharpTestProject\FSharpTestProject.fsproj"
"test\E2ETests\TestAssets\TimeoutTestProject\TimeoutTestProject.csproj"
"test\E2ETests\TestAssets\TimeoutTestProjectNetCore\TimeoutTestProjectNetCore.csproj"
"test\UnitTests\PlatformServices.NetCore.Unit.Tests\PlatformServices.NetCore.Unit.Tests.csproj"
)

#
# Script Preferences
#
Expand Down Expand Up @@ -154,43 +138,34 @@ function Perform-Restore {
$toolset = Locate-Toolset

if ($TFB_ClearPackageCache) {
Write-Log " Clearing local package cache..."
Write-Log "Clearing local package cache..."
& $nuget locals all -clear
}

Write-Log " Starting toolset restore..."
Write-Verbose "$nuget restore -msbuildVersion $msbuildVersion -verbosity normal -nonInteractive -configFile $nugetConfig $toolset"
& $nuget restore -msbuildVersion $msbuildVersion -verbosity normal -nonInteractive -configFile $nugetConfig $toolset
Write-Log "Starting toolset restore..."
Write-Verbose "$nuget restore -verbosity normal -nonInteractive -configFile $nugetConfig $toolset"
& $nuget restore -verbosity normal -nonInteractive -configFile $nugetConfig $toolset

if ($lastExitCode -ne 0) {
throw "The restore failed with an exit code of '$lastExitCode'."
}

Write-Verbose "Locating MSBuild install path..."
$msbuildPath = Locate-MSBuildPath
Write-Verbose "MSBuild install path: $msbuildPath"

Write-Verbose "Starting solution restore..."
foreach ($solution in $TFB_Solutions) {
$solutionPath = Locate-Item -relativePath $solution

Write-Verbose "$nuget restore -msbuildPath $msbuildPath -verbosity quiet -nonInteractive -configFile $nugetConfig $solutionPath"
& $nuget restore -msbuildPath $msbuildPath -verbosity quiet -nonInteractive -configFile $nugetConfig $solutionPath
Write-Verbose "$nuget restore -msbuildPath $msbuildPath -verbosity normal -nonInteractive -configFile $nugetConfig $solutionPath"
& $nuget restore -msbuildPath $msbuildPath -verbosity normal -nonInteractive -configFile $nugetConfig $solutionPath
}

if ($lastExitCode -ne 0) {
throw "The restore failed with an exit code of '$lastExitCode'."
}

$msbuild = Join-Path $msbuildPath "MSBuild.exe"

Write-Verbose "Starting restore for NetCore Projects"
foreach ($project in $TFB_NetCoreProjects) {
$projectPath = Locate-Item -relativePath $project

Write-Verbose "$msbuild /t:restore -verbosity:minimal $projectPath /m"
& $msbuild /t:restore -verbosity:minimal $projectPath /m
}

if ($lastExitCode -ne 0) {
throw "The restore failed with an exit code of '$lastExitCode'."
}
Expand Down Expand Up @@ -300,34 +275,6 @@ function Create-NugetPackages {
Write-Log "Create-NugetPackages: Complete. {$(Get-ElapsedTime($timer))}"
}

function Replace-InFile($File, $RegEx, $ReplaceWith) {
$content = Get-Content -Raw -Encoding utf8 $File
$newContent = ($content -replace $RegEx, $ReplaceWith)
if (-not $content.Equals($newContent)) {
Write-Log "Updating TestPlatform version in $File"
$newContent | Set-Content -Encoding utf8 $File -NoNewline
}
}

function Sync-PackageVersions {
$versionsRegex = '(?mi)<(TestPlatformVersion.*?)>(.*?)<\/TestPlatformVersion>'
$packageRegex = '(?mi)<package id="Microsoft\.TestPlatform([0-9a-z.]+)?" version="([0-9a-z.-]*)"'
$sourceRegex = '(?mi)(.+[a-z =]+\@?\")Microsoft\.TestPlatform\.([0-9.-a-z]+)\";'

if ([String]::IsNullOrWhiteSpace($TestPlatformVersion)) {
$TestPlatformVersion = (([XML](Get-Content $TF_VERSIONS_FILE)).Project.PropertyGroup.TestPlatformVersion).InnerText
}
else {
Replace-InFile -File $TF_VERSIONS_FILE -RegEx $versionsRegex -ReplaceWith "<`$1>$TestPlatformVersion</TestPlatformVersion>"
}

(Get-ChildItem "$PSScriptRoot\..\src\*packages.config", "$PSScriptRoot\..\test\*packages.config" -Recurse) | ForEach-Object {
Replace-InFile -File $_ -RegEx $packageRegex -ReplaceWith ('<package id="Microsoft.TestPlatform$1" version="{0}"' -f $TestPlatformVersion)
}

Replace-InFile -File "$PSScriptRoot\..\test\E2ETests\Automation.CLI\CLITestBase.common.cs" -RegEx $sourceRegex -ReplaceWith ('$1Microsoft.TestPlatform.{0}";' -f $TestPlatformVersion)
}

function ShouldRunStep([string[]]$CurrentSteps) {
if ($Force) {
return $true
Expand Down
11 changes: 5 additions & 6 deletions scripts/PortableToFullPdb.ps1
Expand Up @@ -8,20 +8,19 @@ Param(
[System.String] $Configuration = "Release"
)

. $PSScriptRoot\common.lib.ps1

#
# Variables
#
Write-Verbose "Setup environment variables."
$TF_ROOT_DIR = (Get-Item (Split-Path $MyInvocation.MyCommand.Path)).Parent.FullName
$TF_PACKAGES_DIR = Join-Path $TF_ROOT_DIR "packages"
$TF_OUT_DIR = Join-Path $TF_ROOT_DIR "artifacts"
$TF_PortablePdbs =@("PlatformServices.NetCore\netstandard1.5\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.pdb")
$TF_PortablePdbs = @("PlatformServices.NetCore\netstandard1.5\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.pdb")

$PdbConverterToolVersion = "1.1.0-beta2-21064-01"
$PdbConverterToolVersion = Get-PackageVersion -PackageName "MicrosoftDiaSymReaderPdb2PdbVersion"

function Locate-PdbConverterTool
{
$pdbConverter = Join-Path -path $TF_PACKAGES_DIR -ChildPath "Microsoft.DiaSymReader.Pdb2Pdb.$PdbConverterToolVersion\tools\Pdb2Pdb.exe"
$pdbConverter = Join-Path -path $TF_PACKAGES_DIR -ChildPath "Microsoft.DiaSymReader.Pdb2Pdb\$PdbConverterToolVersion\tools\Pdb2Pdb.exe"

if (!(Test-Path -path $pdbConverter))
{
Expand Down
30 changes: 15 additions & 15 deletions scripts/build/TestFx.Loc.targets
Expand Up @@ -23,55 +23,55 @@

<!-- Localization for Libraries.
'UseSharedResources' flag is true for desktop and netcore as their resources are common and present at a shared location -->
<Target Name="TestFxLocalization" Condition="$(IsVsixProj) =='' and $(IsVsixProj) !='true'" BeforeTargets="BeforeBuild" DependsOnTargets="GatherResxResources">
<CallTarget Targets="CreateLocalizeXLF;CreateLocalizeResx" Condition="'$(HasResxResources)' == 'true' and '$(UseSharedResources)' == ''"/>
<CallTarget Targets="CreateLocalizeXLFShared;CreateLocalizeResxShared" Condition="'$(HasResxResources)' == 'true' and '$(UseSharedResources)' == 'true'"/>
<Target Name="TestFxLocalization" Condition=" '$(IsVsixProj)' == '' and '$(IsVsixProj)' !='true' " BeforeTargets="BeforeBuild" DependsOnTargets="GatherResxResources">
<CallTarget Targets="CreateLocalizeXLF;CreateLocalizeResx" Condition=" '$(HasResxResources)' == 'true' and '$(UseSharedResources)' == '' "/>
<CallTarget Targets="CreateLocalizeXLFShared;CreateLocalizeResxShared" Condition=" '$(HasResxResources)' == 'true' and '$(UseSharedResources)' == 'true' "/>
</Target>

<!-- Generate xlf files from Resources.resx by using command Build.cmd -uxlf -->
<Target Name="CreateLocalizeXLF" Condition="'$(UpdateXlf)' == 'true'">
<Target Name="CreateLocalizeXLF" Condition=" '$(UpdateXlf)' == 'true' ">
<CreateItem Include="@(ResxResources)" AdditionalMetadata="Language=%(ResxLang.Identity)">
<Output ItemName="LocResourceFile" TaskParameter="Include"/>
</CreateItem>
<Exec Command="$(TestFxPackagesRoot)fmdev.xlftool.0.1.3\tools\xlftool.exe update -Resx %(LocResourceFile.Identity) -Xlf $(ResourceDirectory)\xlf\%(LocResourceFile.Filename).%(LocResourceFile.Language).xlf" />
<Exec Command="$(TestFxPackagesRoot)fmdev.xlftool.0.1.3\tools\xlftool.exe update -Resx %(ResxResources.Identity) -Xlf $(ResourceDirectory)\xlf\%(ResxResources.Filename).xlf" />
<Exec Command="$(TestFxPackagesRoot)fmdev.xlftool\$(FmDevXlfToolVersion)\tools\xlftool.exe update -Resx %(LocResourceFile.Identity) -Xlf $(ResourceDirectory)\xlf\%(LocResourceFile.Filename).%(LocResourceFile.Language).xlf" />
<Exec Command="$(TestFxPackagesRoot)fmdev.xlftool\$(FmDevXlfToolVersion)\tools\xlftool.exe update -Resx %(ResxResources.Identity) -Xlf $(ResourceDirectory)\xlf\%(ResxResources.Filename).xlf" />
</Target>

<!-- Generate xlf files from Resources.resx for shared resources by using command Build.cmd -uxlf -->
<Target Name="CreateLocalizeXLFShared" Condition="'$(UpdateXlf)' == 'true'">
<Target Name="CreateLocalizeXLFShared" Condition=" '$(UpdateXlf)' == 'true' ">
<CreateItem Include="@(ResxResources)" AdditionalMetadata="Language=%(ResxLang.Identity)">
<Output ItemName="LocResourceFile" TaskParameter="Include"/>
</CreateItem>
<Exec Command="$(TestFxPackagesRoot)fmdev.xlftool.0.1.3\tools\xlftool.exe update -Resx %(LocResourceFile.Identity) -Xlf $(SharedResourceDirectory)\xlf\%(LocResourceFile.Filename).%(LocResourceFile.Language).xlf" />
<Exec Command="$(TestFxPackagesRoot)fmdev.xlftool.0.1.3\tools\xlftool.exe update -Resx %(ResxResources.Identity) -Xlf $(SharedResourceDirectory)\xlf\%(ResxResources.Filename).xlf" />
<Exec Command="$(TestFxPackagesRoot)fmdev.xlftool\$(FmDevXlfToolVersion)\tools\xlftool.exe update -Resx %(LocResourceFile.Identity) -Xlf $(SharedResourceDirectory)\xlf\%(LocResourceFile.Filename).%(LocResourceFile.Language).xlf" />
<Exec Command="$(TestFxPackagesRoot)fmdev.xlftool\$(FmDevXlfToolVersion)\tools\xlftool.exe update -Resx %(ResxResources.Identity) -Xlf $(SharedResourceDirectory)\xlf\%(ResxResources.Filename).xlf" />
</Target>

<!-- Generate language specific resx files from the xlf files -->
<Target Name="CreateLocalizeResx" Condition="'$(IsLocalizedBuild)' == 'true'">
<Target Name="CreateLocalizeResx" Condition=" '$(IsLocalizedBuild)' == 'true' ">
<CreateItem Include="@(ResxResources)" AdditionalMetadata="Language=%(ResxLang.Identity)">
<Output ItemName="LocResourceFile" TaskParameter="Include"/>
</CreateItem>
<Exec Command="$(TestFxPackagesRoot)fmdev.xlftool.0.1.3\tools\xlftool.exe writeTarget -Xlf $(ResourceDirectory)\xlf\%(LocResourceFile.Filename).%(LocResourceFile.Language).xlf -Resx $(ResourceDirectory)\%(LocResourceFile.Filename).%(LocResourceFile.Language).resx -verbose" />
<Exec Command="$(TestFxPackagesRoot)fmdev.xlftool\$(FmDevXlfToolVersion)\tools\xlftool.exe writeTarget -Xlf $(ResourceDirectory)\xlf\%(LocResourceFile.Filename).%(LocResourceFile.Language).xlf -Resx $(ResourceDirectory)\%(LocResourceFile.Filename).%(LocResourceFile.Language).resx -verbose" />
<ItemGroup>
<EmbeddedResource Include="$(ResourceDirectory)\%(LocResourceFile.Filename).%(LocResourceFile.Language).resx" />
</ItemGroup>
</Target>

<!-- Generate language specific resx files from the xlf files for shared resources -->
<Target Name="CreateLocalizeResxShared" Condition="'$(IsLocalizedBuild)' == 'true'">
<Target Name="CreateLocalizeResxShared" Condition=" '$(IsLocalizedBuild)' == 'true' ">
<CreateItem Include="@(ResxResources)" AdditionalMetadata="Language=%(ResxLang.Identity)">
<Output ItemName="LocResourceFile" TaskParameter="Include"/>
</CreateItem>
<Exec Command="$(TestFxPackagesRoot)fmdev.xlftool.0.1.3\tools\xlftool.exe writeTarget -Xlf $(SharedResourceDirectory)\xlf\%(LocResourceFile.Filename).%(LocResourceFile.Language).xlf -Resx $(ResourceDirectory)\%(LocResourceFile.Filename).%(LocResourceFile.Language).resx -verbose" />
<Exec Command="$(TestFxPackagesRoot)fmdev.xlftool\$(FmDevXlfToolVersion)\tools\xlftool.exe writeTarget -Xlf $(SharedResourceDirectory)\xlf\%(LocResourceFile.Filename).%(LocResourceFile.Language).xlf -Resx $(ResourceDirectory)\%(LocResourceFile.Filename).%(LocResourceFile.Language).resx -verbose" />
<ItemGroup>
<EmbeddedResource Include="$(ResourceDirectory)\%(LocResourceFile.Filename).%(LocResourceFile.Language).resx" />
</ItemGroup>
</Target>

<!-- Localization for documentation files. -->
<Target Name="CopyLocalizedXmls" BeforeTargets="BeforeBuild" Condition="$(LocDocumentationSubPath) != ''">
<Target Name="CopyLocalizedXmls" BeforeTargets="BeforeBuild" Condition=" '$(LocDocumentationSubPath)' != ''">
<PropertyGroup>
<_SourcePath>$(TestFxPackagesRoot)MSTest.Internal.TestFx.Localized.Documentation.1.0.0-build-20170420-1\contentFiles\any\any\$(LocDocumentationSubPath)</_SourcePath>
<_SourcePath>$(TestFxPackagesRoot)MSTest.Internal.TestFx.Localized.Documentation\$(MsTestInternalTestFxLocalizedDocumentationVersion)\contentFiles\any\any\$(LocDocumentationSubPath)</_SourcePath>
</PropertyGroup>
<ItemGroup>
<_LocalizedFiles Include="$(_SourcePath)\**\*.*" />
Expand Down
20 changes: 9 additions & 11 deletions scripts/build/TestFx.Settings.targets
@@ -1,15 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TestFxRoot Condition="$(TestFxRoot) == ''">..\..\</TestFxRoot>
<RepoRoot Condition="$(RepoRoot) == ''">$(MSBuildThisFileDirectory)..\..\</RepoRoot>
<IncludeMicrosoftCommon Condition="$(IncludeMicrosoftCommon) == ''">true</IncludeMicrosoftCommon>
<TestFxRoot Condition=" '$(TestFxRoot)' == '' ">..\..\</TestFxRoot>
<RepoRoot Condition=" '$(RepoRoot)' == '' ">$(MSBuildThisFileDirectory)..\..\</RepoRoot>
<IncludeMicrosoftCommon Condition=" '$(IncludeMicrosoftCommon)' == '' ">true</IncludeMicrosoftCommon>
</PropertyGroup>

<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props') and $(FrameworkIdentifier) != 'NetCore' and $(IncludeMicrosoftCommon) == 'true'" />
<!-- Import props/targets with $(RepoRoot) since msbuild takes the relative path based on settings.targets and not with respect to the project. -->
<Import Project="$(RepoRoot)packages\MicroBuild.Core.0.2.0\build\MicroBuild.Core.props" Condition="Exists('$(RepoRoot)packages\MicroBuild.Core.0.2.0\build\MicroBuild.Core.props')" />
<Import Project="TestFx.Versions.targets" />
<Import Project="$(MSBuildThisFileDirectory)TestFx.Versions.targets" />

<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand All @@ -19,11 +17,11 @@
<GenerateLCE>true</GenerateLCE>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)key.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition="'$(IsLocalizedBuild)' == '' or '$(IsLocalizedBuild)' != 'true'">true</PublicSign>
<PublicSign Condition=" '$(IsLocalizedBuild)' == '' or '$(IsLocalizedBuild)' != 'true'">true</PublicSign>
<!-- Temporarily turning on Delay signing for Localized builds because publickey = true is not passed on to the assembler to create resource assmblies.-->
<DelaySign Condition="'$(IsLocalizedBuild)' == 'true'">true</DelaySign>
<OutputPath Condition="$(OutputPath) == ''">$(TestFxRoot)artifacts\$(Configuration)\$(MSBuildProjectName)\</OutputPath>
<IntermediatePath Condition="$(IntermediatePath) == ''">$(TestFxRoot)artifacts\$(Configuration)\$(MSBuildProjectName)\obj\</IntermediatePath>
<DelaySign Condition=" '$(IsLocalizedBuild)' == 'true' ">true</DelaySign>
<OutputPath Condition=" '$(OutputPath)' == '' ">$(TestFxRoot)artifacts\$(Configuration)\$(MSBuildProjectName)\</OutputPath>
<IntermediatePath Condition=" '$(IntermediatePath)' == '' ">$(TestFxRoot)artifacts\$(Configuration)\$(MSBuildProjectName)\obj\</IntermediatePath>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

Expand All @@ -35,6 +33,6 @@
<PropertyGroup>
<RunCodeAnalysis>false</RunCodeAnalysis>
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)stylecop.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet Condition="$(IsTest) == 'true'">$(MSBuildThisFileDirectory)stylecop.test.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet Condition=" '$(IsTest)' == 'true' ">$(MSBuildThisFileDirectory)stylecop.test.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
</Project>