Skip to content

Commit f18356c

Browse files
committed
Made pushing the serializer optional
1 parent cf7b93c commit f18356c

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

tools/build/BuildDefinition.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,13 @@ public static List<NuGetPackage> Pack(Options options, GitVersion version, Succe
165165
var packagePath = Path.Combine(buildDir, "bin", $"YamlDotNet.{version.NuGetVersion}.nupkg");
166166
result.Add(new NuGetPackage(packagePath, "YamlDotNet"));
167167

168-
buildDir = Path.Combine(BasePath, "YamlDotNet.Analyzers.StaticGenerator");
169-
Run("nuget", $"pack YamlDotNet.Analyzers.StaticGenerator.nuspec -Version {version.NuGetVersion} -OutputDirectory bin", buildDir);
170-
packagePath = Path.Combine(buildDir, "bin", $"YamlDotNet.Analyzers.StaticGenerator.{version.NuGetVersion}.nupkg");
171-
result.Add(new NuGetPackage(packagePath, "YamlDotNet.Analyzers.StaticGenerator"));
168+
if (PushSerializer)
169+
{
170+
buildDir = Path.Combine(BasePath, "YamlDotNet.Analyzers.StaticGenerator");
171+
Run("nuget", $"pack YamlDotNet.Analyzers.StaticGenerator.nuspec -Version {version.NuGetVersion} -OutputDirectory bin", buildDir);
172+
packagePath = Path.Combine(buildDir, "bin", $"YamlDotNet.Analyzers.StaticGenerator.{version.NuGetVersion}.nupkg");
173+
result.Add(new NuGetPackage(packagePath, "YamlDotNet.Analyzers.StaticGenerator"));
174+
}
172175

173176
return result;
174177
}

tools/build/Program.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Program
2525
public static Host Host { get; private set; }
2626
private static readonly Dictionary<Type, object> state = new Dictionary<Type, object>();
2727
public static bool UnlistPackage { get; private set; } = true;
28-
28+
public static bool PushSerializer { get; private set; }
2929
private static T GetState<T>() where T : notnull
3030
{
3131
return state.TryGetValue(typeof(T), out var value)
@@ -137,6 +137,11 @@ static async Task<int> Main(string[] args)
137137
return false;
138138
}
139139

140+
if (a == "--push-serializer")
141+
{
142+
PushSerializer = true;
143+
return false;
144+
}
140145
return true;
141146
})
142147
.ToList();
@@ -221,6 +226,7 @@ static async Task<int> Main(string[] args)
221226
Console.WriteLine($" {palette.Option}--no-prerelease {palette.Default}Force the current version to be considered final{palette.Reset}");
222227
Console.WriteLine($" {palette.Option}--version=<version> {palette.Default}Force the current version to equal to the specified value{palette.Reset}");
223228
Console.WriteLine($" {palette.Option}--no-unlist {palette.Default}Don't unlist the pushed NuGet package{palette.Reset}");
229+
Console.WriteLine($" {palette.Option}--push-serializer {palette.Default}Push up the serializer nuget package{palette.Reset}");
224230
}
225231

226232
return exitCode;

0 commit comments

Comments
 (0)