-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CookFlavor property for projects. (#7)
* Add CookFlavor property for projects. * Add support for multiple cook flavors. Also change BuildConfigBuildTarget's platform to an object so it can contain additional information (such as cook flavors). * Add CookFlavor property for projects. * Add support for multiple cook flavors. Also change BuildConfigBuildTarget's platform to an object so it can contain additional information (such as cook flavors). * Fix exception when target platform is not Android. * Refactor cook and pak + stage steps to loop over each cook flavor. * Do not tag staged output files with cook flavor if platform does not use cook flavors. * Copy Android binaries to Android_<CookFlavor> directory to avoid file conflict when all binaries are requested for testing. * Fix file path separators for Mac. * Fix code style inconsistencies.
- Loading branch information
1 parent
bd1f240
commit 260f20c
Showing
8 changed files
with
252 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
218 changes: 139 additions & 79 deletions
218
UET/Redpoint.Uet.BuildPipeline/BuildGraph/BuildGraph_Project.xml
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
UET/Redpoint.Uet.Configuration/BuildConfigTargetPlatform.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
namespace Redpoint.Uet.Configuration | ||
{ | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Text.Json.Serialization; | ||
|
||
public class BuildConfigTargetPlatform | ||
{ | ||
/// <summary> | ||
/// The platform name to build the project for. | ||
/// </summary> | ||
[JsonPropertyName("Platform")] | ||
public string Platform { get; set; } = string.Empty; | ||
|
||
/// <summary> | ||
/// The flavors to cook an Android platform for. e.g. ASTC, DXT, ETC2, Multi. | ||
/// </summary> | ||
[JsonPropertyName("CookFlavors")] | ||
[SuppressMessage("Performance", "CA1819:Properties should not return arrays", Justification = "This property is used for JSON serialization.")] | ||
public string[]? CookFlavors { get; set; } = null; | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
UET/Redpoint.Uet.Configuration/BuildConfigTargetPlatformConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
namespace Redpoint.Uet.Configuration | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text.Json.Serialization; | ||
using System.Text.Json; | ||
|
||
public class BuildConfigTargetPlatformConverter : JsonConverter<BuildConfigTargetPlatform[]> | ||
{ | ||
public override BuildConfigTargetPlatform[] Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) | ||
{ | ||
if (reader.TokenType != JsonTokenType.StartArray) | ||
{ | ||
throw new JsonException("Expected StartArray token"); | ||
} | ||
|
||
var platforms = new List<BuildConfigTargetPlatform>(); | ||
|
||
while (reader.Read() && reader.TokenType != JsonTokenType.EndArray) | ||
{ | ||
if (reader.TokenType == JsonTokenType.String) | ||
{ | ||
platforms.Add(new BuildConfigTargetPlatform | ||
{ | ||
Platform = reader.GetString()! | ||
}); | ||
} | ||
else if (reader.TokenType == JsonTokenType.StartObject) | ||
{ | ||
var platform = new BuildConfigTargetPlatform(); | ||
|
||
while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) | ||
{ | ||
if (reader.TokenType != JsonTokenType.PropertyName) | ||
{ | ||
throw new JsonException("Expected PropertyName token"); | ||
} | ||
|
||
var propName = reader.GetString(); | ||
reader.Read(); | ||
|
||
switch (propName) | ||
{ | ||
case nameof(BuildConfigTargetPlatform.Platform): | ||
platform.Platform = reader.GetString()!; | ||
break; | ||
case nameof(BuildConfigTargetPlatform.CookFlavors): | ||
if (reader.TokenType != JsonTokenType.StartArray) | ||
{ | ||
throw new JsonException("Expected StartArray token"); | ||
} | ||
List<string> cookFlavors = []; | ||
while (reader.Read() && reader.TokenType != JsonTokenType.EndArray) | ||
{ | ||
cookFlavors.Add(reader.GetString()!); | ||
} | ||
platform.CookFlavors = cookFlavors.ToArray(); | ||
break; | ||
} | ||
} | ||
|
||
platforms.Add(platform); | ||
} | ||
} | ||
|
||
return platforms.ToArray(); | ||
} | ||
|
||
public override void Write(Utf8JsonWriter writer, BuildConfigTargetPlatform[] value, JsonSerializerOptions options) | ||
{ | ||
throw new NotSupportedException(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters