Ejemplo n.º 1
0
            /// <summary>
            /// Convert min target SDK to an integer in the form
            // (major * 10) + minor.
            /// </summary>
            /// <return>Numeric minimum SDK revision required by this pod.</return>
            public int MinTargetSdkToVersion()
            {
                string sdkString =
                    String.IsNullOrEmpty(minTargetSdk) ? "0.0" : minTargetSdk;

                if (!sdkString.Contains("."))
                {
                    sdkString = sdkString + ".0";
                }
                return(IOSResolver.TargetSdkStringToVersion(sdkString));
            }
Ejemplo n.º 2
0
        public void OnGUI()
        {
            GUI.skin.label.wordWrap = true;
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Label("Podfile Generation", EditorStyles.boldLabel, new GUILayoutOption[0]);
            this.settings.podfileGenerationEnabled = EditorGUILayout.Toggle(this.settings.podfileGenerationEnabled, new GUILayoutOption[0]);
            GUILayout.EndHorizontal();
            GUILayout.Label("Podfile generation is required to install Cocoapods.  It may be desirable to disable Podfile generation if frameworks are manually included in Unity's generated Xcode project.", new GUILayoutOption[0]);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Label("Cocoapods Integration", EditorStyles.boldLabel, new GUILayoutOption[0]);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            this.settings.cocoapodsIntegrationMenuIndex = EditorGUILayout.Popup(this.settings.cocoapodsIntegrationMenuIndex, IOSResolverSettingsDialog.cocopodsIntegrationStrings, new GUILayoutOption[0]);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            if (IOSResolverSettingsDialog.integrationMapping[this.settings.cocoapodsIntegrationMenuIndex] != IOSResolver.CocoapodsIntegrationMethod.None && !this.settings.podfileGenerationEnabled)
            {
                GUILayout.Label("Cocoapod installation requires Podfile generation to be enabled.", new GUILayoutOption[0]);
            }
            else if (IOSResolverSettingsDialog.integrationMapping[this.settings.cocoapodsIntegrationMenuIndex] == IOSResolver.CocoapodsIntegrationMethod.Workspace)
            {
                GUILayout.Label("Unity Cloud Build and Unity 5.5 and below do not open generated Xcode workspaces so this plugin will fall back to Xcode Project integration in those environments.", new GUILayoutOption[0]);
            }
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Label("Use Shell to Execute Cocoapod Tool", EditorStyles.boldLabel, new GUILayoutOption[0]);
            this.settings.podToolExecutionViaShellEnabled = EditorGUILayout.Toggle(this.settings.podToolExecutionViaShellEnabled, new GUILayoutOption[0]);
            GUILayout.EndHorizontal();
            if (this.settings.podToolExecutionViaShellEnabled)
            {
                GUILayout.Label("Shell execution is useful when configuration in the shell environment (e.g ~/.profile) is required to execute Cocoapods tools.", new GUILayoutOption[0]);
            }
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Label("Auto Install Cocoapod Tools in Editor", EditorStyles.boldLabel, new GUILayoutOption[0]);
            this.settings.autoPodToolInstallInEditorEnabled = EditorGUILayout.Toggle(this.settings.autoPodToolInstallInEditorEnabled, new GUILayoutOption[0]);
            GUILayout.EndHorizontal();
            if (this.settings.autoPodToolInstallInEditorEnabled)
            {
                GUILayout.Label("Automatically installs the Cocoapod tool if the editor isn't running in batch mode", new GUILayoutOption[0]);
            }
            else
            {
                GUILayout.Label("Cocoapod tool installation can be performed via the menu option: Assets > Play Services Resolver > iOS Resolver > Install Cocoapods", new GUILayoutOption[0]);
            }
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Label("Verbose Logging", EditorStyles.boldLabel, new GUILayoutOption[0]);
            this.settings.verboseLoggingEnabled = EditorGUILayout.Toggle(this.settings.verboseLoggingEnabled, new GUILayoutOption[0]);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Label("Use project settings", EditorStyles.boldLabel, new GUILayoutOption[0]);
            this.settings.useProjectSettings = EditorGUILayout.Toggle(this.settings.useProjectSettings, new GUILayoutOption[0]);
            GUILayout.EndHorizontal();
            GUILayout.Space(10f);
            if (GUILayout.Button("Reset to Defaults", new GUILayoutOption[0]))
            {
                IOSResolverSettingsDialog.Settings settings = new IOSResolverSettingsDialog.Settings();
                IOSResolver.RestoreDefaultSettings();
                this.LoadSettings();
                settings.Save();
            }
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            bool flag  = GUILayout.Button("Cancel", new GUILayoutOption[0]);
            bool flag2 = GUILayout.Button("OK", new GUILayoutOption[0]);

            flag |= flag2;
            if (flag2)
            {
                this.settings.Save();
            }
            if (flag)
            {
                base.Close();
            }
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Called when the GUI should be rendered.
        /// </summary>
        public void OnGUI()
        {
            GUI.skin.label.wordWrap = true;
            GUILayout.BeginVertical();
            GUILayout.Label(String.Format("iOS Resolver (version {0}.{1}.{2})",
                                          IOSResolverVersionNumber.Value.Major,
                                          IOSResolverVersionNumber.Value.Minor,
                                          IOSResolverVersionNumber.Value.Build));

            GUILayout.BeginHorizontal();
            GUILayout.Label("Podfile Generation", EditorStyles.boldLabel);
            settings.podfileGenerationEnabled =
                EditorGUILayout.Toggle(settings.podfileGenerationEnabled);
            GUILayout.EndHorizontal();
            GUILayout.Label("Podfile generation is required to install Cocoapods.  " +
                            "It may be desirable to disable Podfile generation if frameworks " +
                            "are manually included in Unity's generated Xcode project.");

            GUILayout.BeginHorizontal();
            GUILayout.Label("Cocoapods Integration", EditorStyles.boldLabel);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            settings.cocoapodsIntegrationMenuIndex = EditorGUILayout.Popup(
                settings.cocoapodsIntegrationMenuIndex, cocopodsIntegrationStrings);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            if (integrationMapping[settings.cocoapodsIntegrationMenuIndex] !=
                IOSResolver.CocoapodsIntegrationMethod.None && !settings.podfileGenerationEnabled)
            {
                GUILayout.Label("Cocoapod installation requires Podfile generation to be enabled.");
            }
            else if (integrationMapping[settings.cocoapodsIntegrationMenuIndex] ==
                     IOSResolver.CocoapodsIntegrationMethod.Workspace)
            {
                GUILayout.Label("Unity Cloud Build and Unity 5.5 and below do not open generated " +
                                "Xcode workspaces so this plugin will fall back to Xcode Project " +
                                "integration in those environments.");
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Use Shell to Execute Cocoapod Tool", EditorStyles.boldLabel);
            settings.podToolExecutionViaShellEnabled =
                EditorGUILayout.Toggle(settings.podToolExecutionViaShellEnabled);
            GUILayout.EndHorizontal();
            if (settings.podToolExecutionViaShellEnabled)
            {
                GUILayout.Label("Shell execution is useful when configuration in the shell " +
                                "environment (e.g ~/.profile) is required to execute Cocoapods tools.");
            }

            GUILayout.BeginHorizontal();
            GUILayout.Label("Auto Install Cocoapod Tools in Editor", EditorStyles.boldLabel);
            settings.autoPodToolInstallInEditorEnabled =
                EditorGUILayout.Toggle(settings.autoPodToolInstallInEditorEnabled);
            GUILayout.EndHorizontal();
            if (settings.autoPodToolInstallInEditorEnabled)
            {
                GUILayout.Label("Automatically installs the Cocoapod tool if the editor isn't " +
                                "running in batch mode");
            }
            else
            {
                GUILayout.Label(
                    "Cocoapod tool installation can be performed via the menu option: " +
                    "Assets > External Dependency Manager > iOS Resolver > Install Cocoapods");
            }

            if (settings.podfileGenerationEnabled)
            {
                GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
                GUILayout.Label("Podfile Configurations", EditorStyles.largeLabel);
                EditorGUILayout.Separator();

                GUILayout.BeginHorizontal();
                GUILayout.Label("Add use_frameworks! to Podfile", EditorStyles.boldLabel);
                settings.podfileAddUseFrameworks =
                    EditorGUILayout.Toggle(settings.podfileAddUseFrameworks);
                GUILayout.EndHorizontal();

                GUILayout.Label("Add the following line to Podfile. Required if any third-party " +
                                "Unity packages depends on Swift frameworks.");
                if (settings.podfileStaticLinkFrameworks)
                {
                    GUILayout.Label("  use_frameworks! :linkage => :static");
                }
                else
                {
                    GUILayout.Label("  use_frameworks!");
                }

                if (settings.podfileAddUseFrameworks)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("Link frameworks statically", EditorStyles.boldLabel);
                    settings.podfileStaticLinkFrameworks =
                        EditorGUILayout.Toggle(settings.podfileStaticLinkFrameworks);
                    GUILayout.EndHorizontal();
                }

                if (IOSResolver.MultipleXcodeTargetsSupported)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("Always add the main target to Podfile", EditorStyles.boldLabel);
                    settings.podfileAlwaysAddMainTarget =
                        EditorGUILayout.Toggle(settings.podfileAlwaysAddMainTarget);
                    GUILayout.EndHorizontal();

                    GUILayout.Label("Add the following lines to Podfile.");
                    GUILayout.Label(String.Format("  target '{0}' do\n" +
                                                  "  end", IOSResolver.XcodeMainTargetName));

                    if (settings.podfileAlwaysAddMainTarget)
                    {
                        GUILayout.BeginHorizontal();
                        GUILayout.Label("Allow the same pod to be in multiple targets",
                                        EditorStyles.boldLabel);
                        settings.podfileAllowPodsInMultipleTargets =
                            EditorGUILayout.Toggle(settings.podfileAllowPodsInMultipleTargets);
                        GUILayout.EndHorizontal();

                        GUILayout.Label("Allow to add the same pod to multiple targets, if specified in " +
                                        "Dependencies.xml with 'addToAllTargets' attribute.");
                    }
                }

                GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
            }

            settings.analyticsSettings.RenderGui();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Verbose Logging", EditorStyles.boldLabel);
            settings.verboseLoggingEnabled = EditorGUILayout.Toggle(settings.verboseLoggingEnabled);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Use project settings", EditorStyles.boldLabel);
            settings.useProjectSettings = EditorGUILayout.Toggle(settings.useProjectSettings);
            GUILayout.EndHorizontal();

            GUILayout.Space(10);

            if (GUILayout.Button("Reset to Defaults"))
            {
                // Load default settings into the dialog but preserve the state in the user's
                // saved preferences.
                var backupSettings = new Settings();
                IOSResolver.RestoreDefaultSettings();
                IOSResolver.analytics.Report("settings/reset", "Settings Reset");
                LoadSettings();
                backupSettings.Save();
            }

            GUILayout.BeginHorizontal();
            bool closeWindow = GUILayout.Button("Cancel");

            if (closeWindow)
            {
                IOSResolver.analytics.Report("settings/cancel", "Settings Cancel");
            }
            bool ok = GUILayout.Button("OK");

            closeWindow |= ok;
            if (ok)
            {
                IOSResolver.analytics.Report(
                    "settings/save",
                    new KeyValuePair <string, string>[] {
                    new KeyValuePair <string, string>(
                        "podfileGenerationEnabled",
                        IOSResolver.PodfileGenerationEnabled.ToString()),
                    new KeyValuePair <string, string>(
                        "podToolExecutionViaShellEnabled",
                        IOSResolver.PodToolExecutionViaShellEnabled.ToString()),
                    new KeyValuePair <string, string>(
                        "autoPodToolInstallInEditorEnabled",
                        IOSResolver.AutoPodToolInstallInEditorEnabled.ToString()),
                    new KeyValuePair <string, string>(
                        "verboseLoggingEnabled",
                        IOSResolver.VerboseLoggingEnabled.ToString()),
                    new KeyValuePair <string, string>(
                        "cocoapodsIntegrationMethod",
                        IOSResolver.CocoapodsIntegrationMethodPref.ToString()),
                    new KeyValuePair <string, string>(
                        "podfileAddUseFrameworks",
                        IOSResolver.PodfileAddUseFrameworks.ToString()),
                    new KeyValuePair <string, string>(
                        "podfileStaticLinkFrameworks",
                        IOSResolver.PodfileStaticLinkFrameworks.ToString()),
                    new KeyValuePair <string, string>(
                        "podfileAlwaysAddMainTarget",
                        IOSResolver.PodfileAlwaysAddMainTarget.ToString()),
                    new KeyValuePair <string, string>(
                        "podfileAllowPodsInMultipleTargets",
                        IOSResolver.PodfileAllowPodsInMultipleTargets.ToString()),
                },
                    "Settings Save");
                settings.Save();
            }
            if (closeWindow)
            {
                Close();
            }
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Called when the GUI should be rendered.
        /// </summary>
        public void OnGUI()
        {
            GUI.skin.label.wordWrap = true;
            GUILayout.BeginVertical();
            GUILayout.Label(String.Format("iOS Resolver (version {0}.{1}.{2})",
                                          IOSResolverVersionNumber.Value.Major,
                                          IOSResolverVersionNumber.Value.Minor,
                                          IOSResolverVersionNumber.Value.Build));

            GUILayout.BeginHorizontal();
            GUILayout.Label("Podfile Generation", EditorStyles.boldLabel);
            settings.podfileGenerationEnabled =
                EditorGUILayout.Toggle(settings.podfileGenerationEnabled);
            GUILayout.EndHorizontal();
            GUILayout.Label("Podfile generation is required to install Cocoapods.  " +
                            "It may be desirable to disable Podfile generation if frameworks " +
                            "are manually included in Unity's generated Xcode project.");

            GUILayout.BeginHorizontal();
            GUILayout.Label("Cocoapods Integration", EditorStyles.boldLabel);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            settings.cocoapodsIntegrationMenuIndex = EditorGUILayout.Popup(
                settings.cocoapodsIntegrationMenuIndex, cocopodsIntegrationStrings);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            if (integrationMapping[settings.cocoapodsIntegrationMenuIndex] !=
                IOSResolver.CocoapodsIntegrationMethod.None && !settings.podfileGenerationEnabled)
            {
                GUILayout.Label("Cocoapod installation requires Podfile generation to be enabled.");
            }
            else if (integrationMapping[settings.cocoapodsIntegrationMenuIndex] ==
                     IOSResolver.CocoapodsIntegrationMethod.Workspace)
            {
                GUILayout.Label("Unity Cloud Build and Unity 5.5 and below do not open generated " +
                                "Xcode workspaces so this plugin will fall back to Xcode Project " +
                                "integration in those environments.");
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Use Shell to Execute Cocoapod Tool", EditorStyles.boldLabel);
            settings.podToolExecutionViaShellEnabled =
                EditorGUILayout.Toggle(settings.podToolExecutionViaShellEnabled);
            GUILayout.EndHorizontal();
            if (settings.podToolExecutionViaShellEnabled)
            {
                GUILayout.Label("Shell execution is useful when configuration in the shell " +
                                "environment (e.g ~/.profile) is required to execute Cocoapods tools.");
            }

            GUILayout.BeginHorizontal();
            GUILayout.Label("Auto Install Cocoapod Tools in Editor", EditorStyles.boldLabel);
            settings.autoPodToolInstallInEditorEnabled =
                EditorGUILayout.Toggle(settings.autoPodToolInstallInEditorEnabled);
            GUILayout.EndHorizontal();
            if (settings.autoPodToolInstallInEditorEnabled)
            {
                GUILayout.Label("Automatically installs the Cocoapod tool if the editor isn't " +
                                "running in batch mode");
            }
            else
            {
                GUILayout.Label("Cocoapod tool installation can be performed via the menu option: " +
                                "Assets > Play Services Resolver > iOS Resolver > Install Cocoapods");
            }

            settings.analyticsSettings.RenderGui();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Verbose Logging", EditorStyles.boldLabel);
            settings.verboseLoggingEnabled = EditorGUILayout.Toggle(settings.verboseLoggingEnabled);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Use project settings", EditorStyles.boldLabel);
            settings.useProjectSettings = EditorGUILayout.Toggle(settings.useProjectSettings);
            GUILayout.EndHorizontal();

            GUILayout.Space(10);

            if (GUILayout.Button("Reset to Defaults"))
            {
                // Load default settings into the dialog but preserve the state in the user's
                // saved preferences.
                var backupSettings = new Settings();
                IOSResolver.RestoreDefaultSettings();
                IOSResolver.analytics.Report("settings/reset", "Settings Reset");
                LoadSettings();
                backupSettings.Save();
            }

            GUILayout.BeginHorizontal();
            bool closeWindow = GUILayout.Button("Cancel");

            if (closeWindow)
            {
                IOSResolver.analytics.Report("settings/cancel", "Settings Cancel");
            }
            bool ok = GUILayout.Button("OK");

            closeWindow |= ok;
            if (ok)
            {
                IOSResolver.analytics.Report(
                    "settings/save",
                    new KeyValuePair <string, string>[] {
                    new KeyValuePair <string, string>(
                        "podfileGenerationEnabled",
                        IOSResolver.PodfileGenerationEnabled.ToString()),
                    new KeyValuePair <string, string>(
                        "podToolExecutionViaShellEnabled",
                        IOSResolver.PodToolExecutionViaShellEnabled.ToString()),
                    new KeyValuePair <string, string>(
                        "autoPodToolInstallInEditorEnabled",
                        IOSResolver.AutoPodToolInstallInEditorEnabled.ToString()),
                    new KeyValuePair <string, string>(
                        "verboseLoggingEnabled",
                        IOSResolver.VerboseLoggingEnabled.ToString()),
                    new KeyValuePair <string, string>(
                        "cocoapodsIntegrationMethod",
                        IOSResolver.CocoapodsIntegrationMethodPref.ToString()),
                },
                    "Settings Save");
                settings.Save();
            }
            if (closeWindow)
            {
                Close();
            }
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
        }