Skip to content

Commit

Permalink
Fix debug build exploding
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoco007 committed May 18, 2024
1 parent c6c8825 commit e978a7a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
1 change: 0 additions & 1 deletion BeatSaberMarkupLanguage/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
</ItemGroup>

<Copy SourceFiles="@(FilesToCopy)" DestinationFolder="$(BeatSaberDir)\%(RecursiveDir)" />
<Copy SourceFiles="$(TargetDir)YamlDotNet.dll" DestinationFolder="$(BeatSaberDir)Libs" Condition="'$(Configuration)' == 'Debug' AND !Exists('$(BeatSaberDir)Libs\YamlDotNet.dll')" />
</Target>

<!-- Clean up artifact files -->
Expand Down
19 changes: 9 additions & 10 deletions BeatSaberMarkupLanguage/Util/DocumentationDataGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,24 @@ namespace BeatSaberMarkupLanguage.Util
{
internal class DocumentationDataGenerator
{
private readonly ISerializer serializer;
private readonly IDeserializer deserializer;
private readonly IReadOnlyList<Type> typeHandlerTypes;

internal DocumentationDataGenerator(IEnumerable<Type> typeHandlers)
{
this.serializer = new SerializerBuilder().WithNamingConvention(CamelCaseNamingConvention.Instance).Build();
this.deserializer = new DeserializerBuilder().WithNamingConvention(CamelCaseNamingConvention.Instance).Build();
this.typeHandlerTypes = typeHandlers.Select(t => t.GetCustomAttribute<ComponentHandler>(true).type).OrderBy(t => t.Name).ToList();
}

internal void Generate()
{
GenerateTags();
GenerateMacros();
GenerateTypeHandlers();
IDeserializer deserializer = new DeserializerBuilder().WithNamingConvention(CamelCaseNamingConvention.Instance).Build();
ISerializer serializer = new SerializerBuilder().WithNamingConvention(CamelCaseNamingConvention.Instance).Build();

GenerateTags(serializer);
GenerateMacros(deserializer, serializer);
GenerateTypeHandlers(deserializer, serializer);
}

private void GenerateTags()
private void GenerateTags(ISerializer serializer)
{
GameObject dummy = new();
List<TagDefinition> tags = new();
Expand All @@ -59,7 +58,7 @@ private void GenerateTags()
UnityEngine.Object.Destroy(dummy);
}

private void GenerateMacros()
private void GenerateMacros(IDeserializer deserializer, ISerializer serializer)
{
GameObject dummy = new();
List<MacroDefinition> macros = deserializer.Deserialize<List<MacroDefinition>>(File.ReadAllText("Macros.yml"));
Expand Down Expand Up @@ -99,7 +98,7 @@ private void GenerateMacros()
UnityEngine.Object.Destroy(dummy);
}

private void GenerateTypeHandlers()
private void GenerateTypeHandlers(IDeserializer deserializer, ISerializer serializer)
{
GameObject dummy = new();
List<TypeHandlerDefinition> typeHandlers = deserializer.Deserialize<List<TypeHandlerDefinition>>(File.ReadAllText("TypeHandlers.yml"));
Expand Down

0 comments on commit e978a7a

Please sign in to comment.