Merge pull request #200 from dotnet/update_runtime

Update runtime version to 3.0.0-preview-27205-02
This commit is contained in:
Livar 2018-12-05 16:32:06 -08:00 committed by GitHub
commit 799a33c6ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 27 additions and 298 deletions

View file

@ -1,30 +0,0 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Linq;
using Microsoft.DotNet.Cli.CommandLine;
namespace Microsoft.DotNet.Tools.DependencyInvoker
{
public static class AppliedOptionExtensions
{
public static T ValueOrDefault<T>(this AppliedOption parseResult, string alias)
{
return parseResult
.AppliedOptions
.Where(o => o.HasAlias(alias))
.Select(o => o.Value<T>())
.SingleOrDefault();
}
public static string SingleArgumentOrDefault(this AppliedOption parseResult, string alias)
{
return parseResult
.AppliedOptions
.Where(o => o.HasAlias(alias))
.Select(o => o.Arguments.Single())
.SingleOrDefault();
}
}
}

View file

@ -1,57 +0,0 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.IO;
using System.Linq;
using Microsoft.DotNet.Cli.CommandLine;
using Microsoft.DotNet.Tools.Common;
using Microsoft.DotNet.Cli.Utils;
using NuGet.Frameworks;
namespace Microsoft.DotNet.Tools.DependencyInvoker
{
internal static class DotnetDependencyToolInvokerParser
{
public static Microsoft.DotNet.Cli.CommandLine.Command DotnetDependencyToolInvoker() =>
Create.Command(
"dotnet-dependency-tool-invoker",
"DotNet Dependency Tool Invoker",
Accept.ExactlyOneArgument()
.With(name: "COMMAND",
description: "The command to execute."),
false,
Create.Option(
"-h|--help",
"Show help information",
Accept.NoArguments()),
Create.Option(
"-p|--project-path",
"Path to Project.json that contains the tool dependency",
Accept.ExactlyOneArgument()
.With(name: "PROJECT_JSON_PATH",
defaultValue: () =>
PathUtility.EnsureTrailingSlash(Directory.GetCurrentDirectory()))),
Create.Option(
"-c|--configuration",
"Configuration under which to build",
Accept.ExactlyOneArgument()
.With(name: "CONFIGURATION",
defaultValue: () => Constants.DefaultConfiguration)),
Create.Option(
"-o|--output",
"Directory in which to find the binaries to be run",
Accept.ExactlyOneArgument()
.With(name: "OUTPUT_DIR")),
Create.Option(
"-f|--framework",
"Looks for test binaries for a specific framework",
Accept.ExactlyOneArgument()
.With(name: "FRAMEWORK")
.MaterializeAs(p => NuGetFramework.Parse(p.Arguments.Single()))),
Create.Option(
"-r|--runtime",
"Look for test binaries for a for the specified runtime",
Accept.ExactlyOneArgument()
.With(name: "RUNTIME_IDENTIFIER")));
}
}

View file

@ -1,110 +0,0 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using Microsoft.DotNet.Cli.CommandLine;
using Microsoft.DotNet.Cli.Utils;
using NuGet.Frameworks;
using Microsoft.DotNet.Tools.Common;
namespace Microsoft.DotNet.Tools.DependencyInvoker
{
public class Program
{
public static int Main(string[] args)
{
DebugHelper.HandleDebugSwitch(ref args);
args = new [] { "dotnet-dependency-tool-invoker" }.Concat(args).ToArray();
var parser = new Parser(
options: DotnetDependencyToolInvokerParser.DotnetDependencyToolInvoker());
var parseResult = parser.Parse(args);
var appliedOptions = parseResult["dotnet-dependency-tool-invoker"];
Console.WriteLine(parseResult.Diagram());
if (appliedOptions.HasOption("help"))
{
Console.WriteLine(parseResult.Command().HelpView());
return 0;
}
var command = appliedOptions.Arguments.First();
var framework = appliedOptions.ValueOrDefault<NuGetFramework>("framework");
var configuration = appliedOptions.ValueOrDefault<string>("configuration");
if (string.IsNullOrEmpty(configuration))
{
configuration = Constants.DefaultConfiguration;
}
var output = appliedOptions.SingleArgumentOrDefault("output");
var projectPath = appliedOptions.ValueOrDefault<string>("project-path");
if (string.IsNullOrEmpty(projectPath))
{
projectPath = PathUtility.EnsureTrailingSlash(Directory.GetCurrentDirectory());
}
var appArguments = parseResult.UnmatchedTokens;
var commandFactory =
new ProjectDependenciesCommandFactory(
framework,
configuration,
output,
string.Empty,
projectPath);
var result =
InvokeDependencyToolForMSBuild(commandFactory, command, framework, configuration, appArguments);
return result;
}
private static int InvokeDependencyToolForMSBuild(
ProjectDependenciesCommandFactory commandFactory,
string command,
NuGetFramework framework,
string configuration,
IEnumerable<string> appArguments)
{
Console.WriteLine($"Invoking '{command}' for '{framework.GetShortFolderName()}'.");
return InvokeDependencyTool(commandFactory, command, framework, configuration, appArguments);
}
private static int InvokeDependencyTool(
ProjectDependenciesCommandFactory commandFactory,
string command,
NuGetFramework framework,
string configuration,
IEnumerable<string> appArguments)
{
try
{
var exitCode = commandFactory.Create(
$"dotnet-{command}",
appArguments,
framework,
configuration)
.ForwardStdErr()
.ForwardStdOut()
.Execute()
.ExitCode;
Console.WriteLine($"Command returned {exitCode}");
}
catch (CommandUnknownException)
{
Console.WriteLine($"Command not found");
return 1;
}
return 0;
}
}
}

View file

@ -1,21 +0,0 @@
<Project>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), testAsset.props))\testAsset.props" />
<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.props" />
<PropertyGroup>
<VersionPrefix>1.0.0-rc</VersionPrefix>
<TargetFramework>$(CliTargetFramework)</TargetFramework>
<OutputType>Exe</OutputType>
<VersionSuffix></VersionSuffix>
<RuntimeFrameworkVersion>$(MicrosoftNETCoreAppPackageVersion)</RuntimeFrameworkVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NuGet.Frameworks" Version="$(NuGetFrameworksPackageVersion)" />
<PackageReference Include="Microsoft.DotNet.Cli.Utils" Version="$(MicrosoftDotNetCliUtilsPackageVersion)" />
<PackageReference Include="Microsoft.DotNet.Cli.CommandLine" Version="$(MicrosoftDotNetCliCommandLinePackageVersion)" />
<PackageReference Include="System.Linq" Version="4.3.0" />
</ItemGroup>
<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.targets" />
</Project>

View file

@ -1,15 +0,0 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
namespace MSBuildTestApp
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}

View file

@ -1,19 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), testAsset.props))\testAsset.props" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>$(CliTargetFramework)</TargetFramework>
<RestoreAdditionalProjectSources Condition="'$(TEST_PACKAGES)' != ''">$(TEST_PACKAGES)</RestoreAdditionalProjectSources>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="dotnet-portable" Version="1.0.0" >
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="dotnet-dependency-tool-invoker" Version="1.0.0-*" />
</ItemGroup>
</Project>

View file

@ -20,7 +20,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<MicrosoftNETCoreAppPackageVersion>3.0.0-preview-27122-01</MicrosoftNETCoreAppPackageVersion> <MicrosoftNETCoreAppPackageVersion>3.0.0-preview-27205-02</MicrosoftNETCoreAppPackageVersion>
<MicrosoftNETCoreDotNetHostResolverPackageVersion>$(MicrosoftNETCoreAppPackageVersion)</MicrosoftNETCoreDotNetHostResolverPackageVersion> <MicrosoftNETCoreDotNetHostResolverPackageVersion>$(MicrosoftNETCoreAppPackageVersion)</MicrosoftNETCoreDotNetHostResolverPackageVersion>
</PropertyGroup> </PropertyGroup>

View file

@ -1,10 +1,10 @@
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<NuGetFrameworksPackageVersion>4.8.0-rtm.5348</NuGetFrameworksPackageVersion> <NuGetFrameworksPackageVersion>5.0.0-preview1.5663</NuGetFrameworksPackageVersion>
<MicrosoftDotNetCliUtilsPackageVersion>3.0.100-alpha1-20180711-1</MicrosoftDotNetCliUtilsPackageVersion> <MicrosoftDotNetCliUtilsPackageVersion>3.0.100-preview.18580.6</MicrosoftDotNetCliUtilsPackageVersion>
<MicrosoftDotNetCliCommandLinePackageVersion>0.1.1</MicrosoftDotNetCliCommandLinePackageVersion> <MicrosoftDotNetCliCommandLinePackageVersion>0.1.1</MicrosoftDotNetCliCommandLinePackageVersion>
<MicrosoftNETTestSdkPackageVersion>15.8.0</MicrosoftNETTestSdkPackageVersion> <MicrosoftNETTestSdkPackageVersion>15.8.0</MicrosoftNETTestSdkPackageVersion>
<MicrosoftDotNetPlatformAbstractionsPackageVersion>3.0.0-preview-27122-01</MicrosoftDotNetPlatformAbstractionsPackageVersion> <MicrosoftDotNetPlatformAbstractionsPackageVersion>3.0.0-preview-27205-02</MicrosoftDotNetPlatformAbstractionsPackageVersion>
<MicrosoftDotNetProjectJsonMigrationPackageVersion>1.3.1</MicrosoftDotNetProjectJsonMigrationPackageVersion> <MicrosoftDotNetProjectJsonMigrationPackageVersion>1.3.1</MicrosoftDotNetProjectJsonMigrationPackageVersion>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View file

@ -20,16 +20,6 @@
<Target Name="SetupTestPackageProjectBaseData"> <Target Name="SetupTestPackageProjectBaseData">
<ItemGroup> <ItemGroup>
<BaseTestPackageProject Include="TestAssets/TestPackages/dotnet-dependency-tool-invoker">
<Name>dotnet-dependency-tool-invoker</Name>
<ProjectName>dotnet-dependency-tool-invoker.csproj</ProjectName>
<IsTool>True</IsTool>
<IsApplicable>True</IsApplicable>
<VersionPrefix>$(CliVersionPrefix)</VersionPrefix>
<VersionSuffix>$(VersionSuffix)</VersionSuffix>
<ReleaseSuffix>$(ReleaseSuffix)</ReleaseSuffix>
<Clean>True</Clean>
</BaseTestPackageProject>
<BaseTestPackageProject Include="TestAssets/TestPackages/dotnet-portable"> <BaseTestPackageProject Include="TestAssets/TestPackages/dotnet-portable">
<Name>dotnet-portable</Name> <Name>dotnet-portable</Name>
<ProjectName>dotnet-portable.csproj</ProjectName> <ProjectName>dotnet-portable.csproj</ProjectName>

View file

@ -95,33 +95,5 @@ namespace Microsoft.DotNet.Tests.EndToEnd
.Should().Pass() .Should().Pass()
.And.HaveStdOutContaining("Hello I prefer the cli runtime World!");; .And.HaveStdOutContaining("Hello I prefer the cli runtime World!");;
} }
[Fact(Skip="https://github.com/dotnet/cli/issues/9688")]
public void ItCanRunAToolThatInvokesADependencyToolInACSProj()
{
var repoDirectoriesProvider = new RepoDirectoriesProvider();
var testInstance = TestAssets.Get("TestAppWithProjDepTool")
.CreateInstance()
.WithSourceFiles()
.WithRestoreFiles();
var configuration = "Debug";
var testProjectDirectory = testInstance.Root;
new BuildCommand()
.WithWorkingDirectory(testProjectDirectory)
.Execute($"-c {configuration} ")
.Should()
.Pass();
new DotnetCommand()
.WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput(
$"-d dependency-tool-invoker -c {configuration} -f netcoreapp3.0 portable")
.Should().Pass()
.And.HaveStdOutContaining("Hello Portable World!");;
}
} }
} }

View file

@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<Description>Microsoft.DotNet.TestFramework Class Library</Description> <Description>Microsoft.DotNet.TestFramework Class Library</Description>
<VersionPrefix>$(CliVersionPrefix)</VersionPrefix> <VersionPrefix>$(CliVersionPrefix)</VersionPrefix>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<AssemblyOriginatorKeyFile>../../tools/Key.snk</AssemblyOriginatorKeyFile> <AssemblyOriginatorKeyFile>../../tools/Key.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly> <SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign> <PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>

View file

@ -3,6 +3,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
@ -251,7 +252,7 @@ namespace Microsoft.DotNet.TestFramework
Console.WriteLine($"TestAsset Build '{TestAssetInfo.AssetName}'"); Console.WriteLine($"TestAsset Build '{TestAssetInfo.AssetName}'");
var commandResult = Command.Create(TestAssetInfo.DotnetExeFile.FullName, args) var commandResult = CreateCommand(TestAssetInfo.DotnetExeFile.FullName, args)
.WorkingDirectory(Root.FullName) .WorkingDirectory(Root.FullName)
.CaptureStdOut() .CaptureStdOut()
.CaptureStdErr() .CaptureStdErr()
@ -280,7 +281,7 @@ namespace Microsoft.DotNet.TestFramework
{ {
var restoreArgs = new string[] { "restore", projectFile.FullName }; var restoreArgs = new string[] { "restore", projectFile.FullName };
var commandResult = Command.Create(TestAssetInfo.DotnetExeFile.FullName, restoreArgs) var commandResult = CreateCommand(TestAssetInfo.DotnetExeFile.FullName, restoreArgs)
.CaptureStdOut() .CaptureStdOut()
.CaptureStdErr() .CaptureStdErr()
.Execute(); .Execute();
@ -308,5 +309,23 @@ namespace Microsoft.DotNet.TestFramework
Restore(projFile); Restore(projFile);
} }
} }
private static Command CreateCommand(string path, IEnumerable<string> args)
{
var psi = new ProcessStartInfo
{
FileName = path,
Arguments = ArgumentEscaper.EscapeAndConcatenateArgArrayForProcessStart(args),
UseShellExecute = false
};
var _process = new Process
{
StartInfo = psi
};
return new Command(_process);
}
} }
} }

View file

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<Description>Microsoft.DotNet.Tools.Tests.Utilities Class Library</Description> <Description>Microsoft.DotNet.Tools.Tests.Utilities Class Library</Description>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<AssemblyName>Microsoft.DotNet.Tools.Tests.Utilities</AssemblyName> <AssemblyName>Microsoft.DotNet.Tools.Tests.Utilities</AssemblyName>
<AssemblyOriginatorKeyFile>../../tools/Key.snk</AssemblyOriginatorKeyFile> <AssemblyOriginatorKeyFile>../../tools/Key.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly> <SignAssembly>true</SignAssembly>