[msbuild] When doing device-specific builds, ignore incompatible devi… (#579)
[msbuild] When doing device-specific builds, ignore incompatible device OS's If the user has tvOS, watchOS, and iOS projects in their solution and goes to build for one of them for a specific device, it passes along the device specific info to MSBuild. The build would then fail for the tvOS and/or watchOS projects because of incompatible architecture requirements. This fixes that problem by short-cutting the ParseDeviceSpecificBuildInfo task to output the default values (the values used when not building for a specific device).
This commit is contained in:
Родитель
3e04819622
Коммит
ec56c6103d
|
@ -24,6 +24,9 @@ namespace Xamarin.iOS.Tasks
|
|||
[Required]
|
||||
public string OutputPath { get; set; }
|
||||
|
||||
[Required]
|
||||
public string TargetFrameworkIdentifier { get; set; }
|
||||
|
||||
[Required]
|
||||
public string TargetiOSDevice { get; set; }
|
||||
|
||||
|
@ -51,22 +54,36 @@ namespace Xamarin.iOS.Tasks
|
|||
public override bool Execute ()
|
||||
{
|
||||
TargetArchitecture architectures, deviceArchitectures, target = TargetArchitecture.Default;
|
||||
string targetOperatingSystem;
|
||||
PDictionary plist, device;
|
||||
PString value;
|
||||
PString value, os;
|
||||
|
||||
Log.LogTaskName ("ParseDeviceSpecificBuildInformation");
|
||||
Log.LogTaskProperty ("Architectures", Architectures);
|
||||
Log.LogTaskProperty ("IntermediateOutputPath", IntermediateOutputPath);
|
||||
Log.LogTaskProperty ("OutputPath", OutputPath);
|
||||
Log.LogTaskProperty ("TargetFrameworkIdentifier", TargetFrameworkIdentifier);
|
||||
Log.LogTaskProperty ("TargetiOSDevice", TargetiOSDevice);
|
||||
|
||||
switch (PlatformFrameworkHelper.GetFramework (TargetFrameworkIdentifier)) {
|
||||
case PlatformFramework.WatchOS:
|
||||
targetOperatingSystem = "watchOS";
|
||||
break;
|
||||
case PlatformFramework.TVOS:
|
||||
targetOperatingSystem = "tvOS";
|
||||
break;
|
||||
default:
|
||||
targetOperatingSystem = "iOS";
|
||||
break;
|
||||
}
|
||||
|
||||
if (!Enum.TryParse (Architectures, out architectures)) {
|
||||
Log.LogError ("Invalid architectures: '{0}'.", Architectures);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((plist = PObject.FromString (TargetiOSDevice) as PDictionary) == null) {
|
||||
Log.LogError ("Failed to parse the target iOS device information.");
|
||||
Log.LogError ("Failed to parse the target device information.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -85,8 +102,24 @@ namespace Xamarin.iOS.Tasks
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!device.TryGetValue ("os", out os)) {
|
||||
Log.LogError ("No device operating system information found.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (os.Value != targetOperatingSystem) {
|
||||
// user is building the solution for another Apple device, do not build this project for a specific device
|
||||
DeviceSpecificIntermediateOutputPath = IntermediateOutputPath;
|
||||
DeviceSpecificOutputPath = OutputPath;
|
||||
TargetArchitectures = Architectures;
|
||||
TargetDeviceOSVersion = string.Empty;
|
||||
TargetDeviceModel = string.Empty;
|
||||
|
||||
return !Log.HasLoggedErrors;
|
||||
}
|
||||
|
||||
if ((architectures & deviceArchitectures) == 0) {
|
||||
Log.LogError ("The target iOS device architecture {0} is not supported by the build configuration: {1}", architectures, deviceArchitectures);
|
||||
Log.LogError ("The target {0} device architecture {1} is not supported by the build configuration: {2}", targetOperatingSystem, architectures, deviceArchitectures);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -174,6 +174,7 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved.
|
|||
Architectures="$(MtouchArch)"
|
||||
IntermediateOutputPath="$(IntermediateOutputPath)"
|
||||
OutputPath="$(OutputPath)"
|
||||
TargetFrameworkIdentifier="$(TargetFrameworkIdentifier)"
|
||||
TargetiOSDevice="$(TargetiOSDevice)"
|
||||
>
|
||||
<Output TaskParameter="DeviceSpecificIntermediateOutputPath" PropertyName="DeviceSpecificIntermediateOutputPath" />
|
||||
|
|
Загрузка…
Ссылка в новой задаче