Esempio n. 1
0
 private static void PrintLogo()
 {
     Logger.Log(FigletTransform.GetText("NUKE"));
     Logger.Log(typeof(BuildExecutor).GetTypeInfo().Assembly.GetInformationText());
     Logger.Log($"Host: {EnvironmentInfo.HostType}");
     Logger.Log();
 }
Esempio n. 2
0
        public static int Execute <T>(Expression <Func <T, Target> > defaultTargetExpression)
            where T : NukeBuild
        {
            var executionList = default(IReadOnlyCollection <TargetDefinition>);
            var build         = CreateBuildInstance(defaultTargetExpression);

            HandleCompletion(build);
            CheckActiveBuildProjectConfigurations();
            AttachVisualStudioDebugger();

            try
            {
                build.OnBuildCreated();

                Logger.OutputSink = build.OutputSink;
                Logger.LogLevel   = NukeBuild.LogLevel;
                ToolPathResolver.NuGetPackagesConfigFile = build.NuGetPackagesConfigFile;

                Logger.Log($"NUKE Execution Engine {typeof(BuildExecutor).Assembly.GetInformationalText()}");
                Logger.Log(FigletTransform.GetText("NUKE"));

                HandleEarlyExits(build);
                ProcessManager.CheckPathEnvironmentVariable();
                InjectionUtility.InjectValues(build);

                executionList = TargetDefinitionLoader.GetExecutingTargets(build, NukeBuild.InvokedTargets, NukeBuild.SkippedTargets);
                RequirementService.ValidateRequirements(executionList, build);

                build.OnBuildInitialized();

                Execute(build, executionList);

                return(0);
            }
            catch (Exception exception)
            {
                Logger.Error(exception);
                return(-1);
            }
            finally
            {
                if (Logger.OutputSink is SevereMessagesOutputSink outputSink)
                {
                    Logger.Log();
                    WriteWarningsAndErrors(outputSink);
                }

                if (executionList != null)
                {
                    Logger.Log();
                    WriteSummary(executionList);
                }

                build.OnBuildFinished();
            }
        }
Esempio n. 3
0
        public static int Execute <T>(Expression <Func <T, Target> > defaultTargetExpression)
            where T : NukeBuild
        {
            Logger.Log(FigletTransform.GetText("NUKE"));
            Logger.Log($"Version: {typeof(BuildExecutor).GetTypeInfo().Assembly.GetVersionText()}");
            Logger.Log($"Host: {EnvironmentInfo.HostType}");
            Logger.Log();

            var executionList = default(IReadOnlyCollection <TargetDefinition>);

            try
            {
                var build = CreateBuildInstance(defaultTargetExpression);
                InjectionService.InjectValues(build);
                HandleEarlyExits(build);

                executionList = TargetDefinitionLoader.GetExecutingTargets(build);
                RequirementService.ValidateRequirements(executionList, build);
                Execute(executionList);

                return(0);
            }
            catch (AggregateException exception)
            {
                foreach (var innerException in exception.Flatten().InnerExceptions)
                {
                    OutputSink.Error(innerException.Message, innerException.StackTrace);
                }
                return(-exception.Message.GetHashCode());
            }
            catch (TargetInvocationException exception)
            {
                var innerException = exception.InnerException.NotNull();
                OutputSink.Error(innerException.Message, innerException.StackTrace);
                return(-exception.Message.GetHashCode());
            }
            catch (Exception exception)
            {
                OutputSink.Error(exception.Message, exception.StackTrace);
                return(-exception.Message.GetHashCode());
            }
            finally
            {
                if (executionList != null)
                {
                    OutputSink.WriteSummary(executionList);
                }
            }
        }
Esempio n. 4
0
        public static int Execute <T>(Expression <Func <T, Target> > defaultTargetExpression)
            where T : NukeBuild
        {
            var executionList = default(IReadOnlyCollection <TargetDefinition>);

            try
            {
                var build = CreateBuildInstance(defaultTargetExpression);

                Logger.OutputSink = build.OutputSink;
                Logger.LogLevel   = build.LogLevel;
                NuGetPackageResolver.DefaultPackagesConfigFile = build.PackagesConfigFile;

                Logger.Log(FigletTransform.GetText("NUKE"));
                Logger.Log($"Version: {typeof(BuildExecutor).GetTypeInfo().Assembly.GetInformationalText()}");
                Logger.Log($"Host: {build.Host}");
                Logger.Log();

                ProcessManager.CheckPathEnvironmentVariable();
                InjectionService.InjectValues(build);
                HandleEarlyExits(build);

                executionList = TargetDefinitionLoader.GetExecutingTargets(build, build.InvokedTargets);
                RequirementService.ValidateRequirements(executionList, build);
                Execute(executionList);

                return(0);
            }
            catch (Exception exception)
            {
                Logger.Error(exception);
                return(-1);
            }
            finally
            {
                if (Logger.OutputSink is SevereMessagesOutputSink outputSink)
                {
                    Logger.Log();
                    WriteWarningsAndErrors(outputSink);
                }

                if (executionList != null)
                {
                    Logger.Log();
                    WriteSummary(executionList);
                }
            }
        }
Esempio n. 5
0
 public override IDisposable WriteBlock(string text)
 {
     return(DelegateDisposable.CreateBracket(
                () => WriteNormal(FigletTransform.GetText(text, "ansi-shadow"))));
 }
Esempio n. 6
0
 private static void PrintLogo()
 {
     Logger.Log(FigletTransform.GetText("NUKE"));
     Logger.Log($"Version: {typeof(BuildExecutor).GetTypeInfo().Assembly.GetName().Version}");
     Logger.Log(string.Empty);
 }