コード例 #1
0
ファイル: EntryStack.cs プロジェクト: RainsSoft/CSLiteScript
 public void Push(int label, ExitKind ek)
 {
     EntryRec rec = new EntryRec();
     rec.Label = label;
     rec.StringLabel = "";
     rec.EK = ek;
     this.fItems.Add(rec);
 }
コード例 #2
0
        /// <summary>
        /// Numeric exit code based on ExitKind
        /// </summary>
        public static int FromExitKind(ExitKind exitKind)
        {
            switch (exitKind)
            {
            case ExitKind.InvalidCommandLine:
                return(1);

            case ExitKind.BuildNotRequested:
            case ExitKind.BuildSucceeded:
                return(0);

            case ExitKind.BuildFailedWithGeneralErrors:
            case ExitKind.BuildFailedWithPipErrors:
            case ExitKind.BuildFailedWithFileMonErrors:
            case ExitKind.BuildFailedWithMissingOutputErrors:
            case ExitKind.BuildFailedSpecificationError:
            case ExitKind.NoPipsMatchFilter:
            case ExitKind.BuildCancelled:
            case ExitKind.UserError:
                return(1);

            case ExitKind.ConnectionToAppServerLost:
            case ExitKind.AppServerFailedToStart:
            case ExitKind.Aborted:
                return(2);

            case ExitKind.InfrastructureError:
                return(3);

            case ExitKind.OutOfDiskSpace:
            case ExitKind.DataErrorDriveFailure:
                return(4);

            case ExitKind.BuildFailedTelemetryShutdownException:
                return(5);

            case ExitKind.BuildTimeout:
                return(6);

            case ExitKind.InternalError:
                return(-1);

            default:
                Contract.Check(false)?.Assert("Unknown ExitKind" + exitKind.ToString());
                throw new ArgumentException("Unknown ExitKind" + exitKind.ToString());
            }
        }
コード例 #3
0
        /// <summary>
        /// The core execution of the tool.
        /// </summary>
        /// <remarks>
        /// If you discover boilerplate in multiple implementations, add it to MainImpl, or add another inheritance hierarchy.
        /// </remarks>
        public int Run()
        {
            // We may have been started to be an app server. See StartAppServerProcess. If so, run as an app server (and expect no args).
            string startupParamsSerialized = Environment.GetEnvironmentVariable(BuildXlAppServerConfigVariable);

            if (startupParamsSerialized != null)
            {
                if (RawArgs.Length > 0)
                {
                    // TODO: Message
                    return(ExitCode.FromExitKind(ExitKind.InvalidCommandLine));
                }

                AppServer.StartupParameters startupParameters = AppServer.StartupParameters.TryParse(startupParamsSerialized);
                if (startupParameters == null)
                {
                    return(ExitCode.FromExitKind(ExitKind.InvalidCommandLine));
                }

                return(ExitCode.FromExitKind(RunAppServer(startupParameters)));
            }

            LightConfig lightConfig;

            if (!LightConfig.TryParse(RawArgs, out lightConfig) && lightConfig.Help == HelpLevel.None)
            {
                // If light config parsing failed, go through the full argument parser to collect & print the errors
                // it would catch.
                ICommandLineConfiguration config;
                Analysis.IgnoreResult(Args.TryParseArguments(RawArgs, new PathTable(), null, out config));
                HelpText.DisplayHelp(BuildXL.ToolSupport.HelpLevel.Verbose);
                return(ExitCode.FromExitKind(ExitKind.InvalidCommandLine));
            }

            // Not an app server; will either run fully within this process ('single instance') or start / connect to an app server.
            if (!lightConfig.NoLogo)
            {
                HelpText.DisplayLogo();
            }

            if (lightConfig.Help != HelpLevel.None)
            {
                // Need to cast here to convert from the configuration enum to the ToolSupoort enum. Their values
                // are manually kept in sync to avoid the additional dependency.
                HelpText.DisplayHelp((BuildXL.ToolSupport.HelpLevel)lightConfig.Help);

                return(ExitCode.FromExitKind(ExitKind.BuildNotRequested));
            }

            // Optionally perform some special tasks related to server mode
            switch (lightConfig.Server)
            {
            case ServerMode.Kill:
                ServerDeployment.KillServer(ServerDeployment.ComputeDeploymentDir(lightConfig.ServerDeploymentDirectory));
                Console.WriteLine(Strings.App_ServerKilled);
                return(ExitCode.FromExitKind(ExitKind.BuildNotRequested));
            }

            ExitKind exitKind = lightConfig.Server != ServerMode.Disabled
                ? ConnectToAppServerAndRun(lightConfig, RawArgs)
                : RunSingleInstance(RawArgs);

            return(ExitCode.FromExitKind(exitKind));
        }
コード例 #4
0
ファイル: VB_Parser.cs プロジェクト: RainsSoft/CSLiteScript
 private void PushExitKind(ExitKind k)
 {
     this.exit_kind_stack.Push((int) k);
 }
コード例 #5
0
 public ExitStatement(ExitKind kind)
 {
     this.ExitKind = kind;
 }
コード例 #6
0
ファイル: EntryStack.cs プロジェクト: RainsSoft/CSLiteScript
 public int TopLabel(ExitKind ek)
 {
     for (int i = this.Count - 1; i >= 0; i--)
     {
         EntryRec rec = (EntryRec) this.fItems[i];
         if (rec.EK == ek)
         {
             return rec.Label;
         }
     }
     return 0;
 }