Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/Xamarin.Android.Build.Tasks/Tasks/Aot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ IEnumerable<Config> GetAotConfigs ()
outdir = Path.Combine (AotOutputDirectory, "arm64-v8a");
mtriple = "aarch64-linux-android";
arch = AndroidTargetArch.Arm64;
break;
break;

case "x86":
aotCompiler = Path.Combine (sdkBinDirectory, "cross-x86");
Expand Down Expand Up @@ -366,21 +366,21 @@ IEnumerable<Config> GetAotConfigs ()

var libs = new List<string>();
if (NdkUtil.UsingClangNDK) {
libs.Add ($"-L{toolchainLibDir}");
libs.Add ($"-L{androidLibPath}");
libs.Add ($"-L{toolchainLibDir.TrimEnd ('\\')}");
libs.Add ($"-L{androidLibPath.TrimEnd ('\\')}");

if (arch == AndroidTargetArch.Arm) {
// Needed for -lunwind to work
string compilerLibDir = Path.Combine (toolchainPath, "..", "sysroot", "usr", "lib", NdkUtil.GetArchDirName (arch));
libs.Add ($"-L{compilerLibDir}");
libs.Add ($"-L{compilerLibDir.TrimEnd ('\\')}");
}
}

libs.Add ($"\\\"{Path.Combine (toolchainLibDir, "libgcc.a")}\\\"");
libs.Add ($"\\\"{Path.Combine (androidLibPath, "libc.so")}\\\"");
libs.Add ($"\\\"{Path.Combine (androidLibPath, "libm.so")}\\\"");
libs.Add (Path.Combine (toolchainLibDir, "libgcc.a"));
libs.Add (Path.Combine (androidLibPath, "libc.so"));
libs.Add (Path.Combine (androidLibPath, "libm.so"));

ldFlags = string.Join(";", libs);
ldFlags = $"\\\"{string.Join("\\\";\\\"", libs)}\\\"";
}

string ldName = String.Empty;
Expand Down Expand Up @@ -466,7 +466,7 @@ IEnumerable<Config> GetAotConfigs ()
}
}
}

bool RunAotCompiler (string assembliesPath, string aotCompiler, string aotOptions, string assembly, string responseFile)
{
var stdout_completed = new ManualResetEvent (false);
Expand All @@ -487,7 +487,7 @@ bool RunAotCompiler (string assembliesPath, string aotCompiler, string aotOption
WindowStyle=ProcessWindowStyle.Hidden,
WorkingDirectory = WorkingDirectory,
};

// we do not want options to be provided out of band to the cross compilers
psi.EnvironmentVariables ["MONO_ENV_OPTIONS"] = String.Empty;
// the C code cannot parse all the license details, including the activation code that tell us which license level is allowed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,49 @@
using Mono.Cecil;
using NUnit.Framework;
using Xamarin.ProjectTools;
using Xamarin.Android.Build;

namespace Xamarin.Android.Build.Tests
{
[Category ("Node-2"), Category ("AOT")]
[Parallelizable (ParallelScope.Children)]
public class AotTests : BaseTest
{
public string SdkWithSpacesPath {
get {
return Path.Combine (Root, "temp", string.Format ("SDK Ümläüts"));
}
}

[OneTimeSetUp]
public void Setup ()
{
if (!IsWindows)
return;

var sdkPath = AndroidSdkPath;
var ndkPath = AndroidNdkPath;

var symSdkPath = Path.Combine (SdkWithSpacesPath, "sdk");
var symNdkPath = Path.Combine (SdkWithSpacesPath, "ndk");

SymbolicLink.Create (symSdkPath, sdkPath);
SymbolicLink.Create (symNdkPath, ndkPath);

Environment.SetEnvironmentVariable ("TEST_ANDROID_SDK_PATH", symSdkPath);
Environment.SetEnvironmentVariable ("TEST_ANDROID_NDK_PATH", symNdkPath);
}

[OneTimeTearDown]
public void TearDown ()
{
if (!IsWindows)
return;
Environment.SetEnvironmentVariable ("TEST_ANDROID_SDK_PATH", "");
Environment.SetEnvironmentVariable ("TEST_ANDROID_NDK_PATH", "");
Directory.Delete (SdkWithSpacesPath, recursive: true);
}

[Test, Category ("SmokeTests")]
public void BuildBasicApplicationReleaseProfiledAot ()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<ItemGroup>
<Compile Remove="DebuggingTasksTests.cs" Condition="!Exists('$(XAInstallPrefix)xbuild\Xamarin\Android\Xamarin.Android.Build.Debugging.Tasks.dll')" />
<Compile Remove="Expected\**" />
<Compile Include="..\..\..\..\tools\xabuild\SymbolicLink.cs" />
<Content Include="Expected\GenerateDesignerFileExpected.cs">
<Link>..\Expected\GenerateDesignerFileExpected.cs</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ static string GetPathFromRegistry (string valueName)

public static string GetAndroidSdkPath ()
{
var sdkPath = Environment.GetEnvironmentVariable ("ANDROID_SDK_PATH");
var sdkPath = Environment.GetEnvironmentVariable ("TEST_ANDROID_SDK_PATH");
if (String.IsNullOrEmpty (sdkPath))
sdkPath = Environment.GetEnvironmentVariable ("ANDROID_SDK_PATH");
if (String.IsNullOrEmpty (sdkPath))
sdkPath = GetPathFromRegistry ("AndroidSdkDirectory");
if (String.IsNullOrEmpty (sdkPath))
Expand All @@ -34,7 +36,9 @@ public static string GetAndroidSdkPath ()

public static string GetAndroidNdkPath ()
{
var ndkPath = Environment.GetEnvironmentVariable ("ANDROID_NDK_PATH");
var ndkPath = Environment.GetEnvironmentVariable ("TEST_ANDROID_NDK_PATH");
if (String.IsNullOrEmpty (ndkPath))
ndkPath = Environment.GetEnvironmentVariable ("ANDROID_NDK_PATH");
if (String.IsNullOrEmpty (ndkPath))
ndkPath = GetPathFromRegistry ("AndroidNdkDirectory");
if (String.IsNullOrEmpty (ndkPath))
Expand Down