Skip to content

Commit

Permalink
rebuildAssetsWhenCompressionChanged (#1980)
Browse files Browse the repository at this point in the history
  • Loading branch information
nkast authored Oct 31, 2024
1 parent fff26b0 commit 4aca45e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
8 changes: 4 additions & 4 deletions Tools/MonoGame.Content.Builder/BuildEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ private static string ConvertToString(object value)
internal class PipelineBuildEventBinaryWriter : BinaryWriter
{
private const string Header = "KNIC"; // content db
private const short MajorVersion = 3;
private const short MinorVersion = 9;
private const short MajorVersion = 3;
private const short MinorVersion = 15;
private const short DataType = 2; // PipelineBuildEvent data


Expand Down Expand Up @@ -366,8 +366,8 @@ private void WriteDateTime(DateTime value)
internal class PipelineBuildEventBinaryReader : BinaryReader
{
private const string Header = "KNIC"; // content db
private const short MajorVersion = 3;
private const short MinorVersion = 9;
private const short MajorVersion = 3;
private const short MinorVersion = 15;
private const int DataType = 2; // PipelineBuildEvent data


Expand Down
3 changes: 2 additions & 1 deletion Tools/MonoGame.Content.Builder/ContentBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,6 @@ public void Build()
}

_manager = new PipelineManager(projectDirectory, _responseFilename, outputPath, intermediatePath, this.Quiet);
_manager.Compression = compression;

// Feed all the assembly references to the pipeline manager
// so it can resolve importers, processors, writers, and types.
Expand All @@ -361,6 +360,7 @@ public void Build()
bool targetChanged = previousFileCollection.Config != Config
|| previousFileCollection.Platform != Platform
|| previousFileCollection.Profile != Profile
|| previousFileCollection.Compression != compression
;

// First clean previously built content.
Expand All @@ -374,6 +374,7 @@ public void Build()
{
Profile = _manager.Profile = Profile,
Platform = _manager.Platform = Platform,
Compression = _manager.Compression = compression,
Config = _manager.Config = Config
};
SuccessCount = 0;
Expand Down
13 changes: 9 additions & 4 deletions Tools/MonoGame.Content.Builder/SourceFileCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Collections.Generic;
using System.IO;
using Microsoft.Xna.Framework.Content.Pipeline;
using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler;
using Microsoft.Xna.Framework.Graphics;

namespace Microsoft.Xna.Framework.Content.Pipeline.Builder
Expand All @@ -18,6 +19,8 @@ public sealed class SourceFileCollection

public TargetPlatform Platform { get; set; }

public ContentCompression Compression { get; set; }

public string Config { get; set; }

public List<string> SourceFiles { get; set; }
Expand Down Expand Up @@ -87,8 +90,8 @@ public void Merge(SourceFileCollection previousFileCollection)
internal class SourceFileCollectionBinaryWriter : BinaryWriter
{
private const string Header = "KNIC"; // content db
private const short MajorVersion = 3;
private const short MinorVersion = 9;
private const short MajorVersion = 3;
private const short MinorVersion = 15;
private const int DataType = 1; // SourceFileCollection data


Expand All @@ -110,6 +113,7 @@ internal void Write(SourceFileCollection value)

Write((Int32)value.Profile);
Write((Int32)value.Platform);
Write((Int32)value.Compression);
WriteStringOrNull(value.Config);

WritePackedInt(value.SourceFiles.Count);
Expand Down Expand Up @@ -145,8 +149,8 @@ private void WriteStringOrNull(string value)
internal class SourceFileCollectionBinaryReader : BinaryReader
{
private const string Header = "KNIC"; // content db
private const short MajorVersion = 3;
private const short MinorVersion = 9;
private const short MajorVersion = 3;
private const short MinorVersion = 15;
private const int DataType = 1; // SourceFileCollection data


Expand Down Expand Up @@ -175,6 +179,7 @@ internal void Read(SourceFileCollection value)

value.Profile = (GraphicsProfile)ReadInt32();
value.Platform = (TargetPlatform)ReadInt32();
value.Compression = (ContentCompression)ReadInt32();
value.Config = ReadStringOrNull();

int filesCount = ReadPackedInt();
Expand Down

0 comments on commit 4aca45e

Please sign in to comment.