Beispiel #1
0
        public override int Execute(CommandContext context, DefaultCommandSettings settings)
        {
            // Set log verbosity.
            _log.Verbosity = settings.Verbosity;

            if (settings.ShowVersion)
            {
                return(_version.Run());
            }
            if (settings.ShowInfo)
            {
                return(_info.Run());
            }
            if (settings.Bootstrap)
            {
                return(_bootstrapper.Run(context.Remaining, new BootstrapFeatureSettings
                {
                    Script = settings.Script,
                    Verbosity = settings.Verbosity
                }));
            }

            // Get the build host type.
            var host = GetBuildHostKind(settings);

            // Run the build feature.
            return(_builder.Run(context.Remaining, new BuildFeatureSettings(host)
            {
                Script = settings.Script,
                Verbosity = settings.Verbosity,
                Exclusive = settings.Exclusive,
                Debug = settings.Debug
            }));
        }
        public override int Execute(CommandContext context, DefaultCommandSettings settings)
        {
            try
            {
                // Set log verbosity.
                _log.Verbosity = settings.Verbosity;

                if (settings.ShowVersion)
                {
                    return(_version.Run());
                }
                else if (settings.ShowInfo)
                {
                    return(_info.Run());
                }

                // Get the build host type.
                var host = GetBuildHostKind(settings);

                // Run the bootstrapper?
                if (!settings.SkipBootstrap || settings.Bootstrap)
                {
                    int bootstrapperResult = PerformBootstrapping(context, settings, host);
                    if (bootstrapperResult != 0 || settings.Bootstrap)
                    {
                        return(bootstrapperResult);
                    }
                }

                // Run the build feature.
                return(_builder.Run(context.Remaining, new BuildFeatureSettings(host)
                {
                    Script = settings.Script,
                    Verbosity = settings.Verbosity,
                    Exclusive = settings.Exclusive,
                    Debug = settings.Debug,
                    NoBootstrapping = settings.SkipBootstrap,
                }));
            }
            catch (Exception ex)
            {
                return(LogException(_log, ex));
            }
        }