2015-11-16 11:21:57 -08:00
|
|
|
|
// 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;
|
2016-01-04 23:12:40 -08:00
|
|
|
|
using Microsoft.DotNet.Cli.Utils;
|
2015-10-06 10:46:43 -07:00
|
|
|
|
|
|
|
|
|
namespace Microsoft.DotNet.Tools.Compiler
|
|
|
|
|
{
|
2016-01-30 21:47:50 -08:00
|
|
|
|
public class CommpileCommand
|
2015-10-06 10:46:43 -07:00
|
|
|
|
{
|
2015-12-10 13:06:33 -08:00
|
|
|
|
|
2016-01-30 21:47:50 -08:00
|
|
|
|
public static int Run(string[] args)
|
2015-10-06 10:46:43 -07:00
|
|
|
|
{
|
2015-10-13 14:31:29 -07:00
|
|
|
|
DebugHelper.HandleDebugSwitch(ref args);
|
|
|
|
|
|
2015-10-06 10:46:43 -07:00
|
|
|
|
try
|
|
|
|
|
{
|
2016-02-09 16:35:43 -08:00
|
|
|
|
var commandFactory = new DotNetCommandFactory();
|
|
|
|
|
var scriptRunner = new ScriptRunner();
|
|
|
|
|
var managedCompiler = new ManagedCompiler(scriptRunner, commandFactory);
|
|
|
|
|
var nativeCompiler = new NativeCompiler();
|
|
|
|
|
var compilationDriver = new CompilationDriver(managedCompiler, nativeCompiler);
|
|
|
|
|
|
2015-12-10 13:06:33 -08:00
|
|
|
|
var compilerCommandArgs = new CompilerCommandApp("dotnet compile", ".NET Compiler", "Compiler for the .NET Platform");
|
2016-02-09 16:35:43 -08:00
|
|
|
|
|
|
|
|
|
return compilerCommandArgs.Execute(compilationDriver.Compile, args);
|
2015-10-06 10:46:43 -07:00
|
|
|
|
}
|
2015-10-18 02:06:15 -07:00
|
|
|
|
catch (Exception ex)
|
2015-10-06 10:46:43 -07:00
|
|
|
|
{
|
2015-10-20 01:43:37 -07:00
|
|
|
|
#if DEBUG
|
|
|
|
|
Console.Error.WriteLine(ex);
|
|
|
|
|
#else
|
2015-10-06 10:46:43 -07:00
|
|
|
|
Console.Error.WriteLine(ex.Message);
|
2015-10-20 01:43:37 -07:00
|
|
|
|
#endif
|
2015-10-06 10:46:43 -07:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|