public void Generate(NukeBuild build, IReadOnlyCollection <ExecutableTarget> executableTargets) { var relevantTargets = RelevantTargetNames .SelectMany(x => ExecutionPlanner.GetExecutionPlan(executableTargets, new[] { x })) .Distinct() .Where(x => !IrrelevantTargetNames.Contains(x.Name)).ToList(); var configuration = GetConfiguration(build, relevantTargets); using var stream = CreateStream(); var writer = CreateWriter(stream); writer.WriteComment("------------------------------------------------------------------------------"); writer.WriteComment("<auto-generated>"); writer.WriteComment(); writer.WriteComment(" This code was generated."); writer.WriteComment(); writer.WriteComment(" - To turn off auto-generation set:"); writer.WriteComment(); writer.WriteComment($" [{GetType().Name.TrimEnd(nameof(Attribute))} ({nameof(IConfigurationGenerator.AutoGenerate)} = false)]"); writer.WriteComment(); writer.WriteComment(" - To trigger manual generation invoke:"); writer.WriteComment(); writer.WriteComment($" nuke --{ConfigurationParameterName} {Id} --host {HostName}"); writer.WriteComment(); writer.WriteComment("</auto-generated>"); writer.WriteComment("------------------------------------------------------------------------------"); writer.WriteLine(); writer.Write(configuration.Write); }
public void OnBeforeLogo(NukeBuild build, IReadOnlyCollection <ExecutableTarget> executableTargets) { if (!EnvironmentInfo.GetParameter <bool>(ConfigurationParameterName) || NukeBuild.Host != HostType) { return; } ControlFlow.Assert(NukeBuild.RootDirectory != null, "NukeBuild.RootDirectory != null"); var relevantTargets = RelevantTargetNames .SelectMany(x => ExecutionPlanner.GetExecutionPlan(executableTargets, new[] { x })) .Distinct() .Where(x => !IrrelevantTargetNames.Contains(x.Name)).ToList(); using (var writer = CreateWriter()) { WriteAutoGenerationComment(writer); var configuration = GetConfiguration(build, relevantTargets); configuration.Write(writer); } Environment.Exit(0); }
protected IEnumerable <ExecutableTarget> GetTargetDependencies(ExecutableTarget executableTarget) { return(executableTarget.ExecutionDependencies.Where(x => !IrrelevantTargetNames.Contains(x.Name))); }
protected IEnumerable <string> GetInvokedTargets(ExecutableTarget executableTarget) { return(executableTarget .DescendantsAndSelf(x => x.ExecutionDependencies.Concat(x.Triggers), x => IrrelevantTargetNames.Contains(x.Name)) .Where(x => x == executableTarget || NonEntryTargets.Contains(x.Name)) .Reverse() .Select(x => x.Name)); }