Merge pull request #985 from brthor/525/arg_forwarding

Argument Forwarding Changes #525
This commit is contained in:
Piotr Puszkiewicz 2016-01-23 20:55:56 -08:00
commit ea43482551
66 changed files with 1274 additions and 408 deletions

View file

@ -2,7 +2,7 @@
<configuration> <configuration>
<packageSources> <packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below --> <!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear /> <clear />
<add key="dotnet-core" value="https://www.myget.org/F/dotnet-core/api/v3/index.json" /> <add key="dotnet-core" value="https://www.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="nugetbuild" value="https://www.myget.org/F/nugetbuild/api/v3/index.json" /> <add key="nugetbuild" value="https://www.myget.org/F/nugetbuild/api/v3/index.json" />
<add key="AspNetCIDev" value="https://www.myget.org/F/aspnetcidev/api/v3/index.json" /> <add key="AspNetCIDev" value="https://www.myget.org/F/aspnetcidev/api/v3/index.json" />

View file

@ -10,7 +10,7 @@ param(
$toolsDir = $toolsDir.TrimEnd('\') $toolsDir = $toolsDir.TrimEnd('\')
$versionArg = "" $versionArg = ""
if ($versionSuffix -ne "") { if ($versionSuffix -ne "") {
$versionArg = "--version-suffix $versionSuffix" $versionArg = "--version-suffix"
} }
. "$PSScriptRoot\..\..\scripts\common\_common.ps1" . "$PSScriptRoot\..\..\scripts\common\_common.ps1"
@ -24,7 +24,7 @@ New-Item -ItemType Directory -Force -Path $IntermediatePackagesDir
foreach ($ProjectName in $ProjectsToPack) { foreach ($ProjectName in $ProjectsToPack) {
$ProjectFile = "$RepoRoot\src\$ProjectName\project.json" $ProjectFile = "$RepoRoot\src\$ProjectName\project.json"
& $toolsDir\dotnet pack "$ProjectFile" --basepath "$Stage2CompilationDir\bin" --output "$IntermediatePackagesDir" --configuration "$Configuration" $versionArg & $toolsDir\dotnet pack "$ProjectFile" --basepath "$Stage2CompilationDir\bin" --output "$IntermediatePackagesDir" --configuration "$Configuration" $versionArg $versionSuffix
if (!$?) { if (!$?) {
Write-Host "$toolsDir\dotnet pack failed for: $ProjectFile" Write-Host "$toolsDir\dotnet pack failed for: $ProjectFile"
Exit 1 Exit 1

View file

@ -5,17 +5,18 @@ REM This file encapsulates the temporary steps to build the dotnet-compile-nativ
REM The AppDepSDK package is a temporary artifact until we have CoreRT assemblies published to Nuget REM The AppDepSDK package is a temporary artifact until we have CoreRT assemblies published to Nuget
set __ScriptDir=%~dp0 set __ScriptDir=%~dp0
set __RepoRoot=%__ScriptDir%\..\.. set __RepoRoot=%__ScriptDir%..\..
set __AppDepsProjectDir=%__RepoRoot%\src\Microsoft.DotNet.Tools.Compiler.Native\appdep set __AppDepsProjectDir=%__RepoRoot%\src\Microsoft.DotNet.Tools.Compiler.Native\appdep
REM Get absolute path REM Get absolute path
pushd %1 pushd %1
set __OutputPath=%CD%\bin set __OutputPath=%__RepoRoot%\artifacts\win7-x64\stage2\bin
popd popd
pushd %__AppDepsProjectDir% pushd %__AppDepsProjectDir%
rmdir /S /Q packages rmdir /S /Q packages
mkdir packages
dotnet restore --packages %__AppDepsProjectDir%\packages dotnet restore --packages %__AppDepsProjectDir%\packages
set __AppDepSDK=%__AppDepsProjectDir%\packages\toolchain*\ set __AppDepSDK=%__AppDepsProjectDir%\packages\toolchain*\
popd popd

View file

@ -0,0 +1,38 @@
#
# 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.
#
. "$PSScriptRoot\..\common\_common.ps1"
$TestPackagesPath = "$RepoRoot\tests\packages"
$ArgTestRoot = "$RepoRoot\test\ArgumentForwardingTests"
$ArgTestOutputRoot = "$RepoRoot\artifacts\tests\arg-forwarding"
$ArgTestBin = "$ArgTestOutputRoot\$Configuration\dnxcore50"
dotnet publish --framework "dnxcore50" --runtime "$Rid" --output "$ArgTestOutputRoot" --configuration "$Configuration" "$ArgTestRoot\Reflector"
if (!$?) {
Write-Host Command failed: dotnet publish --framework "dnxcore50" --runtime "$Rid" --output "$ArgTestOutputRoot" --configuration "$Configuration" "$ArgTestRoot\Reflector"
Exit 1
}
dotnet publish --framework "dnxcore50" --runtime "$Rid" --output "$ArgTestOutputRoot" --configuration "$Configuration" "$ArgTestRoot\ArgumentForwardingTests"
if (!$?) {
Write-Host Command failed: dotnet publish --framework "dnxcore50" --runtime "$Rid" --output "$ArgTestOutputRoot" --configuration "$Configuration" "$ArgTestRoot\ArgumentForwardingTests"
Exit 1
}
cp "$ArgTestRoot\Reflector\reflector_cmd.cmd" "$ArgTestBin"
pushd "$ArgTestBin"
& ".\corerun" "xunit.console.netcore.exe" "ArgumentForwardingTests.dll" -xml "$_-testResults.xml" -notrait category=failing
$exitCode = $LastExitCode
popd
# No need to output here, we'll get test results
if ($exitCode -ne 0) {
Exit 1
}

View file

@ -0,0 +1,31 @@
#!/usr/bin/env bash
#
# 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.
#
set -e
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/../common/_common.sh"
ArgTestRoot="$REPOROOT/test/ArgumentForwardingTests"
ArgTestOutputRoot="$REPOROOT/artifacts/tests/arg-forwarding"
ArgTestBin="$ArgTestOutputRoot/$CONFIGURATION/dnxcore50"
dotnet publish --framework "dnxcore50" --output "$ArgTestOutputRoot" --configuration "$CONFIGURATION" "$ArgTestRoot/Reflector"
dotnet publish --framework "dnxcore50" --output "$ArgTestOutputRoot" --configuration "$CONFIGURATION" "$ArgTestRoot/ArgumentForwardingTests"
pushd "$ArgTestBin"
./corerun "xunit.console.netcore.exe" "ArgumentForwardingTests.dll" -xml "ArgumentForwardingTests-testResults.xml" -notrait category=failing
popd

View file

@ -17,6 +17,11 @@ $TestProjects = @(
"Microsoft.DotNet.Tools.Builder.Tests" "Microsoft.DotNet.Tools.Builder.Tests"
) )
$TestScripts = @(
"package-command-test.ps1",
"argument-forwarding-tests.ps1"
)
# Publish each test project # Publish each test project
$TestProjects | ForEach-Object { $TestProjects | ForEach-Object {
dotnet publish --framework "dnxcore50" --runtime "$Rid" --output "$TestBinRoot" --configuration "$Configuration" "$RepoRoot\test\$_" dotnet publish --framework "dnxcore50" --runtime "$Rid" --output "$TestBinRoot" --configuration "$Configuration" "$RepoRoot\test\$_"
@ -64,11 +69,13 @@ $TestProjects | ForEach-Object {
popd popd
& $RepoRoot\scripts\test\package-command-test.ps1 $TestScripts | ForEach-Object {
$exitCode = $LastExitCode & "$RepoRoot\scripts\test\$_"
if ($exitCode -ne 0) { $exitCode = $LastExitCode
$failCount += 1 if ($exitCode -ne 0) {
$failingTests += "package-command-test" $failingTests += "$_"
$failCount += 1
}
} }
if ($failCount -ne 0) { if ($failCount -ne 0) {

View file

@ -27,6 +27,11 @@ TestProjects=( \
Microsoft.DotNet.Tools.Builder.Tests \ Microsoft.DotNet.Tools.Builder.Tests \
) )
TestScripts=( \
"package-command-test.sh" \
"argument-forwarding-tests.sh" \
)
for project in ${TestProjects[@]} for project in ${TestProjects[@]}
do do
dotnet publish --framework "dnxcore50" --output "$TestBinRoot" --configuration "$CONFIGURATION" "$REPOROOT/test/$project" dotnet publish --framework "dnxcore50" --output "$TestBinRoot" --configuration "$CONFIGURATION" "$REPOROOT/test/$project"
@ -58,11 +63,15 @@ do
fi fi
done done
"$REPOROOT/scripts/test/package-command-test.sh" for script in ${TestScripts[@]}
if [ $? -ne 0 ]; then do
failCount+=1 "$REPOROOT/scripts/test/$script"
failedTests+=("package-command-test.sh") exitCode=$?
fi if [ $exitCode -ne 0 ]; then
failedTests+=($script)
failCount+=1
fi
done
for test in ${failedTests[@]} for test in ${failedTests[@]}
do do

View file

@ -0,0 +1,206 @@
// 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.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Microsoft.DotNet.Cli.Utils
{
public static class ArgumentEscaper
{
/// <summary>
/// Undo the processing which took place to create string[] args in Main,
/// so that the next process will receive the same string[] args
///
/// See here for more info:
/// http://blogs.msdn.com/b/twistylittlepassagesallalike/archive/2011/04/23/everyone-quotes-arguments-the-wrong-way.aspx
/// </summary>
/// <param name="args"></param>
/// <returns></returns>
public static string EscapeAndConcatenateArgArrayForProcessStart(IEnumerable<string> args)
{
return string.Join(" ", EscapeArgArray(args));
}
/// <summary>
/// Undo the processing which took place to create string[] args in Main,
/// so that the next process will receive the same string[] args
///
/// See here for more info:
/// http://blogs.msdn.com/b/twistylittlepassagesallalike/archive/2011/04/23/everyone-quotes-arguments-the-wrong-way.aspx
/// </summary>
/// <param name="args"></param>
/// <returns></returns>
public static string EscapeAndConcatenateArgArrayForCmdProcessStart(IEnumerable<string> args)
{
return string.Join(" ", EscapeArgArrayForCmd(args));
}
/// <summary>
/// Undo the processing which took place to create string[] args in Main,
/// so that the next process will receive the same string[] args
///
/// See here for more info:
/// http://blogs.msdn.com/b/twistylittlepassagesallalike/archive/2011/04/23/everyone-quotes-arguments-the-wrong-way.aspx
/// </summary>
/// <param name="args"></param>
/// <returns></returns>
private static IEnumerable<string> EscapeArgArray(IEnumerable<string> args)
{
var escapedArgs = new List<string>();
foreach (var arg in args)
{
escapedArgs.Add(EscapeArg(arg));
}
return escapedArgs;
}
/// <summary>
/// This prefixes every character with the '^' character to force cmd to
/// interpret the argument string literally. An alternative option would
/// be to do this only for cmd metacharacters.
///
/// See here for more info:
/// http://blogs.msdn.com/b/twistylittlepassagesallalike/archive/2011/04/23/everyone-quotes-arguments-the-wrong-way.aspx
/// </summary>
/// <param name="args"></param>
/// <returns></returns>
private static IEnumerable<string> EscapeArgArrayForCmd(IEnumerable<string> arguments)
{
var escapedArgs = new List<string>();
foreach (var arg in arguments)
{
escapedArgs.Add(EscapeArgForCmd(arg));
}
return escapedArgs;
}
private static string EscapeArg(string arg)
{
var sb = new StringBuilder();
var quoted = ShouldSurroundWithQuotes(arg);
if (quoted) sb.Append("\"");
for (int i = 0; i < arg.Length; ++i)
{
var backslashCount = 0;
// Consume All Backslashes
while (i < arg.Length && arg[i] == '\\')
{
backslashCount++;
i++;
}
// Escape any backslashes at the end of the arg
// This ensures the outside quote is interpreted as
// an argument delimiter
if (i == arg.Length)
{
sb.Append('\\', 2 * backslashCount);
}
// Escape any preceding backslashes and the quote
else if (arg[i] == '"')
{
sb.Append('\\', (2 * backslashCount) + 1);
sb.Append('"');
}
// Output any consumed backslashes and the character
else
{
sb.Append('\\', backslashCount);
sb.Append(arg[i]);
}
}
if (quoted) sb.Append("\"");
return sb.ToString();
}
/// <summary>
/// Prepare as single argument to
/// roundtrip properly through cmd.
///
/// This prefixes every character with the '^' character to force cmd to
/// interpret the argument string literally. An alternative option would
/// be to do this only for cmd metacharacters.
///
/// See here for more info:
/// http://blogs.msdn.com/b/twistylittlepassagesallalike/archive/2011/04/23/everyone-quotes-arguments-the-wrong-way.aspx
/// </summary>
/// <param name="args"></param>
/// <returns></returns>
private static string EscapeArgForCmd(string argument)
{
var sb = new StringBuilder();
var quoted = ShouldSurroundWithQuotes(argument);
if (quoted) sb.Append("^\"");
foreach (var character in argument)
{
if (character == '"')
{
sb.Append('^');
sb.Append('"');
sb.Append('^');
sb.Append(character);
}
else
{
sb.Append("^");
sb.Append(character);
}
}
if (quoted) sb.Append("^\"");
return sb.ToString();
}
/// <summary>
/// Prepare as single argument to
/// roundtrip properly through cmd.
///
/// This prefixes every character with the '^' character to force cmd to
/// interpret the argument string literally. An alternative option would
/// be to do this only for cmd metacharacters.
///
/// See here for more info:
/// http://blogs.msdn.com/b/twistylittlepassagesallalike/archive/2011/04/23/everyone-quotes-arguments-the-wrong-way.aspx
/// </summary>
/// <param name="args"></param>
/// <returns></returns>
internal static bool ShouldSurroundWithQuotes(string argument)
{
// Don't quote already quoted strings
if (argument.StartsWith("\"", StringComparison.Ordinal) &&
argument.EndsWith("\"", StringComparison.Ordinal))
{
return false;
}
// Only quote if whitespace exists in the string
if (argument.Contains(" ") || argument.Contains("\t") || argument.Contains("\n"))
{
return true;
}
return true;
}
}
}

View file

@ -39,20 +39,25 @@ namespace Microsoft.DotNet.Cli.Utils
ResolutionStrategy = commandSpec.ResolutionStrategy; ResolutionStrategy = commandSpec.ResolutionStrategy;
} }
public static Command Create(string commandName, IEnumerable<string> args, NuGetFramework framework = null) /// <summary>
/// Create a command with the specified arg array. Args will be
/// escaped properly to ensure that exactly the strings in this
/// array will be present in the corresponding argument array
/// in the command's process.
/// </summary>
/// <param name="commandName"></param>
/// <param name="args"></param>
/// <param name="framework"></param>
/// <returns></returns>
public static Command Create(string commandName, IEnumerable<string> args, NuGetFramework framework = null, bool useComSpec = false)
{ {
return Create(commandName, string.Join(" ", args), framework); var commandSpec = CommandResolver.TryResolveCommandSpec(commandName, args, framework, useComSpec=useComSpec);
}
public static Command Create(string commandName, string args, NuGetFramework framework = null)
{
var commandSpec = CommandResolver.TryResolveCommandSpec(commandName, args, framework);
if (commandSpec == null) if (commandSpec == null)
{ {
throw new CommandUnknownException(commandName); throw new CommandUnknownException(commandName);
} }
var command = new Command(commandSpec); var command = new Command(commandSpec);
return command; return command;
@ -60,6 +65,7 @@ namespace Microsoft.DotNet.Cli.Utils
public CommandResult Execute() public CommandResult Execute()
{ {
Reporter.Verbose.WriteLine($"Running {_process.StartInfo.FileName} {_process.StartInfo.Arguments}"); Reporter.Verbose.WriteLine($"Running {_process.StartInfo.FileName} {_process.StartInfo.Arguments}");
ThrowIfRunning(); ThrowIfRunning();

View file

@ -12,45 +12,52 @@ namespace Microsoft.DotNet.Cli.Utils
{ {
internal static class CommandResolver internal static class CommandResolver
{ {
public static CommandSpec TryResolveCommandSpec(string commandName, string args, NuGetFramework framework = null) public static CommandSpec TryResolveCommandSpec(string commandName, IEnumerable<string> args, NuGetFramework framework = null, bool useComSpec = false)
{ {
return ResolveFromRootedCommand(commandName, args) ?? return ResolveFromRootedCommand(commandName, args, useComSpec) ??
ResolveFromProjectDependencies(commandName, args, framework) ?? ResolveFromProjectDependencies(commandName, args, framework, useComSpec) ??
ResolveFromProjectTools(commandName, args) ?? ResolveFromProjectTools(commandName, args, useComSpec) ??
ResolveFromAppBase(commandName, args) ?? ResolveFromAppBase(commandName, args, useComSpec) ??
ResolveFromPath(commandName, args); ResolveFromPath(commandName, args, useComSpec);
} }
private static CommandSpec ResolveFromPath(string commandName, string args) private static CommandSpec ResolveFromPath(string commandName, IEnumerable<string> args, bool useComSpec = false)
{ {
var commandPath = Env.GetCommandPath(commandName); var commandPath = Env.GetCommandPath(commandName);
return commandPath == null return commandPath == null
? null ? null
: CreateCommandSpecPreferringExe(commandName, args, commandPath, CommandResolutionStrategy.Path); : CreateCommandSpecPreferringExe(commandName, args, commandPath, CommandResolutionStrategy.Path, useComSpec);
} }
private static CommandSpec ResolveFromAppBase(string commandName, string args) private static CommandSpec ResolveFromAppBase(string commandName, IEnumerable<string> args, bool useComSpec = false)
{ {
var commandPath = Env.GetCommandPathFromAppBase(AppContext.BaseDirectory, commandName); var commandPath = Env.GetCommandPathFromAppBase(AppContext.BaseDirectory, commandName);
return commandPath == null return commandPath == null
? null ? null
: CreateCommandSpecPreferringExe(commandName, args, commandPath, CommandResolutionStrategy.BaseDirectory); : CreateCommandSpecPreferringExe(commandName, args, commandPath, CommandResolutionStrategy.BaseDirectory, useComSpec);
} }
private static CommandSpec ResolveFromRootedCommand(string commandName, string args) private static CommandSpec ResolveFromRootedCommand(string commandName, IEnumerable<string> args, bool useComSpec = false)
{ {
if (Path.IsPathRooted(commandName)) if (Path.IsPathRooted(commandName))
{ {
return new CommandSpec(commandName, args, CommandResolutionStrategy.Path); if (useComSpec)
{
return CreateComSpecCommandSpec(commandName, args, CommandResolutionStrategy.Path);
}
else
{
var escapedArgs = ArgumentEscaper.EscapeAndConcatenateArgArrayForProcessStart(args);
return new CommandSpec(commandName, escapedArgs, CommandResolutionStrategy.Path);
}
} }
return null; return null;
} }
public static CommandSpec ResolveFromProjectDependencies(string commandName, string args, public static CommandSpec ResolveFromProjectDependencies(string commandName, IEnumerable<string> args,
NuGetFramework framework) NuGetFramework framework, bool useComSpec = false)
{ {
if (framework == null) return null; if (framework == null) return null;
@ -64,7 +71,7 @@ namespace Microsoft.DotNet.Cli.Utils
var depsPath = GetDepsPath(projectContext, Constants.DefaultConfiguration); var depsPath = GetDepsPath(projectContext, Constants.DefaultConfiguration);
return ConfigureCommandFromPackage(commandName, args, commandPackage, projectContext, depsPath); return ConfigureCommandFromPackage(commandName, args, commandPackage, projectContext, depsPath, useComSpec);
} }
private static ProjectContext GetProjectContext(NuGetFramework framework) private static ProjectContext GetProjectContext(NuGetFramework framework)
@ -93,7 +100,7 @@ namespace Microsoft.DotNet.Cli.Utils
e == FileNameSuffixes.DotNet.DynamicLib)); e == FileNameSuffixes.DotNet.DynamicLib));
} }
public static CommandSpec ResolveFromProjectTools(string commandName, string args) public static CommandSpec ResolveFromProjectTools(string commandName, IEnumerable<string> args, bool useComSpec = false)
{ {
var context = GetProjectContext(FrameworkConstants.CommonFrameworks.DnxCore50); var context = GetProjectContext(FrameworkConstants.CommonFrameworks.DnxCore50);
@ -129,7 +136,7 @@ namespace Microsoft.DotNet.Cli.Utils
: null; : null;
} }
private static CommandSpec ConfigureCommandFromPackage(string commandName, string args, string packageDir) private static CommandSpec ConfigureCommandFromPackage(string commandName, IEnumerable<string> args, string packageDir)
{ {
var commandPackage = new PackageFolderReader(packageDir); var commandPackage = new PackageFolderReader(packageDir);
@ -138,8 +145,8 @@ namespace Microsoft.DotNet.Cli.Utils
return ConfigureCommandFromPackage(commandName, args, files, packageDir); return ConfigureCommandFromPackage(commandName, args, files, packageDir);
} }
private static CommandSpec ConfigureCommandFromPackage(string commandName, string args, private static CommandSpec ConfigureCommandFromPackage(string commandName, IEnumerable<string> args,
PackageDescription commandPackage, ProjectContext projectContext, string depsPath = null) PackageDescription commandPackage, ProjectContext projectContext, string depsPath = null, bool useComSpec = false)
{ {
var files = commandPackage.Library.Files; var files = commandPackage.Library.Files;
@ -149,11 +156,11 @@ namespace Microsoft.DotNet.Cli.Utils
var packageDir = Path.Combine(packageRoot, packagePath); var packageDir = Path.Combine(packageRoot, packagePath);
return ConfigureCommandFromPackage(commandName, args, files, packageDir, depsPath); return ConfigureCommandFromPackage(commandName, args, files, packageDir, depsPath, useComSpec);
} }
private static CommandSpec ConfigureCommandFromPackage(string commandName, string args, private static CommandSpec ConfigureCommandFromPackage(string commandName, IEnumerable<string> args,
IEnumerable<string> files, string packageDir, string depsPath = null) IEnumerable<string> files, string packageDir, string depsPath = null, bool useComSpec = false)
{ {
var fileName = string.Empty; var fileName = string.Empty;
@ -169,21 +176,33 @@ namespace Microsoft.DotNet.Cli.Utils
fileName = CoreHost.HostExePath; fileName = CoreHost.HostExePath;
var depsArg = string.Empty; var additionalArgs = new List<string>();
additionalArgs.Add(dllPath);
if (depsPath != null) if (depsPath != null)
{ {
depsArg = $"\"--depsfile:{depsPath}\" "; additionalArgs.Add("--depsfile");
additionalArgs.Add(depsPath);
} }
args = $"\"{dllPath}\" {depsArg}{args}"; args = additionalArgs.Concat(args);
} }
else else
{ {
fileName = Path.Combine(packageDir, commandPath); fileName = Path.Combine(packageDir, commandPath);
} }
return new CommandSpec(fileName, args, CommandResolutionStrategy.NugetPackage); if (useComSpec)
{
return CreateComSpecCommandSpec(fileName, args, CommandResolutionStrategy.NugetPackage);
}
else
{
var escapedArgs = ArgumentEscaper.EscapeAndConcatenateArgArrayForProcessStart(args);
return new CommandSpec(fileName, escapedArgs, CommandResolutionStrategy.NugetPackage);
}
} }
private static string GetDepsPath(ProjectContext context, string buildConfiguration) private static string GetDepsPath(ProjectContext context, string buildConfiguration)
@ -192,23 +211,64 @@ namespace Microsoft.DotNet.Cli.Utils
context.ProjectFile.Name + FileNameSuffixes.Deps); context.ProjectFile.Name + FileNameSuffixes.Deps);
} }
private static CommandSpec CreateCommandSpecPreferringExe(string commandName, string args, string commandPath, private static CommandSpec CreateCommandSpecPreferringExe(
CommandResolutionStrategy resolutionStrategy) string commandName,
IEnumerable<string> args,
string commandPath,
CommandResolutionStrategy resolutionStrategy,
bool useComSpec = false)
{ {
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) &&
Path.GetExtension(commandPath).Equals(".cmd", StringComparison.OrdinalIgnoreCase)) Path.GetExtension(commandPath).Equals(".cmd", StringComparison.OrdinalIgnoreCase))
{ {
var preferredCommandPath = Env.GetCommandPath(commandName, ".exe"); var preferredCommandPath = Env.GetCommandPath(commandName, ".exe");
if (preferredCommandPath != null) // Use cmd if we can't find an exe
if (preferredCommandPath == null)
{ {
commandPath = Environment.GetEnvironmentVariable("ComSpec"); useComSpec = true;
}
args = $"/S /C \"\"{preferredCommandPath}\" {args}\""; else
{
commandPath = preferredCommandPath;
} }
} }
return new CommandSpec(commandPath, args, resolutionStrategy); if (useComSpec)
{
return CreateComSpecCommandSpec(commandPath, args, resolutionStrategy);
}
else
{
var escapedArgs = ArgumentEscaper.EscapeAndConcatenateArgArrayForProcessStart(args);
return new CommandSpec(commandPath, escapedArgs, resolutionStrategy);
}
}
private static CommandSpec CreateComSpecCommandSpec(
string command,
IEnumerable<string> args,
CommandResolutionStrategy resolutionStrategy)
{
// To prevent Command Not Found, comspec gets passed in as
// the command already in some cases
var comSpec = Environment.GetEnvironmentVariable("ComSpec");
if (command.Equals(comSpec, StringComparison.OrdinalIgnoreCase))
{
command = args.FirstOrDefault();
args = args.Skip(1);
}
var cmdEscapedArgs = ArgumentEscaper.EscapeAndConcatenateArgArrayForCmdProcessStart(args);
if (ArgumentEscaper.ShouldSurroundWithQuotes(command))
{
command = $"\"{command}\"";
}
var escapedArgString = $"/s /c \"{command} {cmdEscapedArgs}\"";
return new CommandSpec(comSpec, escapedArgString, resolutionStrategy);
} }
} }
} }

View file

@ -31,6 +31,8 @@ namespace Microsoft.DotNet.Cli.Utils
return null; return null;
} }
var useComSpec = false;
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{ {
// Only forward slashes are used in script blocks. Replace with backslashes to correctly // Only forward slashes are used in script blocks. Replace with backslashes to correctly
@ -45,10 +47,10 @@ namespace Microsoft.DotNet.Cli.Utils
var comSpec = Environment.GetEnvironmentVariable("ComSpec"); var comSpec = Environment.GetEnvironmentVariable("ComSpec");
if (!string.IsNullOrEmpty(comSpec)) if (!string.IsNullOrEmpty(comSpec))
{ {
scriptArguments = useComSpec=true;
new[] { comSpec, "/S", "/C", "\"" }
scriptArguments = new string[] { comSpec }
.Concat(scriptArguments) .Concat(scriptArguments)
.Concat(new[] { "\"" })
.ToArray(); .ToArray();
} }
} }
@ -88,7 +90,7 @@ namespace Microsoft.DotNet.Cli.Utils
.ToArray(); .ToArray();
} }
return Command.Create(scriptArguments.FirstOrDefault(), string.Join(" ", scriptArguments.Skip(1))) return Command.Create(scriptArguments.FirstOrDefault(), scriptArguments.Skip(1), useComSpec: useComSpec)
.WorkingDirectory(project.ProjectDirectory); .WorkingDirectory(project.ProjectDirectory);
} }
private static Func<string, string> WrapVariableDictionary(IDictionary<string, string> contextVariables) private static Func<string, string> WrapVariableDictionary(IDictionary<string, string> contextVariables)

View file

@ -119,7 +119,7 @@ Common Commands:
{ {
if (appArgs.Any()) if (appArgs.Any())
{ {
return Command.Create("dotnet-" + appArgs.First(), "--help") return Command.Create("dotnet-" + appArgs.First(), new string[] { "--help" })
.ForwardStdErr() .ForwardStdErr()
.ForwardStdOut() .ForwardStdOut()
.Execute() .Execute()

View file

@ -22,7 +22,7 @@ namespace Microsoft.DotNet.Cli.Compiler.Common
var existingAttributes = new List<Type>(); var existingAttributes = new List<Type>();
foreach (var sourceFile in sourceFiles) foreach (var sourceFile in sourceFiles)
{ {
var tree = CSharpSyntaxTree.ParseText(File.ReadAllText(sourceFile)); var tree = CSharpSyntaxTree.ParseText(File.ReadAllText(sourceFile.Trim('"')));
var root = tree.GetRoot(); var root = tree.GetRoot();
// assembly attributes can be only on first level // assembly attributes can be only on first level

View file

@ -6,7 +6,7 @@
}, },
"dependencies": { "dependencies": {
"NETStandard.Library": "1.0.0-rc2-23704", "NETStandard.Library": "1.0.0-rc2-23704",
"System.Threading.ThreadPool": "4.0.10-beta-23704", "System.Threading.ThreadPool": "4.0.10-rc2-23704",
"System.Runtime.Serialization.Primitives": "4.1.0-rc2-23704", "System.Runtime.Serialization.Primitives": "4.1.0-rc2-23704",
"Microsoft.DotNet.ProjectModel": "1.0.0-*", "Microsoft.DotNet.ProjectModel": "1.0.0-*",
"Microsoft.DotNet.Compiler.Common": "1.0.0-*", "Microsoft.DotNet.Compiler.Common": "1.0.0-*",
@ -14,8 +14,8 @@
"type": "build", "type": "build",
"version": "1.0.0-*" "version": "1.0.0-*"
}, },
"Microsoft.Extensions.Logging": "1.0.0-rc2-15935", "Microsoft.Extensions.Logging": "1.0.0-rc2-16011",
"Microsoft.Extensions.Logging.Console": "1.0.0-rc2-15935", "Microsoft.Extensions.Logging.Console": "1.0.0-rc2-16011",
"Newtonsoft.Json": "7.0.1" "Newtonsoft.Json": "7.0.1"
}, },
"frameworks": { "frameworks": {

View file

@ -13,7 +13,7 @@
"System.Xml.XDocument": "4.0.11-rc2-23704", "System.Xml.XDocument": "4.0.11-rc2-23704",
"NuGet.Packaging": "3.4.0-beta-*", "NuGet.Packaging": "3.4.0-beta-*",
"Microsoft.Extensions.FileSystemGlobbing": "1.0.0-rc2-15964", "Microsoft.Extensions.FileSystemGlobbing": "1.0.0-rc2-15975",
"Microsoft.Extensions.JsonParser.Sources": { "Microsoft.Extensions.JsonParser.Sources": {
"type": "build", "type": "build",
"version": "1.0.0-*" "version": "1.0.0-*"

View file

@ -125,7 +125,7 @@ namespace Microsoft.DotNet.Tools.Build
if (!newInputs.Any()) if (!newInputs.Any())
{ {
Reporter.Output.WriteLine($"\nProject {project.ProjectName()} was previoulsy compiled. Skipping compilation."); Reporter.Output.WriteLine($"\nProject {project.ProjectName()} was previously compiled. Skipping compilation.");
return false; return false;
} }
@ -220,7 +220,7 @@ namespace Microsoft.DotNet.Tools.Build
private void CollectCheckPathProbingPreconditions(ProjectContext project, IncrementalPreconditions preconditions) private void CollectCheckPathProbingPreconditions(ProjectContext project, IncrementalPreconditions preconditions)
{ {
var pathCommands = CompilerUtil.GetCommandsInvokedByCompile(project) var pathCommands = CompilerUtil.GetCommandsInvokedByCompile(project)
.Select(commandName => Command.Create(commandName, "", project.TargetFramework)) .Select(commandName => Command.Create(commandName, Enumerable.Empty<string>(), project.TargetFramework))
.Where(c => c.ResolutionStrategy.Equals(CommandResolutionStrategy.Path)); .Where(c => c.ResolutionStrategy.Equals(CommandResolutionStrategy.Path));
foreach (var pathCommand in pathCommands) foreach (var pathCommand in pathCommands)
@ -257,13 +257,24 @@ namespace Microsoft.DotNet.Tools.Build
private bool InvokeCompileOnDependency(ProjectDescription projectDependency) private bool InvokeCompileOnDependency(ProjectDescription projectDependency)
{ {
var compileResult = Command.Create("dotnet-compile", var args = new List<string>();
$"--framework {projectDependency.Framework} " +
$"--configuration {_args.ConfigValue} " + args.Add("--framework");
$"--output \"{_args.OutputValue}\" " + args.Add($"{projectDependency.Framework}");
$"--temp-output \"{_args.IntermediateValue}\" " + args.Add("--configuration");
(_args.NoHostValue ? "--no-host " : string.Empty) + args.Add($"{_args.ConfigValue}");
$"\"{projectDependency.Project.ProjectDirectory}\"") args.Add("--output");
args.Add($"{_args.OutputValue}");
args.Add("--temp-output");
args.Add($"{_args.IntermediateValue}");
args.Add($"{projectDependency.Project.ProjectDirectory}");
if (_args.NoHostValue)
{
args.Add("--no-host");
}
var compileResult = Command.Create("dotnet-compile", args)
.ForwardStdOut() .ForwardStdOut()
.ForwardStdErr() .ForwardStdErr()
.Execute(); .Execute();
@ -274,20 +285,59 @@ namespace Microsoft.DotNet.Tools.Build
private bool InvokeCompileOnRootProject() private bool InvokeCompileOnRootProject()
{ {
// todo: add methods to CompilerCommandApp to generate the arg string? // todo: add methods to CompilerCommandApp to generate the arg string?
var compileResult = Command.Create("dotnet-compile", var args = new List<string>();
$"--framework {_rootProject.TargetFramework} " + args.Add("--framework");
$"--configuration {_args.ConfigValue} " + args.Add(_rootProject.TargetFramework.ToString());
$"--output \"{_args.OutputValue}\" " + args.Add("--configuration");
$"--temp-output \"{_args.IntermediateValue}\" " + args.Add(_args.ConfigValue);
(_args.NoHostValue ? "--no-host " : string.Empty) + args.Add("--output");
//nativeArgs args.Add(_args.OutputValue);
(_args.IsNativeValue ? "--native " : string.Empty) + args.Add("--temp-output");
(_args.IsCppModeValue ? "--cpp " : string.Empty) + args.Add(_args.IntermediateValue);
(!string.IsNullOrWhiteSpace(_args.ArchValue) ? $"--arch {_args.ArchValue} " : string.Empty) +
(!string.IsNullOrWhiteSpace(_args.IlcArgsValue) ? $"--ilcargs \"{_args.IlcArgsValue}\" " : string.Empty) + if (_args.NoHostValue)
(!string.IsNullOrWhiteSpace(_args.IlcPathValue) ? $"--ilcpath \"{_args.IlcPathValue}\" " : string.Empty) + {
(!string.IsNullOrWhiteSpace(_args.IlcSdkPathValue) ? $"--ilcsdkpath \"{_args.IlcSdkPathValue}\" " : string.Empty) + args.Add("--no-host");
$"\"{_rootProject.ProjectDirectory}\"") }
//native args
if (_args.IsNativeValue)
{
args.Add("--native");
}
if (_args.IsCppModeValue)
{
args.Add("--cpp");
}
if (!string.IsNullOrWhiteSpace(_args.ArchValue))
{
args.Add("--arch");
args.Add(_args.ArchValue);
}
if (!string.IsNullOrWhiteSpace(_args.IlcArgsValue))
{
args.Add("--ilcargs");
args.Add(_args.IlcArgsValue);
}
if (!string.IsNullOrWhiteSpace(_args.IlcPathValue))
{
args.Add("--ilcpath");
args.Add(_args.IlcPathValue);
}
if (!string.IsNullOrWhiteSpace(_args.IlcSdkPathValue))
{
args.Add("--ilcsdkpath");
args.Add(_args.IlcSdkPathValue);
}
args.Add(_rootProject.ProjectDirectory);
var compileResult = Command.Create("dotnet-compile",args)
.ForwardStdOut() .ForwardStdOut()
.ForwardStdErr() .ForwardStdErr()
.Execute(); .Execute();

View file

@ -79,31 +79,33 @@ namespace Microsoft.DotNet.Tools.Compiler.Csc
return returnCode; return returnCode;
} }
var translated = TranslateCommonOptions(commonOptions, outputName); var translated = TranslateCommonOptions(commonOptions, outputName.Trim('"'));
var allArgs = new List<string>(translated); var allArgs = new List<string>(translated);
allArgs.AddRange(GetDefaultOptions()); allArgs.AddRange(GetDefaultOptions());
// Generate assembly info // Generate assembly info
var assemblyInfo = Path.Combine(tempOutDir, $"dotnet-compile.assemblyinfo.cs"); var tempOutputStrippedSpaces = tempOutDir.Trim('"');
var assemblyInfo = Path.Combine(tempOutputStrippedSpaces, $"dotnet-compile.assemblyinfo.cs");
File.WriteAllText(assemblyInfo, AssemblyInfoFileGenerator.Generate(assemblyInfoOptions, sources)); File.WriteAllText(assemblyInfo, AssemblyInfoFileGenerator.Generate(assemblyInfoOptions, sources));
allArgs.Add($"\"{assemblyInfo}\""); allArgs.Add($"\"{assemblyInfo}\"");
if (outputName != null) if (outputName != null)
{ {
allArgs.Add($"-out:\"{outputName}\""); allArgs.Add($"-out:\"{outputName.Trim('"')}\"");
} }
allArgs.AddRange(references.Select(r => $"-r:\"{r}\"")); allArgs.AddRange(references.Select(r => $"-r:\"{r.Trim('"')}\""));
allArgs.AddRange(resources.Select(resource => $"-resource:{resource}")); allArgs.AddRange(resources.Select(resource => $"-resource:{resource.Trim('"')}"));
allArgs.AddRange(sources.Select(s => $"\"{s}\"")); allArgs.AddRange(sources.Select(s => $"\"{s.Trim('"')}\""));
var rsp = Path.Combine(tempOutDir, "dotnet-compile-csc.rsp"); var rsp = Path.Combine(tempOutputStrippedSpaces, "dotnet-compile-csc.rsp");
File.WriteAllLines(rsp, allArgs, Encoding.UTF8); File.WriteAllLines(rsp, allArgs, Encoding.UTF8);
// Execute CSC! // Execute CSC!
var result = RunCsc($"-noconfig @\"{rsp}\"") var result = RunCsc(new string[] { $"-noconfig", "@" + $"{rsp}" })
.ForwardStdErr() .ForwardStdErr()
.ForwardStdOut() .ForwardStdOut()
.Execute(); .Execute();
@ -192,7 +194,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Csc
if (options.GenerateXmlDocumentation == true) if (options.GenerateXmlDocumentation == true)
{ {
commonArgs.Add($"-doc:{Path.ChangeExtension(outputName, "xml")}"); commonArgs.Add($"-doc:\"{Path.ChangeExtension(outputName.Trim('"'), "xml")}\"");
} }
if (options.EmitEntryPoint != true) if (options.EmitEntryPoint != true)
@ -214,7 +216,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Csc
return languageVersion; return languageVersion;
} }
private static Command RunCsc(string cscArgs) private static Command RunCsc(string[] cscArgs)
{ {
// Locate CoreRun // Locate CoreRun
return Command.Create("csc", cscArgs); return Command.Create("csc", cscArgs);

View file

@ -87,7 +87,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Fsc
// Generate assembly info // Generate assembly info
var assemblyInfo = Path.Combine(tempOutDir, $"dotnet-compile.assemblyinfo.fs"); var assemblyInfo = Path.Combine(tempOutDir, $"dotnet-compile.assemblyinfo.fs");
File.WriteAllText(assemblyInfo, AssemblyInfoFileGenerator.GenerateFSharp(assemblyInfoOptions)); File.WriteAllText(assemblyInfo, AssemblyInfoFileGenerator.GenerateFSharp(assemblyInfoOptions));
allArgs.Add($"\"{assemblyInfo}\""); allArgs.Add($"{assemblyInfo}");
//HACK fsc raise error FS0208 if target exe doesnt have extension .exe //HACK fsc raise error FS0208 if target exe doesnt have extension .exe
bool hackFS0208 = commonOptions.EmitEntryPoint == true; bool hackFS0208 = commonOptions.EmitEntryPoint == true;
@ -100,18 +100,32 @@ namespace Microsoft.DotNet.Tools.Compiler.Fsc
outputName = Path.ChangeExtension(outputName, ".exe"); outputName = Path.ChangeExtension(outputName, ".exe");
} }
allArgs.Add($"--out:\"{outputName}\""); allArgs.Add($"--out:");
allArgs.Add($"{outputName}");
} }
allArgs.AddRange(references.Select(r => $"-r:\"{r}\"")); foreach (var reference in references)
allArgs.AddRange(resources.Select(resource => $"--resource:{resource}")); {
allArgs.AddRange(sources.Select(s => $"\"{s}\"")); allArgs.Add("-r");
allArgs.Add($"{reference}");
}
foreach (var resource in resources)
{
allArgs.Add("--resource");
allArgs.Add($"{resource}");
}
foreach (var source in sources)
{
allArgs.Add($"{source}");
}
var rsp = Path.Combine(tempOutDir, "dotnet-compile-fsc.rsp"); var rsp = Path.Combine(tempOutDir, "dotnet-compile-fsc.rsp");
File.WriteAllLines(rsp, allArgs, Encoding.UTF8); File.WriteAllLines(rsp, allArgs, Encoding.UTF8);
// Execute FSC! // Execute FSC!
var result = RunFsc(string.Join(" ", allArgs)) var result = RunFsc(allArgs)
.ForwardStdErr() .ForwardStdErr()
.ForwardStdOut() .ForwardStdOut()
.Execute(); .Execute();
@ -192,11 +206,16 @@ namespace Microsoft.DotNet.Tools.Compiler.Fsc
return commonArgs; return commonArgs;
} }
private static Command RunFsc(string fscArgs) private static Command RunFsc(List<string> fscArgs)
{ {
var corerun = Path.Combine(AppContext.BaseDirectory, Constants.HostExecutableName); var corerun = Path.Combine(AppContext.BaseDirectory, Constants.HostExecutableName);
var fscExe = Path.Combine(AppContext.BaseDirectory, "fsc.exe"); var fscExe = Path.Combine(AppContext.BaseDirectory, "fsc.exe");
return Command.Create(corerun, $"\"{fscExe}\" {fscArgs}");
List<string> args = new List<string>();
args.Add(fscExe);
args.AddRange(fscArgs);
return Command.Create(corerun, args.ToArray());
} }
} }
} }

View file

@ -1,11 +1,6 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq;
using Microsoft.Dnx.Runtime.Common.CommandLine;
using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.Tools.Common;
namespace Microsoft.DotNet.Tools.Compiler.Native namespace Microsoft.DotNet.Tools.Compiler.Native
{ {
@ -13,15 +8,14 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
{ {
private readonly string ExecutableName = "corerun" + Constants.ExeSuffix; private readonly string ExecutableName = "corerun" + Constants.ExeSuffix;
private readonly string ILCompiler = "ilc.exe"; private readonly string ILCompiler = "ilc.exe";
private IEnumerable<string> Args;
private NativeCompileSettings config;
private static readonly Dictionary<NativeIntermediateMode, string> ModeOutputExtensionMap = new Dictionary<NativeIntermediateMode, string> private static readonly Dictionary<NativeIntermediateMode, string> ModeOutputExtensionMap = new Dictionary<NativeIntermediateMode, string>
{ {
{ NativeIntermediateMode.cpp, ".cpp" }, { NativeIntermediateMode.cpp, ".cpp" },
{ NativeIntermediateMode.ryujit, ".obj" } { NativeIntermediateMode.ryujit, ".obj" }
}; };
private string ArgStr { get; set; }
private NativeCompileSettings config;
public ILCompilerInvoker(NativeCompileSettings config) public ILCompilerInvoker(NativeCompileSettings config)
{ {
@ -39,28 +33,31 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
throw new FileNotFoundException("Unable to find ILCompiler at " + managedPath); throw new FileNotFoundException("Unable to find ILCompiler at " + managedPath);
} }
argsList.Add($"\"{managedPath}\""); argsList.Add($"{managedPath}");
// Input File // Input File
var inputFilePath = config.InputManagedAssemblyPath; var inputFilePath = config.InputManagedAssemblyPath;
argsList.Add($"\"{inputFilePath}\""); argsList.Add($"{inputFilePath}");
// System.Private.* References // System.Private.* References
var coreLibsPath = Path.Combine(config.IlcSdkPath, "sdk"); var coreLibsPath = Path.Combine(config.IlcSdkPath, "sdk");
foreach (var reference in Directory.EnumerateFiles(coreLibsPath, "*.dll")) foreach (var reference in Directory.EnumerateFiles(coreLibsPath, "*.dll"))
{ {
argsList.Add($"-r \"{reference}\""); argsList.Add($"-r");
argsList.Add($"{reference}");
} }
// AppDep References // AppDep References
foreach (var reference in config.ReferencePaths) foreach (var reference in config.ReferencePaths)
{ {
argsList.Add($"-r \"{reference}\""); argsList.Add($"-r");
argsList.Add($"{reference}");
} }
// Set Output DetermineOutFile // Set Output DetermineOutFile
var outFile = DetermineOutputFile(config); var outFile = DetermineOutputFile(config);
argsList.Add($"-out \"{outFile}\""); argsList.Add($"-out");
argsList.Add($"{outFile}");
// Add Mode Flag TODO // Add Mode Flag TODO
if (config.NativeMode == NativeIntermediateMode.cpp) if (config.NativeMode == NativeIntermediateMode.cpp)
@ -74,14 +71,14 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
argsList.Add(config.IlcArgs); argsList.Add(config.IlcArgs);
} }
this.ArgStr = string.Join(" ", argsList); Args = argsList;
} }
public int Invoke() public int Invoke()
{ {
var executablePath = Path.Combine(config.IlcPath, ExecutableName); var executablePath = Path.Combine(config.IlcPath, ExecutableName);
var result = Command.Create(executablePath, ArgStr) var result = Command.Create(executablePath, Args)
.ForwardStdErr() .ForwardStdErr()
.ForwardStdOut() .ForwardStdOut()
.Execute(); .Execute();

View file

@ -1,43 +1,35 @@
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 Microsoft.Dnx.Runtime.Common.CommandLine;
using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.Tools.Common;
namespace Microsoft.DotNet.Tools.Compiler.Native namespace Microsoft.DotNet.Tools.Compiler.Native
{ {
public class LinuxCppCompileStep : IPlatformNativeStep public class LinuxCppCompileStep : IPlatformNativeStep
{ {
private readonly string CompilerName = "clang-3.5"; private const string CompilerName = "clang-3.5";
private readonly string InputExtension = ".cpp"; private const string InputExtension = ".cpp";
// TODO: debug/release support // TODO: debug/release support
private readonly string cLibsFlags = "-lm -ldl"; private readonly string [] _cLibsFlags = { "-lm", "-ldl"};
private readonly string cflags = "-g -lstdc++ -lrt -Wno-invalid-offsetof -pthread"; private readonly string [] _cflags = { "-g", "-lstdc++", "-lrt", "-Wno-invalid-offsetof", "-pthread"};
private readonly string[] IlcSdkLibs = new string[] public IEnumerable<string> CompilerArgs { get; set; }
{
"libbootstrappercpp.a",
"libPortableRuntime.a",
"libSystem.Private.CoreLib.Native.a"
};
private readonly string[] appdeplibs = new string[] private readonly string[] _ilcSdkLibs =
{ {
"libSystem.Native.a" "libbootstrappercpp.a",
}; "libPortableRuntime.a",
"libSystem.Private.CoreLib.Native.a"
};
private readonly string[] _appdeplibs =
private string CompilerArgStr { get; set; } {
private NativeCompileSettings config; "libSystem.Native.a"
};
public LinuxCppCompileStep(NativeCompileSettings config) public LinuxCppCompileStep(NativeCompileSettings config)
{ {
this.config = config;
InitializeArgs(config); InitializeArgs(config);
} }
@ -63,11 +55,11 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
var argsList = new List<string>(); var argsList = new List<string>();
// Flags // Flags
argsList.Add(cflags); argsList.AddRange(_cflags);
var ilcSdkIncPath = Path.Combine(config.IlcSdkPath, "inc"); var ilcSdkIncPath = Path.Combine(config.IlcSdkPath, "inc");
argsList.Add("-I"); argsList.Add("-I");
argsList.Add($"\"{ilcSdkIncPath}\""); argsList.Add($"{ilcSdkIncPath}");
// Input File // Input File
var inCppFile = DetermineInFile(config); var inCppFile = DetermineInFile(config);
@ -80,33 +72,26 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
} }
// ILC SDK Libs // ILC SDK Libs
var IlcSdkLibPath = Path.Combine(config.IlcSdkPath, "sdk"); var ilcSdkLibPath = Path.Combine(config.IlcSdkPath, "sdk");
foreach (var lib in IlcSdkLibs) argsList.AddRange(_ilcSdkLibs.Select(lib => Path.Combine(ilcSdkLibPath, lib)));
{
var libPath = Path.Combine(IlcSdkLibPath, lib);
argsList.Add(libPath);
}
// AppDep Libs // AppDep Libs
var baseAppDeplibPath = Path.Combine(config.AppDepSDKPath, "CPPSdk/ubuntu.14.04/x64"); var baseAppDeplibPath = Path.Combine(config.AppDepSDKPath, "CPPSdk/ubuntu.14.04/x64");
foreach (var lib in appdeplibs) argsList.AddRange(_appdeplibs.Select(lib => Path.Combine(baseAppDeplibPath, lib)));
{
var appDeplibPath = Path.Combine(baseAppDeplibPath, lib);
argsList.Add(appDeplibPath);
}
argsList.Add(cLibsFlags); argsList.AddRange(_cLibsFlags);
// Output // Output
var libOut = DetermineOutputFile(config); var libOut = DetermineOutputFile(config);
argsList.Add($"-o \"{libOut}\""); argsList.Add($"-o");
argsList.Add($"{libOut}");
this.CompilerArgStr = string.Join(" ", argsList); CompilerArgs = argsList;
} }
private int InvokeCompiler() private int InvokeCompiler()
{ {
var result = Command.Create(CompilerName, CompilerArgStr) var result = Command.Create(CompilerName, CompilerArgs)
.ForwardStdErr() .ForwardStdErr()
.ForwardStdOut() .ForwardStdOut()
.Execute(); .Execute();

View file

@ -1,44 +1,34 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq;
using Microsoft.Dnx.Runtime.Common.CommandLine;
using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.Tools.Common; using System.Linq;
namespace Microsoft.DotNet.Tools.Compiler.Native namespace Microsoft.DotNet.Tools.Compiler.Native
{ {
public class LinuxRyuJitCompileStep : IPlatformNativeStep public class LinuxRyuJitCompileStep : IPlatformNativeStep
{ {
private readonly string CompilerName = "clang-3.5"; private const string CompilerName = "clang-3.5";
private readonly string InputExtension = ".obj"; private const string InputExtension = ".obj";
private const string CompilerOutputExtension = "";
private readonly string CompilerOutputExtension = ""; public List<string> CompilerArgs { get; set; }
// TODO: debug/release support // TODO: debug/release support
private readonly string cflags = "-lstdc++ -lpthread -ldl -lm -lrt"; private readonly string[] _cflags = {"-lstdc++", "-lpthread", "-ldl", "-lm", "-lrt"};
private readonly string[] _ilcSdkLibs =
{
"libbootstrapper.a",
"libRuntime.a",
"libSystem.Private.CoreLib.Native.a"
};
private readonly string[] IlcSdkLibs = new string[] private readonly string[] _appdeplibs =
{ {
"libbootstrapper.a", "libSystem.Native.a"
"libRuntime.a", };
"libSystem.Private.CoreLib.Native.a"
};
private readonly string[] appdeplibs = new string[]
{
"libSystem.Native.a"
};
private string CompilerArgStr { get; set; }
private NativeCompileSettings config;
public LinuxRyuJitCompileStep(NativeCompileSettings config) public LinuxRyuJitCompileStep(NativeCompileSettings config)
{ {
this.config = config;
InitializeArgs(config); InitializeArgs(config);
} }
@ -64,7 +54,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
var argsList = new List<string>(); var argsList = new List<string>();
// Flags // Flags
argsList.Add(cflags); argsList.AddRange(_cflags);
// Input File // Input File
var inLibFile = DetermineInFile(config); var inLibFile = DetermineInFile(config);
@ -77,31 +67,24 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
} }
// ILC SDK Libs // ILC SDK Libs
var IlcSdkLibPath = Path.Combine(config.IlcSdkPath, "sdk"); var ilcSdkLibPath = Path.Combine(config.IlcSdkPath, "sdk");
foreach (var lib in IlcSdkLibs) argsList.AddRange(_ilcSdkLibs.Select(lib => Path.Combine(ilcSdkLibPath, lib)));
{
var libPath = Path.Combine(IlcSdkLibPath, lib);
argsList.Add(libPath);
}
// AppDep Libs // AppDep Libs
var baseAppDepLibPath = Path.Combine(config.AppDepSDKPath, "CPPSdk/ubuntu.14.04", config.Architecture.ToString()); var baseAppDepLibPath = Path.Combine(config.AppDepSDKPath, "CPPSdk/ubuntu.14.04", config.Architecture.ToString());
foreach (var lib in appdeplibs) argsList.AddRange(_appdeplibs.Select(lib => Path.Combine(baseAppDepLibPath, lib)));
{
var appDepLibPath = Path.Combine(baseAppDepLibPath, lib);
argsList.Add(appDepLibPath);
}
// Output // Output
var libOut = DetermineOutputFile(config); var libOut = DetermineOutputFile(config);
argsList.Add($"-o \"{libOut}\""); argsList.Add($"-o");
argsList.Add($"{libOut}");
this.CompilerArgStr = string.Join(" ", argsList); CompilerArgs = argsList;
} }
private int InvokeCompiler() private int InvokeCompiler()
{ {
var result = Command.Create(CompilerName, CompilerArgStr) var result = Command.Create(CompilerName, CompilerArgs)
.ForwardStdErr() .ForwardStdErr()
.ForwardStdOut() .ForwardStdOut()
.Execute(); .Execute();

View file

@ -12,34 +12,32 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
{ {
public class MacCppCompileStep : IPlatformNativeStep public class MacCppCompileStep : IPlatformNativeStep
{ {
private readonly string CompilerName = "clang"; private const string CompilerName = "clang";
private readonly string InputExtension = ".cpp"; public const string InputExtension = ".cpp";
// TODO: debug/release support // TODO: debug/release support
private readonly string cflags = "-g -lstdc++ -Wno-invalid-offsetof -pthread"; private readonly string [] _cflags = { "-g", "-lstdc++", "-Wno-invalid-offsetof", "-pthread"};
// Link to iconv APIs // Link to iconv APIs
private readonly string libFlags = "-liconv"; private const string LibFlags = "-liconv";
private readonly string[] IlcSdkLibs = new string[] private readonly string[] _ilcSdkLibs =
{ {
"libbootstrappercpp.a", "libbootstrappercpp.a",
"libPortableRuntime.a", "libPortableRuntime.a",
"libSystem.Private.CoreLib.Native.a" "libSystem.Private.CoreLib.Native.a"
}; };
private readonly string[] appdeplibs = new string[] private readonly string[] _appdeplibs =
{ {
"libSystem.Native.a" "libSystem.Native.a"
}; };
private string CompilerArgStr { get; set; } private List<string> CompilerArgs { get; set; }
private NativeCompileSettings config;
public MacCppCompileStep(NativeCompileSettings config) public MacCppCompileStep(NativeCompileSettings config)
{ {
this.config = config;
InitializeArgs(config); InitializeArgs(config);
} }
@ -65,18 +63,18 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
var argsList = new List<string>(); var argsList = new List<string>();
// Flags // Flags
argsList.Add(cflags); argsList.AddRange(_cflags);
var ilcSdkIncPath = Path.Combine(config.IlcSdkPath, "inc"); var ilcSdkIncPath = Path.Combine(config.IlcSdkPath, "inc");
argsList.Add("-I"); argsList.Add("-I");
argsList.Add($"\"{ilcSdkIncPath}\""); argsList.Add($"{ilcSdkIncPath}");
// Input File // Input File
var inCppFile = DetermineInFile(config); var inCppFile = DetermineInFile(config);
argsList.Add(inCppFile); argsList.Add(inCppFile);
// Lib flags // Lib flags
argsList.Add(libFlags); argsList.Add(LibFlags);
// Pass the optional native compiler flags if specified // Pass the optional native compiler flags if specified
if (!string.IsNullOrWhiteSpace(config.CppCompilerFlags)) if (!string.IsNullOrWhiteSpace(config.CppCompilerFlags))
@ -85,11 +83,9 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
} }
// ILC SDK Libs // ILC SDK Libs
var IlcSdkLibPath = Path.Combine(config.IlcSdkPath, "sdk"); var ilcSdkLibPath = Path.Combine(config.IlcSdkPath, "sdk");
foreach (var lib in IlcSdkLibs) foreach (var libPath in _ilcSdkLibs.Select(lib => Path.Combine(ilcSdkLibPath, lib)))
{ {
var libPath = Path.Combine(IlcSdkLibPath, lib);
// Forward the library to linked to the linker // Forward the library to linked to the linker
argsList.Add("-Xlinker"); argsList.Add("-Xlinker");
argsList.Add(libPath); argsList.Add(libPath);
@ -97,23 +93,23 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
// AppDep Libs // AppDep Libs
var baseAppDeplibPath = Path.Combine(config.AppDepSDKPath, "CPPSdk/osx.10.10/x64"); var baseAppDeplibPath = Path.Combine(config.AppDepSDKPath, "CPPSdk/osx.10.10/x64");
foreach (var lib in appdeplibs) foreach (var appDeplibPath in _appdeplibs.Select(lib => Path.Combine(baseAppDeplibPath, lib)))
{ {
var appDeplibPath = Path.Combine(baseAppDeplibPath, lib);
argsList.Add("-Xlinker"); argsList.Add("-Xlinker");
argsList.Add(appDeplibPath); argsList.Add(appDeplibPath);
} }
// Output // Output
var libOut = DetermineOutputFile(config); var libOut = DetermineOutputFile(config);
argsList.Add($"-o \"{libOut}\""); argsList.Add($"-o");
argsList.Add($"{libOut}");
this.CompilerArgStr = string.Join(" ", argsList); CompilerArgs = argsList;
} }
private int InvokeCompiler() private int InvokeCompiler()
{ {
var result = Command.Create(CompilerName, CompilerArgStr) var result = Command.Create(CompilerName, CompilerArgs)
.ForwardStdErr() .ForwardStdErr()
.ForwardStdOut() .ForwardStdOut()
.Execute(); .Execute();

View file

@ -1,44 +1,36 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq;
using Microsoft.Dnx.Runtime.Common.CommandLine;
using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.Tools.Common; using System.Linq;
namespace Microsoft.DotNet.Tools.Compiler.Native namespace Microsoft.DotNet.Tools.Compiler.Native
{ {
public class MacRyuJitCompileStep : IPlatformNativeStep public class MacRyuJitCompileStep : IPlatformNativeStep
{ {
private readonly string CompilerName = "clang"; private const string CompilerName = "clang";
private readonly string InputExtension = ".obj"; private const string InputExtension = ".obj";
private readonly string CompilerOutputExtension = ""; private const string CompilerOutputExtension = "";
private IEnumerable<string> CompilerArgs;
// TODO: debug/release support // TODO: debug/release support
private readonly string cflags = "-g -lstdc++ -Wno-invalid-offsetof -pthread -ldl -lm -liconv"; private readonly string [] _cflags = { "-g", "-lstdc++", "-Wno-invalid-offsetof", "-pthread", "-ldl", "-lm", "-liconv" };
private readonly string[] IlcSdkLibs = new string[] private readonly string[] _ilcSdkLibs =
{ {
"libbootstrapper.a", "libbootstrapper.a",
"libRuntime.a", "libRuntime.a",
"libSystem.Private.CoreLib.Native.a" "libSystem.Private.CoreLib.Native.a"
}; };
private readonly string[] appdeplibs = new string[] private readonly string[] appdeplibs =
{ {
"libSystem.Native.a" "libSystem.Native.a"
}; };
private string CompilerArgStr { get; set; }
private NativeCompileSettings config;
public MacRyuJitCompileStep(NativeCompileSettings config) public MacRyuJitCompileStep(NativeCompileSettings config)
{ {
this.config = config;
InitializeArgs(config); InitializeArgs(config);
} }
@ -64,7 +56,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
var argsList = new List<string>(); var argsList = new List<string>();
// Flags // Flags
argsList.Add(cflags); argsList.AddRange(_cflags);
// Pass the optional native compiler flags if specified // Pass the optional native compiler flags if specified
if (!string.IsNullOrWhiteSpace(config.CppCompilerFlags)) if (!string.IsNullOrWhiteSpace(config.CppCompilerFlags))
@ -77,31 +69,24 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
argsList.Add("-Xlinker "+inLibFile); argsList.Add("-Xlinker "+inLibFile);
// ILC SDK Libs // ILC SDK Libs
var IlcSdkLibPath = Path.Combine(config.IlcSdkPath, "sdk"); var ilcSdkLibPath = Path.Combine(config.IlcSdkPath, "sdk");
foreach (var lib in IlcSdkLibs) argsList.AddRange(_ilcSdkLibs.Select(lib => Path.Combine(ilcSdkLibPath, lib)).Select(libPath => "-Xlinker " + libPath));
{
var libPath = Path.Combine(IlcSdkLibPath, lib);
argsList.Add("-Xlinker "+libPath);
}
// AppDep Libs // AppDep Libs
var baseAppDepLibPath = Path.Combine(config.AppDepSDKPath, "CPPSdk/osx.10.10", config.Architecture.ToString()); var baseAppDepLibPath = Path.Combine(config.AppDepSDKPath, "CPPSdk/osx.10.10", config.Architecture.ToString());
foreach (var lib in appdeplibs) argsList.AddRange(appdeplibs.Select(lib => Path.Combine(baseAppDepLibPath, lib)).Select(appDepLibPath => "-Xlinker " + appDepLibPath));
{
var appDepLibPath = Path.Combine(baseAppDepLibPath, lib);
argsList.Add("-Xlinker "+appDepLibPath);
}
// Output // Output
var libOut = DetermineOutputFile(config); var libOut = DetermineOutputFile(config);
argsList.Add($"-o \"{libOut}\""); argsList.Add($"-o");
argsList.Add($"{libOut}");
this.CompilerArgStr = string.Join(" ", argsList); this.CompilerArgs = argsList;
} }
private int InvokeCompiler() private int InvokeCompiler()
{ {
var result = Command.Create(CompilerName, CompilerArgStr) var result = Command.Create(CompilerName, CompilerArgs)
.ForwardStdErr() .ForwardStdErr()
.ForwardStdOut() .ForwardStdOut()
.Execute(); .Execute();

View file

@ -20,13 +20,13 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
private readonly string CompilerOutputExtension = ".obj"; private readonly string CompilerOutputExtension = ".obj";
private static readonly Dictionary<BuildConfiguration, string> ConfigurationCompilerOptionsMap = new Dictionary<BuildConfiguration, string> private static readonly Dictionary<BuildConfiguration, string[]> ConfigurationCompilerOptionsMap = new Dictionary<BuildConfiguration, string[]>
{ {
{ BuildConfiguration.debug, "/ZI /nologo /W3 /WX- /sdl /Od /D CPPCODEGEN /D WIN32 /D _CONSOLE /D _LIB /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MD /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Gd /TP /wd4477 /errorReport:prompt" }, { BuildConfiguration.debug, new string[] {"/ZI", "/nologo", "/W3", "/WX-", "/sdl", "/Od", "/D", "CPPCODEGEN", "/D", "WIN32", "/D", "_CONSOLE", "/D", "_LIB", "/D", "_UNICODE", "/D", "UNICODE", "/Gm", "/EHsc", "/RTC1", "/MD", "/GS", "/fp:precise", "/Zc:wchar_t", "/Zc:forScope", "/Zc:inline", "/Gd", "/TP", "/wd4477", "/errorReport:prompt"} },
{ BuildConfiguration.release, "/Zi /nologo /W3 /WX- /sdl /O2 /Oi /GL /D CPPCODEGEN /D WIN32 /D NDEBUG /D _CONSOLE /D _LIB /D _UNICODE /D UNICODE /Gm- /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Gd /TP /wd4477 /errorReport:prompt" } { BuildConfiguration.release, new string[] {"/Zi", "/nologo", "/W3", "/WX-", "/sdl", "/O2", "/Oi", "/GL", "/D", "CPPCODEGEN", "/D", "WIN32", "/D", "NDEBUG", "/D", "_CONSOLE", "/D", "_LIB", "/D", "_UNICODE", "/D", "UNICODE", "/Gm-", "/EHsc", "/MD", "/GS", "/Gy", "/fp:precise", "/Zc:wchar_t", "/Zc:forScope", "/Zc:inline", "/Gd", "/TP", "/wd4477", "/errorReport:prompt"} }
}; };
private string CompilerArgStr { get; set; } private IEnumerable<string> CompilerArgs { get; set; }
private NativeCompileSettings config; private NativeCompileSettings config;
@ -70,10 +70,10 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
// Add Includes // Add Includes
var ilcSdkIncPath = Path.Combine(config.IlcSdkPath, "inc"); var ilcSdkIncPath = Path.Combine(config.IlcSdkPath, "inc");
argsList.Add("/I"); argsList.Add("/I");
argsList.Add($"\"{ilcSdkIncPath}\""); argsList.Add($"{ilcSdkIncPath}");
// Configuration Based Compiler Options // Configuration Based Compiler Options
argsList.Add(ConfigurationCompilerOptionsMap[config.BuildType]); argsList.AddRange(ConfigurationCompilerOptionsMap[config.BuildType]);
// Pass the optional native compiler flags if specified // Pass the optional native compiler flags if specified
if (!string.IsNullOrWhiteSpace(config.CppCompilerFlags)) if (!string.IsNullOrWhiteSpace(config.CppCompilerFlags))
@ -83,13 +83,13 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
// Output // Output
var objOut = DetermineOutputFile(config); var objOut = DetermineOutputFile(config);
argsList.Add($"/Fo\"{objOut}\""); argsList.Add($"/Fo{objOut}");
// Input File // Input File
var inCppFile = DetermineInFile(config); var inCppFile = DetermineInFile(config);
argsList.Add($"\"{inCppFile}\""); argsList.Add($"{inCppFile}");
this.CompilerArgStr = string.Join(" ", argsList); this.CompilerArgs = argsList;
} }
private int InvokeCompiler() private int InvokeCompiler()
@ -97,7 +97,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
var vcInstallDir = Environment.GetEnvironmentVariable("VS140COMNTOOLS"); var vcInstallDir = Environment.GetEnvironmentVariable("VS140COMNTOOLS");
var compilerPath = Path.Combine(vcInstallDir, VSBin, CompilerName); var compilerPath = Path.Combine(vcInstallDir, VSBin, CompilerName);
var result = Command.Create(compilerPath, CompilerArgStr) var result = Command.Create(compilerPath, CompilerArgs.ToArray())
.ForwardStdErr() .ForwardStdErr()
.ForwardStdOut() .ForwardStdOut()
.Execute(); .Execute();

View file

@ -54,7 +54,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
{ BuildConfiguration.release , new string[] { "msvcrt.lib" } } { BuildConfiguration.release , new string[] { "msvcrt.lib" } }
}; };
private string ArgStr { get; set; } private IEnumerable<string> Args { get; set; }
private NativeCompileSettings config; private NativeCompileSettings config;
public WindowsLinkStep(NativeCompileSettings config) public WindowsLinkStep(NativeCompileSettings config)
@ -95,10 +95,13 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
//Output //Output
var outFile = DetermineOutputFile(config); var outFile = DetermineOutputFile(config);
argsList.Add($"/out:\"{outFile}\""); argsList.Add($"/out:{outFile}");
// Constant Libs // Constant Libs
argsList.Add(string.Join(" ", ConstantLinkLibs)); foreach (var lib in ConstantLinkLibs)
{
argsList.Add(lib);
}
// ILC SDK Libs // ILC SDK Libs
var SDKLibs = IlcSdkLibMap[config.NativeMode]; var SDKLibs = IlcSdkLibMap[config.NativeMode];
@ -106,19 +109,19 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
foreach (var lib in SDKLibs) foreach (var lib in SDKLibs)
{ {
var sdkLibPath = Path.Combine(IlcSdkLibPath, lib); var sdkLibPath = Path.Combine(IlcSdkLibPath, lib);
argsList.Add($"\"{sdkLibPath}\""); argsList.Add($"{sdkLibPath}");
} }
// Configuration Based Libs // Configuration Based Libs
var configLibs = ConfigurationLinkLibMap[config.BuildType]; var configLibs = ConfigurationLinkLibMap[config.BuildType];
foreach (var lib in configLibs) foreach (var lib in configLibs)
{ {
argsList.Add($"\"{lib}\""); argsList.Add($"{lib}");
} }
// Link Libs // Link Libs
foreach(var path in config.LinkLibPaths){ foreach(var path in config.LinkLibPaths){
argsList.Add($"\"{path}\""); argsList.Add($"{path}");
} }
//arch //arch
@ -126,9 +129,9 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
//Input Obj file //Input Obj file
var inputFile = DetermineInputFile(config); var inputFile = DetermineInputFile(config);
argsList.Add($"\"{inputFile}\""); argsList.Add($"{inputFile}");
this.ArgStr = string.Join(" ", argsList); this.Args = argsList;
} }
private int InvokeLinker() private int InvokeLinker()
@ -136,7 +139,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
var vcInstallDir = Environment.GetEnvironmentVariable("VS140COMNTOOLS"); var vcInstallDir = Environment.GetEnvironmentVariable("VS140COMNTOOLS");
var linkerPath = Path.Combine(vcInstallDir, VSBin, LinkerName); var linkerPath = Path.Combine(vcInstallDir, VSBin, LinkerName);
var result = Command.Create(linkerPath, ArgStr) var result = Command.Create(linkerPath, Args.ToArray())
.ForwardStdErr() .ForwardStdErr()
.ForwardStdOut() .ForwardStdOut()
.Execute(); .Execute();

View file

@ -5,7 +5,7 @@
"emitEntryPoint": true "emitEntryPoint": true
}, },
"dependencies": { "dependencies": {
"Microsoft.NETCore.Platforms": "1.0.1-*", "Microsoft.NETCore.Platforms": "1.0.1-rc2-23704",
"Microsoft.DotNet.AppDep":"1.0.4-*" "Microsoft.DotNet.AppDep":"1.0.4-*"
}, },
"frameworks": { "frameworks": {

View file

@ -150,7 +150,7 @@ namespace Microsoft.DotNet.Tools.Compiler
// Need CoreRT Framework published to nuget // Need CoreRT Framework published to nuget
// Do Native Compilation // Do Native Compilation
var result = Command.Create("dotnet-compile-native", $"--rsp \"{rsp}\"") var result = Command.Create("dotnet-compile-native", new string[] { "--rsp", $"{rsp}" })
.ForwardStdErr() .ForwardStdErr()
.ForwardStdOut() .ForwardStdOut()
.Execute(); .Execute();
@ -207,8 +207,8 @@ namespace Microsoft.DotNet.Tools.Compiler
// Assemble args // Assemble args
var compilerArgs = new List<string>() var compilerArgs = new List<string>()
{ {
$"--temp-output:{intermediateOutputPath}", $"--temp-output:\"{intermediateOutputPath}\"",
$"--out:{outputName}" $"--out:\"{outputName}\""
}; };
var compilationOptions = CompilerUtil.ResolveCompilationOptions(context, args.ConfigValue); var compilationOptions = CompilerUtil.ResolveCompilationOptions(context, args.ConfigValue);
@ -238,10 +238,10 @@ namespace Microsoft.DotNet.Tools.Compiler
references.AddRange(dependency.CompilationAssemblies.Select(r => r.ResolvedPath)); references.AddRange(dependency.CompilationAssemblies.Select(r => r.ResolvedPath));
} }
compilerArgs.AddRange(dependency.SourceReferences); compilerArgs.AddRange(dependency.SourceReferences.Select(s => $"\"{s}\""));
} }
compilerArgs.AddRange(references.Select(r => $"--reference:{r}")); compilerArgs.AddRange(references.Select(r => $"--reference:\"{r}\""));
if (compilationOptions.PreserveCompilationContext == true) if (compilationOptions.PreserveCompilationContext == true)
{ {
@ -258,7 +258,7 @@ namespace Microsoft.DotNet.Tools.Compiler
writer.Write(dependencyContext, fileStream); writer.Write(dependencyContext, fileStream);
} }
compilerArgs.Add($"--resource:\"{depsJsonFile}\",{context.ProjectFile.Name}.deps.json"); compilerArgs.Add($"--resource:\"{depsJsonFile},{context.ProjectFile.Name}.deps.json\"");
var refsFolder = Path.Combine(outputPath, "refs"); var refsFolder = Path.Combine(outputPath, "refs");
if (Directory.Exists(refsFolder)) if (Directory.Exists(refsFolder))
@ -298,7 +298,7 @@ namespace Microsoft.DotNet.Tools.Compiler
}; };
RunScripts(context, ScriptNames.PreCompile, contextVariables); RunScripts(context, ScriptNames.PreCompile, contextVariables);
var result = Command.Create($"dotnet-compile-{compilerName}", $"@\"{rsp}\"") var result = Command.Create($"dotnet-compile-{compilerName}", new string[] {"@" + $"{rsp}" })
.OnErrorLine(line => .OnErrorLine(line =>
{ {
var diagnostic = ParseDiagnostic(context.ProjectDirectory, line); var diagnostic = ParseDiagnostic(context.ProjectDirectory, line);
@ -423,7 +423,14 @@ namespace Microsoft.DotNet.Tools.Compiler
{ {
var result = var result =
Command.Create("dotnet-resgen", Command.Create("dotnet-resgen",
$"\"{resgenFile.InputFile}\" -o \"{resgenFile.OutputFile}\" -v \"{project.Version.Version}\"") new string[]
{
$"{resgenFile.InputFile}",
"-o",
$"{resgenFile.OutputFile}",
"-v",
$"{project.Version.Version}"
})
.ForwardStdErr() .ForwardStdErr()
.ForwardStdOut() .ForwardStdOut()
.Execute(); .Execute();
@ -433,11 +440,11 @@ namespace Microsoft.DotNet.Tools.Compiler
return false; return false;
} }
compilerArgs.Add($"--resource:\"{resgenFile.OutputFile}\",{Path.GetFileName(resgenFile.MetadataName)}"); compilerArgs.Add($"--resource:\"{resgenFile.OutputFile},{Path.GetFileName(resgenFile.MetadataName)}\"");
} }
else else
{ {
compilerArgs.Add($"--resource:\"{resgenFile.InputFile}\",{Path.GetFileName(resgenFile.MetadataName)}"); compilerArgs.Add($"--resource:\"{resgenFile.InputFile},{Path.GetFileName(resgenFile.MetadataName)}\"");
} }
} }

View file

@ -5,6 +5,7 @@ using System.Linq;
using System.Text; using System.Text;
using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.ProjectModel; using Microsoft.DotNet.ProjectModel;
using System.Collections.Generic;
namespace Microsoft.DotNet.Tools.Pack namespace Microsoft.DotNet.Tools.Pack
{ {
@ -39,22 +40,25 @@ namespace Microsoft.DotNet.Tools.Pack
if (_project.Files.SourceFiles.Any()) if (_project.Files.SourceFiles.Any())
{ {
var argsBuilder = new StringBuilder(); var argsBuilder = new List<string>();
argsBuilder.Append($"--configuration {_configuration}"); argsBuilder.Add("--configuration");
argsBuilder.Add($"{_configuration}");
if (_artifactPathsCalculator.PackageOutputPathSet) if (_artifactPathsCalculator.PackageOutputPathSet)
{ {
argsBuilder.Append($" --output \"{_artifactPathsCalculator.PackageOutputPathParameter}\""); argsBuilder.Add("--output");
argsBuilder.Add($"{_artifactPathsCalculator.PackageOutputPathParameter}");
} }
if (!string.IsNullOrEmpty(_intermediateOutputPath)) if (!string.IsNullOrEmpty(_intermediateOutputPath))
{ {
argsBuilder.Append($" --temp-output \"{_intermediateOutputPath}\""); argsBuilder.Add("--temp-output");
argsBuilder.Add($"{_intermediateOutputPath}");
} }
argsBuilder.Append($" \"{_project.ProjectFilePath}\""); argsBuilder.Add($"{_project.ProjectFilePath}");
var result = Command.Create("dotnet-build", argsBuilder.ToString()) var result = Command.Create("dotnet-build", argsBuilder)
.ForwardStdOut() .ForwardStdOut()
.ForwardStdErr() .ForwardStdErr()
.Execute(); .Execute();

View file

@ -102,12 +102,17 @@ namespace Microsoft.DotNet.Tools.Publish
} }
// Compile the project (and transitively, all it's dependencies) // Compile the project (and transitively, all it's dependencies)
var result = Command.Create("dotnet-build", var result = Command.Create("dotnet-build",
$"--framework \"{context.TargetFramework.DotNetFrameworkName}\" " + new string[] {
$"--output \"{outputPathCalculator.BaseCompilationOutputPath}\" " + "--framework",
$"--configuration \"{configuration}\" " + $"{context.TargetFramework.DotNetFrameworkName}",
"--no-host " + "--output",
$"\"{context.ProjectFile.ProjectDirectory}\"") $"{outputPathCalculator.BaseCompilationOutputPath}",
"--configuration",
$"{configuration}",
"--no-host",
$"{context.ProjectFile.ProjectDirectory}"
})
.ForwardStdErr() .ForwardStdErr()
.ForwardStdOut() .ForwardStdOut()
.Execute(); .Execute();

View file

@ -5,7 +5,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.IO; using System.IO;
using System.Text;
using Microsoft.Dnx.Runtime.Common.CommandLine; using Microsoft.Dnx.Runtime.Common.CommandLine;
using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.ProjectModel; using Microsoft.DotNet.ProjectModel;
@ -60,10 +59,21 @@ namespace Microsoft.DotNet.Tools.Repl.Csi
Reporter.Output.WriteLine($"Compiling {projectContext.RootProject.Identity.Name.Yellow()} for {projectContext.TargetFramework.DotNetFrameworkName.Yellow()} to use with the {"C# REPL".Yellow()} environment."); Reporter.Output.WriteLine($"Compiling {projectContext.RootProject.Identity.Name.Yellow()} for {projectContext.TargetFramework.DotNetFrameworkName.Yellow()} to use with the {"C# REPL".Yellow()} environment.");
// --temp-output is actually the intermediate output folder and can be the same as --output for our temporary compilation (`dotnet run` can be seen doing the same) // --temp-output is actually the intermediate output folder and can be the same as --output for our temporary compilation (`dotnet run` can be seen doing the same)
return Command.Create($"dotnet-build", $"--output \"{tempOutputDir}\" --temp-output \"{tempOutputDir}\" --framework \"{projectContext.TargetFramework}\" --configuration \"{configuration}\" \"{projectContext.ProjectDirectory}\"") return Command.Create($"dotnet-build", new []
.ForwardStdOut(onlyIfVerbose: true) {
.ForwardStdErr() $"--output",
.Execute(); $"{tempOutputDir}",
$"--temp-output",
$"{tempOutputDir}",
$"--framework",
$"{projectContext.TargetFramework}",
$"--configuration",
$"{configuration}",
$"{projectContext.ProjectDirectory}"
})
.ForwardStdOut(onlyIfVerbose: true)
.ForwardStdErr()
.Execute();
} }
private static IEnumerable<string> GetRuntimeDependencies(ProjectContext projectContext, string buildConfiguration) private static IEnumerable<string> GetRuntimeDependencies(ProjectContext projectContext, string buildConfiguration)
@ -148,7 +158,7 @@ namespace Microsoft.DotNet.Tools.Repl.Csi
} }
string responseFile = CreateResponseFile(projectContext, buildConfiguration, tempOutputDir); string responseFile = CreateResponseFile(projectContext, buildConfiguration, tempOutputDir);
csiArgs.Add($"@\"{responseFile}\""); csiArgs.Add($"@{responseFile}");
} }
if (string.IsNullOrEmpty(script) && !remainingArguments.Any()) if (string.IsNullOrEmpty(script) && !remainingArguments.Any())

View file

@ -90,7 +90,18 @@ namespace Microsoft.DotNet.Tools.Run
var tempDir = Path.Combine(_context.ProjectDirectory, "bin", ".dotnetrun", Guid.NewGuid().ToString("N")); var tempDir = Path.Combine(_context.ProjectDirectory, "bin", ".dotnetrun", Guid.NewGuid().ToString("N"));
// Compile to that directory // Compile to that directory
var result = Command.Create($"dotnet-build", $"--output \"{tempDir}\" --temp-output \"{tempDir}\" --framework \"{_context.TargetFramework}\" --configuration \"{Configuration}\" {_context.ProjectFile.ProjectDirectory}") var result = Command.Create($"dotnet-build", new []
{
$"--output",
$"{tempDir}",
$"--temp-output",
$"{tempDir}",
$"--framework",
$"{_context.TargetFramework}",
$"--configuration",
$"{Configuration}",
$"{_context.ProjectFile.ProjectDirectory}"
})
.ForwardStdOut(onlyIfVerbose: true) .ForwardStdOut(onlyIfVerbose: true)
.ForwardStdErr() .ForwardStdErr()
.Execute(); .Execute();
@ -134,7 +145,7 @@ namespace Microsoft.DotNet.Tools.Run
} }
} }
result = Command.Create(outputName, string.Join(" ", _args)) result = Command.Create(outputName, _args)
.ForwardStdOut() .ForwardStdOut()
.ForwardStdErr() .ForwardStdErr()
.EnvironmentVariable("DOTNET_HOME", runtime) .EnvironmentVariable("DOTNET_HOME", runtime)
@ -151,7 +162,7 @@ namespace Microsoft.DotNet.Tools.Run
private static int RunInteractive(string scriptName) private static int RunInteractive(string scriptName)
{ {
var command = Command.Create($"dotnet-repl-csi", scriptName) var command = Command.Create($"dotnet-repl-csi", new [] {scriptName})
.ForwardStdOut() .ForwardStdOut()
.ForwardStdErr(); .ForwardStdErr();
var result = command.Execute(); var result = command.Execute();

View file

@ -14,9 +14,12 @@
"NETStandard.Library": "1.0.0-rc2-23704", "NETStandard.Library": "1.0.0-rc2-23704",
"System.Diagnostics.TextWriterTraceListener": "4.0.0-rc2-23704", "System.Diagnostics.TextWriterTraceListener": "4.0.0-rc2-23704",
"System.Diagnostics.TraceSource": "4.0.0-rc2-23704", "System.Diagnostics.TraceSource": "4.0.0-rc2-23704",
"Microsoft.NETCore.ConsoleHost": "1.0.0-rc2-23616", "Microsoft.NETCore.ConsoleHost": "1.0.0-rc2-23616",
"Microsoft.NETCore.TestHost": "1.0.0-rc2-23616", "Microsoft.NETCore.TestHost": "1.0.0-rc2-23616",
"Microsoft.DotNet.Cli.Utils": "1.0.0-*", "Microsoft.DotNet.Cli.Utils": "1.0.0-*",
"Microsoft.Extensions.Testing.Abstractions": "1.0.0-*",
"Microsoft.Dnx.Runtime.CommandParsing.Sources": { "Microsoft.Dnx.Runtime.CommandParsing.Sources": {
"version": "1.0.0-*", "version": "1.0.0-*",
"type": "build" "type": "build"
@ -25,21 +28,14 @@
"version": "1.0.0-*", "version": "1.0.0-*",
"type": "build" "type": "build"
}, },
"Microsoft.Extensions.Testing.Abstractions": {
"version": "1.0.0-*",
"type": "build"
},
"Microsoft.Extensions.CommandLineUtils.Sources": { "Microsoft.Extensions.CommandLineUtils.Sources": {
"version": "1.0.0-*", "version": "1.0.0-*",
"type": "build" "type": "build"
}, },
"Microsoft.Extensions.Logging": "1.0.0-rc2-15935", "Microsoft.Extensions.Logging": "1.0.0-rc2-16023"
"Newtonsoft.Json": "7.0.1"
}, },
"frameworks": { "frameworks": {
"dnxcore50": { "dnxcore50": {
} }
},
"scripts": {
} }
} }

View file

@ -11,8 +11,8 @@
}, },
"dependencies": { "dependencies": {
"Newtonsoft.Json": "7.0.1", "Newtonsoft.Json": "7.0.1",
"Microsoft.DotNet.ProjectModel": {"target":"project"}, "Microsoft.DotNet.ProjectModel": "1.0.0-*",
"Microsoft.Extensions.Logging.Abstractions": "1.0.0-rc2-15935", "Microsoft.Extensions.Logging.Abstractions": "1.0.0-rc2-16011",
"NETStandard.Library": "1.0.0-rc2-23704", "NETStandard.Library": "1.0.0-rc2-23704",
"System.Resources.ResourceManager": "4.0.1-rc2-23704", "System.Resources.ResourceManager": "4.0.1-rc2-23704",
"System.Runtime.Serialization.Primitives": "4.1.0-rc2-23704" "System.Runtime.Serialization.Primitives": "4.1.0-rc2-23704"
@ -20,7 +20,5 @@
"frameworks": { "frameworks": {
"dnxcore50": { "dnxcore50": {
} }
},
"scripts": {
} }
} }

View file

@ -185,7 +185,7 @@ namespace Microsoft.DotNet.Tools.Restore
Console.WriteLine($"Restoring Tool '{tooldep.Name}' for '{projectPath}' in '{tempPath}'"); Console.WriteLine($"Restoring Tool '{tooldep.Name}' for '{projectPath}' in '{tempPath}'");
File.WriteAllText(projectPath, GenerateProjectJsonContents(new[] {"dnxcore50"}, tooldep)); File.WriteAllText(projectPath, GenerateProjectJsonContents(new[] {"dnxcore50"}, tooldep));
NuGet3.Restore(new [] { $"\"{projectPath}\"", "--runtime", $"{DefaultRid}"}.Concat(args), quiet); NuGet3.Restore(new [] { $"{projectPath}", "--runtime", $"{DefaultRid}"}.Concat(args), quiet);
} }
private static string GenerateProjectJsonContents(IEnumerable<string> frameworks, LibraryRange tooldep) private static string GenerateProjectJsonContents(IEnumerable<string> frameworks, LibraryRange tooldep)

View file

@ -26,7 +26,7 @@
"version": "1.0.0-*", "version": "1.0.0-*",
"type": "build" "type": "build"
}, },
"Microsoft.Extensions.Logging": "1.0.0-rc2-15935", "Microsoft.Extensions.Logging": "1.0.0-rc2-16010",
"Newtonsoft.Json": "7.0.1" "Newtonsoft.Json": "7.0.1"
}, },
"frameworks": { "frameworks": {

View file

@ -0,0 +1,263 @@
// 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.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using Xunit;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.ProjectModel;
using Microsoft.DotNet.Tools.Test.Utilities;
using Microsoft.Extensions.PlatformAbstractions;
using System.Diagnostics;
using FluentAssertions;
namespace Microsoft.DotNet.Tests.ArgumentForwarding
{
public class ArgumentForwardingTests : TestBase
{
private static readonly string s_reflectorExeName = "Reflector" + Constants.ExeSuffix;
private static readonly string s_reflectorCmdName = "reflector_cmd";
private string ReflectorPath { get; set; }
private string ReflectorCmdPath { get; set; }
public static void Main()
{
Console.WriteLine("Dummy Entrypoint.");
}
public ArgumentForwardingTests()
{
// This test has a dependency on an argument reflector
// Make sure it's been binplaced properly
FindAndEnsureReflectorPresent();
}
private void FindAndEnsureReflectorPresent()
{
ReflectorPath = Path.Combine(AppContext.BaseDirectory, s_reflectorExeName);
ReflectorCmdPath = Path.Combine(AppContext.BaseDirectory, s_reflectorCmdName);
File.Exists(ReflectorPath).Should().BeTrue();
}
/// <summary>
/// Tests argument forwarding in Command.Create
/// This is a critical scenario for the driver.
/// </summary>
/// <param name="testUserArgument"></param>
[Theory]
[InlineData(@"""abc"" d e")]
[InlineData(@"""abc"" d e")]
[InlineData("\"abc\"\t\td\te")]
[InlineData(@"a\\b d""e f""g h")]
[InlineData(@"\ \\ \\\")]
[InlineData(@"a\""b c d")]
[InlineData(@"a\\""b c d")]
[InlineData(@"a\\\""b c d")]
[InlineData(@"a\\\\""b c d")]
[InlineData(@"a\\\\""b c d")]
[InlineData(@"a\\\\""b c"" d e")]
[InlineData(@"a""b c""d e""f g""h i""j k""l")]
[InlineData(@"a b c""def")]
[InlineData(@"""\a\"" \\""\\\ b c")]
[InlineData(@"a\""b \\ cd ""\e f\"" \\""\\\")]
public void TestArgumentForwarding(string testUserArgument)
{
// Get Baseline Argument Evaluation via Reflector
var rawEvaluatedArgument = RawEvaluateArgumentString(testUserArgument);
// Escape and Re-Evaluate the rawEvaluatedArgument
var escapedEvaluatedRawArgument = EscapeAndEvaluateArgumentString(rawEvaluatedArgument);
rawEvaluatedArgument.Length.Should().Be(escapedEvaluatedRawArgument.Length);
for (int i=0; i<rawEvaluatedArgument.Length; ++i)
{
var rawArg = rawEvaluatedArgument[i];
var escapedArg = escapedEvaluatedRawArgument[i];
rawArg.Should().Be(escapedArg);
}
}
/// <summary>
/// Tests argument forwarding in Command.Create to a cmd file
/// This is a critical scenario for the driver.
/// </summary>
/// <param name="testUserArgument"></param>
[Theory]
[InlineData(@"""abc"" d e")]
[InlineData(@"""abc"" d e")]
[InlineData("\"abc\"\t\td\te")]
[InlineData(@"a\\b d""e f""g h")]
[InlineData(@"\ \\ \\\")]
[InlineData(@"a\""b c d")]
[InlineData(@"a\\""b c d")]
[InlineData(@"a\\\""b c d")]
[InlineData(@"a\\\\""b c d")]
[InlineData(@"a\\\\""b c d")]
[InlineData(@"a\\\\""b c"" d e")]
[InlineData(@"a""b c""d e""f g""h i""j k""l")]
[InlineData(@"a b c""def")]
[InlineData(@"""\a\"" \\""\\\ b c")]
[InlineData(@"a\""b \\ cd ""\e f\"" \\""\\\")]
public void TestArgumentForwardingCmd(string testUserArgument)
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return;
}
// Get Baseline Argument Evaluation via Reflector
// This does not need to be different for cmd because
// it only establishes what the string[] args should be
var rawEvaluatedArgument = RawEvaluateArgumentString(testUserArgument);
// Escape and Re-Evaluate the rawEvaluatedArgument
var escapedEvaluatedRawArgument = EscapeAndEvaluateArgumentStringCmd(rawEvaluatedArgument);
try
{
rawEvaluatedArgument.Length.Should().Be(escapedEvaluatedRawArgument.Length);
}
catch(Exception e)
{
Console.WriteLine("Argument Lists differ in length.");
var expected = string.Join(",", rawEvaluatedArgument);
var actual = string.Join(",", escapedEvaluatedRawArgument);
Console.WriteLine($"Expected: {expected}");
Console.WriteLine($"Actual: {actual}");
throw e;
}
for (int i = 0; i < rawEvaluatedArgument.Length; ++i)
{
var rawArg = rawEvaluatedArgument[i];
var escapedArg = escapedEvaluatedRawArgument[i];
try
{
rawArg.Should().Be(escapedArg);
}
catch(Exception e)
{
Console.WriteLine($"Expected: {rawArg}");
Console.WriteLine($"Actual: {escapedArg}");
throw e;
}
}
}
/// <summary>
/// EscapeAndEvaluateArgumentString returns a representation of string[] args
/// when rawEvaluatedArgument is passed as an argument to a process using
/// Command.Create(). Ideally this should escape the argument such that
/// the output is == rawEvaluatedArgument.
/// </summary>
/// <param name="rawEvaluatedArgument">A string[] representing string[] args as already evaluated by a process</param>
/// <returns></returns>
private string[] EscapeAndEvaluateArgumentString(string[] rawEvaluatedArgument)
{
var commandResult = Command.Create(ReflectorPath, rawEvaluatedArgument)
.CaptureStdErr()
.CaptureStdOut()
.Execute();
commandResult.ExitCode.Should().Be(0);
return ParseReflectorOutput(commandResult.StdOut);
}
/// <summary>
/// EscapeAndEvaluateArgumentString returns a representation of string[] args
/// when rawEvaluatedArgument is passed as an argument to a process using
/// Command.Create(). Ideally this should escape the argument such that
/// the output is == rawEvaluatedArgument.
/// </summary>
/// <param name="rawEvaluatedArgument">A string[] representing string[] args as already evaluated by a process</param>
/// <returns></returns>
private string[] EscapeAndEvaluateArgumentStringCmd(string[] rawEvaluatedArgument)
{
var cmd = Command.Create(s_reflectorCmdName, rawEvaluatedArgument);
var commandResult = cmd
.CaptureStdErr()
.CaptureStdOut()
.Execute();
Console.WriteLine(commandResult.StdOut);
Console.WriteLine(commandResult.StdErr);
commandResult.ExitCode.Should().Be(0);
return ParseReflectorCmdOutput(commandResult.StdOut);
}
/// <summary>
/// Parse the output of the reflector into a string array.
/// Reflector output is simply string[] args written to
/// one string separated by commas.
/// </summary>
/// <param name="reflectorOutput"></param>
/// <returns></returns>
private string[] ParseReflectorOutput(string reflectorOutput)
{
return reflectorOutput.Split(',');
}
/// <summary>
/// Parse the output of the reflector into a string array.
/// Reflector output is simply string[] args written to
/// one string separated by commas.
/// </summary>
/// <param name="reflectorOutput"></param>
/// <returns></returns>
private string[] ParseReflectorCmdOutput(string reflectorOutput)
{
var args = reflectorOutput.Split(new string[] { "," }, StringSplitOptions.None);
args[args.Length-1] = args[args.Length-1].TrimEnd('\r', '\n');
// To properly pass args to cmd, quotes inside a parameter are doubled
// Count them as a single quote for our comparison.
for (int i=0; i < args.Length; ++i)
{
args[i] = args[i].Replace(@"""""", @"""");
}
return args;
}
/// <summary>
/// RawEvaluateArgumentString returns a representation of string[] args
/// when testUserArgument is provided (unmodified) as arguments to a c#
/// process.
/// </summary>
/// <param name="testUserArgument">A test argument representing what a "user" would provide to a process</param>
/// <returns>A string[] representing string[] args with the provided testUserArgument</returns>
private string[] RawEvaluateArgumentString(string testUserArgument)
{
var proc = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = s_reflectorExeName,
Arguments = testUserArgument,
UseShellExecute = false,
RedirectStandardOutput = true,
CreateNoWindow = true
}
};
proc.Start();
proc.WaitForExit();
var stdOut = proc.StandardOutput.ReadToEnd();
Assert.Equal(0, proc.ExitCode);
return ParseReflectorOutput(stdOut);
}
}
}

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.24720" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.24720</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>6973e08d-11ec-49dc-82ef-d5effec7c6e9</ProjectGuid>
<RootNamespace>Microsoft.DotNet.Tests.ArgumentForwarding</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View file

@ -0,0 +1,24 @@
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"NETStandard.Library" : "1.0.0-rc2-23714",
"Microsoft.NETCore.TestHost": "1.0.0-rc2-23714",
"xunit": "2.1.0",
"xunit.console.netcore": "1.0.2-prerelease-00101",
"xunit.netcore.extensions": "1.0.0-prerelease-00153",
"xunit.runner.utility": "2.1.0",
"Microsoft.DotNet.ProjectModel": { "target": "project" },
"Microsoft.DotNet.Cli.Utils": { "target": "project" },
"Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" }
},
"frameworks": {
"dnxcore50": { }
}
}

View file

@ -0,0 +1,38 @@
// 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.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using Xunit;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.ProjectModel;
using Microsoft.DotNet.Tools.Test.Utilities;
using Microsoft.Extensions.PlatformAbstractions;
using System.Diagnostics;
using FluentAssertions;
namespace Microsoft.DotNet.Tests.ArgumentForwarding
{
public class Program
{
public static void Main(string[] args)
{
bool first=true;
foreach (var arg in args)
{
if (first)
{
first=false;
}
else
{
Console.Write(",");
}
Console.Write(arg);
}
}
}
}

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.24720" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.24720</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>6f2e6f25-b43b-495d-9ca5-7f207d1dd604</ProjectGuid>
<RootNamespace>Microsoft.DotNet.Tests.ArgumentForwarding</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View file

@ -0,0 +1,24 @@
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"NETStandard.Library" : "1.0.0-rc2-23706",
"Microsoft.NETCore.TestHost": "1.0.0-rc2-23706",
"xunit": "2.1.0",
"xunit.console.netcore": "1.0.2-prerelease-00101",
"xunit.netcore.extensions": "1.0.0-prerelease-00153",
"xunit.runner.utility": "2.1.0",
"Microsoft.DotNet.ProjectModel": { "target": "project" },
"Microsoft.DotNet.Cli.Utils": { "target": "project" },
"Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" }
},
"frameworks": {
"dnxcore50": { }
}
}

View file

@ -0,0 +1,19 @@
@echo off
set ALL_ARGS=
set a=%1
if not defined a goto :doneSetArgs
set ALL_ARGS=%~1%
shift
:setArgs
set a=%1
if not defined a goto :doneSetArgs
set ALL_ARGS=%ALL_ARGS%,%~1%
shift
goto setArgs
:doneSetArgs
echo %ALL_ARGS%
goto :EOF

View file

@ -7,7 +7,7 @@
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" /> <Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>65741cb1-8aee-4c66-8198-10a7ea0e4258</ProjectGuid> <ProjectGuid>65741cb1-8aee-4c66-8198-10a7ea0e4258</ProjectGuid>
<RootNamespace>E2E</RootNamespace> <RootNamespace>Microsoft.DotNet.Tests.EndToEnd</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath> <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath> <OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
</PropertyGroup> </PropertyGroup>

View file

@ -19,7 +19,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd
{ {
private static readonly string s_expectedOutput = "Hello World!" + Environment.NewLine; private static readonly string s_expectedOutput = "Hello World!" + Environment.NewLine;
private static readonly string s_testdirName = "e2etestroot"; private static readonly string s_testdirName = "e2etestroot";
private static readonly string s_outputdirName = "testbin"; private static readonly string s_outputdirName = "test space/bin";
private string Rid { get; set; } private string Rid { get; set; }
private string TestDirectory { get; set; } private string TestDirectory { get; set; }
@ -51,8 +51,6 @@ namespace Microsoft.DotNet.Tests.EndToEnd
[Fact] [Fact]
public void TestDotnetIncrementalBuild() public void TestDotnetIncrementalBuild()
{ {
TestSetup();
// first build // first build
var buildCommand = new BuildCommand(TestProject, output: OutputDirectory); var buildCommand = new BuildCommand(TestProject, output: OutputDirectory);
buildCommand.Execute().Should().Pass(); buildCommand.Execute().Should().Pass();

View file

@ -6,18 +6,20 @@
"dependencies": { "dependencies": {
"NETStandard.Library" : "1.0.0-rc2-23704", "NETStandard.Library" : "1.0.0-rc2-23704",
"Microsoft.NETCore.TestHost" : "1.0.0-rc2-23704",
"xunit": "2.1.0", "xunit": "2.1.0",
"xunit.console.netcore": "1.0.2-prerelease-00101", "xunit.console.netcore": "1.0.2-prerelease-00101",
"xunit.netcore.extensions": "1.0.0-prerelease-*", "xunit.netcore.extensions": "1.0.0-prerelease-00153",
"xunit.runner.utility": "2.1.0", "xunit.runner.utility": "2.1.0",
"Microsoft.DotNet.ProjectModel": "1.0.0-*", "Microsoft.DotNet.ProjectModel": {"target":"project"},
"Microsoft.DotNet.Cli.Utils": "1.0.0-*", "Microsoft.DotNet.Cli.Utils": {"target":"project"},
"Microsoft.DotNet.Tools.Tests.Utilities": "1.0.0-*" "Microsoft.DotNet.Tools.Tests.Utilities": {"target":"project"}
}, },
"frameworks": { "frameworks": {
"dnxcore50": { } "dnxcore50": { }
} },
"testRunner":"xunit"
} }

View file

@ -9,9 +9,9 @@
], ],
"dependencies": { "dependencies": {
"Microsoft.FSharp.Core.netcore": "1.0.0-alpha-151221", "Microsoft.FSharp.Core.netcore": "1.0.0-alpha-151221",
"Microsoft.NETCore.ConsoleHost": "1.0.0-23428", "Microsoft.NETCore.ConsoleHost": "1.0.0-rc2-23704",
"Microsoft.NETCore.Runtime": "1.0.1-23428", "Microsoft.NETCore.Runtime": "1.0.1-rc2-23704",
"System.Console": "4.0.0-beta-23109" "System.Console": "4.0.0-rc2-23704"
}, },
"frameworks": { "frameworks": {

View file

@ -15,7 +15,7 @@
"Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-16530", "Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-16530",
"Microsoft.DotNet.ProjectModel.Loader": "1.0.0-*" "Microsoft.DotNet.ProjectModel.Loader": {"target":"project"}
}, },
"frameworks": { "frameworks": {

View file

@ -1,6 +1,6 @@
{ {
"dependencies": { "dependencies": {
"Microsoft.NETCore.Platforms": "1.0.1-rc2-23704", "Microsoft.NETCore.Platforms": "1.0.1-rc2-23706",
"Microsoft.DotNet.ProjectModel": {"target":"project"}, "Microsoft.DotNet.ProjectModel": {"target":"project"},
"Microsoft.DotNet.ProjectModel.Server": {"target":"project"}, "Microsoft.DotNet.ProjectModel.Server": {"target":"project"},
"Newtonsoft.Json": "7.0.1", "Newtonsoft.Json": "7.0.1",

View file

@ -75,7 +75,7 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
protected static void AssertProjectSkipped(string skippedProject, CommandResult buildResult) protected static void AssertProjectSkipped(string skippedProject, CommandResult buildResult)
{ {
Assert.Contains($"Project {skippedProject} was previoulsy compiled. Skipping compilation.", buildResult.StdOut, StringComparison.OrdinalIgnoreCase); Assert.Contains($"Project {skippedProject} was previously compiled. Skipping compilation.", buildResult.StdOut, StringComparison.OrdinalIgnoreCase);
} }
protected static void AssertProjectCompiled(string rebuiltProject, CommandResult buildResult) protected static void AssertProjectCompiled(string rebuiltProject, CommandResult buildResult)

View file

@ -3,11 +3,11 @@
"dependencies": { "dependencies": {
"NETStandard.Library": "1.0.0-rc2-23704", "NETStandard.Library": "1.0.0-rc2-23704",
"Microsoft.NETCore.TestHost" : "1.0.0-*", "Microsoft.NETCore.TestHost" : "1.0.0-rc2-23704",
"xunit": "2.1.0", "xunit": "2.1.0",
"xunit.console.netcore": "1.0.2-prerelease-00101", "xunit.console.netcore": "1.0.2-prerelease-00101",
"xunit.netcore.extensions": "1.0.0-prerelease-*", "xunit.netcore.extensions": "1.0.0-prerelease-00153",
"xunit.runner.utility": "2.1.0", "xunit.runner.utility": "2.1.0",
"Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" }, "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" },

View file

@ -3,11 +3,11 @@
"dependencies": { "dependencies": {
"NETStandard.Library": "1.0.0-rc2-23704", "NETStandard.Library": "1.0.0-rc2-23704",
"Microsoft.NETCore.TestHost" : "1.0.0-*", "Microsoft.NETCore.TestHost" : "1.0.0-rc2-23704",
"xunit": "2.1.0", "xunit": "2.1.0",
"xunit.console.netcore": "1.0.2-prerelease-00101", "xunit.console.netcore": "1.0.2-prerelease-00101",
"xunit.netcore.extensions": "1.0.0-prerelease-*", "xunit.netcore.extensions": "1.0.0-prerelease-00153",
"xunit.runner.utility": "2.1.0", "xunit.runner.utility": "2.1.0",
"Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" }, "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" },

View file

@ -25,7 +25,7 @@ namespace Microsoft.DotNet.Tools.Publish.Tests
new object[] { "", PlatformServices.Default.Runtime.GetLegacyRestoreRuntimeIdentifier(), "", "" }, new object[] { "", PlatformServices.Default.Runtime.GetLegacyRestoreRuntimeIdentifier(), "", "" },
new object[] { "", "", "Release", "" }, new object[] { "", "", "Release", "" },
new object[] { "", "", "", "some/dir"}, new object[] { "", "", "", "some/dir"},
//new object[] { "", "", "", "\"some/dir/with spaces\"" }, // issue - https://github.com/dotnet/cli/issues/525 new object[] { "", "", "", "some/dir/with spaces" },
new object[] { "dnxcore50", PlatformServices.Default.Runtime.GetLegacyRestoreRuntimeIdentifier(), "Debug", "some/dir" }, new object[] { "dnxcore50", PlatformServices.Default.Runtime.GetLegacyRestoreRuntimeIdentifier(), "Debug", "some/dir" },
}; };
} }
@ -175,6 +175,7 @@ namespace Microsoft.DotNet.Tools.Publish.Tests
} }
[Fact] [Fact]
[ActiveIssue(982)]
public void PublishScriptsRun() public void PublishScriptsRun()
{ {
// create unique directories in the 'temp' folder // create unique directories in the 'temp' folder

View file

@ -2,13 +2,13 @@
"version": "1.0.0-*", "version": "1.0.0-*",
"dependencies": { "dependencies": {
"NETStandard.Library": "1.0.0-rc2-23704", "NETStandard.Library": "1.0.0-rc2-23706",
"Microsoft.NETCore.TestHost": "1.0.0-rc2-*", "Microsoft.NETCore.TestHost": "1.0.0-rc2-23706",
"System.Text.RegularExpressions": "4.0.11-*", "System.Text.RegularExpressions": "4.0.11-rc2-23706",
"xunit": "2.1.0", "xunit": "2.1.0",
"xunit.console.netcore": "1.0.2-prerelease-00101", "xunit.console.netcore": "1.0.2-prerelease-00101",
"xunit.netcore.extensions": "1.0.0-prerelease-*", "xunit.netcore.extensions": "1.0.0-prerelease-00153",
"xunit.runner.utility": "2.1.0", "xunit.runner.utility": "2.1.0",
"Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" }, "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" },

View file

@ -32,7 +32,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
{ {
return _outputDirectory == string.Empty ? return _outputDirectory == string.Empty ?
"" : "" :
$"-o {_outputDirectory}"; $"-o \"{_outputDirectory}\"";
} }
} }
@ -214,7 +214,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
private string BuildArgs() private string BuildArgs()
{ {
return $"{BuildProfile} {ForceIncrementalUnsafe} {_projectPath} {OutputOption} {TempOutputOption} {ConfigurationOption} {NoHostOption} {NativeOption} {ArchitectureOption} {IlcArgsOption} {IlcPathOption} {AppDepSDKPathOption} {NativeCppModeOption} {CppCompilerFlagsOption}"; return $"{BuildProfile} {ForceIncrementalUnsafe} \"{_projectPath}\" {OutputOption} {TempOutputOption} {ConfigurationOption} {NoHostOption} {NativeOption} {ArchitectureOption} {IlcArgsOption} {IlcPathOption} {AppDepSDKPathOption} {NativeCppModeOption} {CppCompilerFlagsOption}";
} }
} }
} }

View file

@ -20,7 +20,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
{ {
return _outputDirectory == string.Empty ? return _outputDirectory == string.Empty ?
"" : "" :
$"-o {_outputDirectory}"; $"-o \"{_outputDirectory}\"";
} }
} }

View file

@ -102,7 +102,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
private string GetOutputOption() private string GetOutputOption()
{ {
return string.IsNullOrEmpty(_output) ? "" : $"-o {_output}"; return string.IsNullOrEmpty(_output) ? "" : $"-o \"{_output}\"";
} }
private string GetConfigOption() private string GetConfigOption()

View file

@ -19,7 +19,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
{ {
return _projectPath == string.Empty ? return _projectPath == string.Empty ?
"" : "" :
$"-p {_projectPath}"; $"-p \"{_projectPath}\"";
} }
} }
@ -48,7 +48,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
get get
{ {
return _preserveTemporary ? return _preserveTemporary ?
$"-t {_projectPath}" : $"-t \"{_projectPath}\"" :
""; "";
} }
} }

View file

@ -3,6 +3,8 @@
using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.Cli.Utils;
using System; using System;
using System.Diagnostics;
using System.IO;
namespace Microsoft.DotNet.Tools.Test.Utilities namespace Microsoft.DotNet.Tools.Test.Utilities
@ -18,24 +20,71 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
public virtual CommandResult Execute(string args = "") public virtual CommandResult Execute(string args = "")
{ {
Console.WriteLine($"Executing - {_command} {args}"); var commandPath = _command;
var commandResult = Command.Create(_command, args) if (!Path.IsPathRooted(_command))
.ForwardStdErr() {
.ForwardStdOut() _command = Env.GetCommandPath(_command) ??
.Execute(); Env.GetCommandPathFromAppBase(AppContext.BaseDirectory, _command);
}
return commandResult; Console.WriteLine($"Executing - {_command} {args}");
var stdOut = new StreamForwarder();
var stdErr = new StreamForwarder();
stdOut.ForwardTo(write: Reporter.Output.Write, writeLine: Reporter.Output.WriteLine);
stdErr.ForwardTo(write: Reporter.Error.Write, writeLine: Reporter.Output.WriteLine);
return RunProcess(commandPath, args, stdOut, stdErr);
} }
public virtual CommandResult ExecuteWithCapturedOutput(string args = "") public virtual CommandResult ExecuteWithCapturedOutput(string args = "")
{ {
Console.WriteLine($"Executing (Captured Output) - {_command} {args}"); Console.WriteLine($"Executing (Captured Output) - {_command} {args}");
var commandResult = Command.Create(_command, args)
.CaptureStdErr()
.CaptureStdOut()
.Execute();
return commandResult; var commandPath = Env.GetCommandPath(_command, ".exe", ".cmd", "") ??
Env.GetCommandPathFromAppBase(AppContext.BaseDirectory, _command, ".exe", ".cmd", "");
var stdOut = new StreamForwarder();
var stdErr = new StreamForwarder();
stdOut.Capture();
stdErr.Capture();
return RunProcess(commandPath, args, stdOut, stdErr);
}
private CommandResult RunProcess(string executable, string args, StreamForwarder stdOut, StreamForwarder stdErr)
{
var psi = new ProcessStartInfo
{
FileName = executable,
Arguments = args,
RedirectStandardError = true,
RedirectStandardOutput = true
};
var process = new Process
{
StartInfo = psi
};
process.EnableRaisingEvents = true;
process.Start();
var threadOut = stdOut.BeginRead(process.StandardOutput);
var threadErr = stdErr.BeginRead(process.StandardError);
process.WaitForExit();
threadOut.Join();
threadErr.Join();
var result = new CommandResult(
process.ExitCode,
stdOut.GetCapturedOutput(),
stdErr.GetCapturedOutput());
return result;
} }
} }
} }

View file

@ -3,18 +3,18 @@
"description": "Microsoft.DotNet.Tools.Tests.Utilities Class Library", "description": "Microsoft.DotNet.Tools.Tests.Utilities Class Library",
"dependencies": { "dependencies": {
"System.Collections": "4.0.11-*", "System.Collections": "4.0.11-rc2-23714",
"System.Collections.Immutable": "1.1.38-*", "System.Collections.Immutable": "1.1.38-rc2-23714",
"System.Linq": "4.0.1-*", "System.Linq": "4.0.1-rc2-23714",
"System.Threading": "4.0.11-*", "System.Threading": "4.0.11-rc2-23714",
"System.IO.FileSystem": "4.0.1-*", "System.IO.FileSystem": "4.0.1-rc2-23714",
"System.IO": "4.0.11-*", "System.IO": "4.0.11-rc2-23714",
"System.Runtime.InteropServices": "4.0.21-*", "System.Runtime.InteropServices": "4.0.21-rc2-23714",
"System.Text.RegularExpressions": "4.0.11-*", "System.Text.RegularExpressions": "4.0.11-rc2-23714",
"FluentAssertions": "4.0.0", "FluentAssertions": "4.0.0",
"xunit": "2.1.0", "xunit": "2.1.0",
"Microsoft.DotNet.Cli.Utils": "1.0.0-*", "Microsoft.DotNet.Cli.Utils": {"target":"project"},
"Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-16530" "Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-16530"
}, },
@ -23,3 +23,4 @@
"dnxcore50": { } "dnxcore50": { }
} }
} }

View file

@ -5,7 +5,7 @@
}, },
"dependencies": { "dependencies": {
"NETStandard.Library": "1.0.0-rc2-23616", "NETStandard.Library": "1.0.0-rc2-23704",
"dotnet-hello": { "version": "1.0.0", "target": "package" } "dotnet-hello": { "version": "1.0.0", "target": "package" }
}, },

View file

@ -7,7 +7,7 @@
"testRunner": "must-be-specified-to-generate-deps", "testRunner": "must-be-specified-to-generate-deps",
"dependencies": { "dependencies": {
"NETStandard.Library": "1.0.0-rc2-23616", "NETStandard.Library": "1.0.0-rc2-23704",
"dotnet-hello": {"version": "1.0.0", "target": "package"} "dotnet-hello": {"version": "1.0.0", "target": "package"}
}, },

View file

@ -5,7 +5,7 @@
}, },
"dependencies": { "dependencies": {
"NETStandard.Library": "1.0.0-rc2-23616" "NETStandard.Library": "1.0.0-rc2-23704"
}, },
"frameworks": { "frameworks": {

View file

@ -5,11 +5,11 @@
}, },
"dependencies": { "dependencies": {
"NETStandard.Library" : "1.0.0-rc2-23704", "NETStandard.Library" : "1.0.0-rc2-23706",
"xunit": "2.1.0", "xunit": "2.1.0",
"xunit.console.netcore": "1.0.2-prerelease-00101", "xunit.console.netcore": "1.0.2-prerelease-00101",
"xunit.netcore.extensions": "1.0.0-prerelease-*", "xunit.netcore.extensions": "1.0.0-prerelease-00153",
"xunit.runner.utility": "2.1.0", "xunit.runner.utility": "2.1.0",
"Microsoft.DotNet.ProjectModel": { "target": "project" }, "Microsoft.DotNet.ProjectModel": { "target": "project" },

View file

@ -5,7 +5,7 @@
}, },
"dependencies": { "dependencies": {
"TestLibrary": "1.0.0-*", "TestLibrary": { "target":"project"},
"NETStandard.Library": "1.0.0-rc2-23704", "NETStandard.Library": "1.0.0-rc2-23704",
"Microsoft.NETCore.Platforms": "1.0.1-rc2-23704" "Microsoft.NETCore.Platforms": "1.0.1-rc2-23704"

View file

@ -5,10 +5,10 @@
}, },
"dependencies": { "dependencies": {
"Microsoft.NETCore.Runtime": "1.0.1-beta-*", "Microsoft.NETCore.Runtime": "1.0.1-rc2-23714",
"System.IO": "4.0.10-beta-*", "System.IO": "4.0.10-rc2-23714",
"System.Console": "4.0.0-beta-*", "System.Console": "4.0.0-rc2-23714",
"System.Runtime": "4.0.21-beta-*" "System.Runtime": "4.0.21-rc2-23714"
}, },
"frameworks": { "frameworks": {

View file

@ -5,10 +5,10 @@
}, },
"dependencies": { "dependencies": {
"Microsoft.NETCore.Runtime": "1.0.1-beta-*", "Microsoft.NETCore.Runtime": "1.0.1-rc2-23714",
"System.IO": "4.0.10-beta-*", "System.IO": "4.0.10-rc2-23714",
"System.Console": "4.0.0-beta-*", "System.Console": "4.0.0-rc2-23714",
"System.Runtime": "4.0.21-beta-*" "System.Runtime": "4.0.21-rc2-23714"
}, },