Пример #1
0
        private void DependencyStateBlock(
            DependencyDefinition definition,
            PackageRepo bestMatch,
            PackageRepo latest,
            InstalledPackage installed
            )
        {
            EditorGUILayout.LabelField(definition.Name + ":", EditorStyles.boldLabel);
            EditorGUILayout.LabelField("Requirement: " + definition.Requirement.ToString());
            if (installed != null)
            {
                EditorGUILayout.LabelField("Installed version: " + installed.Version);

                if (VersionParser.GreaterThan(bestMatch.Package.PackageVersion, installed.Version))
                {
                    EditorGUILayout.HelpBox(
                        string.Format(
                            "Package is outdated. You can update it to {0} (from {1})",
                            bestMatch.Package.PackageVersion,
                            bestMatch.Repository.ToString()
                            ),
                        MessageType.Info
                        );
                    if (GUILayout.Button("Update to version " + bestMatch.Package.PackageVersion))
                    {
                        UpliftManager.Instance().UpdatePackage(bestMatch, updateLockfile: true);
                        Init();
                        Repaint();
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox("Package is up to date!", MessageType.Info);
                }

                if (!definition.Requirement.IsMetBy(installed.Version))
                {
                    EditorGUILayout.HelpBox(
                        "The version of the package currently installed does not match the requirements of your project!",
                        installed.Version != bestMatch.Package.PackageVersion ? MessageType.Warning : MessageType.Error
                        );
                }
            }
            else
            {
                EditorGUILayout.LabelField("Not yet installed");
            }

            if (latest.Package.PackageVersion != bestMatch.Package.PackageVersion)
            {
                EditorGUILayout.HelpBox(
                    string.Format(
                        "Note: there is a more recent version of the package ({0} from {1}), but it doesn't match your requirement",
                        latest.Package.PackageVersion,
                        bestMatch.Repository.ToString()
                        ),
                    MessageType.Info
                    );
            }
        }
Пример #2
0
        private static IEnumerator CheckForUpdateRoutine()
        {
            IEnumerator e = GitHub.LoadReleases("https://api.github.com/repos/DragonBox/uplift/releases");

            while (e.MoveNext())
            {
                yield return(e.Current);
            }

            GitHubRelease[] releases = (GitHubRelease[])e.Current;

            if (releases == null)
            {
                Debug.LogError("Unable to check for Uplift updates");
            }
            else if (!releases.Any(release => VersionParser.GreaterThan(release.tag, About.Version)))
            {
                Debug.Log("No udpate for Uplift available");
            }
            else
            {
                UpdatePopup popup = EditorWindow.GetWindow(typeof(UpdatePopup), true) as UpdatePopup;
                popup.SetReleases(releases.Where(release => VersionParser.GreaterThan(release.tag, About.Version, true)).ToArray());
            }
            EditorApplication.update -= EditorUpdate;
            EditorPrefs.SetString(
                lastUpdateCheckKey,
                DateTime.UtcNow.ToString(dateFormat, provider)
                );
        }
Пример #3
0
 private void CheckVersionConflict(ref DependencyNode existing, DependencyNode compared)
 {
     if (versionParser.GreaterThan(compared.Version, existing.Version))
     {
         UnityEngine.Debug.LogWarning(string.Format("Existing dependency for {0} is version {1}, but another package depends on a greater version {2}. Upgrading dependency definition.", compared.Name, existing.Version, compared.Version));
         existing.Version = compared.Version;
     }
     else
     {
         UnityEngine.Debug.Log(string.Format("Existing dependency for {0} is version {1}, but another package depends on a lower version {2}. Ignoring the latter.", compared.Name, existing.Version, compared.Version));
     }
 }
Пример #4
0
 internal PackageRepo[] FindCandidatesForDefinition(DependencyDefinition packageDefinition)
 {
     return((
                // From All the available packages
                from packageRepo in GetAllPackages()
                // Select the ones that match the definition name
                where packageRepo.Package.PackageName == packageDefinition.Name
                // And the version definition
                where versionParser.GreaterThan(packageRepo.Package, packageDefinition)
                // And use found package
                select packageRepo
                // As an array
                ).ToArray());
 }
Пример #5
0
 public void CompareUpliftBetaReleases()
 {
     Assert.IsTrue(VersionParser.GreaterThan("1.0.0beta5", "1.0.0beta4", incomplete: true));
     Assert.IsFalse(VersionParser.GreaterThan("1.0.0beta5", "1.0.0beta4", incomplete: false));
 }
Пример #6
0
 public void CompareUpliftReleases()
 {
     Assert.IsTrue(VersionParser.GreaterThan("3.0.0", "2.0.0"));
 }