mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-25 05:56:58 +01:00
Release Notes fixes
- Do not use markdown with Nuget release notes. - Force asserts to evaluate as they were breaking the `TGSDeploy` notes
This commit is contained in:
@@ -661,7 +661,7 @@ namespace Tgstation.Server.ReleaseNotes
|
||||
if (changelists.TryGetValue(component, out var currentChangelist))
|
||||
currentChangelist.Changes.AddRange(tupleSelector);
|
||||
else
|
||||
Debug.Assert(changelists.TryAdd(component, new Changelist
|
||||
DebugAssert(changelists.TryAdd(component, new Changelist
|
||||
{
|
||||
Changes = tupleSelector.ToList(),
|
||||
Unreleased = false,
|
||||
@@ -725,7 +725,7 @@ namespace Tgstation.Server.ReleaseNotes
|
||||
|
||||
await previousTask;
|
||||
|
||||
Debug.Assert(!(await needExtendedComponentVersions) || changelists.Where(x => x.Key == Component.Core).All(x => x.Value.ComponentVersions != null && x.Value.ComponentVersions.Count > 3));
|
||||
DebugAssert(!(await needExtendedComponentVersions) || changelists.Where(x => x.Key == Component.Core).All(x => x.Value.ComponentVersions != null && x.Value.ComponentVersions.Count > 3));
|
||||
|
||||
return Tuple.Create(changelists.ToDictionary(kvp => kvp.Key, kvp => kvp.Value), await componentVersions, isReleasePR);
|
||||
}
|
||||
@@ -987,7 +987,7 @@ The user account that created this pull request is available to correct any issu
|
||||
newList = newList.OrderBy(x => x).ToList();
|
||||
|
||||
var index = newList.IndexOf(componentVersion);
|
||||
Debug.Assert(index != -1);
|
||||
DebugAssert(index != -1);
|
||||
if (index != (newList.Count - 1))
|
||||
{
|
||||
componentVersion = newList[index + 1];
|
||||
@@ -1013,10 +1013,10 @@ The user account that created this pull request is available to correct any issu
|
||||
entry.Changes.AddRange(changelist.Changes);
|
||||
}
|
||||
|
||||
Debug.Assert(list.Select(x => x.Version.ToString()).Distinct().Count() == list.Count);
|
||||
DebugAssert(list.Select(x => x.Version.ToString()).Distinct().Count() == list.Count);
|
||||
if (component == Component.Core)
|
||||
{
|
||||
Debug.Assert(list.All(x => x.Version == milestoneVersion));
|
||||
DebugAssert(list.All(x => x.Version == milestoneVersion));
|
||||
}
|
||||
|
||||
list = list.OrderByDescending(x => x.Version).ToList();
|
||||
@@ -1038,7 +1038,7 @@ The user account that created this pull request is available to correct any issu
|
||||
});
|
||||
}
|
||||
else
|
||||
Debug.Assert(finalResults[Component.Core].All(x => x.Version == milestoneVersion && x.ComponentVersions != null && x.ComponentVersions.Count > 3));
|
||||
DebugAssert(finalResults[Component.Core].All(x => x.Version == milestoneVersion && x.ComponentVersions != null && x.ComponentVersions.Count > 3));
|
||||
|
||||
var notes = new ReleaseNotes
|
||||
{
|
||||
@@ -1189,7 +1189,7 @@ The user account that created this pull request is available to correct any issu
|
||||
.Where(x => x.Key == Component.Core)
|
||||
.ToList();
|
||||
|
||||
Debug.Assert(
|
||||
DebugAssert(
|
||||
coreCls.Count == milestonesToProcess.Count);
|
||||
|
||||
var distinctCoreVersions = coreCls
|
||||
@@ -1204,7 +1204,7 @@ The user account that created this pull request is available to correct any issu
|
||||
.Where(x => !distinctCoreVersions.Any(y => Version.Parse(x.Title.AsSpan(1)) == y))
|
||||
.ToList();
|
||||
|
||||
Debug.Assert(missingCoreVersions.Count == 0);
|
||||
DebugAssert(missingCoreVersions.Count == 0);
|
||||
|
||||
var changelistsGroupedByComponent =
|
||||
milestonePRTasks
|
||||
@@ -1236,7 +1236,7 @@ The user account that created this pull request is available to correct any issu
|
||||
.ToList()))
|
||||
};
|
||||
|
||||
Debug.Assert(releaseNotes.Components.ContainsKey(Component.Core) && releaseNotes.Components[Component.Core].Count == milestonesToProcess.Count);
|
||||
DebugAssert(releaseNotes.Components.ContainsKey(Component.Core) && releaseNotes.Components[Component.Core].Count == milestonesToProcess.Count);
|
||||
|
||||
if (previousNotes != null)
|
||||
{
|
||||
@@ -1274,7 +1274,7 @@ The user account that created this pull request is available to correct any issu
|
||||
foreach (var kvp in releaseNotes.Components)
|
||||
{
|
||||
var distinctCount = kvp.Value.Select(changelist => changelist.Version.ToString()).Distinct().Count();
|
||||
Debug.Assert(distinctCount == kvp.Value.Count);
|
||||
DebugAssert(distinctCount == kvp.Value.Count);
|
||||
|
||||
foreach (var cl in kvp.Value)
|
||||
{
|
||||
@@ -1313,11 +1313,14 @@ The user account that created this pull request is available to correct any issu
|
||||
throw new Exception($"Changlist {changelist.Version} has no changes!");
|
||||
}
|
||||
|
||||
static string GenerateComponentNotes(ReleaseNotes releaseNotes, Component component, Version version)
|
||||
static string GenerateComponentNotes(ReleaseNotes releaseNotes, Component component, Version version, bool useMarkdown)
|
||||
{
|
||||
var relevantChangelog = releaseNotes.Components[component].FirstOrDefault(x => x.Version == version);
|
||||
|
||||
var newNotes = new StringBuilder("Full changelog can be found [here](https://raw.githubusercontent.com/tgstation/tgstation-server/gh-pages/changelog.yml).");
|
||||
var newNotes = new StringBuilder(
|
||||
useMarkdown
|
||||
? "Full changelog can be found [here](https://raw.githubusercontent.com/tgstation/tgstation-server/gh-pages/changelog.yml)."
|
||||
: "Full changelog can be found here: https://raw.githubusercontent.com/tgstation/tgstation-server/gh-pages/changelog.yml.");
|
||||
if (relevantChangelog != null)
|
||||
{
|
||||
newNotes.AppendLine();
|
||||
@@ -1331,7 +1334,7 @@ The user account that created this pull request is available to correct any issu
|
||||
static async Task<int> ReleaseComponent(IGitHubClient client, Version version, Component component)
|
||||
{
|
||||
var releaseNotes = await GenerateNotes(client, new Dictionary<Component, Version> { { component, version } });
|
||||
await File.WriteAllTextAsync(OutputPath, GenerateComponentNotes(releaseNotes, component, version));
|
||||
await File.WriteAllTextAsync(OutputPath, GenerateComponentNotes(releaseNotes, component, version, true));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1373,7 +1376,7 @@ The user account that created this pull request is available to correct any issu
|
||||
var component = kvp.Key;
|
||||
var csprojPath = CsprojSubstitution.Replace("$PROJECT$", kvp.Value);
|
||||
|
||||
var markdown = GenerateComponentNotes(releaseNotes, component, componentVersions[component]);
|
||||
var markdown = GenerateComponentNotes(releaseNotes, component, componentVersions[component], false);
|
||||
|
||||
var escapedMarkdown = SecurityElement.Escape(markdown);
|
||||
|
||||
@@ -1557,5 +1560,15 @@ package (version) distribution(s); urgency=urgency
|
||||
await File.WriteAllTextAsync(outputPath, changelog);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void DebugAssert(bool condition, string message = null)
|
||||
{
|
||||
// This exists because one of the fucking asserts evaluates an enumerable or something and it was getting optimized out in release
|
||||
// I CBA to track this down.
|
||||
if (message != null)
|
||||
Debug.Assert(condition, message);
|
||||
else
|
||||
Debug.Assert(condition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user