Пример #1
0
        // Return all matching pod files in the Podfile
        private void ParsePodInfos(string podFileData)
        {
            m_PodInfos = new List <PodInfo>();
            var matches = podRegex.Matches(podFileData);

            foreach (Match m in matches)
            {
                PodInfo pi = new PodInfo();
                pi.Library         = PodItem.CreateFromMatchGroup(m.Groups["library"]);
                pi.VersionOperator = PodItem.CreateFromMatchGroup(m.Groups["operator"]);
                pi.Version         = PodItem.CreateFromMatchGroup(m.Groups["version"]);
                m_PodInfos.Add(pi);
            }
        }
Пример #2
0
        public static void GenerateCocoapodsUpdateWarning(string pluginFolder, string buildFolder)
        {
            // Open Podfile
            string  sourcePodfilePath = Path.Combine(pluginFolder, "GVRSDK/Podfile");
            Podfile sourcePodfile     = new Podfile(sourcePodfilePath);
            // extract version
            PodInfo sourcePod = sourcePodfile.GetPodInfoForLibrary(kGoogleVRSDKLibrary);

            if (sourcePod == null)
            {
                throw new Exception("Google VR (iOS) package is missing the source Podfile data for the Google VR library!");
            }

            // Open target Podfile
            string  targetPodfilePath = Path.Combine(buildFolder, "Podfile");
            Podfile targetPodfile     = new Podfile(targetPodfilePath);
            // Extract version
            PodInfo targetPod = targetPodfile.GetPodInfoForLibrary(kGoogleVRSDKLibrary);

            if (targetPod == null)
            {
                targetPod = targetPodfile.GetPodInfoForLibrary(kGoogleVRNDKLibrary);
            }

            // If versions don't match, log warning
            if (targetPod == null || targetPod < sourcePod)
            {
                string msg = "The generated project already contains a Podfile and so are unable to automatically update the target Podfile.\n\n\n" +
                             "To update to the latest version of Google VR shipped with Unity, you may need to modify the Podfile (located here: " + targetPodfilePath +
                             ") in the following way:\n\n";

                if (targetPod != null)
                {
                    msg += "Remove the following from the Podfile: " + targetPod.ToString() + "\n";
                }

                msg += "Add the following to the Podfile: " + sourcePod.ToString() + "\n";
                msg += "\nFor more information on Cocoapods, including how to install and use the pod tool, please see http://cocoapods.org\n";
                Debug.LogWarning(msg);
            }
        }
Пример #3
0
        public bool IsLowerVersionThan(PodInfo otherPod)
        {
            if (otherPod == null || String.IsNullOrEmpty(otherPod.Version.Value))
            {
                return(false);
            }
            if (String.IsNullOrEmpty(Version.Value))
            {
                return(true);
            }

            short[] ourVersions   = CrackVersion(Version.Value);
            short[] theirVersions = CrackVersion(otherPod.Version.Value);

            for (int i = 0; i < kMaxVersionParts; i++)
            {
                if (ourVersions[i] < theirVersions[i])
                {
                    return(true);
                }
            }

            return(false);
        }