-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathIBuilderStep.cs
More file actions
52 lines (47 loc) · 1.47 KB
/
IBuilderStep.cs
File metadata and controls
52 lines (47 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
namespace CustomBuilder
{
/// <summary>
/// 打包步骤
/// 实现此类可以自定义打包过程中的步骤
/// </summary>
public interface IBuilderStep
{
/// <summary>
/// 打包前动作
/// 通常用于额外数据生成
/// </summary>
/// <param name="option">BuildOption</param>
/// <remarks>
/// 为保证工作空间清洁,若此动作修改了部分文件,请在打包后动作内还原对应的文件。
/// </remarks>
void ActionBefore(object option);
/// <summary>
/// 打包后动作
/// 通常用于额外数据清理。
/// </summary>
void ActionAfter();
}
/// <summary>
/// 打包步骤配置
/// 可以配置如何运行打包配置。
/// </summary>
[System.AttributeUsage(System.AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
public sealed class BuilderStepAttribute : Attribute, IComparable<BuilderStepAttribute>
{
/// <summary>
/// 执行顺序优先级
/// 优先级越低越先执行
/// </summary>
public int Priority { get; set; } = 0;
public BuilderStepAttribute(int priority = 0)
{
Priority = priority;
}
public int CompareTo(BuilderStepAttribute obj)
{
if (obj == null) return 1;
return Priority.CompareTo(obj.Priority);
}
}
}