Example #1
0
        protected override IEnumerable<string> GetTargetDevices(PDictionary plist)
        {
            var devices = IPhoneDeviceType.NotSet;
            bool watch = false;

            if (plist != null) {
                if (!(watch = plist.GetWKWatchKitApp ())) {
                    // the project is either a normal iOS project or an extension
                    if ((devices = plist.GetUIDeviceFamily ()) == IPhoneDeviceType.NotSet) {
                        // library projects and extension projects will not have this key, but
                        // we'll want them to work for both iPhones and iPads if the
                        // xib or storyboard supports them
                        devices = IPhoneDeviceType.IPhoneAndIPad;
                    }

                    // if the project is a watch extension, we'll also want to incldue watch support
                    watch = IsWatchExtension (plist);
                } else {
                    // the project is a WatchApp, only include watch support
                }
            } else {
                devices = IPhoneDeviceType.IPhoneAndIPad;
            }

            if ((devices & IPhoneDeviceType.IPhone) != 0)
                yield return "iphone";

            if ((devices & IPhoneDeviceType.IPad) != 0)
                yield return "ipad";

            if (watch)
                yield return "watch";

            yield break;
        }
Example #2
0
        protected override IEnumerable <string> GetTargetDevices(PDictionary plist)
        {
            if (AppleSdkSettings.XcodeVersion < new Version(6, 3))
            {
                yield break;
            }

            var  devices = IPhoneDeviceType.NotSet;
            bool watch   = false;

            if (plist != null)
            {
                if (!(watch = plist.GetWKWatchKitApp()))
                {
                    // the project is either a normal iOS project or an extension
                    if ((devices = plist.GetUIDeviceFamily()) == IPhoneDeviceType.NotSet)
                    {
                        // library projects and extension projects will not have this key, but
                        // we'll want them to work for both iPhones and iPads if the
                        // xib or storyboard supports them
                        devices = IPhoneDeviceType.IPhoneAndIPad;
                    }

                    // if the project is a watch extension, we'll also want to include watch support
                    watch = IsWatchExtension(plist);
                }
                else
                {
                    // the project is a WatchApp, only include watch support
                }
            }
            else
            {
                devices = IPhoneDeviceType.IPhoneAndIPad;
            }

            if ((devices & IPhoneDeviceType.IPhone) != 0)
            {
                yield return("iphone");
            }

            if ((devices & IPhoneDeviceType.IPad) != 0)
            {
                yield return("ipad");
            }

            if (watch)
            {
                yield return("watch");
            }

            yield break;
        }
        public override bool Execute()
        {
            PDictionary?plist = null;

            if (!string.IsNullOrEmpty(AppManifest?.ItemSpec))
            {
                try {
                    plist = PDictionary.FromFile(AppManifest !.ItemSpec);
                } catch (Exception ex) {
                    Log.LogError(null, null, null, AppManifest !.ItemSpec, 0, 0, 0, 0, MSBStrings.E0010, AppManifest.ItemSpec, ex.Message);
                    return(false);
                }
            }

            CFBundleExecutable   = plist.GetCFBundleExecutable();
            CFBundleDisplayName  = plist?.GetCFBundleDisplayName();
            CFBundleIdentifier   = plist?.GetCFBundleIdentifier();
            CFBundleVersion      = plist?.GetCFBundleVersion();
            CLKComplicationGroup = plist?.Get <PString> (ManifestKeys.CLKComplicationGroup)?.Value;

            MinimumOSVersion = plist?.Get <PString> (PlatformFrameworkHelper.GetMinimumOSVersionKey(Platform))?.Value;
            if (Platform == ApplePlatform.MacCatalyst)
            {
                // The minimum version in the Info.plist is the macOS version. However, the rest of our tooling
                // expects the iOS version, so expose that.
                if (!MacCatalystSupport.TryGetiOSVersion(Sdks.GetAppleSdk(Platform).GetSdkPath(SdkVersion, false), MinimumOSVersion !, out var convertedVersion, out var knownMacOSVersions))
                {
                    Log.LogError(MSBStrings.E0187, MinimumOSVersion, string.Join(", ", knownMacOSVersions));
                }
                MinimumOSVersion = convertedVersion;
            }

            NSExtensionPointIdentifier = plist?.GetNSExtensionPointIdentifier();
            UIDeviceFamily             = plist?.GetUIDeviceFamily().ToString();
            WKWatchKitApp       = plist?.GetWKWatchKitApp() == true;
            XSAppIconAssets     = plist?.Get <PString> (ManifestKeys.XSAppIconAssets)?.Value;
            XSLaunchImageAssets = plist?.Get <PString> (ManifestKeys.XSLaunchImageAssets)?.Value;

            return(!Log.HasLoggedErrors);
        }