-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate_workflows.csx
25 lines (24 loc) · 1.04 KB
/
generate_workflows.csx
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
var packages = File.ReadAllLines("packages.txt");
var orig_cont = File.ReadAllText("tool_build_template.yml.tmpl");
foreach (var package in packages){
var arr = package.Trim().Split(new []{":"},StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
var pkg_name = arr[0];
if (String.IsNullOrWhiteSpace(pkg_name))
continue;
var deps = arr.Length > 1 ? arr[1] : "";
var noDebug=false;
if (deps.Contains("-NoDebug")){
deps = deps.Replace("-NoDebug","");
noDebug=true;
}
if (! string.IsNullOrWhiteSpace(deps)){
var dep_arr = deps.Split(new []{" "},StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
var tabs=" ";
deps = $"RequiredDeps: |\n{tabs}" + string.Join("\n" + tabs,dep_arr);
}
if (noDebug)
deps +="\n NoDebugBuild: true";
deps = deps.Trim();
var cont = orig_cont.Replace("[NAME]",pkg_name).Replace("[DEPS]",deps);
File.WriteAllText($"workflows/tool_{pkg_name}_build.yml", cont);
}