[Xamarin.Android.Build.Tasks-Tests] Fix path to msbuild on Linux (#809)

Keep in mind that there is no `/Library/Frameworks/Mono.framework` outside macOS.
This commit is contained in:
Atsushi Eno 2017-09-06 04:43:08 +09:00 коммит произвёл Jonathan Pryor
Родитель 10d1213bff
Коммит 7ad9c59216
1 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -11,6 +11,7 @@ namespace Xamarin.ProjectTools
public class Builder : IDisposable public class Builder : IDisposable
{ {
const string fixed_osx_xbuild_path = "/Library/Frameworks/Mono.framework/Commands"; const string fixed_osx_xbuild_path = "/Library/Frameworks/Mono.framework/Commands";
const string fixed_linux_xbuild_path = "/usr/bin";
const string xbuildapp = "xbuild"; const string xbuildapp = "xbuild";
const string msbuildapp = "msbuild"; const string msbuildapp = "msbuild";
string msbuildExe; string msbuildExe;
@ -26,9 +27,10 @@ namespace Xamarin.ProjectTools
string GetUnixBuildExe () string GetUnixBuildExe ()
{ {
RunningMSBuild = false; RunningMSBuild = false;
string path = Path.Combine (fixed_osx_xbuild_path, xbuildapp); var tooldir = Directory.Exists (fixed_osx_xbuild_path) ? fixed_osx_xbuild_path : fixed_linux_xbuild_path;
string path = Path.Combine (tooldir, xbuildapp);
if (!string.IsNullOrEmpty (Environment.GetEnvironmentVariable ("USE_MSBUILD"))) { if (!string.IsNullOrEmpty (Environment.GetEnvironmentVariable ("USE_MSBUILD"))) {
path = Path.Combine (fixed_osx_xbuild_path, msbuildapp); path = Path.Combine (tooldir, msbuildapp);
RunningMSBuild = true; RunningMSBuild = true;
} }
return File.Exists (path) ? path : msbuildapp; return File.Exists (path) ? path : msbuildapp;