Skip to content

Commit 97f207a

Browse files
authored
[MonoAotOffsetsDumper] Remove --monodroid argument (mono#10512)
It's dead now
1 parent 1b163d6 commit 97f207a

File tree

1 file changed

+14
-31
lines changed

1 file changed

+14
-31
lines changed

tools/offsets-tool/MonoAotOffsetsDumper.cs

Lines changed: 14 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@ static class MonoAotOffsetsDumper
2626
static string OutputDir;
2727
static string OutputFile;
2828

29-
static string MonodroidDir = @"";
30-
static string AndroidNdkPath = @"";
3129
static string TargetDir = @"";
3230
static bool GenIOS;
3331
static bool GenAndroid;
32+
static string AndroidNdkPath = @"";
3433

3534
public enum TargetPlatform
3635
{
@@ -216,13 +215,7 @@ public static void Main(string[] args)
216215
{
217216
ParseCommandLineArgs(args);
218217

219-
string monodroidDir;
220-
if (!Directory.Exists (MonodroidDir) &&
221-
GetParentSubDirectoryPath ("monodroid", out monodroidDir)) {
222-
MonodroidDir = Path.Combine (monodroidDir);
223-
}
224-
225-
if (Directory.Exists (MonodroidDir) || GenAndroid)
218+
if (GenAndroid)
226219
SetupAndroidTargets();
227220

228221
if (GenIOS)
@@ -270,21 +263,6 @@ static void BuildParseOptions(Driver driver, Target target)
270263
}
271264
}
272265

273-
static string GetAndroidNdkPath()
274-
{
275-
if (!String.IsNullOrEmpty (AndroidNdkPath))
276-
return AndroidNdkPath;
277-
278-
// Find the Android NDK's path from Monodroid's config.
279-
var configFile = Path.Combine(MonodroidDir, "env.config");
280-
if (!File.Exists(configFile))
281-
throw new Exception("Expected a valid Monodroid environment config file at " + configFile);
282-
283-
var config = File.ReadAllText(configFile);
284-
var match = Regex.Match(config, @"ANDROID_NDK_PATH\s*:=\s(.*)");
285-
return match.Groups[1].Value.Trim();
286-
}
287-
288266
static void ParseCommandLineArgs(string[] args)
289267
{
290268
var showHelp = false;
@@ -293,7 +271,6 @@ static void ParseCommandLineArgs(string[] args)
293271
{ "abi=", "ABI triple to generate", v => Abis.Add(v) },
294272
{ "o|out=", "output directory", v => OutputDir = v },
295273
{ "outfile=", "output directory", v => OutputFile = v },
296-
{ "monodroid=", "top monodroid directory", v => MonodroidDir = v },
297274
{ "android-ndk=", "Path to Android NDK", v => AndroidNdkPath = v },
298275
{ "targetdir=", "Path to the directory containing the mono build", v =>TargetDir = v },
299276
{ "mono=", "include directory", v => MonoDir = v },
@@ -347,14 +324,18 @@ static void SetupMono(Driver driver, Target target)
347324
string targetBuild;
348325
switch (target.Platform) {
349326
case TargetPlatform.Android:
350-
if (TargetDir == "") {
327+
if (string.IsNullOrEmpty (TargetDir)) {
351328
Console.Error.WriteLine ("The --targetdir= option is required when targeting android.");
352329
Environment.Exit (1);
353330
}
354-
if (MonoDir == "") {
331+
if (string.IsNullOrEmpty (MonoDir)) {
355332
Console.Error.WriteLine ("The --mono= option is required when targeting android.");
356333
Environment.Exit (1);
357334
}
335+
if (string.IsNullOrEmpty(AndroidNdkPath)) {
336+
Console.WriteLine("The --android-ndk= option is required when targeting android");
337+
Environment.Exit (1);
338+
}
358339
if (Abis.Count != 1) {
359340
Console.Error.WriteLine ("Exactly one --abi= argument is required when targeting android.");
360341
Environment.Exit (1);
@@ -367,6 +348,10 @@ static void SetupMono(Driver driver, Target target)
367348
Console.Error.WriteLine ("The --targetdir= option is required when targeting ios.");
368349
Environment.Exit (1);
369350
}
351+
if (string.IsNullOrEmpty (MonoDir)) {
352+
Console.Error.WriteLine ("The --mono= option is required when targeting ios.");
353+
Environment.Exit (1);
354+
}
370355
targetBuild = TargetDir;
371356
break;
372357
}
@@ -570,9 +555,8 @@ static void SetupXcode(Driver driver, Target target)
570555

571556
static string GetAndroidHostToolchainPath()
572557
{
573-
var androidNdkPath = GetAndroidNdkPath ();
574558
var toolchains = Directory.EnumerateDirectories(
575-
Path.Combine(androidNdkPath, "toolchains"), "llvm*").ToList();
559+
Path.Combine(AndroidNdkPath, "toolchains"), "llvm*").ToList();
576560
toolchains.Sort();
577561

578562
var toolchainPath = toolchains.LastOrDefault();
@@ -617,10 +601,9 @@ static void SetupAndroidNDK(Driver driver, Target target)
617601
var builtinsPath = GetAndroidBuiltinIncludesFolder();
618602
parserOptions.AddSystemIncludeDirs(builtinsPath);
619603

620-
var androidNdkRoot = GetAndroidNdkPath ();
621604
const int androidNdkApiLevel = 21;
622605

623-
var toolchainPath = Path.Combine(androidNdkRoot, "platforms",
606+
var toolchainPath = Path.Combine(AndroidNdkPath, "platforms",
624607
"android-" + androidNdkApiLevel, "arch-" + GetArchFromTriple(target.Triple),
625608
"usr", "include");
626609
parserOptions.AddSystemIncludeDirs(toolchainPath);

0 commit comments

Comments
 (0)