-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.bat
84 lines (78 loc) · 2.04 KB
/
deploy.bat
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
74
75
76
77
78
79
80
81
82
83
84
/*
@echo off & cls
set WinDirNet=%WinDir%\Microsoft.NET\Framework
IF EXIST "%WinDirNet%\v2.0.50727\csc.exe" set csc="%WinDirNet%\v2.0.50727\csc.exe"
IF EXIST "%WinDirNet%\v3.5\csc.exe" set csc="%WinDirNet%\v3.5\csc.exe"
IF EXIST "%WinDirNet%\v4.0.30319\csc.exe" set csc="%WinDirNet%\v4.0.30319\csc.exe"
%csc% /nologo /out:"%~0.exe" %0
"%~0.exe"
del "%~0.exe"
exit
*/
using System;
using System.Collections.Generic;
using System.IO;
class Deploy
{
static void Main()
{
string deployDir = "./deploy/";
List<string> files = new List<string>()
{
"./lib/Microsoft.Cci.ILGenerator.dll",
"./lib/Microsoft.Cci.MetadataHelper.dll",
"./lib/Microsoft.Cci.MetadataModel.dll",
"./lib/Microsoft.Cci.MutableMetadataModel.dll",
"./lib/Microsoft.Cci.PeReader.dll",
"./lib/Microsoft.Cci.PeWriter.dll",
"./lib/Microsoft.Cci.SourceModel.dll",
"./src/Mirage/bin/Release/Mirage.dll",
"./src/Mirage.Cmd/bin/Release/Mirage.Cmd.exe",
"./src/Mirage.Compiler/bin/Release/Mirage.Compiler.exe",
"./LICENSE.TXT",
"./README.TXT",
};
List<string> dirs = new List<string>()
{
"./doc",
};
if (! Directory.Exists(deployDir))
{
Directory.CreateDirectory(deployDir);
}
foreach (var file in files)
{
if (File.Exists(file))
{
File.Copy(file, deployDir + Path.GetFileName(file), true);
}
else
{
Console.WriteLine("Could not find file {0}", file);
}
}
foreach (var dir in dirs)
{
CopyDir(dir, deployDir + GetDirName(dir));
}
}
static void CopyDir(string sourceDir, string destDir)
{
if (! Directory.Exists(destDir))
{
Directory.CreateDirectory(destDir);
}
foreach (var file in Directory.GetFiles(sourceDir))
{
File.Copy(file, destDir + "/" + Path.GetFileName(file), true);
}
foreach (var dir in Directory.GetDirectories(sourceDir))
{
CopyDir(dir, destDir + "/" + GetDirName(dir));
}
}
static string GetDirName(string dir)
{
return dir.Substring(dir.Replace("\\","/").LastIndexOf("/")+1);
}
}