Skip to content

Commit 066398c

Browse files
committed
Use the ProfileStubber utility
This change ensures that the unityjit and unityaot profiles match the .NET 4.7.1 API by using the profile stubber to modify the IL code in the class library assemblies.
1 parent dc98d95 commit 066398c

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed

external/buildscripts/build.pl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@
180180
# abs_path ends up returning an empty string
181181
$externalBuildDeps = abs_path($externalBuildDeps) if (-d $externalBuildDeps);
182182

183+
my $extraBuildTools = "$monoroot/../../mono-build-tools-extra/build";
184+
183185
my $existingExternalMonoRoot = "$externalBuildDeps/MonoBleedingEdge";
184186
my $existingExternalMono = "";
185187
my $existingExternalMonoBinDir = "";
@@ -269,6 +271,23 @@
269271
push @configureparams, "--with-monotouch=no";
270272
}
271273

274+
if (!(-d "$extraBuildTools"))
275+
{
276+
# Check out on the fly
277+
print(">>> Checking out mono build tools extra to : $extraBuildTools\n");
278+
my $repo = '[email protected]:vm/mono-build-tools-extra.git';
279+
print(">>> Cloning $repo at $extraBuildTools\n");
280+
my $checkoutResult = system("git", "clone", "--recurse-submodules", $repo, "$extraBuildTools");
281+
282+
if ($checkoutResult ne 0)
283+
{
284+
die("Failed to checkout mono build tools extra\n");
285+
}
286+
287+
# Only clean up if the dir exists. Otherwise abs_path will return empty string
288+
$extraBuildTools = abs_path($extraBuildTools) if (-d $extraBuildTools);
289+
}
290+
272291
if ($existingMonoRootPath eq "")
273292
{
274293
print(">>> No existing mono supplied. Checking for external...\n");
@@ -1415,6 +1434,13 @@
14151434
}
14161435

14171436
chdir("$monoroot");
1437+
1438+
my $stubResult = system("perl", "$buildscriptsdir/stub_classlibs.pl");
1439+
1440+
if ($stubResult ne 0)
1441+
{
1442+
die("Failed to run the profile stubber\n");
1443+
}
14181444
}
14191445
}
14201446
else
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
use Cwd;
2+
use Cwd 'abs_path';
3+
use File::Basename;
4+
use File::Path;
5+
6+
if($^O ne "darwin")
7+
{
8+
print ">>> The ProfileStubber is only built and run in the class library build on macOS\n";
9+
exit
10+
}
11+
12+
my $monoroot = File::Spec->rel2abs(dirname(__FILE__) . "/../..");
13+
my $monoroot = abs_path($monoroot);
14+
my $extraBuildTools = "$monoroot/../../mono-build-tools-extra/build";
15+
16+
print ">>> Building the ProfileStubber utility\n";
17+
18+
my $result = system("xbuild",
19+
"$extraBuildTools/mono-build-tools-extra.sln",
20+
"/p:Configuration=Release");
21+
22+
if ($result ne 0)
23+
{
24+
die("Failed to build ProfileStubber utility\n");
25+
}
26+
27+
my $profileRoot = "tmp/lib/mono";
28+
my $referenceProfile = "$profileRoot/4.7.1-api";
29+
30+
print ">>> Modifying the unityjit profile to match the .NET 4.7.1 API\n";
31+
32+
$result = system("mono",
33+
"$extraBuildTools/build/ProfileStubber.exe",
34+
"--reference-profile=$referenceProfile",
35+
"--stub-profile=$profileRoot/unityjit");
36+
37+
if ($result ne 0)
38+
{
39+
die("Failed to stub the unityjit profile\n");
40+
}
41+
42+
print ">>> Modifying the unityaot profile to match the .NET 4.7.1 API\n";
43+
44+
$result = system("mono",
45+
"$extraBuildTools/build/ProfileStubber.exe",
46+
"--reference-profile=$referenceProfile",
47+
"--stub-profile=$profileRoot/unityaot");
48+
49+
if ($result ne 0)
50+
{
51+
die("Failed to stub the unityaot profile\n");
52+
}

0 commit comments

Comments
 (0)