From 83c85328dd491a4268b41f1aae9de279e1fe7be5 Mon Sep 17 00:00:00 2001 From: zdickinsonfugro <78182603+zdickinsonfugro@users.noreply.github.com> Date: Fri, 11 Oct 2024 00:02:39 +1000 Subject: [PATCH] Removed all instances of interpolated strings from editor scripts so we don't get compiler errors on old versions of .NET in Unity 2018 (#633) Co-authored-by: Zac Co-authored-by: Andrew Kahr <22359829+AndrewKahr@users.noreply.github.com> Co-authored-by: David Finol --- .../Editor/UnityBuilderAction/Builder.cs | 2 +- .../Input/AndroidSettings.cs | 6 +++--- .../Input/ArgumentsParser.cs | 18 ++++++++--------- .../Reporting/CompileListener.cs | 2 +- .../Reporting/StdOutReporter.cs | 20 +++++++++---------- .../UnityBuilderAction/Versioning/Git.cs | 4 ++-- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/dist/default-build-script/Assets/Editor/UnityBuilderAction/Builder.cs b/dist/default-build-script/Assets/Editor/UnityBuilderAction/Builder.cs index d7cba912e..453dd1f4f 100644 --- a/dist/default-build-script/Assets/Editor/UnityBuilderAction/Builder.cs +++ b/dist/default-build-script/Assets/Editor/UnityBuilderAction/Builder.cs @@ -74,7 +74,7 @@ public static void BuildProject() } catch (Exception e) { - Debug.LogError($"Failed to run default addressables build:\n{e}"); + Debug.LogError("Failed to run default addressables build:\n" + e); } } diff --git a/dist/default-build-script/Assets/Editor/UnityBuilderAction/Input/AndroidSettings.cs b/dist/default-build-script/Assets/Editor/UnityBuilderAction/Input/AndroidSettings.cs index 2682f956a..06aad4f2f 100644 --- a/dist/default-build-script/Assets/Editor/UnityBuilderAction/Input/AndroidSettings.cs +++ b/dist/default-build-script/Assets/Editor/UnityBuilderAction/Input/AndroidSettings.cs @@ -56,17 +56,17 @@ public static void Apply(Dictionary options) case "androidStudioProject": EditorUserBuildSettings.exportAsGoogleAndroidProject = true; if (buildAppBundle != null) - buildAppBundle.SetValue(null, false); + buildAppBundle.SetValue(null, false, null); break; case "androidAppBundle": EditorUserBuildSettings.exportAsGoogleAndroidProject = false; if (buildAppBundle != null) - buildAppBundle.SetValue(null, true); + buildAppBundle.SetValue(null, true, null); break; case "androidPackage": EditorUserBuildSettings.exportAsGoogleAndroidProject = false; if (buildAppBundle != null) - buildAppBundle.SetValue(null, false); + buildAppBundle.SetValue(null, false, null); break; } } diff --git a/dist/default-build-script/Assets/Editor/UnityBuilderAction/Input/ArgumentsParser.cs b/dist/default-build-script/Assets/Editor/UnityBuilderAction/Input/ArgumentsParser.cs index 5beeb8df7..058d31b7b 100644 --- a/dist/default-build-script/Assets/Editor/UnityBuilderAction/Input/ArgumentsParser.cs +++ b/dist/default-build-script/Assets/Editor/UnityBuilderAction/Input/ArgumentsParser.cs @@ -28,7 +28,7 @@ public static Dictionary GetValidatedOptions() } if (!Enum.IsDefined(typeof(BuildTarget), buildTarget)) { - Console.WriteLine($"{buildTarget} is not a defined {nameof(BuildTarget)}"); + Console.WriteLine(buildTarget + " is not a defined " + typeof(BuildTarget).Name); EditorApplication.Exit(121); } @@ -41,10 +41,10 @@ public static Dictionary GetValidatedOptions() const string defaultCustomBuildName = "TestBuild"; string customBuildName; if (!validatedOptions.TryGetValue("customBuildName", out customBuildName)) { - Console.WriteLine($"Missing argument -customBuildName, defaulting to {defaultCustomBuildName}."); + Console.WriteLine("Missing argument -customBuildName, defaulting to" + defaultCustomBuildName); validatedOptions.Add("customBuildName", defaultCustomBuildName); } else if (customBuildName == "") { - Console.WriteLine($"Invalid argument -customBuildName, defaulting to {defaultCustomBuildName}."); + Console.WriteLine("Invalid argument -customBuildName, defaulting to" + defaultCustomBuildName); validatedOptions.Add("customBuildName", defaultCustomBuildName); } @@ -57,11 +57,11 @@ static void ParseCommandLineArguments(out Dictionary providedArg string[] args = Environment.GetCommandLineArgs(); Console.WriteLine( - $"{EOL}" + - $"###########################{EOL}" + - $"# Parsing settings #{EOL}" + - $"###########################{EOL}" + - $"{EOL}" + EOL + + "###########################" + EOL + + "# Parsing settings #" + EOL + + "###########################" + EOL + + EOL ); // Extract flags with optional values @@ -78,7 +78,7 @@ static void ParseCommandLineArguments(out Dictionary providedArg string displayValue = secret ? "*HIDDEN*" : "\"" + value + "\""; // Assign - Console.WriteLine($"Found flag \"{flag}\" with value {displayValue}."); + Console.WriteLine("Found flag \"" + flag + "\" with value " + displayValue); providedArguments.Add(flag, value); } } diff --git a/dist/default-build-script/Assets/Editor/UnityBuilderAction/Reporting/CompileListener.cs b/dist/default-build-script/Assets/Editor/UnityBuilderAction/Reporting/CompileListener.cs index 4dc14570d..d5e8744d3 100644 --- a/dist/default-build-script/Assets/Editor/UnityBuilderAction/Reporting/CompileListener.cs +++ b/dist/default-build-script/Assets/Editor/UnityBuilderAction/Reporting/CompileListener.cs @@ -30,7 +30,7 @@ private static void Application_logMessageReceived(string condition, string stac prefix = "error"; break; } - Console.WriteLine($"{Environment.NewLine}::{prefix} ::{condition}{Environment.NewLine}{stackTrace}"); + Console.WriteLine(Environment.NewLine + "::" + prefix + "::" + condition + Environment.NewLine + stackTrace); } } } diff --git a/dist/default-build-script/Assets/Editor/UnityBuilderAction/Reporting/StdOutReporter.cs b/dist/default-build-script/Assets/Editor/UnityBuilderAction/Reporting/StdOutReporter.cs index 027e02f56..18f5c6813 100644 --- a/dist/default-build-script/Assets/Editor/UnityBuilderAction/Reporting/StdOutReporter.cs +++ b/dist/default-build-script/Assets/Editor/UnityBuilderAction/Reporting/StdOutReporter.cs @@ -11,16 +11,16 @@ public class StdOutReporter public static void ReportSummary(BuildSummary summary) { Console.WriteLine( - $"{EOL}" + - $"###########################{EOL}" + - $"# Build results #{EOL}" + - $"###########################{EOL}" + - $"{EOL}" + - $"Duration: {summary.totalTime.ToString()}{EOL}" + - $"Warnings: {summary.totalWarnings.ToString()}{EOL}" + - $"Errors: {summary.totalErrors.ToString()}{EOL}" + - $"Size: {summary.totalSize.ToString()} bytes{EOL}" + - $"{EOL}" + EOL + + "###########################" + EOL + + "# Build results #" + EOL + + "###########################" + EOL + + EOL + + "Duration: " + summary.totalTime.ToString() + EOL + + "Warnings: " + summary.totalWarnings.ToString() + EOL + + "Errors: " + summary.totalErrors.ToString() + EOL + + "Size: " + summary.totalSize.ToString() + " bytes" + EOL + + EOL ); } diff --git a/dist/default-build-script/Assets/Editor/UnityBuilderAction/Versioning/Git.cs b/dist/default-build-script/Assets/Editor/UnityBuilderAction/Versioning/Git.cs index dbf3c4fa1..98c24105a 100644 --- a/dist/default-build-script/Assets/Editor/UnityBuilderAction/Versioning/Git.cs +++ b/dist/default-build-script/Assets/Editor/UnityBuilderAction/Versioning/Git.cs @@ -21,11 +21,11 @@ public static string GenerateSemanticCommitVersion() version = GetSemanticCommitVersion(); Console.WriteLine("Repository has a valid version tag."); } else { - version = $"0.0.{GetTotalNumberOfCommits()}"; + version = "0.0." + GetTotalNumberOfCommits(); Console.WriteLine("Repository does not have tags to base the version on."); } - Console.WriteLine($"Version is {version}"); + Console.WriteLine("Version is " + version); return version; }