public ExportCommand DoWorkImpl() { string[] commandLineArgs = Program.GetCommandLineArgs(); ExportCommand command = FlagParser.Parse(commandLineArgs); // TODO: I don't like this here. command.PlatformProvider = new PlatformProvider(); return(command); }
static void Main(string[] args) { Dictionary <string, string> argLookup = null; using (new PerformanceSection("Crayon")) { #if DEBUG args = GetEffectiveArgs(args); // First chance exceptions should crash in debug builds. argLookup = FlagParser.Parse(args); Program.Compile(argLookup); // Crash if there were any graphics contexts that weren't cleaned up. // This is okay on Windows, but on OSX this is a problem, so ensure that a // regressions are quickly noticed. SystemBitmap.Graphics.EnsureCleanedUp(); #else if (args.Length == 0) { System.Console.WriteLine(USAGE); } else { try { argLookup = FlagParser.Parse(args); Program.Compile(argLookup); } catch (InvalidOperationException e) { System.Console.Error.WriteLine(e.Message); } catch (ParserException e) { System.Console.Error.WriteLine(e.Message); } } #endif } #if DEBUG if (argLookup != null) { if (argLookup.ContainsKey(FlagParser.SHOW_PERFORMANCE_MARKERS)) { string summary = PerformanceTimer.GetSummary(); Console.WriteLine(summary); } } #endif }
private static async Task MainTask(string[] args) { Wax.WaxHub waxHub = new Wax.WaxHub(); waxHub.SourceRoot = SourceDirectoryFinder.CrayonSourceDirectory; waxHub.ErrorsAsExceptions = !IS_RELEASE; waxHub.RegisterService(new Router.RouterService()); waxHub.RegisterService(new AssemblyResolver.AssemblyService()); waxHub.RegisterService(new Runtime.RuntimeService()); waxHub.RegisterService(new Builder.BuilderService()); waxHub.RegisterService(new U3.U3Service()); Wax.ToolchainCommand command = FlagParser.Parse(args); if (command.UseOutputPrefixes) { Wax.ConsoleWriter.EnablePrefixes(); } foreach (string directory in GetExtensionDirectories()) { waxHub.RegisterExtensionDirectory(directory); } waxHub.RegisterLibraryDirectory(GetLibraryDirectory()); Dictionary <string, object> result = await waxHub.SendRequest("router", command); Wax.Error[] errors = Wax.Error.GetErrorsFromResult(result); if (command.UseJsonOutput) { string jsonErrors = "{\"errors\":[" + string.Join(',', errors.Select(err => err.ToJson())) + "]}"; Wax.ConsoleWriter.Print(Wax.ConsoleMessageType.COMPILER_INFORMATION, jsonErrors); } else if (errors.Length > 0) { ErrorPrinter.ShowErrors(errors, waxHub.ErrorsAsExceptions); } }
public override CrayonWorkerResult DoWorkImpl(CrayonWorkerResult[] args) { string[] commandLineArgs = Program.GetCommandLineArgs(); ExportCommand command = FlagParser.Parse(commandLineArgs); // TODO: I don't like these here. command.PlatformProvider = new PlatformProvider(); command.InlineImportCodeLoader = new InlineImportCodeLoader(); CrayonWorkerResult result = new CrayonWorkerResult() { Value = command, }; ExecutionType action = this.IdentifyUseCase(command); switch (action) { case ExecutionType.SHOW_USAGE: result.SetField("IsDisplayUsage", true); break; case ExecutionType.GENERATE_DEFAULT_PROJECT: result.SetField("IsGenerateDefaultProject", true); break; case ExecutionType.EXPORT_VM_BUNDLE: result.SetField("IsExportCbxVmBundle", true); break; case ExecutionType.EXPORT_VM_STANDALONE: result.SetField("IsExportStandaloneVm", true); break; case ExecutionType.EXPORT_CBX: result.SetField("IsExportStandaloneCbx", true); break; case ExecutionType.RUN_CBX: result.SetField("IsRunCbx", true); break; default: throw new Exception(); } result.SetField("ShowPerformance", command.ShowPerformanceMarkers); result.SetField("ShowLibraryDeps", command.ShowLibraryDepTree); return(result); }