-
Notifications
You must be signed in to change notification settings - Fork 258
/
Copy pathprepare_package_sources.cs
55 lines (43 loc) · 1.91 KB
/
prepare_package_sources.cs
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
using System.Diagnostics;
using System.IO;
using System.Linq;
using System;
class Script
{
static public void Main()
{
var version = "3.28.9.0";
var src_dir = Path.GetFullPath(@"..\..\..\..\..\..\Releases\v" + version + @"\bin\lib\Bin\Linux");
var dest_dir = $"cs-script_{version}";
void copy(string file, string new_file_name = null)
{
var s = Path.Combine(src_dir, file);
var d = Path.Combine(dest_dir, new_file_name ?? file);
Console.WriteLine("Copying:\n\t" + s + "\n\t" + d);
File.Copy(s, d, true);
}
void generate_from_template(string file, Func<string, string> generator)
{
File.WriteAllText(file, generator(File.ReadAllText(file + ".template")));
Process.Start(editor, file);
}
Directory.CreateDirectory(dest_dir);
copy("CSSRoslynProvider.dll");
copy("cscs.exe");
copy("-update.deb.cs", "-update.cs");
File.WriteAllText(@"..\version.txt", version);
// Mon, 14 Aug 2017 16:16:27 +1000
var timestamp = $"{DateTime.Now:ddd, d MMM yyyy hh:mm:ss} " + $"{DateTime.Now:zzz} ".Replace(":", "");
generate_from_template(@"debian\changelog",
text => text.Replace("${version}", version)
.Replace("${date}", timestamp));
generate_from_template(@"debian\install",
text => text.Replace("${version}", version));
Process.Start(editor, "readme.md");
Process.Start("7z.exe", @"a -r -tzip .\..\build.zip .\*");
Console.WriteLine("=====================");
Console.WriteLine("Prepared for building package cs-script_" + version);
Console.WriteLine("The build folder '.\\..\\build.zip' is ready.");
}
static string editor = @"E:\Program Files\Sublime Text 3\sublime_text.exe";
}