This repository was archived by the owner on Nov 4, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathRunner.cs
More file actions
73 lines (54 loc) · 1.92 KB
/
Runner.cs
File metadata and controls
73 lines (54 loc) · 1.92 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using ADB.Config;
using ADB.GitHub;
using ADB.Java;
using ADB.Util;
using Aves.Shared;
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
namespace ADB
{
public class Runner
{
protected Configuration Config { get; set; }
public Runner(Configuration configuration)
{
Config = configuration;
Init();
}
#region Init
private void Init()
{
#if !DEBUG
if (string.IsNullOrWhiteSpace(Config.GitHubConfig.GitHubToken))
throw new ArgumentException($"{nameof(Config.GitHubConfig.GitHubToken)}[='****'] is invalid");
#endif
if (string.IsNullOrWhiteSpace(Config.RID))
throw new ArgumentException($"{nameof(Config.RID)}[='{Config.RID}'] is invalid");
if (string.IsNullOrWhiteSpace(Config.DestinationDir))
{
if (string.IsNullOrWhiteSpace(Config.DestinationDirPattern))
throw new ArgumentException($"{nameof(Config.DestinationDirPattern)}[='{Config.DestinationDirPattern}'] is invalid");
var destDir = Config.DestinationDirPattern.Replace('/', Path.DirectorySeparatorChar)
.Replace($"{{{nameof(Config.RID)}}}", Config.RID);
if (Config.BuildConfiguration != null)
destDir = destDir.Replace($"{{{nameof(Config.BuildConfiguration)}}}", Config.BuildConfiguration);
Log.Info($"SetInp: {nameof(Config.DestinationDir)}='{destDir}'");
Config.DestinationDir = destDir;
}
DirUtil.EnsureCreated(Config.DestinationDir);
}
#endregion Init
public void Run()
{
Log.Info("Starting run");
TaskRunner.RunTasks(
() => new GithubTask(Config).Run(),
() => new JavaTask(Config).Run());
Log.Info("All tasks successfully finished!");
Log.Info("Finished run");
}
}
}