Skip to content

Commit

Permalink
[WIP] If in-tree binutils aren't found, try to get them from the syst…
Browse files Browse the repository at this point in the history
…em location
  • Loading branch information
grendello committed Jul 27, 2021
1 parent 874bbb8 commit 422d856
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ public void BeforeAllTests ()
Console.Error.WriteLine ("Failed to determine whether there is Android target emulator or not: " + ex);
}

CreateBinutilsSymlink ();
}

void CreateBinutilsSymlink ()
{
Console.Error.WriteLine ("DEBUG: making sure ndk link exists at the test assemblies location:");
string hostNdkDir = GetHostBinutilsDir ();
Console.Error.WriteLine ($" DEBUG: hostNdkDir == {hostNdkDir}");
Expand All @@ -105,9 +110,16 @@ public void BeforeAllTests ()
File.Delete (symlinkDir);
}

// We first try the in-tree location...
string binutilsDirFullPath = Path.Combine (XABuildPaths.PrefixDirectory, "lib", "xamarin.android", "xbuild", "Xamarin", "Android", hostNdkDir);
if (!Directory.Exists (binutilsDirFullPath)) {
throw new InvalidOperationException ($"Host NDK directory does not exist, {hostNdkDir}");
Console.Error.WriteLine ($"In-tree binutils not found in {binutilsDirFullPath}, trying the system location");

// ...since it failed, we'll try to find the system location
binutilsDirFullPath = Path.Combine (TestEnvironment.MonoAndroidToolsDirectory, hostNdkDir);
if (!Directory.Exists (binutilsDirFullPath)) {
throw new InvalidOperationException ($"Host NDK directory does not exist, {binutilsDirFullPath}");
}
}

Console.Error.WriteLine ($" DEBUG: binutilsDirFullPath == {binutilsDirFullPath}");
Expand Down

0 comments on commit 422d856

Please sign in to comment.