public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
        {
            if (target != BuildTarget.iOS)
            {
                return;
            }

            if (!LineSDKSettings.GetOrCreateSettings().UseCarthage)
            {
                return;
            }

            projectRoot = pathToBuiltProject;

            ShellCommand.AddSearchPath("/usr/local/bin/");
            ShellCommand.AddPossibleRubySearchPaths();

            if (!CheckCarthage())
            {
                // Carthage is required for install LINE SDK on iOS.
                return;
            }

            PrepareCartfile();
            CarthageUpdate();
            ConfigureXcodeForCarthage();
            AddCarthageCopyPhase();
        }
Ejemplo n.º 2
0
        static void DrawPref()
        {
            if (settings == null)
            {
                settings = LineSDKSettings.GetSerializedSettings();
            }
            settings.Update();
            EditorGUI.BeginChangeCheck();

            var property = settings.FindProperty("iOSDependencyManager");
            var selected = LineSDKSettings.DependencySelectedIndex(property.stringValue);

            selected = EditorGUILayout.Popup("iOS Dependency Manager", selected, LineSDKSettings.dependencyManagerOptions);

            if (selected < 0)
            {
                selected = 0;
            }
            property.stringValue = LineSDKSettings.dependencyManagerOptions[selected];

            if (EditorGUI.EndChangeCheck())
            {
                settings.ApplyModifiedProperties();
                AssetDatabase.SaveAssets();
            }
        }
Ejemplo n.º 3
0
        public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
        {
            if (target != BuildTarget.iOS)
            {
                return;
            }

            if (!LineSDKSettings.GetOrCreateSettings().UseCocoaPods)
            {
                return;
            }

            // Add usual ruby runtime manager path to process.
            ShellCommand.AddPossibleRubySearchPaths();

            var podExisting = ShellCommand.Run("which", "pod");

            if (string.IsNullOrEmpty(podExisting))
            {
                var text = @"LINE SDK integrating failed. Building LINE SDK for iOS target requires CocoaPods, but it is not installed. Please run ""sudo gem install cocoapods"" and try again.";
                UnityEngine.Debug.LogError(text);
                var clicked = EditorUtility.DisplayDialog("CocoaPods not found", text, "More", "Cancel");
                if (clicked)
                {
                    Application.OpenURL("https://cocoapods.org");
                }
            }

            var currentDirectory = Directory.GetCurrentDirectory();

            var podFileLocation = Path.Combine(pathToBuiltProject, "Podfile");

            if (File.Exists(podFileLocation))
            {
                var text = @"A Podfile is already existing under Xcode project root. Skipping copying of LINE SDK's Podfile. Make sure you have setup Podfile correctly if you are using another package also requires CocoaPods.";
                UnityEngine.Debug.Log(text);
            }
            else
            {
#if UNITY_2019_3_OR_NEWER
                var bundledPodfile = "Assets/LineSDK/Editor/CocoaPods/Podfile_2019_3";
#else
                var bundledPodfile = "Assets/LineSDK/Editor/CocoaPods/Podfile_2017_4";
#endif
                var podfilePath = Path.Combine(currentDirectory, bundledPodfile);
                UnityEngine.Debug.Log(podfilePath);
                File.Copy(podfilePath, podFileLocation);
            }

            Directory.SetCurrentDirectory(pathToBuiltProject);
            var log = ShellCommand.Run("pod", "install");
            UnityEngine.Debug.Log(log);
            Directory.SetCurrentDirectory(currentDirectory);

            ConfigureXcodeForCocoaPods(pathToBuiltProject);
        }