From ecf4c7d1b03d9cb4ce3b5fc784ec46ccc1bcbdfd Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Fri, 14 Aug 2020 15:13:18 +0000 Subject: [PATCH] 1.3.1 ## [1.3.1](https://github.com/mob-sakai/UpmGitExtension/compare/v1.3.0...v1.3.1) (2020-08-14) ### Bug Fixes * Cannot implicitly convert type 'UnityEditor.PackageManager.UI.IPageManager' ([4122c94](https://github.com/mob-sakai/UpmGitExtension/commit/4122c948e50c7fe45490574859e65a7604e31339)), closes [#93](https://github.com/mob-sakai/UpmGitExtension/issues/93) * Package resolver is not working in Unity 2020.2 ([a3d6140](https://github.com/mob-sakai/UpmGitExtension/commit/a3d61400e1cb17074d3bbbbe780a392202661057)) * uninstall package from lock file ([ab696d8](https://github.com/mob-sakai/UpmGitExtension/commit/ab696d865abf48be48fa5a3725f29db0626d0a6d)) --- CHANGELOG.md | 9 +++ .../AvailableVersionExtensions.cs | 7 +- .../AvailableVersions.cs | 38 ++++----- .../Coffee.UpmGitExtension/InternalBridge.cs | 23 ++++-- Editor/Coffee.UpmGitExtension/UI/GitButton.cs | 5 +- .../UI/InstallPackageWindow.cs | 11 +-- .../UI/PackageDetailsExtension.cs | 15 +++- .../Coffee.UpmGitExtension/UpmGitExtension.cs | 5 +- Editor/Coffee.UpmGitExtension/Utils.cs | 78 ++++++++++++------- package.json | 2 +- 10 files changed, 120 insertions(+), 73 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e5bc59b..725bdb9 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +## [1.3.1](https://github.com/mob-sakai/UpmGitExtension/compare/v1.3.0...v1.3.1) (2020-08-14) + + +### Bug Fixes + +* Cannot implicitly convert type 'UnityEditor.PackageManager.UI.IPageManager' ([4122c94](https://github.com/mob-sakai/UpmGitExtension/commit/4122c948e50c7fe45490574859e65a7604e31339)), closes [#93](https://github.com/mob-sakai/UpmGitExtension/issues/93) +* Package resolver is not working in Unity 2020.2 ([a3d6140](https://github.com/mob-sakai/UpmGitExtension/commit/a3d61400e1cb17074d3bbbbe780a392202661057)) +* uninstall package from lock file ([ab696d8](https://github.com/mob-sakai/UpmGitExtension/commit/ab696d865abf48be48fa5a3725f29db0626d0a6d)) + # [1.3.0](https://github.com/mob-sakai/UpmGitExtension/compare/v1.2.3...v1.3.0) (2020-08-13) diff --git a/Editor/Coffee.UpmGitExtension/AvailableVersionExtensions.cs b/Editor/Coffee.UpmGitExtension/AvailableVersionExtensions.cs index 2ceb2fd..f34d83a 100644 --- a/Editor/Coffee.UpmGitExtension/AvailableVersionExtensions.cs +++ b/Editor/Coffee.UpmGitExtension/AvailableVersionExtensions.cs @@ -81,11 +81,8 @@ static void WatchResultJson() EnableRaisingEvents = true, }; - watcher.Created += (s, e) => - { - EditorApplication.delayCall += () => OnResultCreated(e.FullPath); - }; + watcher.Created += (s, e) => { EditorApplication.delayCall += () => OnResultCreated(e.FullPath); }; } } } -#endif // [ASMDEFEX] DO NOT REMOVE THIS LINE MANUALLY. \ No newline at end of file +#endif // [ASMDEFEX] DO NOT REMOVE THIS LINE MANUALLY. diff --git a/Editor/Coffee.UpmGitExtension/AvailableVersions.cs b/Editor/Coffee.UpmGitExtension/AvailableVersions.cs index 4a30c08..88a4c6c 100644 --- a/Editor/Coffee.UpmGitExtension/AvailableVersions.cs +++ b/Editor/Coffee.UpmGitExtension/AvailableVersions.cs @@ -17,24 +17,25 @@ public class AvailableVersion : IEquatable public string refName = ""; public string repoUrl = ""; - public string refNameText { get { return version == refName ? version : version + " - " + refName; } } - public string refNameVersion { get { return version == refName ? version : version + "-" + refName; } } + public string refNameText => version == refName ? version : version + " - " + refName; + + public string refNameVersion => version == refName ? version : version + "-" + refName; bool IEquatable.Equals(AvailableVersion other) { return other != null - && packageName == other.packageName - && version == other.version - && repoUrl == other.repoUrl - && refName == other.refName; + && packageName == other.packageName + && version == other.version + && repoUrl == other.repoUrl + && refName == other.refName; } public override int GetHashCode() { return packageName.GetHashCode() - + version.GetHashCode() - + repoUrl.GetHashCode() - + refName.GetHashCode(); + + version.GetHashCode() + + repoUrl.GetHashCode() + + refName.GetHashCode(); } } @@ -49,7 +50,7 @@ public class AvailableVersions : ScriptableSingleton const string kPackageDir = "Library/UGE/packages"; public AvailableVersion[] versions = new AvailableVersion[0]; - + public static event Action OnChanged = () => { }; public static void ClearAll() @@ -78,29 +79,28 @@ public static IEnumerable GetVersions(string packageName = nul public static void Dump() { var sb = new StringBuilder("[AvailableVersions] Dump:\n"); - foreach(var v in instance.versions.OrderBy(x=>x.packageName).ThenBy(x=>x.version)) + foreach (var v in instance.versions.OrderBy(x => x.packageName).ThenBy(x => x.version)) { sb.AppendLine(JsonUtility.ToJson(v)); } + UnityEngine.Debug.Log(sb); } public static void AddVersions(IEnumerable add) { - if (add == null || !add.Any()) - return; + if (add == null || !add.Any()) return; var length = instance.versions.Length; var versions = instance.versions .Union(add) .ToArray(); - if (versions.Length != length) - { - instance.versions = versions; - OnChanged(); - } + if (versions.Length == length) return; + + instance.versions = versions; + OnChanged(); } } } -#endif // [ASMDEFEX] DO NOT REMOVE THIS LINE MANUALLY. \ No newline at end of file +#endif // [ASMDEFEX] DO NOT REMOVE THIS LINE MANUALLY. diff --git a/Editor/Coffee.UpmGitExtension/InternalBridge.cs b/Editor/Coffee.UpmGitExtension/InternalBridge.cs index e950059..fe7d235 100644 --- a/Editor/Coffee.UpmGitExtension/InternalBridge.cs +++ b/Editor/Coffee.UpmGitExtension/InternalBridge.cs @@ -26,6 +26,7 @@ #endif #if UNITY_2020_1_OR_NEWER using UnityEditor.Scripting.ScriptCompilation; + #endif namespace Coffee.UpmGitExtension @@ -35,14 +36,20 @@ internal class Bridge const string kHeader = "[Bridge] "; private static Bridge instance = new Bridge(); - public static Bridge Instance { get { return instance; } } + + public static Bridge Instance + { + get { return instance; } + } PackageList packageList; PackageDetails packageDetails; bool reloading; - private Bridge() { } + private Bridge() + { + } public void Setup(VisualElement root) { @@ -105,7 +112,7 @@ static bool UpdatePackageVersions(Package package, IEnumerable var versionInfos = versions .Select(v => v.ToPackageVersion(pInfoCurrent)) - .Concat(new[] { pInfoCurrent }) + .Concat(new[] {pInfoCurrent}) .Where(pInfo => pInfo == pInfoCurrent || pInfo.GetVersion() != pInfoCurrent.GetVersion()) .OrderBy(pInfo => pInfo.GetVersion()) .ToArray(); @@ -116,6 +123,7 @@ static bool UpdatePackageVersions(Package package, IEnumerable package.UpdateVersions(versionInfos); return true; } + return false; } @@ -130,11 +138,10 @@ internal static class PackageExtensions { #if UNITY_2020_1_OR_NEWER - internal static PageManager PageManagerInstance => #if UNITY_2020_2_OR_NEWER - ServicesContainer.instance.Resolve(); + internal static PageManager PageManagerInstance => ServicesContainer.instance.Resolve(); #else - PageManager.instance; + internal static IPageManager PageManagerInstance => PageManager.instance; #endif internal static void RegisterLoadedAction(this PackageList self, Action action) @@ -153,7 +160,7 @@ internal static IEnumerable GetGitPackages() internal static IEnumerable GetGitPackageInfos() { - return GetGitPackages().Select(x=>x.GetInstalledVersion()); + return GetGitPackages().Select(x => x.GetInstalledVersion()); } internal static UpmPackageVersion GetInstalledVersion(this UpmPackage self) @@ -379,4 +386,4 @@ internal static PackageInfo ToPackageVersion(this AvailableVersion self, Package #endif } } -#endif // [ASMDEFEX] DO NOT REMOVE THIS LINE MANUALLY. \ No newline at end of file +#endif // [ASMDEFEX] DO NOT REMOVE THIS LINE MANUALLY. diff --git a/Editor/Coffee.UpmGitExtension/UI/GitButton.cs b/Editor/Coffee.UpmGitExtension/UI/GitButton.cs index 9606c9d..38f23ac 100644 --- a/Editor/Coffee.UpmGitExtension/UI/GitButton.cs +++ b/Editor/Coffee.UpmGitExtension/UI/GitButton.cs @@ -3,6 +3,7 @@ #if UNITY_2019_1_OR_NEWER using UnityEngine.UIElements; using UnityEditor.UIElements; + #else using UnityEngine.Experimental.UIElements; using UnityEditor.Experimental.UIElements; @@ -26,7 +27,7 @@ public static bool IsResourceReady() public GitButton(System.Action action) : base(action) { #if UNITY_2019_1_OR_NEWER - styleSheets.Add (UnityEditor.AssetDatabase.LoadAssetAtPath(StylePath)); + styleSheets.Add(UnityEditor.AssetDatabase.LoadAssetAtPath(StylePath)); #else AddStyleSheetPath(StylePath); #endif @@ -40,4 +41,4 @@ public GitButton(System.Action action) : base(action) } } } -#endif // [ASMDEFEX] DO NOT REMOVE THIS LINE MANUALLY. \ No newline at end of file +#endif // [ASMDEFEX] DO NOT REMOVE THIS LINE MANUALLY. diff --git a/Editor/Coffee.UpmGitExtension/UI/InstallPackageWindow.cs b/Editor/Coffee.UpmGitExtension/UI/InstallPackageWindow.cs index 68dadc6..a169915 100644 --- a/Editor/Coffee.UpmGitExtension/UI/InstallPackageWindow.cs +++ b/Editor/Coffee.UpmGitExtension/UI/InstallPackageWindow.cs @@ -7,6 +7,7 @@ using UnityEngine; #if UNITY_2019_1_OR_NEWER using UnityEngine.UIElements; + #else using UnityEngine.Experimental.UIElements; #endif @@ -37,8 +38,8 @@ public InstallPackageWindow() VisualTreeAsset asset = EditorGUIUtility.Load(TemplatePath) as VisualTreeAsset; #if UNITY_2019_1_OR_NEWER - root = asset.CloneTree (); - styleSheets.Add (AssetDatabase.LoadAssetAtPath (StylePath)); + root = asset.CloneTree(); + styleSheets.Add(AssetDatabase.LoadAssetAtPath(StylePath)); #else root = asset.CloneTree(null); AddStyleSheetPath(StylePath); @@ -69,13 +70,13 @@ public InstallPackageWindow() // Url container #if UNITY_2019_1_OR_NEWER - repoUrlText.RegisterValueChangedCallback ((evt) => onChange_RepoUrl (evt.newValue)); + repoUrlText.RegisterValueChangedCallback((evt) => onChange_RepoUrl(evt.newValue)); #else repoUrlText.OnValueChanged ((evt) => onChange_RepoUrl(evt.newValue)); #endif #if UNITY_2019_3_OR_NEWER - subDirText.RegisterValueChangedCallback ((evt) => onChange_RepoUrl (repoUrlText.value)); + subDirText.RegisterValueChangedCallback((evt) => onChange_RepoUrl(repoUrlText.value)); UIUtils.SetElementDisplay(root.Q("subDirContainer"), true); #else UIUtils.SetElementDisplay(root.Q("subDirContainer"), false); @@ -225,4 +226,4 @@ public static string GetRepoUrl(string url, string path) } } } -#endif // [ASMDEFEX] DO NOT REMOVE THIS LINE MANUALLY. \ No newline at end of file +#endif // [ASMDEFEX] DO NOT REMOVE THIS LINE MANUALLY. diff --git a/Editor/Coffee.UpmGitExtension/UI/PackageDetailsExtension.cs b/Editor/Coffee.UpmGitExtension/UI/PackageDetailsExtension.cs index ac8d59e..0be60df 100644 --- a/Editor/Coffee.UpmGitExtension/UI/PackageDetailsExtension.cs +++ b/Editor/Coffee.UpmGitExtension/UI/PackageDetailsExtension.cs @@ -34,7 +34,7 @@ public void Setup(VisualElement root) var hostButton = packageDetails.Q