From 21d477dc86f02abb2fbfb13f2283a92aa56205c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dino=20Fejzagi=C4=87?= Date: Mon, 6 May 2024 20:39:38 +0200 Subject: [PATCH] Resolve merge issues --- Editor/AssemblyInfo.cs | 2 +- .../RealityCollective.Utilities.Editor.asmdef | 3 +- .../AssemblyDefinitionPostprocessor.cs | 97 ------------------- .../AssemblyDefinitionPostprocessor.cs.meta | 11 --- Runtime/AssemblyInfo.cs | 2 +- Runtime/RealityCollective.Utilities.asmdef | 3 +- Tests/AssemblyInfo.cs | 2 +- package.json | 5 +- 8 files changed, 7 insertions(+), 118 deletions(-) delete mode 100644 Editor/Utilities/AssemblyDefinitionPostprocessor.cs delete mode 100644 Editor/Utilities/AssemblyDefinitionPostprocessor.cs.meta diff --git a/Editor/AssemblyInfo.cs b/Editor/AssemblyInfo.cs index 3720f1c..99fb0c1 100644 --- a/Editor/AssemblyInfo.cs +++ b/Editor/AssemblyInfo.cs @@ -3,7 +3,7 @@ using System.Reflection; -[assembly: AssemblyVersion("1.0.11")] +[assembly: AssemblyVersion("1.0.12")] [assembly: AssemblyTitle("com.realitycollective.utilities.editor")] [assembly: AssemblyCompany("Reality Collective")] [assembly: AssemblyCopyright("Copyright (c) Reality Collective. All rights reserved.")] diff --git a/Editor/RealityCollective.Utilities.Editor.asmdef b/Editor/RealityCollective.Utilities.Editor.asmdef index 288d69e..22431bc 100644 --- a/Editor/RealityCollective.Utilities.Editor.asmdef +++ b/Editor/RealityCollective.Utilities.Editor.asmdef @@ -2,8 +2,7 @@ "name": "RealityCollective.Utilities.Editor", "rootNamespace": "RealityCollective.Utilities.Editor", "references": [ - "GUID:b2d046948d6452a4b8485efc9ce0f88c", - "GUID:84651a3751eca9349aac36a66bba901b" + "GUID:b2d046948d6452a4b8485efc9ce0f88c" ], "includePlatforms": [ "Editor" diff --git a/Editor/Utilities/AssemblyDefinitionPostprocessor.cs b/Editor/Utilities/AssemblyDefinitionPostprocessor.cs deleted file mode 100644 index ce6f15f..0000000 --- a/Editor/Utilities/AssemblyDefinitionPostprocessor.cs +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) Reality Collective. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System; -using System.IO; -using System.Text.RegularExpressions; -using UnityEditor; -using UnityEngine; - -namespace RealityCollective.Editor.Utilities -{ - internal class AssemblyDefinitionPostprocessor : AssetPostprocessor - { - [Serializable] - private class PackageInfo - { - [SerializeField] - private string name; - - public string Name => name; - - [SerializeField] - private string version; - - public string Version => version; - } - - private const string VersionRegexPattern = "\\[assembly: AssemblyVersion\\(\"(.*)\"\\)\\]"; - - private void OnPreprocessAsset() - { - if (assetPath.Contains("package.json") && !Application.isBatchMode) - { - if (Path.GetFullPath(assetPath).Contains("PackageCache")) - { - return; - } - - var text = File.ReadAllText(assetPath); - var packageJson = JsonUtility.FromJson(text); - - if (!packageJson.Name.Contains("com.realitycollective") && - !packageJson.Name.Contains("com.realitytoolkit")) - { - return; - } - - var packageVersion = packageJson.Version; - - if (packageVersion.Contains("-pre.")) - { -#if UNITY_2021_1_OR_NEWER - packageVersion = packageVersion[..packageVersion.IndexOf("-", StringComparison.Ordinal)]; -#else - packageVersion = packageVersion.Substring(0, packageVersion.IndexOf("-", StringComparison.Ordinal)); -#endif - } - - var newVersion = $"[assembly: AssemblyVersion(\"{packageVersion}\")]"; - var asmdefs = Directory.GetFiles(assetPath.Replace("package.json", string.Empty), "*.asmdef", SearchOption.AllDirectories); - - foreach (var assembly in asmdefs) - { - var assemblyName = Path.GetFileNameWithoutExtension(assembly).ToLower(); - var directory = Path.GetDirectoryName(assembly); - var assemblyInfoPath = $"{directory}/AssemblyInfo.cs"; - var fileText = !File.Exists(assemblyInfoPath) - ? $@"// Copyright (c) Reality Collective. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System.Reflection; - -[assembly: AssemblyVersion(""0.0.0"")] -[assembly: AssemblyTitle(""com.{assemblyName}"")] -[assembly: AssemblyCompany(""Reality Collective"")] -[assembly: AssemblyCopyright(""Copyright (c) Reality Collective. All rights reserved."")] -" - : File.ReadAllText(assemblyInfoPath); - - if (!fileText.Contains("AssemblyVersion")) - { - fileText += "\nusing System.Reflection;\n\n[assembly: AssemblyVersion(\"0.0.0\")]\n"; - } - - if (!fileText.Contains("AssemblyTitle")) - { - fileText += $"[assembly: AssemblyTitle(\"com.{assemblyName}\")]\n"; - } - - File.WriteAllText(assemblyInfoPath, Regex.Replace(fileText, VersionRegexPattern, newVersion)); - } - - AssetDatabase.Refresh(ImportAssetOptions.Default); - } - } - } -} diff --git a/Editor/Utilities/AssemblyDefinitionPostprocessor.cs.meta b/Editor/Utilities/AssemblyDefinitionPostprocessor.cs.meta deleted file mode 100644 index fbaec1b..0000000 --- a/Editor/Utilities/AssemblyDefinitionPostprocessor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ae88737d43244bc3928db0d855c2d44a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Runtime/AssemblyInfo.cs b/Runtime/AssemblyInfo.cs index c83c8b0..61b9cc8 100644 --- a/Runtime/AssemblyInfo.cs +++ b/Runtime/AssemblyInfo.cs @@ -3,7 +3,7 @@ using System.Reflection; -[assembly: AssemblyVersion("1.0.11")] +[assembly: AssemblyVersion("1.0.12")] [assembly: AssemblyTitle("com.realitycollective.utilities")] [assembly: AssemblyCompany("Reality Collective")] [assembly: AssemblyCopyright("Copyright (c) Reality Collective. All rights reserved.")] diff --git a/Runtime/RealityCollective.Utilities.asmdef b/Runtime/RealityCollective.Utilities.asmdef index 8303b7c..4a014ca 100644 --- a/Runtime/RealityCollective.Utilities.asmdef +++ b/Runtime/RealityCollective.Utilities.asmdef @@ -2,8 +2,7 @@ "name": "RealityCollective.Utilities", "rootNamespace": "RealityCollective.Utilities", "references": [ - "GUID:478a2357cc57436488a56e564b08d223", - "GUID:84651a3751eca9349aac36a66bba901b" + "GUID:478a2357cc57436488a56e564b08d223" ], "includePlatforms": [], "excludePlatforms": [], diff --git a/Tests/AssemblyInfo.cs b/Tests/AssemblyInfo.cs index f741ab7..f865463 100644 --- a/Tests/AssemblyInfo.cs +++ b/Tests/AssemblyInfo.cs @@ -3,7 +3,7 @@ using System.Reflection; -[assembly: AssemblyVersion("1.0.11")] +[assembly: AssemblyVersion("1.0.12")] [assembly: AssemblyTitle("com.realitycollective.utilities.tests")] [assembly: AssemblyCompany("Reality Collective")] [assembly: AssemblyCopyright("Copyright (c) Reality Collective. All rights reserved.")] diff --git a/package.json b/package.json index b29aafd..688df08 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,6 @@ }, "dependencies": { "com.unity.modules.unitywebrequest": "1.0.0", - "com.unity.editorcoroutines": "1.0.0", - "com.unity.addressables": "1.18.15" + "com.unity.editorcoroutines": "1.0.0" } -} +} \ No newline at end of file