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
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,19 @@ protected bool BuildInternal (string projectOrSolution, string target, string []
buildLogFullPath, Verbosity.ToString ().ToLower ());

var start = DateTime.UtcNow;
var homeDirectory = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
var androidSdkToolPath = Path.Combine (homeDirectory, "android-toolchain");
var sdkPath = Environment.GetEnvironmentVariable ("ANDROID_SDK_PATH");
if (String.IsNullOrEmpty (sdkPath))
sdkPath = GetPathFromRegistry ("AndroidSdkDirectory");
if (String.IsNullOrEmpty (sdkPath))
sdkPath = Path.GetFullPath (Path.Combine (androidSdkToolPath, "sdk"));
var ndkPath = Environment.GetEnvironmentVariable ("ANDROID_NDK_PATH");
if (String.IsNullOrEmpty (ndkPath))
ndkPath = GetPathFromRegistry ("AndroidNdkDirectory");
if (String.IsNullOrEmpty (ndkPath))
ndkPath = Path.GetFullPath (Path.Combine (androidSdkToolPath, "ndk"));

var args = new StringBuilder ();
var psi = new ProcessStartInfo (XABuildExe);
args.AppendFormat ("{0} /t:{1} {2}",
Expand All @@ -193,6 +206,12 @@ protected bool BuildInternal (string projectOrSolution, string target, string []
args.Append (" /p:BuildingOutOfProcess=true");
else
args.Append (" /p:UseHostCompilerIfAvailable=false /p:BuildingInsideVisualStudio=true");
if (Directory.Exists (sdkPath)) {
args.AppendFormat (" /p:AndroidSdkDirectory=\"{0}\" ", sdkPath);
}
if (Directory.Exists (ndkPath)) {
args.AppendFormat (" /p:AndroidNdkDirectory=\"{0}\" ", ndkPath);
}
if (parameters != null) {
foreach (var param in parameters) {
args.AppendFormat (" /p:{0}", param);
Expand Down
2 changes: 0 additions & 2 deletions tools/xabuild/XABuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ static XmlDocument CreateConfig (XABuildPaths paths)
SetProperty (toolsets, "MSBuildExtensionsPath", paths.MSBuildExtensionsPath);
SetProperty (toolsets, "MSBuildExtensionsPath32", paths.MSBuildExtensionsPath);
SetProperty (toolsets, "RoslynTargetsPath", Path.Combine (paths.MSBuildBin, "Roslyn"));
SetProperty (toolsets, "AndroidSdkDirectory", paths.AndroidSdkDirectory);
SetProperty (toolsets, "AndroidNdkDirectory", paths.AndroidNdkDirectory);
SetProperty (toolsets, "MonoAndroidToolsDirectory", paths.MonoAndroidToolsDirectory);
SetProperty (toolsets, "TargetFrameworkRootPath", paths.FrameworksDirectory + Path.DirectorySeparatorChar); //NOTE: Must include trailing \

Expand Down
7 changes: 0 additions & 7 deletions tools/xabuild/XABuildPaths.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,6 @@ class XABuildPaths

public string MonoAndroidToolsDirectory { get; private set; }

public string AndroidSdkDirectory { get; private set; }

public string AndroidNdkDirectory { get; private set; }

public XABuildPaths ()
{
IsWindows = Environment.OSVersion.Platform == PlatformID.Win32NT;
Expand All @@ -96,7 +92,6 @@ public XABuildPaths ()
XamarinAndroidBuildOutput = Path.GetFullPath (Path.Combine (XABuildDirectory, ".."));

string programFiles = Environment.GetFolderPath (Environment.SpecialFolder.ProgramFilesX86);
string userProfile = Environment.GetFolderPath (Environment.SpecialFolder.UserProfile);
string prefix = Path.Combine (XamarinAndroidBuildOutput, "lib", "xamarin.android");

if (IsWindows) {
Expand Down Expand Up @@ -130,8 +125,6 @@ public XABuildPaths ()
FrameworksDirectory = Path.Combine (prefix, "xbuild-frameworks");
MSBuildExtensionsPath = Path.Combine (prefix, "xbuild");
MonoAndroidToolsDirectory = Path.Combine (prefix, "xbuild", "Xamarin", "Android");
AndroidSdkDirectory = Path.Combine (userProfile, "android-toolchain", "sdk");
AndroidNdkDirectory = Path.Combine (userProfile, "android-toolchain", "ndk");
MSBuildExeTempPath = Path.GetTempFileName ();
XABuildConfig = MSBuildExeTempPath + ".config";
}
Expand Down