Пример #1
0
        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);
                }
            }

            var minimumOSVersionInManifest = plist?.Get <PString> (PlatformFrameworkHelper.GetMinimumOSVersionKey(Platform))?.Value;

            if (string.IsNullOrEmpty(minimumOSVersionInManifest))
            {
                MinimumOSVersion = SdkVersion;
            }
            else if (!IAppleSdkVersion_Extensions.TryParse(minimumOSVersionInManifest, out var _))
            {
                Log.LogError(null, null, null, AppManifest.ItemSpec, 0, 0, 0, 0, MSBStrings.E0011, minimumOSVersionInManifest);
                return(false);
            }
            else
            {
                MinimumOSVersion = minimumOSVersionInManifest;
            }

            if (Platform == ApplePlatform.MacCatalyst)
            {
                // Convert the min macOS version to the min iOS version, which the rest of our tooling expects.
                if (!MacCatalystSupport.TryGetiOSVersion(Sdks.GetAppleSdk(Platform).GetSdkPath(SdkVersion, false), MinimumOSVersion, out var convertedVersion))
                {
                    Log.LogError(MSBStrings.E0187, MinimumOSVersion);
                }
                MinimumOSVersion = convertedVersion;
            }

            return(true);
        }
        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);
        }