Skip to content

Commit

Permalink
🚚 重命名 MSBuild Tasks
Browse files Browse the repository at this point in the history
Signed-off-by: 舰队的偶像-岛风酱! <frg2089@outlook.com>
  • Loading branch information
frg2089 committed Aug 26, 2023
1 parent 901fe7c commit 793d338
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Shimakaze.Sdk.Build;
/// <summary>
/// Csf 构建器
/// </summary>
public sealed class CsfBuilder : MSTask
public sealed class TaskCsfGenerator : MSTask
{
/// <summary>
/// Destination
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Shimakaze.Sdk.Build;
/// <summary>
/// Csf 合并器
/// </summary>
public sealed class CsfMerger : MSTask
public sealed class TaskCsfMerger : MSTask
{
private const string Metadata_Pack = "Pack";

Expand Down Expand Up @@ -39,7 +39,7 @@ public override bool Execute()
if (!DestinationFile.CreateParentDirectory(Log))
return false;

IO.Csf.CsfMerger merger = new();
CsfMerger merger = new();
OutputFile = new TaskItem(DestinationFile);
foreach (var file in SourceFiles)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Shimakaze.Sdk.Build;
/// <summary>
/// Ini 合并器
/// </summary>
public sealed class IniMerger : MSTask
public sealed class TaskIniMerger : MSTask
{
/// <summary>
/// Destination
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Shimakaze.Sdk.Build;
/// <summary>
/// Ini 预处理器
/// </summary>
public sealed class IniPreprocessor : MSTask
public sealed class TaskIniPreprocessor : MSTask
{
private const string Metadata_Destination = "Destination";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@ namespace Shimakaze.Sdk.Build;
/// <summary>
/// Mix Packer Task
/// </summary>
public sealed class MixPacker : MSTask
public sealed class TaskMixGennerator : MSTask
{
/// <summary>
/// 生成的文件
/// </summary>
[Required]
public required string DestinationFile { get; set; }

///// <summary>
///// 是否使用旧的ID计算器
///// </summary>
//public bool UsingOldIdCalculater { get; set; }

/// <summary>
/// 生成的目标文件
/// </summary>
Expand All @@ -33,11 +38,17 @@ public sealed class MixPacker : MSTask
/// <inheritdoc />
public override bool Execute()
{
Log.LogMessage("Packing Mix...");
Log.LogMessage("Generating Mix...");
if (!DestinationFile.CreateParentDirectory(Log))
return false;

var builder = new MixBuilder() { IdCalculater = IdCalculaters.TSIdCalculater };
var builder = new MixBuilder()
{
IdCalculater = IdCalculaters.TSIdCalculater
//IdCalculater = UsingOldIdCalculater
//? IdCalculaters.OldIdCalculater
//: IdCalculaters.TSIdCalculater
};
OutputFile = new TaskItem(DestinationFile);
foreach (var file in SourceFiles)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace Shimakaze.Sdk.Build.Tests;

[TestClass]
public class CsfBuilderTests
public class TaskCsfGeneratorTest
{
private const string Assets = "Assets";
private const string InputJsonV1File = "ra2md.v1.csf.json";
Expand All @@ -21,10 +21,10 @@ public class CsfBuilderTests
public void JsonV1Test()
{
TaskItem item = new(Path.Combine(Assets, InputJsonV1File));
item.SetMetadata(CsfBuilder.Metadata_Destination, Path.Combine(OutputPath, InputJsonV1File));
item.SetMetadata(CsfBuilder.Metadata_Type, "JsonV1");
item.SetMetadata(TaskCsfGenerator.Metadata_Destination, Path.Combine(OutputPath, InputJsonV1File));
item.SetMetadata(TaskCsfGenerator.Metadata_Type, "JsonV1");

CsfBuilder task = new()
TaskCsfGenerator task = new()
{
SourceFiles = new[] { item },
BuildEngine = _buildEngine?.Object,
Expand All @@ -36,10 +36,10 @@ public void JsonV1Test()
public void JsonV2Test()
{
TaskItem item = new(Path.Combine(Assets, InputJsonV2File));
item.SetMetadata(CsfBuilder.Metadata_Destination, Path.Combine(OutputPath, InputJsonV2File));
item.SetMetadata(CsfBuilder.Metadata_Type, "JsonV2");
item.SetMetadata(TaskCsfGenerator.Metadata_Destination, Path.Combine(OutputPath, InputJsonV2File));
item.SetMetadata(TaskCsfGenerator.Metadata_Type, "JsonV2");

CsfBuilder task = new()
TaskCsfGenerator task = new()
{
SourceFiles = new[] { item },
BuildEngine = _buildEngine?.Object,
Expand All @@ -61,10 +61,10 @@ public void Startup()
public void UnknownTest()
{
TaskItem item = new(Path.Combine(Assets, InputXmlV1File));
item.SetMetadata(CsfBuilder.Metadata_Destination, Path.Combine(OutputPath, "Unknown"));
item.SetMetadata(CsfBuilder.Metadata_Type, "Unknown");
item.SetMetadata(TaskCsfGenerator.Metadata_Destination, Path.Combine(OutputPath, "Unknown"));
item.SetMetadata(TaskCsfGenerator.Metadata_Type, "Unknown");

CsfBuilder task = new()
TaskCsfGenerator task = new()
{
SourceFiles = new[] { item },
BuildEngine = _buildEngine?.Object,
Expand All @@ -76,10 +76,10 @@ public void UnknownTest()
public void XmlV1Test()
{
TaskItem item = new(Path.Combine(Assets, InputXmlV1File));
item.SetMetadata(CsfBuilder.Metadata_Destination, Path.Combine(OutputPath, InputXmlV1File));
item.SetMetadata(CsfBuilder.Metadata_Type, "XmlV1");
item.SetMetadata(TaskCsfGenerator.Metadata_Destination, Path.Combine(OutputPath, InputXmlV1File));
item.SetMetadata(TaskCsfGenerator.Metadata_Type, "XmlV1");

CsfBuilder task = new()
TaskCsfGenerator task = new()
{
SourceFiles = new[] { item },
BuildEngine = _buildEngine?.Object,
Expand All @@ -91,10 +91,10 @@ public void XmlV1Test()
public void YamlV1Test()
{
TaskItem item = new(Path.Combine(Assets, InputYamlV1File));
item.SetMetadata(CsfBuilder.Metadata_Destination, Path.Combine(OutputPath, InputYamlV1File));
item.SetMetadata(CsfBuilder.Metadata_Type, "YamlV1");
item.SetMetadata(TaskCsfGenerator.Metadata_Destination, Path.Combine(OutputPath, InputYamlV1File));
item.SetMetadata(TaskCsfGenerator.Metadata_Type, "YamlV1");

CsfBuilder task = new()
TaskCsfGenerator task = new()
{
SourceFiles = new[] { item },
BuildEngine = _buildEngine?.Object,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace Shimakaze.Sdk.Build.Tests;

[TestClass]
public class CsfMergerTests
public class TaskCsfMergerTest
{
private const string Assets = "Assets";
private const string InputFile = "ra2md.csf";
Expand All @@ -19,7 +19,7 @@ public void MergeTest()
{
TaskItem item = new(Path.Combine(Assets, InputFile));

CsfMerger task = new()
TaskCsfMerger task = new()
{
SourceFiles = new[] { item },
DestinationFile = Path.Combine(OutputPath, InputFile),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace Shimakaze.Sdk.Build.Tests;

[TestClass]
public class IniMergerTests
public class TaskIniMergerTest
{
private const string Assets = "Assets";
private const string InputFile = "normal.ini";
Expand All @@ -18,10 +18,10 @@ public class IniMergerTests
public void MergeTest()
{
TaskItem item = new(Path.Combine(Assets, InputFile));
item.SetMetadata(IniMerger.Metadata_Type, "Rule");
item.SetMetadata(TaskIniMerger.Metadata_Type, "Rule");
TaskItem output = new("Rule");
output.SetMetadata(IniMerger.Metadata_Destination, Path.Combine(OutputPath, InputFile));
IniMerger task = new()
output.SetMetadata(TaskIniMerger.Metadata_Destination, Path.Combine(OutputPath, InputFile));
TaskIniMerger task = new()
{
SourceFiles = new[] { item },
DestinationFiles = new[] { output },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace Shimakaze.Sdk.Build.Tests;

[TestClass]
public class IniPreprocessorTest
public class TaskIniPreprocessorTest
{
private const string Assets = "Assets";
private const string Defines = "DEFINED;TEST";
Expand All @@ -28,7 +28,7 @@ public void Startup()
[TestMethod]
public void Test()
{
IniPreprocessor task = new()
TaskIniPreprocessor task = new()
{
SourceFiles = InputFile.Split(';').Select(i =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace Shimakaze.Sdk.Build.Tests;

[TestClass]
public class MixPackerTest
public class TaskMixGenneratorTest
{
private const string Assets = "Assets";
private const string InputFile = "ra2md.csf";
Expand All @@ -30,7 +30,7 @@ public void Test()
{
TaskItem item = new(Path.Combine(Assets, InputFile));

MixPacker task = new()
TaskMixGennerator task = new()
{
SourceFiles = new[] { item },
DestinationFile = Path.Combine(OutputPath, OutputFile),
Expand Down

0 comments on commit 793d338

Please sign in to comment.