-
Notifications
You must be signed in to change notification settings - Fork 19
/
build_us_and_boo.pl
140 lines (112 loc) · 4.42 KB
/
build_us_and_boo.pl
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
use Cwd;
use Cwd 'abs_path';
use Getopt::Long;
use File::Basename;
use File::Path;
use File::Copy;
use lib ('.', 'perl_lib', 'external/buildscripts/perl_lib');
use Tools qw(GitClone);
system("source","~/.profile");
print ">>> My Path: $ENV{PATH}\n";
my $monoroot = File::Spec->rel2abs(dirname(__FILE__) . "/../..");
my $monoroot = abs_path($monoroot);
my $buildscriptsdir = "$monoroot/external/buildscripts";
my $monoprefix = "$monoroot/tmp/monoprefix";
my $buildsroot = "$monoroot/builds";
my $buildMachine = $ENV{UNITY_THISISABUILDMACHINE};
GetOptions(
'monoprefix=s'=>\$monoprefix,
) or die ("illegal cmdline options");
my $xbuildPath = "$monoprefix/bin/xbuild";
my $monoprefix45 = "$monoprefix/lib/mono/4.5";
if (!(-f "$xbuildPath"))
{
die("Unable to locate xbuild at : $xbuildPath\n");
}
BuildUnityScriptFor45();
sub XBuild
{
print(">>> Running : $monoprefix/bin/xbuild @_\n");
system("$monoprefix/bin/xbuild", @_) eq 0 or die("Failed to xbuild @_\n");
}
sub Booc45
{
my $commandLine = shift;
system("$monoprefix45/booc -debug- $commandLine") eq 0 or die("booc failed to execute: $monoprefix45/booc -debug- $commandLine\n");
}
sub BuildUnityScriptFor45
{
my $booCheckout = "$monoroot/external/boo";
print(">>> Using mono prefix $monoprefix45\n");
# Build host is handling this
if (!$buildMachine)
{
if (!(-d "$booCheckout"))
{
print(">>> Checking out boo\n");
GitClone("git://github.com/Unity-Technologies/boo.git", $booCheckout, "unity-trunk");
}
}
my $usCheckout = "$monoroot/external/unityscript";
if (!$buildMachine)
{
if (!(-d "$usCheckout"))
{
print(">>> Checking out unity script\n");
GitClone("git://github.com/Unity-Technologies/unityscript.git", $usCheckout, "unity-trunk");
}
}
my $boocCsproj = "$booCheckout/src/booc/booc.csproj";
if (!(-f "$boocCsproj"))
{
die("Unable to locate : $boocCsproj\n");
}
XBuild("$boocCsproj", "/t:Rebuild");
print(">>> Mono Prefix 4.5 = $monoprefix45\n");
foreach my $file (glob "$booCheckout/ide-build/Boo.Lang*.dll")
{
print(">>> Copying $file to $monoprefix45\n");
copy($file, "$monoprefix45/.");
}
copy("$booCheckout/ide-build/booc.exe", "$monoprefix45/.");
foreach my $file (glob "$buildscriptsdir/add_to_build_results/monodistribution/lib/mono/4.5/*")
{
print(">>> Copying $file to $monoprefix45\n");
copy($file, "$monoprefix45/.");
my $nameOnly = basename($file);
system("chmod", "755", "$monoprefix45/$nameOnly");
}
Booc45("-out:$monoprefix45/Boo.Lang.Extensions.dll -noconfig -nostdlib -srcdir:$booCheckout/src/Boo.Lang.Extensions -r:System.dll -r:System.Core.dll -r:mscorlib.dll -r:Boo.Lang.dll -r:Boo.Lang.Compiler.dll");
Booc45("-out:$monoprefix45/Boo.Lang.Useful.dll -srcdir:$booCheckout/src/Boo.Lang.Useful -r:Boo.Lang.Parser");
Booc45("-out:$monoprefix45/Boo.Lang.PatternMatching.dll -srcdir:$booCheckout/src/Boo.Lang.PatternMatching");
my $UnityScriptLangDLL = "$monoprefix45/UnityScript.Lang.dll";
Booc45("-out:$UnityScriptLangDLL -srcdir:$usCheckout/src/UnityScript.Lang");
my $UnityScriptDLL = "$monoprefix45/UnityScript.dll";
Booc45("-out:$UnityScriptDLL -srcdir:$usCheckout/src/UnityScript -r:$UnityScriptLangDLL -r:Boo.Lang.Parser.dll -r:Boo.Lang.PatternMatching.dll");
Booc45("-out:$monoprefix45/us.exe -srcdir:$usCheckout/src/us -r:$UnityScriptLangDLL -r:$UnityScriptDLL -r:Boo.Lang.Useful.dll");
# # unityscript test suite
# my $UnityScriptTestsCSharpDLL = "$usCheckout/src/UnityScript.Tests.CSharp/bin/Debug/UnityScript.Tests.CSharp.dll";
# XBuild("$usCheckout/src/UnityScript.Tests.CSharp/UnityScript.Tests.CSharp.csproj", "/t:Rebuild");
my $usBuildDir = "$usCheckout/build";
if (!(-d "$usBuildDir"))
{
rmtree($usBuildDir);
}
mkdir($usBuildDir);
# my $UnityScriptTestsDLL = <$usBuildDir/UnityScript.Tests.dll>;
# Booc("-out:$UnityScriptTestsDLL -srcdir:$usCheckout/src/UnityScript.Tests -r:$UnityScriptLangDLL -r:$UnityScriptDLL -r:$UnityScriptTestsCSharpDLL -r:Boo.Lang.Compiler.dll -r:Boo.Lang.Useful.dll");
# cp("$UnityScriptTestsCSharpDLL $usBuildDir/");
print(">>> Populating Unity Script Build Directory : $usBuildDir\n");
foreach my $file (glob "$monoprefix45/Boo.*")
{
print(">>> Copying $file to $usBuildDir\n");
copy($file, "$usBuildDir/.");
}
foreach my $file (glob "$monoprefix45/UnityScript.*")
{
print(">>> Copying $file to $usBuildDir\n");
copy($file, "$usBuildDir/.");
}
print(">>> Copying $monoprefix45/us.exe to $usBuildDir\n");
copy("$monoprefix45/us.exe", "$usBuildDir/.");
}