diff --git a/ReleaseBuilder/Build/Command.GitPush.cs b/ReleaseBuilder/Build/Command.GitPush.cs index 3ba8e30b8..432c3bced 100644 --- a/ReleaseBuilder/Build/Command.GitPush.cs +++ b/ReleaseBuilder/Build/Command.GitPush.cs @@ -40,7 +40,7 @@ public static partial class Command }, workingDirectory: baseDir); // Then push the release - await ProcessHelper.Execute(new[] { "git", "push" }, workingDirectory: baseDir); + await ProcessHelper.Execute(new[] { "git", "push", "-u", "origin", "head" }, workingDirectory: baseDir); await ProcessHelper.Execute(new[] { "git", "push", "--tags" }, workingDirectory: baseDir); } } diff --git a/ReleaseBuilder/Build/Command.cs b/ReleaseBuilder/Build/Command.cs index 627dcd7d5..d8b2e0626 100644 --- a/ReleaseBuilder/Build/Command.cs +++ b/ReleaseBuilder/Build/Command.cs @@ -472,6 +472,9 @@ public static partial class Command throw new Exception($"The following packages cannot be built without Docker: {string.Join(", ", unsupportedBuilds.Select(x => x.PackageTargetString))}"); } + // Prevent the system from going to sleep during the build + using var _ = new KeepAliveAssertion(); + if (rtcfg.UseGithubUpload && !input.GitStashPush) { Console.WriteLine("Github upload requested, but pushing the tag is disabled"); diff --git a/ReleaseBuilder/KeepAliveAssertion.cs b/ReleaseBuilder/KeepAliveAssertion.cs new file mode 100644 index 000000000..3bda14c09 --- /dev/null +++ b/ReleaseBuilder/KeepAliveAssertion.cs @@ -0,0 +1,78 @@ +using System.Diagnostics; +using System.Runtime.InteropServices; +using System.Runtime.Versioning; + +namespace ReleaseBuilder; + +/// +/// A class that prevents the system from sleeping during build +/// +public class KeepAliveAssertion : IDisposable +{ + /// + /// The previous state of the system, on Windows + /// + private NativeMethods.EXECUTION_STATE _previousState; + /// + /// The process that keeps the system awake, on Linux and MacOS + /// + private Process? _keepAliveProcess; + + /// + /// Creates a new instance of the class + /// + public KeepAliveAssertion() + { + if (OperatingSystem.IsWindows()) + { + _previousState = NativeMethods.SetThreadExecutionState(NativeMethods.EXECUTION_STATE.ES_CONTINUOUS | NativeMethods.EXECUTION_STATE.ES_SYSTEM_REQUIRED | NativeMethods.EXECUTION_STATE.ES_AWAYMODE_REQUIRED); + } + else if (OperatingSystem.IsLinux()) + { + _keepAliveProcess = Process.Start("xset", "s off -dpms"); + } + else if (OperatingSystem.IsMacOS()) + { + // Keep the display awake until this process exits + var selfProcessId = Process.GetCurrentProcess().Id; + _keepAliveProcess = Process.Start("caffeinate", ["-d", "-w", selfProcessId.ToString()]); + } + } + + /// + /// A class that contains Windows native methods + /// + [SupportedOSPlatform("windows")] + private class NativeMethods + { + [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] + public static extern EXECUTION_STATE SetThreadExecutionState(EXECUTION_STATE esFlags); // returns the previous state + + [Flags] + public enum EXECUTION_STATE : uint + { + ES_AWAYMODE_REQUIRED = 0x00000040, + ES_CONTINUOUS = 0x80000000, + ES_SYSTEM_REQUIRED = 0x00000001 + } + } + + /// + public void Dispose() + { + if (OperatingSystem.IsWindows()) + { + NativeMethods.SetThreadExecutionState(_previousState); + } + else if (OperatingSystem.IsLinux()) + { + _keepAliveProcess?.Kill(); + _keepAliveProcess?.Dispose(); + } + else if (OperatingSystem.IsMacOS()) + { + _keepAliveProcess?.Kill(); + _keepAliveProcess?.Dispose(); + } + } +} diff --git a/ReleaseBuilder/build_version.txt b/ReleaseBuilder/build_version.txt index bbe27ff9e..6dd8adf6a 100644 --- a/ReleaseBuilder/build_version.txt +++ b/ReleaseBuilder/build_version.txt @@ -1 +1 @@ -2.1.0.101 \ No newline at end of file +2.1.0.102 \ No newline at end of file diff --git a/changelog.txt b/changelog.txt index 9a572bf18..fd54c4fc9 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,20 @@ +2024-12-12 - 2.1.0.102_canary_2024-12-12 +========== +This release is a canary release intended to be used for testing. + +**Note that this build is using .NET8, unlike the 2.0.8.1 build** + +**Note that this build has a redesigned restore flow** +Should issues arise, the previous restore engine can be enabled with `--restore-legacy=true`. + +## Detailed list of changes: +- Upgraded FluentFTP to fix a crash on socket timeout +- Removed named channels to fix a rare exception +- Rewrote the restore process to be multithreaded and target optimal disk I/O write performance +- Added missing documentation to the iDrive e2 backend +- Added activity timeout on backend transfers +- Added support for generating a "forever token" + 2024-12-06 - 2.1.0.101_canary_2024-12-06 ========== This release is a canary release intended to be used for testing.