Skip to content

Commit

Permalink
merge with master
Browse files Browse the repository at this point in the history
  • Loading branch information
smadala committed Oct 26, 2016
2 parents 83c4707 + 49dcac3 commit a063014
Show file tree
Hide file tree
Showing 93 changed files with 64,123 additions and 867 deletions.
19 changes: 19 additions & 0 deletions TestPlatform.sln
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "SimpleTestProject2", "test\TestAssets\SimpleTestProject2\SimpleTestProject2.xproj", "{7D9B9032-6689-46DA-A11F-DEECFBE06E78}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NUnitTestProject1", "test\TestAssets\NUnitTestProject1\NUnitTestProject1.csproj", "{067456C0-086C-46A8-B37F-1405717B7BFC}"
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.TestPlatform.ObjectModel.PlatformTests", "test\Performance\Microsoft.TestPlatform.ObjectModel.PlatformTests\Microsoft.TestPlatform.ObjectModel.PlatformTests.xproj", "{A4025AA7-FE2C-47B4-AB22-5FA32D0CA234}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "PerfTestProject", "test\TestAssets\PerfTestProject\PerfTestProject.xproj", "{96B93E28-A33D-48E5-8793-73F686D3B999}"
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "testhost.UnitTests", "test\testhost.UnitTests\testhost.UnitTests.xproj", "{09599F77-A1F2-4366-BB8A-B4B90E05BCBC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -259,6 +263,18 @@ Global
{067456C0-086C-46A8-B37F-1405717B7BFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{067456C0-086C-46A8-B37F-1405717B7BFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{067456C0-086C-46A8-B37F-1405717B7BFC}.Release|Any CPU.Build.0 = Release|Any CPU
{A4025AA7-FE2C-47B4-AB22-5FA32D0CA234}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A4025AA7-FE2C-47B4-AB22-5FA32D0CA234}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A4025AA7-FE2C-47B4-AB22-5FA32D0CA234}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A4025AA7-FE2C-47B4-AB22-5FA32D0CA234}.Release|Any CPU.Build.0 = Release|Any CPU
{96B93E28-A33D-48E5-8793-73F686D3B999}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{96B93E28-A33D-48E5-8793-73F686D3B999}.Debug|Any CPU.Build.0 = Debug|Any CPU
{96B93E28-A33D-48E5-8793-73F686D3B999}.Release|Any CPU.ActiveCfg = Release|Any CPU
{96B93E28-A33D-48E5-8793-73F686D3B999}.Release|Any CPU.Build.0 = Release|Any CPU
{09599F77-A1F2-4366-BB8A-B4B90E05BCBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{09599F77-A1F2-4366-BB8A-B4B90E05BCBC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{09599F77-A1F2-4366-BB8A-B4B90E05BCBC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{09599F77-A1F2-4366-BB8A-B4B90E05BCBC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -306,5 +322,8 @@ Global
{03FC3BAA-417B-460B-B9EF-AB9A4D2A974A} = {D8EF073C-279A-4279-912D-E9D4B0635E17}
{7D9B9032-6689-46DA-A11F-DEECFBE06E78} = {50D7D355-08F6-4DFD-AEAA-9BCE41C94C18}
{067456C0-086C-46A8-B37F-1405717B7BFC} = {50D7D355-08F6-4DFD-AEAA-9BCE41C94C18}
{A4025AA7-FE2C-47B4-AB22-5FA32D0CA234} = {44DABCFB-7AA0-4682-B7F7-067E0ABA1D14}
{96B93E28-A33D-48E5-8793-73F686D3B999} = {50D7D355-08F6-4DFD-AEAA-9BCE41C94C18}
{09599F77-A1F2-4366-BB8A-B4B90E05BCBC} = {463031A2-7F16-4E38-9944-1F5161D04933}
EndGlobalSection
EndGlobal
115 changes: 81 additions & 34 deletions scripts/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ Param(

[Parameter(Mandatory=$false)]
[Alias("ff")]
[System.Boolean] $FailFast = $true
[System.Boolean] $FailFast = $true,

[Parameter(Mandatory=$false)]
[Alias("loc")]
[System.Boolean] $Localized = $false
)

$ErrorActionPreference = "Stop"
Expand Down Expand Up @@ -162,34 +166,45 @@ function Publish-Package
$fullCLRPackageDir = Get-FullCLRPackageDirectory
$coreCLRPackageDir = Get-CoreCLRPackageDirectory
$testHostProjectDirectory = Join-Path $env:TP_ROOT_DIR "src\testhost"
$testHostx86ProjectDirectory = Join-Path $env:TP_ROOT_DIR "src\testhost.x86"
$testhostFullPackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\Microsoft.TestPlatform.TestHost\$TPB_TargetFramework\$TPB_TargetRuntime")
$testhostCorePackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\Microsoft.TestPlatform.TestHost\$TPB_TargetFrameworkCore")
$vstestConsoleProjectDirectory = Join-Path $env:TP_ROOT_DIR "src\vstest.console"
$dataCollectorProjectDirectory = Join-Path $env:TP_ROOT_DIR "src\datacollector"
$dataCollectorx86ProjectDirectory = Join-Path $env:TP_ROOT_DIR "src\datacollector.x86"

Write-Log ".. Package: Publish package\project.json"

Write-Verbose "$dotnetExe publish $env:TP_PACKAGE_PROJ_DIR\project.json --runtime $TPB_TargetRuntime --framework $TPB_TargetFramework --no-build --configuration $TPB_Configuration --output $fullCLRPackageDir"
& $dotnetExe publish $env:TP_PACKAGE_PROJ_DIR\project.json --runtime $TPB_TargetRuntime --framework $TPB_TargetFramework --no-build --configuration $TPB_Configuration --output $fullCLRPackageDir

Write-Verbose "$dotnetExe publish $env:TP_PACKAGE_PROJ_DIR\project.json --framework $TPB_TargetFrameworkCore --no-build --configuration $TPB_Configuration --output $coreCLRPackageDir"
& $dotnetExe publish $env:TP_PACKAGE_PROJ_DIR\project.json --framework $TPB_TargetFrameworkCore --no-build --configuration $TPB_Configuration --output $coreCLRPackageDir

# Publish testhost, vstest.console and datacollector exclusively because *.deps.json file is not getting publish when we are publishing aforementioned project through dependency.
Write-Log ".. Package: Publish src\vstest.console\project.json"
Write-Verbose "$dotnetExe publish $vstestConsoleProjectDirectory\project.json --framework $TPB_TargetFrameworkCore --no-build --configuration $TPB_Configuration --output $coreCLRPackageDir"
& $dotnetExe publish $vstestConsoleProjectDirectory\project.json --framework $TPB_TargetFrameworkCore --no-build --configuration $TPB_Configuration --output $coreCLRPackageDir

Write-Log ".. Package: Publish src\testhost\project.json"
Write-Verbose "$dotnetExe publish $testHostProjectDirectory\project.json --framework $TPB_TargetFrameworkCore --no-build --configuration $TPB_Configuration --output $coreCLRPackageDir"
& $dotnetExe publish $testHostProjectDirectory\project.json --framework $TPB_TargetFrameworkCore --no-build --configuration $TPB_Configuration --output $coreCLRPackageDir

Write-Log ".. Package: Publish src\datacollector\project.json"
Write-Verbose "$dotnetExe publish $dataCollectorProjectDirectory\project.json --framework $TPB_TargetFrameworkCore --no-build --configuration $TPB_Configuration --output $coreCLRPackageDir"
& $dotnetExe publish $dataCollectorProjectDirectory\project.json --framework $TPB_TargetFrameworkCore --no-build --configuration $TPB_Configuration --output $coreCLRPackageDir
Write-Log "Package: Publish package\project.json"
Publish-Package-Internal $env:TP_PACKAGE_PROJ_DIR\project.json $TPB_TargetFramework $fullCLRPackageDir
Publish-Package-Internal $env:TP_PACKAGE_PROJ_DIR\project.json $TPB_TargetFrameworkCore $coreCLRPackageDir

# For libraries that are externally published, copy the output into artifacts. These will be signed and packaged independently.
Copy-PackageItems "Microsoft.TestPlatform.Build"
#Copy-PackageItems "Microsoft.TestPlatform.ObjectModel"
#Copy-PackageItems "TestHost"
# Publish vstest.console and datacollector exclusively because *.config/*.deps.json file is not getting publish when we are publishing aforementioned project through dependency.
Write-Log "Package: Publish src\vstest.console\project.json"
Publish-Package-Internal $vstestConsoleProjectDirectory\project.json $TPB_TargetFramework $fullCLRPackageDir
Publish-Package-Internal $vstestConsoleProjectDirectory\project.json $TPB_TargetFrameworkCore $coreCLRPackageDir

Write-Log "Package: Publish src\datacollector\project.json"
Publish-Package-Internal $dataCollectorProjectDirectory\project.json $TPB_TargetFramework $fullCLRPackageDir
Publish-Package-Internal $dataCollectorProjectDirectory\project.json $TPB_TargetFrameworkCore $coreCLRPackageDir

Write-Log "Package: Publish src\datacollector.x86\project.json"
Publish-Package-Internal $dataCollectorx86ProjectDirectory\project.json $TPB_TargetFramework $fullCLRPackageDir

# Publish testhost
Write-Log "Package: Publish testhost\project.json"
Publish-Package-Internal $testHostProjectDirectory\project.json $TPB_TargetFramework $testhostFullPackageDir
Publish-Package-Internal $testHostProjectDirectory\project.json $TPB_TargetFrameworkCore $testhostCorePackageDir

Write-Log "Package: Publish testhost.x86\project.json"
Publish-Package-Internal $testHostx86ProjectDirectory\project.json $TPB_TargetFramework $testhostFullPackageDir

# Copy over the Full CLR built testhost package assemblies to the $fullCLRPackageDir
Copy-Item $testhostFullPackageDir\* $fullCLRPackageDir -Force

# Copy over the Full CLR built testhost package assemblies to the Core CLR package folder.
$netFull_Dir = "TestHost"
$fullDestDir = Join-Path $coreCLRPackageDir $netFull_Dir
New-Item -ItemType directory -Path $fullDestDir -Force | Out-Null
Copy-Item $testhostFullPackageDir\* $fullDestDir -Force

if ($lastExitCode -ne 0) {
Set-ScriptFailed
Expand All @@ -214,15 +229,19 @@ function Publish-Package
Move-Item $coreCLRPackageDir\$file $coreCLRExtensionsDir -Force
}

# Copy over the Core CLR built assemblies to the Full CLR package folder.
$netCore_Dir = "NetCore"
$coreDestDir = Join-Path $fullCLRPackageDir $netCore_Dir
New-Item -ItemType directory -Path $coreDestDir -Force | Out-Null
Copy-Item -Recurse $coreCLRPackageDir\* $coreDestDir -Force
# For libraries that are externally published, copy the output into artifacts. These will be signed and packaged independently.
Copy-PackageItems "Microsoft.TestPlatform.Build"

Write-Log "Publish-Package: Complete. {$(Get-ElapsedTime($timer))}"
}


function Publish-Package-Internal($packagename, $framework, $output, $runtime)
{
Write-Verbose "$dotnetExe publish $packagename --no-build --configuration $TPB_Configuration --framework $framework --output $output"
& $dotnetExe publish $packagename --no-build --configuration $TPB_Configuration --framework $framework --output $output
}

function Create-VsixPackage
{
$timer = Start-Timer
Expand All @@ -233,8 +252,6 @@ function Create-VsixPackage
# Copy vsix manifests
$vsixManifests = @("*Content_Types*.xml",
"extension.vsixmanifest",
"testhost.x86.exe.config",
"testhost.exe.config",
"TestPlatform.ObjectModel.manifest",
"TestPlatform.ObjectModel.x86.manifest")
foreach ($file in $vsixManifests) {
Expand Down Expand Up @@ -265,13 +282,17 @@ function Create-NugetPackages
$tpSrcDir = Join-Path $env:TP_ROOT_DIR "src"

# Copy over the nuspecs to the staging directory
$nuspecFiles = @("TestPlatform.TranslationLayer.nuspec", "TestPlatform.ObjectModel.nuspec", "TestPlatform.TestHost.nuspec", "TestPlatform.nuspec", "TestPlatform.CLI.nuspec", "TestPlatform.Build.nuspec")
$nuspecFiles = @("TestPlatform.TranslationLayer.nuspec", "TestPlatform.ObjectModel.nuspec", "TestPlatform.TestHost.nuspec", "TestPlatform.nuspec", "TestPlatform.CLI.nuspec", "TestPlatform.Build.nuspec", "Microsoft.Net.Test.Sdk.nuspec")
$targetFiles = @("Microsoft.Net.Test.Sdk.targets")
# Nuget pack analysis emits warnings if binaries are packaged as content. It is intentional for the below packages.
$skipAnalysis = @("TestPlatform.CLI.nuspec")
foreach ($file in $nuspecFiles) {
foreach ($file in $nuspecFiles + $targetFiles) {
Copy-Item $tpSrcDir\$file $stagingDir -Force
}

# Copy over empty file
Copy-Item -Recurse $tpSrcDir\package\"_._" $stagingDir -Force

# Call nuget pack on these components.
$nugetExe = Join-Path $env:TP_PACKAGES_DIR -ChildPath "Nuget.CommandLine" | Join-Path -ChildPath $env:NUGET_EXE_Version | Join-Path -ChildPath "tools\NuGet.exe"

Expand Down Expand Up @@ -303,6 +324,31 @@ function Copy-PackageItems($packageName)
Copy-Item -Path $binariesDirectory -Destination $publishDirectory -Recurse -Force
}

function Update-LocalizedResources
{
$timer = Start-Timer

Write-Log "Update-LocalizedResources: Started."

# For each resx file, file the xlf files in all languages
# Sync the resx to xlf to ensure all new resources are added
$xlfTool = Join-Path $env:TP_PACKAGES_DIR "fmdev.xlftool\0.1.2\tools\xlftool.exe"
$resxFiles = Get-ChildItem -Recurse -Include *.resx "$env:TP_ROOT_DIR\src"

foreach ($resxFile in $resxFiles) {
Write-Log "... Resource: $resxFile"

foreach ($lang in @("cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-BR", "ru", "tr", "zh-Hans", "zh-Hant")) {
$xlfFile = Join-Path $($resxFile.Directory.FullName) "xlf\$($resxFile.BaseName).$lang.xlf"

Write-VerboseLog "$xlfTool update -resx $($resxFile.FullName) -xlf $xlfFile -verbose"
& $xlfTool update -resx $resxFile.FullName -xlf $xlfFile -verbose
}
}

Write-Log "Update-LocalizedResources: Complete. {$(Get-ElapsedTime($timer))}"
}

#
# Helper functions
#
Expand Down Expand Up @@ -357,6 +403,7 @@ Get-Variable | Where-Object -FilterScript { $_.Name.StartsWith("TPB_") } | Forma

Install-DotNetCli
Restore-Package
Update-LocalizedResources
Invoke-Build
Publish-Package
Create-VsixPackage
Expand Down
20 changes: 20 additions & 0 deletions src/Microsoft.NET.Test.Sdk.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<package >
<metadata>
<id>Microsoft.NET.Test.Sdk</id>
<version>1.0.0-preview</version>
<title>The MSbuild targets and properties for building the .Net core test projects.</title>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>The MSbuild targets and properties for building the .Net core test projects.</description>
<copyright>Copyright 2015</copyright>
<dependencies>
<dependency id="Microsoft.TestPlatform.TestHost" version="15.0.0-preview-20161012-02" />
</dependencies>
</metadata>
<files>
<file src="Microsoft.NET.Test.Sdk.targets" target="build\netcoreapp1.0\" />
<file src="Microsoft.NET.Test.Sdk.targets" target="build\net46\" />
</files>
</package>
65 changes: 65 additions & 0 deletions src/Microsoft.NET.Test.Sdk.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<!--
***********************************************************************************************
Microsoft.NET.Test.Sdk.targets
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your test projects from the command-line or the IDE.
Copyright (c) Microsoft. All rights reserved.
***********************************************************************************************
-->

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<!--
============================================================
GenerateProgramFile
Generates Program file which contains the Main entry point
============================================================
-->
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<GeneratedProgramFile Condition="'$(GeneratedProgramFile)' ==''">$(IntermediateOutputPath)$(MSBuildProjectName).Program$(DefaultLanguageSourceExtension)</GeneratedProgramFile>
<GenerateProgramFile Condition="'$(GenerateProgramFile)' == ''">true</GenerateProgramFile>
</PropertyGroup>
<!--
Note that this must run before every invocation of CoreCompile to ensure that all
compiler runs see the generated Program file. Furthermore, we must run *after*
PrepareForBuild to ensure that the intermediate directory has been created.
-->

<Target Name="GenerateProgramFile"
BeforeTargets="CoreCompile"
DependsOnTargets="PrepareForBuild;CoreGenerateProgramFile"
Condition="'$(GenerateProgramFile)' == 'true'" />

<Target Name="CoreGenerateProgramFile"
Condition="'$(Language)'=='VB' or '$(Language)'=='C#'"
Inputs="$(MSBuildAllProjects)"
Outputs="$(GeneratedProgramFile)">

<ItemGroup Condition="'$(Language)'=='C#'">
<Line Include="using System%3b "/>
<Line Include="class Program {static void Main(string[] args){}}"/>
</ItemGroup>

<ItemGroup Condition="'$(Language)'=='VB'">
<Line Include="Imports System"/>
<Line Include="Module Program"/>
<Line Include="Sub Main(args As String())"/>
<Line Include="End Sub"/>
<Line Include="End Module"/>
</ItemGroup>
<WriteLinesToFile
File="$(GeneratedProgramFile)" Lines="@(Line)" Overwrite="true" Encoding="Unicode">
</WriteLinesToFile>

<!--
Compile Include the generated Program File
-->
<ItemGroup>
<Compile Include="$(GeneratedProgramFile)"/>
</ItemGroup>
</Target>
</Project>
15 changes: 15 additions & 0 deletions src/Microsoft.TestPlatform.Build/Tasks/VSTestTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ namespace Microsoft.TestPlatform.Build.Tasks

using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using System;
using System.IO;

public class VSTestTask : Task
{
Expand Down Expand Up @@ -53,6 +55,10 @@ public string VSTestListTests
public override bool Execute()
{
var vsTestForwardingApp = new VSTestForwardingApp(this.CreateArgument());
if (!string.IsNullOrEmpty(this.VSTestFramework))
{
Console.WriteLine("Test run for {0}({1})", this.TestFileFullPath, this.VSTestFramework);
}
vsTestForwardingApp.Execute();
return true;
}
Expand Down Expand Up @@ -106,6 +112,15 @@ private IEnumerable<string> CreateArgument()
allArgs.Add(this.AddDoubleQuotes(this.TestFileFullPath));
}

// For Full CLR, add source directory as test adapter path.
if (string.IsNullOrEmpty(this.VSTestTestAdapterPath))
{
if (this.VSTestFramework.StartsWith(".NETFramework", StringComparison.OrdinalIgnoreCase))
{
allArgs.Add("--testAdapterPath:" + this.AddDoubleQuotes(Path.GetDirectoryName(this.TestFileFullPath)));
}
}

return allArgs;
}
}
Expand Down
15 changes: 15 additions & 0 deletions src/Microsoft.TestPlatform.Client/Resources/xlf/Resources.xlf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" original="../Resources.resx">
<body>
<trans-unit id="InvalidStateForExecution">
<source>The test run could not be executed because the initial state was invalid.</source>
<note></note>
</trans-unit>
<trans-unit id="WaitForCompletionOperationIsNotAllowedWhenNoTestRunIsActive">
<source>Wait for completion operation is not allowed when there is no active test run. </source>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
4 changes: 2 additions & 2 deletions src/Microsoft.TestPlatform.Client/TestPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public IDiscoveryRequest CreateDiscoveryRequest(DiscoveryCriteria discoveryCrite
}

var runconfiguration = XmlRunSettingsUtilities.GetRunConfigurationNode(discoveryCriteria.RunSettings);
var testHostManager = this.TestEngine.GetDefaultTestHostManager(runconfiguration.TargetPlatform, runconfiguration.TargetFrameworkVersion);
var testHostManager = this.TestEngine.GetDefaultTestHostManager(runconfiguration);

var discoveryManager = this.TestEngine.GetDiscoveryManager(testHostManager, discoveryCriteria);
discoveryManager.Initialize();
Expand All @@ -76,7 +76,7 @@ public ITestRunRequest CreateTestRunRequest(TestRunCriteria testRunCriteria)
}

var runConfiguration = XmlRunSettingsUtilities.GetRunConfigurationNode(testRunCriteria.TestRunSettings);
var testHostManager = this.TestEngine.GetDefaultTestHostManager(runConfiguration.TargetPlatform, runConfiguration.TargetFrameworkVersion);
var testHostManager = this.TestEngine.GetDefaultTestHostManager(runConfiguration);

if (testRunCriteria.TestHostLauncher != null)
{
Expand Down
Loading

0 comments on commit a063014

Please sign in to comment.