[msbuild] Improve DetectSdkLocationsTaskBase error log (#2012)
First: only run `EnsureSdkPath` if `EnsureAppleSdkRoot` passed. Both are based on similar install checks, `SdkIsInstalled` (used for `SdkIsInstalled`) is empty if `IsInstalled` (used by `EnsureAppleSdkRoot`) is false. This avoid having 2 error messages when only 1 at a time is needed. Second: improved `EnsureAppleSdkRoot` error message mentioning the wrong Xcode developer path (which triggered the error) as well as the exact way to fix it.
This commit is contained in:
Родитель
6528978fc4
Коммит
47129dae70
|
@ -1 +1 @@
|
||||||
Subproject commit e7b0f35eb69b579f202d842aeec0d6a8afcdc357
|
Subproject commit 2688b706e040ff17dd3a6417f847dadee96504eb
|
|
@ -61,9 +61,9 @@ namespace Xamarin.Mac.Tasks
|
||||||
Log.LogTaskName ("DetectSdkLocations");
|
Log.LogTaskName ("DetectSdkLocations");
|
||||||
Log.LogTaskProperty ("XamarinSdkRoot", XamarinSdkRoot);
|
Log.LogTaskProperty ("XamarinSdkRoot", XamarinSdkRoot);
|
||||||
|
|
||||||
EnsureAppleSdkRoot ();
|
if (EnsureAppleSdkRoot ())
|
||||||
EnsureXamarinSdkRoot ();
|
|
||||||
EnsureSdkPath ();
|
EnsureSdkPath ();
|
||||||
|
EnsureXamarinSdkRoot ();
|
||||||
|
|
||||||
IsXcode8 = AppleSdkSettings.XcodeVersion.Major >= 8;
|
IsXcode8 = AppleSdkSettings.XcodeVersion.Major >= 8;
|
||||||
|
|
||||||
|
@ -93,18 +93,25 @@ namespace Xamarin.Mac.Tasks
|
||||||
Log.LogError ("Could not locate SDK bin directory");
|
Log.LogError ("Could not locate SDK bin directory");
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnsureAppleSdkRoot ()
|
bool EnsureAppleSdkRoot ()
|
||||||
{
|
{
|
||||||
if (!MacOSXSdks.Native.IsInstalled) {
|
if (!MacOSXSdks.Native.IsInstalled) {
|
||||||
Log.LogError ("Could not find a valid Xcode app bundle");
|
var ideSdkPath = "(Project > SDK Locations > Apple > Apple SDK)";
|
||||||
} else {
|
#if WINDOWS
|
||||||
Log.LogMessage (MessageImportance.Low, "DeveloperRoot: {0}", MacOSXSdks.Native.DeveloperRoot);
|
var ideSdkPath = "(Tools > Options > Xamarin > iOS Settings > Apple SDK)";
|
||||||
Log.LogMessage (MessageImportance.Low, "GetPlatformPath: {0}", MacOSXSdks.Native.GetPlatformPath ());
|
#endif
|
||||||
|
Log.LogError ("Could not find a valid Xcode app bundle at '{0}'. Please update your Apple SDK location in Visual Studio's preferences {1}.", AppleSdkSettings.InvalidDeveloperRoot, ideSdkPath);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Log.LogMessage(MessageImportance.Low, "DeveloperRoot: {0}", MacOSXSdks.Native.DeveloperRoot);
|
||||||
|
Log.LogMessage(MessageImportance.Low, "GetPlatformPath: {0}", MacOSXSdks.Native.GetPlatformPath());
|
||||||
|
|
||||||
SdkDevPath = MacOSXSdks.Native.DeveloperRoot;
|
SdkDevPath = MacOSXSdks.Native.DeveloperRoot;
|
||||||
if (string.IsNullOrEmpty (SdkDevPath))
|
if (string.IsNullOrEmpty(SdkDevPath)) {
|
||||||
Log.LogError ("Could not find a valid Xcode developer path");
|
Log.LogError("Could not find a valid Xcode developer path");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnsureXamarinSdkRoot ()
|
void EnsureXamarinSdkRoot ()
|
||||||
|
|
|
@ -99,8 +99,7 @@ namespace Xamarin.iOS.Tasks
|
||||||
|
|
||||||
IsXcode8 = AppleSdkSettings.XcodeVersion.Major >= 8;
|
IsXcode8 = AppleSdkSettings.XcodeVersion.Major >= 8;
|
||||||
|
|
||||||
EnsureAppleSdkRoot ();
|
if (EnsureAppleSdkRoot ()) {
|
||||||
EnsureXamarinSdkRoot ();
|
|
||||||
switch (Framework) {
|
switch (Framework) {
|
||||||
case PlatformFramework.iOS:
|
case PlatformFramework.iOS:
|
||||||
EnsureiOSSdkPath ();
|
EnsureiOSSdkPath ();
|
||||||
|
@ -114,6 +113,8 @@ namespace Xamarin.iOS.Tasks
|
||||||
default:
|
default:
|
||||||
throw new InvalidOperationException (string.Format ("Invalid framework: {0}", Framework));
|
throw new InvalidOperationException (string.Format ("Invalid framework: {0}", Framework));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
EnsureXamarinSdkRoot ();
|
||||||
|
|
||||||
Log.LogTaskName ("DetectSdkLocations");
|
Log.LogTaskName ("DetectSdkLocations");
|
||||||
Log.LogTaskProperty ("TargetFrameworkIdentifier", TargetFrameworkIdentifier);
|
Log.LogTaskProperty ("TargetFrameworkIdentifier", TargetFrameworkIdentifier);
|
||||||
|
@ -287,19 +288,26 @@ namespace Xamarin.iOS.Tasks
|
||||||
SdkPlatform = SdkIsSimulator ? "iPhoneSimulator" : "iPhoneOS";
|
SdkPlatform = SdkIsSimulator ? "iPhoneSimulator" : "iPhoneOS";
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnsureAppleSdkRoot ()
|
bool EnsureAppleSdkRoot ()
|
||||||
{
|
{
|
||||||
if (!CurrentSdk.IsInstalled) {
|
if (!CurrentSdk.IsInstalled) {
|
||||||
Log.LogError (" Could not find a usable Xcode app bundle in {0}", CurrentSdk.DeveloperRoot);
|
var ideSdkPath = "(Project > SDK Locations > Apple > Apple SDK)";
|
||||||
} else {
|
#if WINDOWS
|
||||||
Log.LogMessage (MessageImportance.Low, " DeveloperRoot: {0}", CurrentSdk.DeveloperRoot);
|
var ideSdkPath = "(Tools > Options > Xamarin > iOS Settings > Apple SDK)";
|
||||||
Log.LogMessage (MessageImportance.Low, " DevicePlatform: {0}", CurrentSdk.DevicePlatform);
|
#endif
|
||||||
Log.LogMessage (MessageImportance.Low, " GetPlatformPath: {0}", CurrentSdk.GetPlatformPath (false));
|
Log.LogError ("Could not find a valid Xcode app bundle at '{0}'. Please update your Apple SDK location in Visual Studio's preferences {1}.", AppleSdkSettings.InvalidDeveloperRoot, ideSdkPath);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Log.LogMessage (MessageImportance.Low, "DeveloperRoot: {0}", CurrentSdk.DeveloperRoot);
|
||||||
|
Log.LogMessage (MessageImportance.Low, "DevicePlatform: {0}", CurrentSdk.DevicePlatform);
|
||||||
|
Log.LogMessage (MessageImportance.Low, "GetPlatformPath: {0}", CurrentSdk.GetPlatformPath (false));
|
||||||
|
|
||||||
SdkDevPath = CurrentSdk.DeveloperRoot;
|
SdkDevPath = CurrentSdk.DeveloperRoot;
|
||||||
if (string.IsNullOrEmpty (SdkDevPath))
|
if (string.IsNullOrEmpty (SdkDevPath)) {
|
||||||
Log.LogError (" Could not find valid a usable Xcode developer path");
|
Log.LogError ("Could not find valid a usable Xcode developer path");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnsureXamarinSdkRoot ()
|
void EnsureXamarinSdkRoot ()
|
||||||
|
@ -308,7 +316,7 @@ namespace Xamarin.iOS.Tasks
|
||||||
XamarinSdkRoot = IPhoneSdks.MonoTouch.SdkDir;
|
XamarinSdkRoot = IPhoneSdks.MonoTouch.SdkDir;
|
||||||
|
|
||||||
if (string.IsNullOrEmpty (XamarinSdkRoot) || !Directory.Exists (XamarinSdkRoot))
|
if (string.IsNullOrEmpty (XamarinSdkRoot) || !Directory.Exists (XamarinSdkRoot))
|
||||||
Log.LogError (" Could not find 'Xamarin.iOS'");
|
Log.LogError ("Could not find 'Xamarin.iOS'");
|
||||||
}
|
}
|
||||||
|
|
||||||
string DirExists (string checkingFor, string path)
|
string DirExists (string checkingFor, string path)
|
||||||
|
@ -319,7 +327,7 @@ namespace Xamarin.iOS.Tasks
|
||||||
|
|
||||||
path = Path.GetFullPath (path);
|
path = Path.GetFullPath (path);
|
||||||
|
|
||||||
Log.LogMessage (MessageImportance.Low, " Searching for '{0}' in '{1}'", checkingFor, path);
|
Log.LogMessage (MessageImportance.Low, "Searching for '{0}' in '{1}'", checkingFor, path);
|
||||||
return Directory.Exists (path) ? path : null;
|
return Directory.Exists (path) ? path : null;
|
||||||
} catch {
|
} catch {
|
||||||
return null;
|
return null;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче