Skip to content

Commit

Permalink
Merge pull request #1458 from RocketSurgeonsGuild/regenerate-yaml-aft…
Browse files Browse the repository at this point in the history
…er-lint

regenerate yaml after the lint phase
  • Loading branch information
david-driscoll authored Dec 19, 2024
2 parents 394b364 + 9104261 commit c14d308
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 39 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,6 @@ jobs:
id: moveUnshippedToShipped
run: |
dotnet .build/bin/Debug/.build.dll --target MoveUnshippedToShipped --skip LintPublicApiAnalyzers --ThisIsAOtherVariable "${{ vars.THIS_IS_A_VARIABLE }}" --ThisIsAnotherVariable "${{ vars.THIS_IS_ANOTHER_VARIABLE }}" --THIS_IS_A_VARIABLE "${{ vars.THIS_IS_A_VARIABLE }}" --ThisIsAEnv "${{ env.THIS_IS_A_ENV || 'test' }}" --ThisIsASecret "${{ secrets.THIS_IS_A_SECRET }}" --GitHubToken "${{ secrets.GITHUB_TOKEN }}"
- name: Regenerate Build Configurations
id: regenerateBuildConfigurations
run: |
dotnet .build/bin/Debug/.build.dll --target RegenerateBuildConfigurations --ThisIsAOtherVariable "${{ vars.THIS_IS_A_VARIABLE }}" --ThisIsAnotherVariable "${{ vars.THIS_IS_ANOTHER_VARIABLE }}" --THIS_IS_A_VARIABLE "${{ vars.THIS_IS_A_VARIABLE }}" --ThisIsAEnv "${{ env.THIS_IS_A_ENV || 'test' }}" --ThisIsASecret "${{ secrets.THIS_IS_A_SECRET }}" --GitHubToken "${{ secrets.GITHUB_TOKEN }}"
- name: Prettier
id: prettier
run: |
Expand All @@ -106,6 +102,10 @@ jobs:
id: jetBrainsCleanupCode
run: |
dotnet .build/bin/Debug/.build.dll --target JetBrainsCleanupCode --ThisIsAOtherVariable "${{ vars.THIS_IS_A_VARIABLE }}" --ThisIsAnotherVariable "${{ vars.THIS_IS_ANOTHER_VARIABLE }}" --THIS_IS_A_VARIABLE "${{ vars.THIS_IS_A_VARIABLE }}" --ThisIsAEnv "${{ env.THIS_IS_A_ENV || 'test' }}" --ThisIsASecret "${{ secrets.THIS_IS_A_SECRET }}" --GitHubToken "${{ secrets.GITHUB_TOKEN }}"
- name: Regenerate Build Configurations
id: regenerateBuildConfigurations
run: |
dotnet .build/bin/Debug/.build.dll --target RegenerateBuildConfigurations --ThisIsAOtherVariable "${{ vars.THIS_IS_A_VARIABLE }}" --ThisIsAnotherVariable "${{ vars.THIS_IS_ANOTHER_VARIABLE }}" --THIS_IS_A_VARIABLE "${{ vars.THIS_IS_A_VARIABLE }}" --ThisIsAEnv "${{ env.THIS_IS_A_ENV || 'test' }}" --ThisIsASecret "${{ secrets.THIS_IS_A_SECRET }}" --GitHubToken "${{ secrets.GITHUB_TOKEN }}"
- name: Generate Solution Items
id: generateSolutionItems
run: |
Expand Down
4 changes: 2 additions & 2 deletions src/Nuke/ICanRegenerateBuildConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Reflection;
using Nuke.Common.CI;
using Nuke.Common.IO;
using Nuke.Common.Tooling;
using Nuke.Common.Tools.DotNet;
using Serilog;

Expand All @@ -19,6 +18,7 @@ public interface ICanRegenerateBuildConfiguration : ICanLint
public Target RegenerateBuildConfigurations =>
t => t
.TriggeredBy<ICanLint>(static z => z.Lint)
.TryAfter<ICanLint>(static z => z.PostLint)
.Executes(
() =>
{
Expand All @@ -40,7 +40,7 @@ public interface ICanRegenerateBuildConfiguration : ICanLint

Log.Logger.Information("Regenerating {HostName} configuration id {Name}", host.HostName, host.Id);

DotNetTasks.DotNet(
_ = DotNetTasks.DotNet(
args.RenderForExecution(),
RootDirectory,
EnvironmentInfo.Variables.AddIfMissing("NUKE_INTERNAL_INTERCEPTOR", "1"),
Expand Down
67 changes: 34 additions & 33 deletions src/Nuke/ResolvedToolsManifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,47 +40,48 @@ private static void DefaultLogger(OutputType kind, string message)
// ReSharper restore TemplateIsNotCompileTimeConstantProblem
}

private static Tool CreateHandler(string command) => (arguments, directory, variables, timeout, output, invocation, logger, handler) =>
{
var newArgs = new ArgumentStringHandler();
newArgs.AppendLiteral(command);
newArgs.AppendLiteral(" ");
newArgs.AppendLiteral(arguments.ToStringAndClear().TrimMatchingDoubleQuotes());
arguments.AppendLiteral(
newArgs.ToStringAndClear().TrimMatchingDoubleQuotes().Replace("\\\"", "\"")
);
return DotNetTasks.DotNet(
arguments,
directory,
variables,
timeout,
output,
invocation,
// ReSharper disable once TemplateIsNotCompileTimeConstantProblem
logger ?? DefaultLogger,
process =>
{
if (handler is null)
{
return process.AssertZeroExitCode();
}

handler.Invoke(process);
return process;
}
);
};

public bool IsInstalled(string commandName) => commandDefinitions.ContainsKey(commandName) || toolDefinitions.ContainsKey(commandName);

public ToolDefinition GetToolDefinition(string nugetPackageName) => ( toolDefinitions.TryGetValue(nugetPackageName, out var tool) )
public ToolDefinition GetToolDefinition(string nugetPackageName) => toolDefinitions.TryGetValue(nugetPackageName, out var tool)
? tool
: throw new InvalidOperationException($"Tool {nugetPackageName} is not installed");

public Tool GetTool(string nugetPackageName) => ( toolDefinitions.TryGetValue(nugetPackageName, out var tool) )
public Tool GetTool(string nugetPackageName) => toolDefinitions.TryGetValue(nugetPackageName, out var tool)
? CreateHandler(tool.Commands.First())
: ( commandDefinitions.TryGetValue(nugetPackageName, out var command) )
: commandDefinitions.TryGetValue(nugetPackageName, out var command)
? CreateHandler(command.Command)
: throw new InvalidOperationException($"Tool {nugetPackageName} is not installed");

public Tool GetProperTool(string nugetPackageName) => GetTool(nugetPackageName);

private static Tool CreateHandler(string command) => (arguments, directory, variables, timeout, output, invocation, logger, handler) =>
{
var newArgs = new ArgumentStringHandler();
newArgs.AppendLiteral(command);
newArgs.AppendLiteral(" ");
newArgs.AppendLiteral(arguments.ToStringAndClear().TrimMatchingDoubleQuotes());
arguments.AppendLiteral(newArgs.ToStringAndClear());
return DotNetTasks.DotNet(
arguments,
directory,
variables,
timeout,
output,
invocation,
// ReSharper disable once TemplateIsNotCompileTimeConstantProblem
logger ?? DefaultLogger,
process =>
{
if (handler is null)
{
return process.AssertZeroExitCode();
}

handler.Invoke(process);
return process;

}
);
};
}

0 comments on commit c14d308

Please sign in to comment.