check in CoreConsole until there's a working build

This commit is contained in:
Andrew Stanton-Nurse 2015-10-16 11:11:07 -07:00 committed by David Fowler
parent 2fa96c3f94
commit 1a9a5acb41
10 changed files with 35 additions and 34 deletions

View file

@ -12,5 +12,7 @@ namespace Microsoft.DotNet.Cli.Utils
public static readonly string CoreConsoleName = "coreconsole" + ExeSuffix;
public static readonly string DefaultConfiguration = "Debug";
public static readonly string BinDirectoryName = "bin";
public static readonly string HostsPathEnvironmentVariable = "DOTNET_CLR_HOSTS_PATH";
}
}

View file

@ -7,7 +7,6 @@
"dotnet": "Microsoft.DotNet.Cli"
},
"dependencies": {
"Microsoft.NETCore.ConsoleHost": "1.0.0-*",
"Microsoft.NETCore.Runtime": "1.0.1-*",
"System.Console": "4.0.0-*",

View file

@ -151,9 +151,13 @@ namespace Microsoft.DotNet.Tools.Compiler
private static Command RunCsc(string cscArgs)
{
// Hack -- if we find csc + corerun in the app directory we should
// use that, otherwise just try to find csc on the PATH
var corerun = Path.Combine(AppContext.BaseDirectory, "CoreRun.exe");
// Locate CoreRun
string hostRoot = Environment.GetEnvironmentVariable(Constants.HostsPathEnvironmentVariable);
if(string.IsNullOrEmpty(hostRoot))
{
hostRoot = AppContext.BaseDirectory;
}
var corerun = Path.Combine(hostRoot, "CoreRun.exe");
var cscExe = Path.Combine(AppContext.BaseDirectory, "csc.exe");
return File.Exists(corerun) && File.Exists(cscExe)
? Command.Create(corerun, $@"""{cscExe}"" {cscArgs}")

View file

@ -7,7 +7,6 @@
"dotnet-compile": "Microsoft.DotNet.Tools.Compiler"
},
"dependencies": {
"Microsoft.NETCore.ConsoleHost": "1.0.0-*",
"Microsoft.NETCore.TestHost": "1.0.0-*",
"Microsoft.NETCore.Runtime": "1.0.1-*",
@ -25,7 +24,7 @@
"type": "build",
"version": "1.0.0-*"
},
"Microsoft.Net.Compilers.netcore": "1.1.0-*",
"Microsoft.Net.Compilers.netcore": "1.1.0-*"
},
"frameworks": {
"dnxcore50": { }

View file

@ -116,29 +116,25 @@ namespace Microsoft.DotNet.Tools.Publish
// Publishing for windows, TODO(anurse): Publish for Mac/Linux/etc.
// CoreConsole should be there...
var coreConsole = Path.Combine(outputPath, Constants.CoreConsoleName);
if (!File.Exists(coreConsole))
// Locate CoreConsole
string hostsPath = Environment.GetEnvironmentVariable(Constants.HostsPathEnvironmentVariable);
if(string.IsNullOrEmpty(hostsPath))
{
Reporter.Error.WriteLine($"Unable to find {Constants.CoreConsoleName} at {coreConsole}. You must have an explicit dependency on Microsoft.NETCore.ConsoleHost (for now ;))".Red().Bold());
hostsPath = AppContext.BaseDirectory;
}
var coreConsole = Path.Combine(hostsPath, Constants.CoreConsoleName);
if(!File.Exists(coreConsole))
{
Reporter.Error.WriteLine($"Unable to locate CoreConsole.exe in {coreConsole}, use {Constants.HostsPathEnvironmentVariable} to set the path to it.".Red().Bold());
return 1;
}
// Allow CoreConsole to be replaced
string overrideCoreConsole = Environment.GetEnvironmentVariable("DOTNET_CORE_CONSOLE_PATH");
if(!string.IsNullOrEmpty(overrideCoreConsole) && File.Exists(overrideCoreConsole))
{
Reporter.Output.WriteLine($"Using CoreConsole override: {overrideCoreConsole}");
File.Copy(overrideCoreConsole, coreConsole, overwrite: true);
}
// TEMPORARILY bring CoreConsole along for the ride on it's own (without renaming)
File.Copy(coreConsole, Path.Combine(outputPath, Constants.CoreConsoleName), overwrite: true);
// Use the 'command' field to generate the name
var outputExe = Path.Combine(outputPath, context.ProjectFile.Name + ".exe");
File.Copy(coreConsole, outputExe, overwrite: true);
if (File.Exists(coreConsole))
{
File.Delete(coreConsole);
}
// Check if the a command name is specified, and rename the necessary files
if(context.ProjectFile.Commands.Count == 1)

View file

@ -7,9 +7,7 @@
"dotnet-publish": "Microsoft.DotNet.Tools.Publish"
},
"dependencies": {
"Microsoft.NETCore.ConsoleHost": "1.0.0-*",
"Microsoft.NETCore.Runtime": "1.0.1-*",
"System.Console": "4.0.0-*",
"System.Collections": "4.0.11-*",
"System.Linq": "4.0.1-*",
@ -23,7 +21,8 @@
"Microsoft.Extensions.CommandLineUtils.Sources": {
"type": "build",
"version": "1.0.0-*"
}
},
"System.AppContext": "4.0.1-*"
},
"frameworks": {
"dnxcore50": { }