protected override PDictionary GetCompiledEntitlements(MobileProvision profile, PDictionary template) { var entitlements = base.GetCompiledEntitlements (profile, template); PBoolean sandbox; if (Debug && entitlements.TryGetValue ("com.apple.security.app-sandbox", out sandbox) && sandbox.Value) entitlements["com.apple.security.network.client"] = new PBoolean (true); return entitlements; }
public static void CreateBuildProgressWindow(string path, bool dSYMBuild, MobileProvision customProvisionProfile, string developerIdentity, bool upload) { CustomBuildProgressIOS window = CustomBuildProgressIOS.CreateInstance<CustomBuildProgressIOS>(); window._uploadToFIR = upload; window._path = path; window._dSYMBuild = dSYMBuild; window._customProvisionProfile = customProvisionProfile; window._developerIdentity = developerIdentity; window.position = new Rect(0, 0, 300, 140); window.minSize = new Vector2(window.position.width, window.position.height); window.maxSize = new Vector2(window.position.width+1, window.position.height+1); window.ShowPopup(); }
PArray MergeEntitlementArray(PArray array, MobileProvision profile) { var result = new PArray(); foreach (var item in array) { PObject value; if (item is PDictionary) { value = MergeEntitlementDictionary((PDictionary)item, profile); } else if (item is PString) { value = MergeEntitlementString((PString)item, profile, false); } else if (item is PArray) { value = MergeEntitlementArray((PArray)item, profile); } else { value = item.Clone(); } if (value != null) { result.Add(value); } } if (result.Count > 0) { return(result); } return(null); }
PString MergeEntitlementString(PString pstr, MobileProvision profile) { string TeamIdentifierPrefix; string AppIdentifierPrefix; if (string.IsNullOrEmpty (pstr.Value)) return (PString) pstr.Clone (); if (profile == null) { if (!warnedTeamIdentifierPrefix && pstr.Value.Contains ("$(TeamIdentifierPrefix)")) { Log.LogWarning (null, null, null, Entitlements, 0, 0, 0, 0, "Cannot expand $(TeamIdentifierPrefix) in Entitlements.plist without a provisioning profile."); warnedTeamIdentifierPrefix = true; } if (!warnedAppIdentifierPrefix && pstr.Value.Contains ("$(AppIdentifierPrefix)")) { Log.LogWarning (null, null, null, Entitlements, 0, 0, 0, 0, "Cannot expand $(AppIdentifierPrefix) in Entitlements.plist without a provisioning profile."); warnedAppIdentifierPrefix = true; } } if (profile != null && profile.ApplicationIdentifierPrefix.Count > 0) AppIdentifierPrefix = profile.ApplicationIdentifierPrefix[0] + "."; else AppIdentifierPrefix = string.Empty; if (profile != null && profile.TeamIdentifierPrefix.Count > 0) TeamIdentifierPrefix = profile.TeamIdentifierPrefix[0] + "."; else TeamIdentifierPrefix = AppIdentifierPrefix; var customTags = new Dictionary<string, string> (StringComparer.OrdinalIgnoreCase) { { "TeamIdentifierPrefix", TeamIdentifierPrefix }, { "AppIdentifierPrefix", AppIdentifierPrefix }, { "CFBundleIdentifier", BundleIdentifier }, }; var expanded = StringParserService.Parse (pstr.Value, customTags); if (expanded.IndexOf ('*') != -1) { int asterisk = expanded.IndexOf ('*'); string prefix; if (expanded.StartsWith (TeamIdentifierPrefix, StringComparison.Ordinal)) prefix = TeamIdentifierPrefix; else if (expanded.StartsWith (AppIdentifierPrefix, StringComparison.Ordinal)) prefix = AppIdentifierPrefix; else prefix = string.Empty; var baseBundleIdentifier = expanded.Substring (prefix.Length, asterisk - prefix.Length); if (!BundleIdentifier.StartsWith (baseBundleIdentifier, StringComparison.Ordinal)) expanded = expanded.Replace ("*", BundleIdentifier); else expanded = prefix + BundleIdentifier; } return new PString (expanded); }
PDictionary MergeEntitlementDictionary(PDictionary dict, MobileProvision profile) { var result = new PDictionary (); foreach (var item in dict) { PObject value = item.Value; if (value is PDictionary) value = MergeEntitlementDictionary ((PDictionary) value, profile); else if (value is PString) value = MergeEntitlementString ((PString) value, profile); else if (value is PArray) value = MergeEntitlementArray ((PArray) value, profile); else value = value.Clone (); if (value != null) result.Add (item.Key, value); } return result; }
PArray MergeEntitlementArray(PArray array, MobileProvision profile) { var result = new PArray (); foreach (var item in array) { PObject value; if (item is PDictionary) value = MergeEntitlementDictionary ((PDictionary) item, profile); else if (item is PString) value = MergeEntitlementString ((PString) item, profile); else if (item is PArray) value = MergeEntitlementArray ((PArray) item, profile); else value = item.Clone (); if (value != null) result.Add (value); } if (result.Count > 0) return result; return null; }
protected virtual PDictionary GetCompiledEntitlements(MobileProvision profile, PDictionary template) { var entitlements = new PDictionary (); if (profile != null && MergeProfileEntitlements) { // start off with the settings from the provisioning profile foreach (var item in profile.Entitlements) { if (!AllowedProvisioningKeys.Contains (item.Key)) continue; var value = item.Value; if (item.Key == "com.apple.developer.icloud-container-environment") value = new PString ("Development"); else if (value is PDictionary) value = MergeEntitlementDictionary ((PDictionary) value, profile); else if (value is PString) value = MergeEntitlementString ((PString) value, profile); else if (value is PArray) value = MergeEntitlementArray ((PArray) value, profile); else value = value.Clone (); if (value != null) entitlements.Add (item.Key, value); } } // merge in the user's values foreach (var item in template) { var value = item.Value; if (item.Key == "com.apple.developer.ubiquity-container-identifiers" || item.Key == "com.apple.developer.icloud-container-identifiers" || item.Key == "com.apple.developer.icloud-container-environment" || item.Key == "com.apple.developer.icloud-services") { if (profile == null) Log.LogWarning (null, null, null, Entitlements, 0, 0, 0, 0, "iCloud entitlements such as '" + item.Key + "' require a Provisioning Profile."); else if (!profile.Entitlements.ContainsKey (item.Key)) Log.LogWarning (null, null, null, Entitlements, 0, 0, 0, 0, "The iCloud entitlement '" + item.Key + "' is not supported by the Provisioning Profile."); } else if (item.Key == ApplicationIdentifierKey) { var str = value as PString; // Ignore ONLY if it is empty, otherwise take the user's value if (str == null || string.IsNullOrEmpty (str.Value)) continue; } if (value is PDictionary) value = MergeEntitlementDictionary ((PDictionary) value, profile); else if (value is PString) value = MergeEntitlementString ((PString) value, profile); else if (value is PArray) value = MergeEntitlementArray ((PArray) value, profile); else value = value.Clone (); if (value != null) entitlements[item.Key] = value; } return entitlements; }
protected virtual PDictionary GetCompiledEntitlements(MobileProvision profile, PDictionary template) { var entitlements = new PDictionary(); if (profile != null && MergeProfileEntitlements) { // start off with the settings from the provisioning profile foreach (var item in profile.Entitlements) { if (!AllowedProvisioningKeys.Contains(item.Key)) { continue; } var value = item.Value; if (item.Key == "com.apple.developer.icloud-container-environment") { value = new PString("Development"); } else if (value is PDictionary) { value = MergeEntitlementDictionary((PDictionary)value, profile); } else if (value is PString) { value = MergeEntitlementString((PString)value, profile, item.Key == ApplicationIdentifierKey); } else if (value is PArray) { value = MergeEntitlementArray((PArray)value, profile); } else { value = value.Clone(); } if (value != null) { entitlements.Add(item.Key, value); } } } // merge in the user's values foreach (var item in template) { var value = item.Value; if (item.Key == "com.apple.developer.ubiquity-container-identifiers" || item.Key == "com.apple.developer.icloud-container-identifiers" || item.Key == "com.apple.developer.icloud-container-environment" || item.Key == "com.apple.developer.icloud-services") { if (profile == null) { Log.LogWarning(null, null, null, Entitlements, 0, 0, 0, 0, MSBStrings.W0110, item.Key); } else if (!profile.Entitlements.ContainsKey(item.Key)) { Log.LogWarning(null, null, null, Entitlements, 0, 0, 0, 0, MSBStrings.W0111, item.Key); } } else if (item.Key == ApplicationIdentifierKey) { var str = value as PString; // Ignore ONLY if it is empty, otherwise take the user's value if (str == null || string.IsNullOrEmpty(str.Value)) { continue; } } if (value is PDictionary) { value = MergeEntitlementDictionary((PDictionary)value, profile); } else if (value is PString) { value = MergeEntitlementString((PString)value, profile, item.Key == ApplicationIdentifierKey); } else if (value is PArray) { value = MergeEntitlementArray((PArray)value, profile); } else { value = value.Clone(); } if (value != null) { entitlements[item.Key] = value; } } switch (Platform) { case ApplePlatform.MacOSX: case ApplePlatform.MacCatalyst: if (Debug && entitlements.TryGetValue("com.apple.security.app-sandbox", out PBoolean sandbox) && sandbox.Value) { entitlements ["com.apple.security.network.client"] = new PBoolean(true); } break; } return(entitlements); }
PString MergeEntitlementString(PString pstr, MobileProvision profile, bool expandWildcards) { string TeamIdentifierPrefix; string AppIdentifierPrefix; if (string.IsNullOrEmpty(pstr.Value)) { return((PString)pstr.Clone()); } if (profile == null) { if (!warnedTeamIdentifierPrefix && pstr.Value.Contains("$(TeamIdentifierPrefix)")) { Log.LogWarning(null, null, null, Entitlements, 0, 0, 0, 0, MSBStrings.W0108); warnedTeamIdentifierPrefix = true; } if (!warnedAppIdentifierPrefix && pstr.Value.Contains("$(AppIdentifierPrefix)")) { Log.LogWarning(null, null, null, Entitlements, 0, 0, 0, 0, MSBStrings.W0109); warnedAppIdentifierPrefix = true; } } if (profile != null && profile.ApplicationIdentifierPrefix.Count > 0) { AppIdentifierPrefix = profile.ApplicationIdentifierPrefix[0] + "."; } else { AppIdentifierPrefix = string.Empty; } if (profile != null && profile.TeamIdentifierPrefix.Count > 0) { TeamIdentifierPrefix = profile.TeamIdentifierPrefix[0] + "."; } else { TeamIdentifierPrefix = AppIdentifierPrefix; } var customTags = new Dictionary <string, string> (StringComparer.OrdinalIgnoreCase) { { "TeamIdentifierPrefix", TeamIdentifierPrefix }, { "AppIdentifierPrefix", AppIdentifierPrefix }, { "CFBundleIdentifier", BundleIdentifier }, }; var expanded = StringParserService.Parse(pstr.Value, customTags); if (expandWildcards && expanded.IndexOf('*') != -1) { int asterisk = expanded.IndexOf('*'); string prefix; if (expanded.StartsWith(TeamIdentifierPrefix, StringComparison.Ordinal)) { prefix = TeamIdentifierPrefix; } else if (expanded.StartsWith(AppIdentifierPrefix, StringComparison.Ordinal)) { prefix = AppIdentifierPrefix; } else { prefix = string.Empty; } var baseBundleIdentifier = expanded.Substring(prefix.Length, asterisk - prefix.Length); if (!BundleIdentifier.StartsWith(baseBundleIdentifier, StringComparison.Ordinal)) { expanded = expanded.Replace("*", BundleIdentifier); } else { expanded = prefix + BundleIdentifier; } } return(new PString(expanded)); }
protected virtual PDictionary GetCompiledEntitlements(MobileProvision profile, PDictionary template) { var entitlements = new PDictionary(); if (profile != null && MergeProfileEntitlements) { // start off with the settings from the provisioning profile foreach (var item in profile.Entitlements) { if (!AllowedProvisioningKeys.Contains(item.Key)) { continue; } var value = item.Value; if (item.Key == "com.apple.developer.icloud-container-environment") { value = new PString("Development"); } else if (value is PDictionary) { value = MergeEntitlementDictionary((PDictionary)value, profile); } else if (value is PString) { value = MergeEntitlementString((PString)value, profile); } else if (value is PArray) { value = MergeEntitlementArray((PArray)value, profile); } else { value = value.Clone(); } if (value != null) { entitlements.Add(item.Key, value); } } } // merge in the user's values foreach (var item in template) { var value = item.Value; if (item.Key == "com.apple.developer.ubiquity-container-identifiers" || item.Key == "com.apple.developer.icloud-container-identifiers" || item.Key == "com.apple.developer.icloud-container-environment" || item.Key == "com.apple.developer.icloud-services") { if (profile == null) { Log.LogWarning(null, null, null, Entitlements, 0, 0, 0, 0, "iCloud entitlements such as '" + item.Key + "' require a Provisioning Profile."); } else if (!profile.Entitlements.ContainsKey(item.Key)) { Log.LogWarning(null, null, null, Entitlements, 0, 0, 0, 0, "The iCloud entitlement '" + item.Key + "' is not supported by the Provisioning Profile."); } } else if (item.Key == ApplicationIdentifierKey) { var str = value as PString; // Ignore ONLY if it is empty, otherwise take the user's value if (str == null || string.IsNullOrEmpty(str.Value)) { continue; } } if (value is PDictionary) { value = MergeEntitlementDictionary((PDictionary)value, profile); } else if (value is PString) { value = MergeEntitlementString((PString)value, profile); } else if (value is PArray) { value = MergeEntitlementArray((PArray)value, profile); } else { value = value.Clone(); } if (value != null) { entitlements[item.Key] = value; } } return(entitlements); }
string ConstructValidAppId(MobileProvision provision, string bundleId) { int matchLength; return(ConstructValidAppId(provision, bundleId, out matchLength)); }
public IPhoneSigningKeyPanelWidget(IPhoneProject project) { this.Build(); resourceRulesEntry.DefaultFilter = "*.plist"; resourceRulesEntry.Project = project; resourceRulesEntry.EntryIsEditable = true; entitlementsEntry.DefaultFilter = "*.plist"; entitlementsEntry.Project = project; entitlementsEntry.EntryIsEditable = true; additionalArgsEntry.AddOptions(IPhoneBuildOptionsWidget.menuOptions); profiles = MobileProvision.GetAllInstalledProvisions(); var txtRenderer = new CellRendererText(); txtRenderer.Ellipsize = Pango.EllipsizeMode.End; identityCombo.Model = identityStore; identityCombo.PackStart(txtRenderer, true); identityCombo.AddAttribute(txtRenderer, "markup", 0); identityCombo.RowSeparatorFunc = delegate(TreeModel model, TreeIter iter) { return((string)model.GetValue(iter, 0) == "-"); }; identityCombo.Changed += delegate { UpdateProfiles(); }; provisioningCombo.Model = profileStore; provisioningCombo.PackStart(txtRenderer, true); provisioningCombo.AddAttribute(txtRenderer, "markup", 0); var signingCerts = Keychain.FindNamedSigningCertificates(x => x.StartsWith("iPhone")).ToList(); signingCerts.Sort((x, y) => Keychain.GetCertificateCommonName(x).CompareTo(Keychain.GetCertificateCommonName(x))); identityStore.AppendValues("<b>Developer (Automatic)</b>", Keychain.DEV_CERT_PREFIX, null); identityStore.AppendValues("<b>Distribution (Automatic)</b>", Keychain.DIST_CERT_PREFIX, null); int trimStart = "iPhone ".Length; identityStore.AppendValues("-", "-", null); foreach (var cert in signingCerts) { string cn = Keychain.GetCertificateCommonName(cert); if (cn.StartsWith(Keychain.DEV_CERT_PREFIX)) { identityStore.AppendValues(GLib.Markup.EscapeText(cn.Substring(trimStart, cn.Length - trimStart)), cn, cert); } } identityStore.AppendValues("-", "-", null); foreach (var cert in signingCerts) { string cn = Keychain.GetCertificateCommonName(cert); if (cn.StartsWith(Keychain.DIST_CERT_PREFIX)) { identityStore.AppendValues(GLib.Markup.EscapeText(cn.Substring(trimStart, cn.Length - trimStart)), cn, cert); } } this.ShowAll(); }
public static System.Diagnostics.Process BuildXCodeApp(MobileProvision customProvisionProfile, bool dSYMBuild, string developerIdentity, string XCodeBuildPath) { string extraArgs = ""; string appOutputPath = XCodeBuildPath + AppOutputPath; if (Directory.Exists(appOutputPath)) Directory.Delete(appOutputPath, true); Directory.CreateDirectory(appOutputPath); if (customProvisionProfile != null && customProvisionProfile.UUID != "") { extraArgs += " PROVISIONING_PROFILE=\"" + customProvisionProfile.UUID + "\""; } if (dSYMBuild) { extraArgs += " DEBUG_INFORMATION_FORMAT=dwarf-with-dsym"; extraArgs += " GCC_GENERATE_DEBUGGING_SYMBOLS=YES"; } if (developerIdentity.Length > 0 && developerIdentity != "iPhone Developer") { extraArgs += " CODE_SIGN_IDENTITY=\"" + developerIdentity + "\""; } extraArgs += " CONFIGURATION_BUILD_DIR=\"" + appOutputPath + "\""; string stages = "clean build "; string args = stages + "-project Unity-iPhone.xcodeproj" + extraArgs; Debug.Log("xcodebuild " + args); return CustomBuildUtil.StartProcess("xcodebuild", args, true, XCodeBuildPath); }
private static void DrawUserSettings_Provisions(MobileProvision[] availableProvisions, string[] availableIdentities) { var identityProvisionOptions = new List<KeyValuePair<string, MobileProvision>>(); foreach (var identity in availableIdentities) { foreach (var provision in availableProvisions) { if (!provision.MatchesBundleId(PlayerSettings.bundleIdentifier)) continue; if (provision.Certificates == null) { identityProvisionOptions.Add(new KeyValuePair<string, MobileProvision>("Unverified Identities", provision)); continue; } if (!System.Array.Exists(provision.Certificates, m => m == identity)) continue; identityProvisionOptions.Add(new KeyValuePair<string, MobileProvision>(identity, provision)); } } var options = new List<string>(); for (int i = 0; i < identityProvisionOptions.Count; ++i) { var option = identityProvisionOptions[i]; string output = option.Key + "/\n" + (option.Value.MatchesBundleId(PlayerSettings.bundleIdentifier) ? "" : "<Different Bundle Id> ") + option.Value.Name; options.Add(output); } int chosen = _customProvisionProfile == null ? 0 : Mathf.Max(0, identityProvisionOptions.FindIndex(delegate(KeyValuePair<string, MobileProvision> obj) { return obj.Value.Equals(_customProvisionProfile); })); var labelContent = new GUIContent("Profile"); chosen = CustomBuildUtil.PopupButton(labelContent, chosen, options.ToArray(), 0); if (identityProvisionOptions.Count != 0 && identityProvisionOptions[chosen].Value != null) { _customProvisionProfile = identityProvisionOptions[chosen].Value; _developerIdentity = identityProvisionOptions[chosen].Key; } GUI.color = Color.white; }
private static void DrawUserSettings_BundleId(MobileProvision[] availableProvisions, string[] availableIdentities) { var bundleIdOptions = new List<string>(); bundleIdOptions.Add("com.*"); foreach (var p in availableProvisions) { int start = p.AppIdentifier.IndexOf("."); if (start == -1) continue; var id = p.AppIdentifier.Substring(start + 1); if (id == "*") id = "com.*"; else if (p.Certificates != null && !System.Array.Exists(availableIdentities, m => p.Certificates.Contains(m))) continue; if (bundleIdOptions.Contains(id)) continue; bundleIdOptions.Add(id); } bundleIdOptions.Sort((m, n) => m.Length.CompareTo(n.Length)); int prevBundle = 0; prevBundle = Mathf.Max(0, bundleIdOptions.FindLastIndex(m => PlayerSettings.bundleIdentifier.StartsWith(m.Replace("*", "")))); var newChosenBundle = CustomBuildUtil.Popup(new GUIContent("Bundle Id*", "Select/edit your bundle Id from the list of bundle ids that match your provisioning profiles."), prevBundle, bundleIdOptions.ToArray(), 0); if (bundleIdOptions.Count == 0) return; var newBundleId = bundleIdOptions[newChosenBundle]; if (bundleIdOptions[newChosenBundle].EndsWith("*")) { EditorGUILayout.BeginHorizontal(); GUILayout.Space(129); EditorGUILayout.BeginHorizontal("box"); var appsuffix = PlayerSettings.productName; if (PlayerSettings.bundleIdentifier.StartsWith(bundleIdOptions[prevBundle].Replace("*", ""))) appsuffix = PlayerSettings.bundleIdentifier.Remove(0, bundleIdOptions[prevBundle].Replace("*", "").Length); newBundleId = bundleIdOptions[newChosenBundle].Replace("*", ""); GUILayout.Label(newBundleId, GUILayout.ExpandWidth(false)); newBundleId += GUILayout.TextField(appsuffix, GUILayout.ExpandWidth(false), GUILayout.MinWidth(100)); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndHorizontal(); } PlayerSettings.bundleIdentifier = newBundleId; }