From f18356c28bd11465f9ba1f8451dfbd6ec3ffe919 Mon Sep 17 00:00:00 2001 From: Edward Cooke Date: Mon, 6 Feb 2023 17:30:16 -0700 Subject: [PATCH] Made pushing the serializer optional --- tools/build/BuildDefinition.cs | 11 +++++++---- tools/build/Program.cs | 8 +++++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/tools/build/BuildDefinition.cs b/tools/build/BuildDefinition.cs index 3274f6ce..059aa1df 100644 --- a/tools/build/BuildDefinition.cs +++ b/tools/build/BuildDefinition.cs @@ -165,10 +165,13 @@ public static List Pack(Options options, GitVersion version, Succe var packagePath = Path.Combine(buildDir, "bin", $"YamlDotNet.{version.NuGetVersion}.nupkg"); result.Add(new NuGetPackage(packagePath, "YamlDotNet")); - buildDir = Path.Combine(BasePath, "YamlDotNet.Analyzers.StaticGenerator"); - Run("nuget", $"pack YamlDotNet.Analyzers.StaticGenerator.nuspec -Version {version.NuGetVersion} -OutputDirectory bin", buildDir); - packagePath = Path.Combine(buildDir, "bin", $"YamlDotNet.Analyzers.StaticGenerator.{version.NuGetVersion}.nupkg"); - result.Add(new NuGetPackage(packagePath, "YamlDotNet.Analyzers.StaticGenerator")); + if (PushSerializer) + { + buildDir = Path.Combine(BasePath, "YamlDotNet.Analyzers.StaticGenerator"); + Run("nuget", $"pack YamlDotNet.Analyzers.StaticGenerator.nuspec -Version {version.NuGetVersion} -OutputDirectory bin", buildDir); + packagePath = Path.Combine(buildDir, "bin", $"YamlDotNet.Analyzers.StaticGenerator.{version.NuGetVersion}.nupkg"); + result.Add(new NuGetPackage(packagePath, "YamlDotNet.Analyzers.StaticGenerator")); + } return result; } diff --git a/tools/build/Program.cs b/tools/build/Program.cs index 39df849d..f6918d49 100644 --- a/tools/build/Program.cs +++ b/tools/build/Program.cs @@ -25,7 +25,7 @@ class Program public static Host Host { get; private set; } private static readonly Dictionary state = new Dictionary(); public static bool UnlistPackage { get; private set; } = true; - + public static bool PushSerializer { get; private set; } private static T GetState() where T : notnull { return state.TryGetValue(typeof(T), out var value) @@ -137,6 +137,11 @@ static async Task Main(string[] args) return false; } + if (a == "--push-serializer") + { + PushSerializer = true; + return false; + } return true; }) .ToList(); @@ -221,6 +226,7 @@ static async Task Main(string[] args) Console.WriteLine($" {palette.Option}--no-prerelease {palette.Default}Force the current version to be considered final{palette.Reset}"); Console.WriteLine($" {palette.Option}--version= {palette.Default}Force the current version to equal to the specified value{palette.Reset}"); Console.WriteLine($" {palette.Option}--no-unlist {palette.Default}Don't unlist the pushed NuGet package{palette.Reset}"); + Console.WriteLine($" {palette.Option}--push-serializer {palette.Default}Push up the serializer nuget package{palette.Reset}"); } return exitCode;