Skip to content

Commit

Permalink
Made pushing the serializer optional
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwardCooke committed Feb 7, 2023
1 parent cf7b93c commit f18356c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
11 changes: 7 additions & 4 deletions tools/build/BuildDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,13 @@ public static List<NuGetPackage> 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;
}
Expand Down
8 changes: 7 additions & 1 deletion tools/build/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Program
public static Host Host { get; private set; }
private static readonly Dictionary<Type, object> state = new Dictionary<Type, object>();
public static bool UnlistPackage { get; private set; } = true;

public static bool PushSerializer { get; private set; }
private static T GetState<T>() where T : notnull
{
return state.TryGetValue(typeof(T), out var value)
Expand Down Expand Up @@ -137,6 +137,11 @@ static async Task<int> Main(string[] args)
return false;
}
if (a == "--push-serializer")
{
PushSerializer = true;
return false;
}
return true;
})
.ToList();
Expand Down Expand Up @@ -221,6 +226,7 @@ static async Task<int> 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=<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;
Expand Down

0 comments on commit f18356c

Please sign in to comment.