Skip to content

Commit

Permalink
Merge pull request #1706 from dotnet/merges/release/15.5-to-master-20…
Browse files Browse the repository at this point in the history
…171101-070039

Merge release/15.5 to master
  • Loading branch information
tmat authored Nov 1, 2017
2 parents 634680a + 829544b commit 7fc8f64
Show file tree
Hide file tree
Showing 74 changed files with 808 additions and 405 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,6 @@ DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish/

# Publish Web Output
*.Publish.xml

Expand Down
22 changes: 22 additions & 0 deletions build/Publish/Publish.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup>
<BuildTasksFeedDllVersion>1.0.0-prerelease-01929-02</BuildTasksFeedDllVersion>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)\PublishNupkgToTransportFeed.targets" />

<PropertyGroup>
<TargetFramework>net46</TargetFramework>
<CopyBuildOutputToOutputDirectory>false</CopyBuildOutputToOutputDirectory>
<CopyOutputSymbolsToOutputDirectory>false</CopyOutputSymbolsToOutputDirectory>
<OutputType>Library</OutputType>
<GenerateDependencyFile>false</GenerateDependencyFile>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<NonShipping>true</NonShipping>
<NoStdLib>true</NoStdLib>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.DotNet.Build.Tasks.Feed" Version="$(BuildTasksFeedDllVersion)" />
</ItemGroup>
</Project>
63 changes: 63 additions & 0 deletions build/Publish/PublishNupkgToTransportFeed.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'Common.props'))\Common.props" />

<PropertyGroup>
<!-- Capture 'OutputPath' before Publish.csproj modifies it -->
<OutputPathTransportFeed>$(OutputPath)</OutputPathTransportFeed>
<BuildTasksFeedDll>$(NuGet_Packages)\Microsoft.DotNet.Build.Tasks.Feed\$(BuildTasksFeedDllVersion)\lib\desktop\Microsoft.DotNet.Build.Tasks.Feed.dll</BuildTasksFeedDll>
</PropertyGroup>

<UsingTask TaskName="PushToBlobFeed" AssemblyFile="$(BuildTasksFeedDll)" />

<ItemGroup>
<NupkgsForPublishing Include="$(OutputPathTransportFeed)Packages\Microsoft.NET.Sdk.*.nupkg" />
<NupkgsForPublishing Include="$(OutputPathTransportFeed)Packages\Microsoft.NET.Build.Extensions.*.nupkg" />
</ItemGroup>

<PropertyGroup>
<RelativePath>packages</RelativePath>
<TransportFeedContainerName>$(TRANSPORTFEED_STORAGE_CONTAINER)</TransportFeedContainerName>
<TransportFeedContainerName Condition="'$(TransportFeedContainerName)' == ''">dotnet-core</TransportFeedContainerName>
<TransportFeedCloudDropAccessToken>$(TRANSPORTFEED_STORAGE_KEY)</TransportFeedCloudDropAccessToken>
<TransportFeedCloudDropAccountName>$(TRANSPORTFEED_STORAGE_ACCOUNT)</TransportFeedCloudDropAccountName>
<TransportFeedCloudDropAccountName Condition="'$(TransportFeedCloudDropAccountName)' == ''">dotnetfeed</TransportFeedCloudDropAccountName>
</PropertyGroup>

<Target Name="PublishNupkgToTransportFeed"
Condition=" '$(PUBLISH_NUPKG_TO_TRANSPORT_FEED)' == 'true' "
DependsOnTargets="RestorePackageForTransportFeed;
PushNupkgToTransportFeed" />

<Target Name="RestorePackageForTransportFeed">
<PropertyGroup>
<NewLineTF>
<![CDATA[
]]>
</NewLineTF>
<SetNuget_PackagesTF>set NUGET_PACKAGES=$(NuGet_Packages)</SetNuget_PackagesTF>
<SetDotnet_Skip_FirstTime>set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true</SetDotnet_Skip_FirstTime>
<PublishProjectFile>"$(MSBuildThisFileDirectory)Publish.csproj"</PublishProjectFile>
</PropertyGroup>

<Exec Command="$(SetNuget_PackagesTF)$(NewLineTF)$(SetDotnet_Skip_FirstTime)$(NewLineTF)$(DotNetTool) restore $(PublishProjectFile) /v:minimal"
WorkingDirectory="$(RepositoryRootDirectory)" />
</Target>

<Target Name="PushNupkgToTransportFeed" >
<Error Condition="'$(TransportFeedContainerName)' == ''" Text="Missing property TransportFeedContainerName." />
<Error Condition="'$(TransportFeedCloudDropAccountName)' == ''" Text="Missing property TransportFeedCloudDropAccountName." />
<Error Condition="'$(TransportFeedCloudDropAccessToken)' == ''" Text="Missing property TransportFeedCloudDropAccessToken." />

<Message Text="Publish to $(TransportFeedContainerName) started" />
<PushToBlobFeed AccountKey="$(TransportFeedCloudDropAccessToken)"
AccountName="$(TransportFeedCloudDropAccountName)"
ContainerName="$(TransportFeedContainerName)"
IndexDirectory="$(IndexDirectory)"
ItemsToPush="@(NupkgsForPublishing)"
Overwrite="false"
PublishFlatContainer="false"
RelativePath="$(RelativePath)" />
</Target>

</Project>
19 changes: 17 additions & 2 deletions build/Targets/TestProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,31 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.NET.TestFramework;

class Program
{
public static int Main(string[] args)
{
var newArgs = args.ToList();
newArgs.Insert(0, typeof(Program).Assembly.Location);
var newArgs = TestCommandLine.HandleCommandLine(args, out bool showHelp);

// Help argument needs to be the first one to xunit, so don't insert assembly location in that case
if (showHelp)
{
newArgs.Insert(0, "/?");
}
else
{
newArgs.Insert(0, typeof(Program).Assembly.Location);
}

int returnCode = new Xunit.ConsoleClient.Program().EntryPoint(newArgs.ToArray());

if (showHelp)
{
TestCommandLine.ShowHelp();
}

return returnCode;
}
}
21 changes: 21 additions & 0 deletions src/Tasks/Common/CommandLine/TestCommandLine.Default.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Microsoft.NET.TestFramework
{
public class TestCommandLine
{
public static List<string> HandleCommandLine(string[] args, out bool showHelp)
{
// No additional command line options for these tests beyond what xunit supports
showHelp = false;
return args.ToList();
}

public static void ShowHelp()
{
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
</PackageReference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\Common\CommandLine\TestCommandLine.Default.cs" />
<Compile Include="GivenAGetDependsOnNETStandardTask.cs" />
<Compile Include="..\Microsoft.NET.Build.Tasks.UnitTests\Mocks\MockBuildEngine.cs" />
<Compile Include="..\Microsoft.NET.Build.Tasks.UnitTests\Mocks\MockTaskItem.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
<Compile Include="Constants.cs" />
<Compile Include="TestLockFiles.cs" />
<Compile Include="GivenARemoveDuplicatePackageReferences.cs" />
<Compile Include="..\Common\CommandLine\TestCommandLine.Default.cs" />
</ItemGroup>
<ItemGroup>
<None Include="all.asset.types.portable.deps.json">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Copyright (c) .NET Foundation. All rights reserved.
</Target>

<Target Name="_CollectTargetFrameworkForTelemetry" AfterTargets="_CheckForUnsupportedTargetFramework">
<Telemetry EventName="TargetFramework" EventData="version=$([MSBuild]::Escape('$(TargetFrameworkMoniker)'))" />
<Telemetry EventName="targetframeworkeval" EventData="TargetFrameworkVersion=$([MSBuild]::Escape('$(TargetFrameworkMoniker)'))" />
</Target>

<!--
Expand Down
14 changes: 10 additions & 4 deletions test/Microsoft.NET.Build.Tests/DeleteNuGetArtifactsFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,15 @@ public class ConstantStringValues
public static string NuGetSharedDirectoryNamePostfix = "_NuGetDependencies";
public static string NetstandardToken = "netstandard";
public static string DependencyDirectoryNamePrefix = "D_";
public static string NuGetPackageBaseDirectory = Path.Combine(
RepoInfo.GetBaseDirectory(),
TestDirectoriesNamePrefix + NuGetSharedDirectoryNamePostfix);
public static string NuGetPackageBaseDirectory
{
get
{
return Path.Combine(TestContext.Current.TestExecutionDirectory,
TestDirectoriesNamePrefix + NuGetSharedDirectoryNamePostfix);
}
}


public static string ConstructNuGetPackageReferencePath(TestProject dependencyProject)
{
Expand Down Expand Up @@ -47,7 +53,7 @@ private void DeleteNuGetArtifacts()
Directory.Delete(ConstantStringValues.NuGetPackageBaseDirectory, true);
}
// Delete the generated NuGet packages in the cache.
foreach (string dir in Directory.EnumerateDirectories(RepoInfo.NuGetCachePath, ConstantStringValues.DependencyDirectoryNamePrefix + "*"))
foreach (string dir in Directory.EnumerateDirectories(TestContext.Current.NuGetCachePath, ConstantStringValues.DependencyDirectoryNamePrefix + "*"))
{
Directory.Delete(dir, true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using Microsoft.NET.TestFramework.Assertions;
using Microsoft.NET.TestFramework.Commands;
using Xunit;
using static Microsoft.NET.TestFramework.Commands.MSBuildTest;
using Microsoft.DotNet.Cli.Utils;
using System.Xml.Linq;
using System.Runtime.CompilerServices;
Expand Down Expand Up @@ -93,7 +92,7 @@ internal static void TestSatelliteResources(
outputFiles.Add("AllResourcesInSatellite.deps.json");
outputFiles.Add("AllResourcesInSatellite.runtimeconfig.json");
outputFiles.Add("AllResourcesInSatellite.runtimeconfig.dev.json");
command = Command.Create(RepoInfo.DotNetHostPath, new[] { Path.Combine(outputDirectory.FullName, "AllResourcesInSatellite.dll") });
command = Command.Create(TestContext.Current.ToolsetUnderTest.DotNetHostPath, new[] { Path.Combine(outputDirectory.FullName, "AllResourcesInSatellite.dll") });
}

outputDirectory.Should().OnlyHaveFiles(outputFiles);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using Microsoft.NET.TestFramework.Assertions;
using Microsoft.NET.TestFramework.Commands;
using Xunit;
using static Microsoft.NET.TestFramework.Commands.MSBuildTest;
using System.Xml.Linq;
using System.Linq;
using FluentAssertions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
using FluentAssertions;
using Xunit;

using static Microsoft.NET.TestFramework.Commands.MSBuildTest;
using Xunit.Abstractions;
using System.Text.RegularExpressions;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public void It_resolves_conflicts(bool isSdk, bool usePackagesConfig)
target.Add(new XElement(ns + "FindUnderPath",
new XAttribute("Files", "@(_ConflictPackageFiles)"),
new XAttribute("Path", RepoInfo.BuildExtensionsMSBuildPath),
new XAttribute("Path", TestContext.Current.ToolsetUnderTest.BuildExtensionsMSBuildPath),
new XElement(ns + "Output",
new XAttribute("TaskParameter", "InPath"),
new XAttribute("ItemName", "_ConflictsInSupportLibs"))
Expand Down Expand Up @@ -287,7 +287,7 @@ public void It_does_not_include_netstandard_when_inbox(bool isSdk)
// Add a target that replaces the facade folder with the set of netstandard support assemblies
// this can be replaced by targeting the version of .NETFramework that includes netstandard inbox,
// once available
var facadesDir = Path.Combine(RepoInfo.BuildExtensionsMSBuildPath, "net461", "lib\\");
var facadesDir = Path.Combine(TestContext.Current.ToolsetUnderTest.BuildExtensionsMSBuildPath, "net461", "lib\\");
var ns = project.Root.Name.Namespace;
var target = new XElement(ns + "Target",
new XAttribute("Name", "ReplaceDesignTimeFacadeDirectories"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,11 +352,11 @@ public void It_uses_hintpath_when_replacing_simple_name_references(bool useFacad
string correctHttpReference;
if (useFacades)
{
correctHttpReference = Path.Combine(RepoInfo.BuildExtensionsMSBuildPath, @"net461\lib\System.Net.Http.dll");
correctHttpReference = Path.Combine(TestContext.Current.ToolsetUnderTest.BuildExtensionsMSBuildPath, @"net461\lib\System.Net.Http.dll");
}
else
{
correctHttpReference = Path.Combine(RepoInfo.NuGetCachePath, "system.net.http", "4.3.2", "ref", "net46", "System.Net.Http.dll");
correctHttpReference = Path.Combine(TestContext.Current.NuGetCachePath, "system.net.http", "4.3.2", "ref", "net46", "System.Net.Http.dll");
}

var valuesWithMetadata = getValuesCommand.GetValuesWithMetadata();
Expand Down
11 changes: 2 additions & 9 deletions test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using Microsoft.NET.TestFramework.Assertions;
using Microsoft.NET.TestFramework.Commands;
using Xunit;
using static Microsoft.NET.TestFramework.Commands.MSBuildTest;
using System.Linq;
using FluentAssertions;
using System.Xml.Linq;
Expand Down Expand Up @@ -79,12 +78,6 @@ public void It_builds_the_library_twice_in_a_row()
[Fact]
public void All_props_and_targets_add_themselves_to_MSBuildAllTargets()
{
// Workaround MSBuild bug causing preprocessing to fail if there is a "--" in a resolved Sdk path: https://github.com/Microsoft/msbuild/pull/1428
if (RepoInfo.RepoRoot.Contains("--"))
{
return;
}

// Disable this test when using full Framework MSBuild, as the paths to the props and targets are different
if (UsingFullFrameworkMSBuild)
{
Expand Down Expand Up @@ -135,7 +128,7 @@ public void All_props_and_targets_add_themselves_to_MSBuildAllTargets()
File.Delete(preprocessedFile);
}, valueType: GetValuesCommand.ValueType.Property);

string dotnetRoot = Path.GetDirectoryName(RepoInfo.DotNetHostPath);
string dotnetRoot = Path.GetDirectoryName(TestContext.Current.ToolsetUnderTest.DotNetHostPath);

expectedAllProjects = expectedAllProjects.Distinct().ToList();

Expand Down Expand Up @@ -739,4 +732,4 @@ public void It_can_target_uwp_using_sdk_extras()
.Pass();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
using System.Text;
using System.Xml.Linq;
using Xunit;
using static Microsoft.NET.TestFramework.Commands.MSBuildTest;
using Xunit.Abstractions;

namespace Microsoft.NET.Build.Tests
Expand Down Expand Up @@ -52,17 +51,17 @@ public void It_targets_the_right_shared_framework(string targetFramework, string
// Test behavior when implicit version differs for framework-dependent and self-contained apps
[Theory]
[InlineData("netcoreapp1.0", false, true, "1.0.5")]
[InlineData("netcoreapp1.0", true, true, RepoInfo.ImplicitRuntimeFrameworkVersionForSelfContainedNetCoreApp1_0)]
[InlineData("netcoreapp1.0", true, true, TestContext.ImplicitRuntimeFrameworkVersionForSelfContainedNetCoreApp1_0)]
[InlineData("netcoreapp1.0", false, false, "1.0.5")]
[InlineData("netcoreapp1.1", false, true, "1.1.2")]
[InlineData("netcoreapp1.1", true, true, RepoInfo.ImplicitRuntimeFrameworkVersionForSelfContainedNetCoreApp1_1)]
[InlineData("netcoreapp1.1", true, true, TestContext.ImplicitRuntimeFrameworkVersionForSelfContainedNetCoreApp1_1)]
[InlineData("netcoreapp1.1", false, false, "1.1.2")]
[InlineData("netcoreapp2.0", false, true, "2.0.0")]
[InlineData("netcoreapp2.0", true, true, RepoInfo.ImplicitRuntimeFrameworkVersionForSelfContainedNetCoreApp2_0)]
[InlineData("netcoreapp2.0", true, true, TestContext.ImplicitRuntimeFrameworkVersionForSelfContainedNetCoreApp2_0)]
[InlineData("netcoreapp2.0", false, false, "2.0.0")]
public void It_targets_the_right_framework_depending_on_output_type(string targetFramework, bool selfContained, bool isExe, string expectedFrameworkVersion)
{
string testIdentifier = "Framework_targeting_" + (isExe ? "App_" : "Lib_") + (selfContained ? "SelfContained" : "FrameworkDependent");
string testIdentifier = "Framework_targeting_" + targetFramework + "_" + (isExe ? "App_" : "Lib_") + (selfContained ? "SelfContained" : "FrameworkDependent");

It_targets_the_right_framework(testIdentifier, targetFramework, null, selfContained, isExe, expectedFrameworkVersion, expectedFrameworkVersion);
}
Expand Down Expand Up @@ -245,7 +244,7 @@ public static void Main()

string outputFolder = buildCommand.GetOutputDirectory(project.TargetFrameworks, runtimeIdentifier: runtimeIdentifier ?? "").FullName;

Command.Create(RepoInfo.DotNetHostPath, new[] { Path.Combine(outputFolder, project.Name + ".dll") })
Command.Create(TestContext.Current.ToolsetUnderTest.DotNetHostPath, new[] { Path.Combine(outputFolder, project.Name + ".dll") })
.CaptureStdOut()
.Execute()
.Should()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void It_collects_TargetFramework_version()
buildCommand
.Execute(TelemetryTestLogger)
.StdOut.Should()
.Contain("{\"EventName\":\"TargetFramework\",\"Properties\":{\"version\":\".NETCoreApp,Version=v1.0\"}");
.Contain("{\"EventName\":\"targetframeworkeval\",\"Properties\":{\"TargetFrameworkVersion\":\".NETCoreApp,Version=v1.0\"}");
}

[CoreMSBuildOnlyFact]
Expand All @@ -67,9 +67,9 @@ public void It_collects_multi_TargetFramework_version()
buildCommand
.Execute(TelemetryTestLogger)
.StdOut.Should()
.Contain("{\"EventName\":\"TargetFramework\",\"Properties\":{\"version\":\".NETFramework,Version=v4.6\"}")
.Contain("{\"EventName\":\"targetframeworkeval\",\"Properties\":{\"TargetFrameworkVersion\":\".NETFramework,Version=v4.6\"}")
.And
.Contain("{\"EventName\":\"TargetFramework\",\"Properties\":{\"version\":\".NETCoreApp,Version=v1.1\"}");
.Contain("{\"EventName\":\"targetframeworkeval\",\"Properties\":{\"TargetFrameworkVersion\":\".NETCoreApp,Version=v1.1\"}");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using Microsoft.NET.TestFramework.Assertions;
using Microsoft.NET.TestFramework.Commands;
using Xunit;
using static Microsoft.NET.TestFramework.Commands.MSBuildTest;
using System.Linq;
using FluentAssertions;
using System.Xml.Linq;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using System.Linq;
using System.Xml.Linq;
using Xunit;
using static Microsoft.NET.TestFramework.Commands.MSBuildTest;
using Xunit.Abstractions;

namespace Microsoft.NET.Build.Tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using Microsoft.NET.TestFramework.Commands;
using Xunit;
using Xunit.Abstractions;
using static Microsoft.NET.TestFramework.Commands.MSBuildTest;

namespace Microsoft.NET.Build.Tests
{
Expand Down
Loading

0 comments on commit 7fc8f64

Please sign in to comment.