-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGenerateObsWebSocketSourcesTask.cs
More file actions
31 lines (25 loc) · 1011 Bytes
/
GenerateObsWebSocketSourcesTask.cs
File metadata and controls
31 lines (25 loc) · 1011 Bytes
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
using Microsoft.Build.Framework;
namespace ObsWebSocket.Codegen.Tasks;
public sealed class GenerateObsWebSocketSourcesTask : Microsoft.Build.Utilities.Task
{
[Required]
public string ProtocolPath { get; set; } = string.Empty;
[Required]
public string OutputDirectory { get; set; } = string.Empty;
public bool DownloadIfMissing { get; set; }
public override bool Execute()
{
int exitCode = ProtocolCodegenRunner.GenerateAsync(
protocolPath: ProtocolPath,
outputDirectory: OutputDirectory,
downloadIfMissing: DownloadIfMissing,
cancellationToken: CancellationToken.None,
logInfo: message => Log.LogMessage(MessageImportance.High, message),
logWarning: message => Log.LogWarning(message),
logError: message => Log.LogError(message)
)
.GetAwaiter()
.GetResult();
return exitCode == 0 && !Log.HasLoggedErrors;
}
}