maint: hotreload updated to 1.13.7
This commit is contained in:
@@ -5,6 +5,7 @@ using System.Text;
|
||||
using SingularityGroup.HotReload.Newtonsoft.Json;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using SingularityGroup.HotReload.Localization;
|
||||
|
||||
namespace SingularityGroup.HotReload.Editor.Cli {
|
||||
internal static class CliUtils {
|
||||
@@ -66,8 +67,14 @@ namespace SingularityGroup.HotReload.Editor.Cli {
|
||||
|
||||
public static string GetExecutableTargetDir() {
|
||||
if (PackageConst.IsAssetStoreBuild) {
|
||||
if (PackageConst.DefaultLocaleField == Locale.SimplifiedChinese) {
|
||||
return Path.Combine(GetAppDataPath(), "asset-store", "zh", $"executables_{PackageConst.ServerVersion.Replace('.', '-')}");
|
||||
}
|
||||
return Path.Combine(GetAppDataPath(), "asset-store", $"executables_{PackageConst.ServerVersion.Replace('.', '-')}");
|
||||
}
|
||||
if (PackageConst.DefaultLocaleField == Locale.SimplifiedChinese) {
|
||||
return Path.Combine(GetAppDataPath(), "zh", $"executables_{PackageConst.ServerVersion.Replace('.', '-')}");
|
||||
}
|
||||
return Path.Combine(GetAppDataPath(), $"executables_{PackageConst.ServerVersion.Replace('.', '-')}");
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,11 @@ using System.Net.NetworkInformation;
|
||||
using System.Net.Sockets;
|
||||
#endif
|
||||
using System.Threading.Tasks;
|
||||
using SingularityGroup.HotReload.Editor.Localization;
|
||||
using SingularityGroup.HotReload.Localization;
|
||||
using SingularityGroup.HotReload.Newtonsoft.Json;
|
||||
using UnityEditor;
|
||||
using Translations = SingularityGroup.HotReload.Editor.Localization.Translations;
|
||||
|
||||
namespace SingularityGroup.HotReload.Editor.Cli {
|
||||
[InitializeOnLoad]
|
||||
@@ -73,10 +76,9 @@ namespace SingularityGroup.HotReload.Editor.Cli {
|
||||
static bool TryGetStartArgs(string dataPath, bool exposeServerToNetwork, bool allAssetChanges, bool createNoWindow, bool isReleaseMode, bool detailedErrorReporting, LoginData loginData, int port, out StartArgs args) {
|
||||
string serverDir;
|
||||
if(!CliUtils.TryFindServerDir(out serverDir)) {
|
||||
Log.Warning($"Failed to start the Hot Reload Server. " +
|
||||
$"Unable to locate the 'Server' directory. " +
|
||||
$"Make sure the 'Server' directory is " +
|
||||
$"somewhere in the Assets folder inside a 'HotReload' folder or in the HotReload package");
|
||||
Log.Warning(string.Format(Translations.Errors.WarningFailedToStartServer,
|
||||
Translations.Utility.UnableToLocateServer +
|
||||
Translations.Utility.UnableToLocateServerDetail));
|
||||
args = null;
|
||||
return false;
|
||||
}
|
||||
@@ -100,11 +102,11 @@ namespace SingularityGroup.HotReload.Editor.Cli {
|
||||
var info = new DirectoryInfo(Path.GetFullPath("."));
|
||||
slnPath = Path.Combine(Path.GetFullPath("."), info.Name + ".sln");
|
||||
if (!File.Exists(slnPath)) {
|
||||
Log.Warning($"Failed to start the Hot Reload Server. Cannot find solution file. Please disable \"useBuiltInProjectGeneration\" in settings to enable custom project generation.");
|
||||
Log.Warning(string.Format(Translations.Errors.WarningFailedToStartServer, Translations.Utility.CannotFindSolutionFile));
|
||||
args = null;
|
||||
return false;
|
||||
}
|
||||
Log.Info("Using default project generation. If you encounter any problem with Unity's default project generation consider disabling it to use custom project generation.");
|
||||
Log.Info(Translations.Errors.InfoDefaultProjectGeneration);
|
||||
try {
|
||||
Directory.Delete(ProjectGeneration.ProjectGeneration.tempDir, true);
|
||||
} catch(Exception ex) {
|
||||
@@ -115,7 +117,7 @@ namespace SingularityGroup.HotReload.Editor.Cli {
|
||||
}
|
||||
|
||||
if (!File.Exists(slnPath)) {
|
||||
Log.Warning($"No .sln file found. Open any c# file to generate it so Hot Reload can work properly");
|
||||
Log.Warning(Translations.Errors.WarningNoSlnFileFound);
|
||||
}
|
||||
|
||||
var searchAssemblies = string.Join(";", CodePatcher.I.GetAssemblySearchPaths());
|
||||
@@ -207,10 +209,10 @@ namespace SingularityGroup.HotReload.Editor.Cli {
|
||||
PrepareBuildInfo(buildInfo);
|
||||
} catch (Exception e) {
|
||||
if (!didLogWarning) {
|
||||
Log.Warning($"Preparing build info failed! On-device functionality might not work. Exception: {e}");
|
||||
Log.Warning(string.Format(Translations.Errors.WarningPreparingBuildInfoFailed, e));
|
||||
didLogWarning = true;
|
||||
} else {
|
||||
Log.Debug($"Preparing build info failed! On-device functionality might not work. Exception: {e}");
|
||||
Log.Debug(string.Format(Translations.Utility.PreparingBuildInfoFailed, e));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using SingularityGroup.HotReload.Editor.Localization;
|
||||
using Debug = UnityEngine.Debug;
|
||||
|
||||
namespace SingularityGroup.HotReload.Editor.Cli {
|
||||
@@ -45,7 +46,7 @@ namespace SingularityGroup.HotReload.Editor.Cli {
|
||||
if (File.Exists(cliargsfile)) {
|
||||
File.Delete(cliargsfile);
|
||||
}
|
||||
throw new Exception("Could not start code patcher process.");
|
||||
throw new Exception(Translations.Errors.ExceptionCouldNotStartCodePatcher);
|
||||
}
|
||||
codePatcherProc.BeginErrorReadLine();
|
||||
codePatcherProc.BeginOutputReadLine();
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using SingularityGroup.HotReload.Editor.Localization;
|
||||
using SingularityGroup.HotReload.Editor.Semver;
|
||||
using Debug = UnityEngine.Debug;
|
||||
|
||||
@@ -38,7 +39,7 @@ namespace SingularityGroup.HotReload.Editor.Cli {
|
||||
return macosVersion;
|
||||
}
|
||||
// should never happen
|
||||
Log.Warning("Failed to detect MacOS version, if Hot Reload fails to start, please contact support.");
|
||||
Log.Warning(Translations.Errors.WarningMacOSVersionDetectionFailed);
|
||||
return SemVersion.None;
|
||||
});
|
||||
|
||||
@@ -84,6 +85,10 @@ namespace SingularityGroup.HotReload.Editor.Cli {
|
||||
Arguments = args.cliArguments,
|
||||
UseShellExecute = false,
|
||||
});
|
||||
|
||||
var pidFilePath = CliUtils.GetPidFilePath(args.hotreloadTempDir);
|
||||
// ReSharper disable once PossibleNullReferenceException
|
||||
File.WriteAllText(pidFilePath, process.Id.ToString());
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
@@ -114,14 +119,14 @@ namespace SingularityGroup.HotReload.Editor.Cli {
|
||||
|
||||
if (process.WaitForExit(1000)) {
|
||||
if (process.ExitCode != 0) {
|
||||
Log.Warning("Failed to the run the start server command. ExitCode={0}\nFilepath: {1}", process.ExitCode, executableScriptPath);
|
||||
Log.Warning(Translations.Errors.WarningFailedToRunServerCommand, process.ExitCode, executableScriptPath);
|
||||
}
|
||||
}
|
||||
else {
|
||||
process.EnableRaisingEvents = true;
|
||||
process.Exited += (_, __) => {
|
||||
if (process.ExitCode != 0) {
|
||||
Log.Warning("Failed to the run the start server command. ExitCode={0}\nFilepath: {1}", process.ExitCode, executableScriptPath);
|
||||
Log.Warning(Translations.Errors.WarningFailedToRunServerCommand, process.ExitCode, executableScriptPath);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -141,11 +146,11 @@ namespace SingularityGroup.HotReload.Editor.Cli {
|
||||
static void UnzipMacOsPackage(string zipPath, string unzippedFolderPath) {
|
||||
//Log.Info("UnzipMacOsPackage called with {0}\n workingDirectory = {1}", zipPath, unzippedFolderPath);
|
||||
if (!zipPath.EndsWith(".zip")) {
|
||||
throw new ArgumentException($"Expected to end with .zip, but it was: {zipPath}", nameof(zipPath));
|
||||
throw new ArgumentException(string.Format(Translations.Errors.ExceptionExpectedZipFile, zipPath), nameof(zipPath));
|
||||
}
|
||||
|
||||
if (!File.Exists(zipPath)) {
|
||||
throw new ArgumentException($"zip file not found {zipPath}", nameof(zipPath));
|
||||
throw new ArgumentException(string.Format(Translations.Errors.ExceptionZipFileNotFound, zipPath), nameof(zipPath));
|
||||
}
|
||||
var processStartInfo = new ProcessStartInfo {
|
||||
FileName = "unzip",
|
||||
@@ -158,7 +163,7 @@ namespace SingularityGroup.HotReload.Editor.Cli {
|
||||
Process process = Process.Start(processStartInfo);
|
||||
process.WaitForExit();
|
||||
if (process.ExitCode != 0) {
|
||||
throw new Exception($"unzip failed with ExitCode {process.ExitCode}");
|
||||
throw new Exception(string.Format(Translations.Errors.ExceptionUnzipFailed, process.ExitCode));
|
||||
}
|
||||
//Log.Info($"did unzip to {unzippedFolderPath}");
|
||||
// Move the .app folder to unzippedFolderPath
|
||||
@@ -181,7 +186,7 @@ namespace SingularityGroup.HotReload.Editor.Cli {
|
||||
}
|
||||
|
||||
if (!done) {
|
||||
throw new Exception("Failed to find .app directory and move it to " + destDir);
|
||||
throw new Exception(string.Format(Translations.Errors.ExceptionFailedToFindAppDirectory, destDir));
|
||||
}
|
||||
//Log.Info($"did unzip to {unzippedFolderPath}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user