From cb7c2a5507c7a7fc2fa50022380623907db07c05 Mon Sep 17 00:00:00 2001 From: beyondkmp Date: Sat, 15 Mar 2025 11:17:04 +0800 Subject: [PATCH 1/5] Skip generating _ExecutionStub.exe if it already exists --- src/Update/Program.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Update/Program.cs b/src/Update/Program.cs index 7bfc2b00f..91a002194 100644 --- a/src/Update/Program.cs +++ b/src/Update/Program.cs @@ -632,12 +632,16 @@ bool isPEFileSigned(string path) async Task createExecutableStubForExe(string fullName) { - var exe = Utility.FindHelperExecutable(@"StubExecutable.exe"); - var target = Path.Combine( Path.GetDirectoryName(fullName), Path.GetFileNameWithoutExtension(fullName) + "_ExecutionStub.exe"); + // Return early if the target already exists + if (File.Exists(target)) { + return; + } + + var exe = Utility.FindHelperExecutable(@"StubExecutable.exe"); await Utility.CopyToAsync(exe, target); await Utility.InvokeProcessAsync( From 0c749444389010ecd86a89f09d9a25adb9fdae28 Mon Sep 17 00:00:00 2001 From: beyondkmp Date: Sat, 15 Mar 2025 17:12:04 +0800 Subject: [PATCH 2/5] update clrf --- src/build_official.cmd | 172 ++++++++++++++++++++--------------------- 1 file changed, 86 insertions(+), 86 deletions(-) diff --git a/src/build_official.cmd b/src/build_official.cmd index 22211a419..6ad87d7e4 100644 --- a/src/build_official.cmd +++ b/src/build_official.cmd @@ -1,86 +1,86 @@ -@echo off - -setlocal -pushd %~dp0 - -:parse_args -if not "%1"=="" shift & goto parse_args - -:: Init - -if "%VCToolsVersion%"=="" call :StartDeveloperCommandPrompt || exit /b - - -:: Clean - -rd /s /q ..\build ..\packages 2> nul - - -:: Build - -nuget restore ..\Squirrel.sln || exit /b - -msbuild -Restore ..\Squirrel.sln -p:Configuration=Release -v:m -m -nr:false -bl:..\build\logs\build.binlog || exit /b - - -:: Pack .nupkg - -nuget pack Squirrel.nuspec -OutputDirectory ..\build\artifacts || exit /b - - -:: Layout electron-winstaller -:: -:: The NPM package electron-winstaller allows developers to -:: build Windows installers for Electron apps using Squirrel -:: (https://github.com/electron/windows-installer) -:: -:: The following copies the required files into a single folder -:: which can then be copied to the electron-winstaller/vendor folder -:: (either manually or in an automated way). - -md ..\build\artifacts\electron-winstaller\vendor - -copy ..\build\Release\net45\Update.exe ..\build\artifacts\electron-winstaller\vendor\Squirrel.exe || exit /b -copy ..\build\Release\net45\update.com ..\build\artifacts\electron-winstaller\vendor\Squirrel.com || exit /b -copy ..\build\Release\net45\Update.pdb ..\build\artifacts\electron-winstaller\vendor\Squirrel.pdb || exit /b -copy ..\build\Release\Win32\Setup.exe ..\build\artifacts\electron-winstaller\vendor || exit /b -copy ..\build\Release\Win32\Setup.pdb ..\build\artifacts\electron-winstaller\vendor || exit /b -copy ..\build\Release\net45\Update-Mono.exe ..\build\artifacts\electron-winstaller\vendor\Squirrel-Mono.exe || exit /b -copy ..\build\Release\net45\Update-Mono.pdb ..\build\artifacts\electron-winstaller\vendor\Squirrel-Mono.pdb || exit /b -copy ..\build\Release\Win32\StubExecutable.exe ..\build\artifacts\electron-winstaller\vendor || exit /b -copy ..\build\Release\net45\SyncReleases.exe ..\build\artifacts\electron-winstaller\vendor || exit /b -copy ..\build\Release\net45\SyncReleases.pdb ..\build\artifacts\electron-winstaller\vendor || exit /b -copy ..\build\Release\Win32\WriteZipToSetup.exe ..\build\artifacts\electron-winstaller\vendor || exit /b -copy ..\build\Release\Win32\WriteZipToSetup.pdb ..\build\artifacts\electron-winstaller\vendor || exit /b - - -goto LExit - -:StartDeveloperCommandPrompt -if not "%SquirrelSkipVsDevCmd%"=="" ( - echo Skipping initializing developer command prompt - exit /b -) - -echo Initializing developer command prompt - -if not exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" ( - "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" - exit /b 2 -) - -for /f "usebackq delims=" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version [16.0^,18.0^) -property installationPath`) do ( - if exist "%%i\Common7\Tools\vsdevcmd.bat" ( - call "%%i\Common7\Tools\vsdevcmd.bat" -no_logo - exit /b - ) - echo developer command prompt not found in %%i -) - -echo No versions of developer command prompt found -exit /b 2 - -:LExit - -popd -endlocal +@echo off + +setlocal +pushd %~dp0 + +:parse_args +if not "%1"=="" shift & goto parse_args + +:: Init + +if "%VCToolsVersion%"=="" call :StartDeveloperCommandPrompt || exit /b + + +:: Clean + +rd /s /q ..\build ..\packages 2> nul + + +:: Build + +nuget restore ..\Squirrel.sln || exit /b + +msbuild -Restore ..\Squirrel.sln -p:Configuration=Release -v:m -m -nr:false -bl:..\build\logs\build.binlog || exit /b + + +:: Pack .nupkg + +nuget pack Squirrel.nuspec -OutputDirectory ..\build\artifacts || exit /b + + +:: Layout electron-winstaller +:: +:: The NPM package electron-winstaller allows developers to +:: build Windows installers for Electron apps using Squirrel +:: (https://github.com/electron/windows-installer) +:: +:: The following copies the required files into a single folder +:: which can then be copied to the electron-winstaller/vendor folder +:: (either manually or in an automated way). + +md ..\build\artifacts\electron-winstaller\vendor + +copy ..\build\Release\net45\Update.exe ..\build\artifacts\electron-winstaller\vendor\Squirrel.exe || exit /b +copy ..\build\Release\net45\update.com ..\build\artifacts\electron-winstaller\vendor\Squirrel.com || exit /b +copy ..\build\Release\net45\Update.pdb ..\build\artifacts\electron-winstaller\vendor\Squirrel.pdb || exit /b +copy ..\build\Release\Win32\Setup.exe ..\build\artifacts\electron-winstaller\vendor || exit /b +copy ..\build\Release\Win32\Setup.pdb ..\build\artifacts\electron-winstaller\vendor || exit /b +copy ..\build\Release\net45\Update-Mono.exe ..\build\artifacts\electron-winstaller\vendor\Squirrel-Mono.exe || exit /b +copy ..\build\Release\net45\Update-Mono.pdb ..\build\artifacts\electron-winstaller\vendor\Squirrel-Mono.pdb || exit /b +copy ..\build\Release\Win32\StubExecutable.exe ..\build\artifacts\electron-winstaller\vendor || exit /b +copy ..\build\Release\net45\SyncReleases.exe ..\build\artifacts\electron-winstaller\vendor || exit /b +copy ..\build\Release\net45\SyncReleases.pdb ..\build\artifacts\electron-winstaller\vendor || exit /b +copy ..\build\Release\Win32\WriteZipToSetup.exe ..\build\artifacts\electron-winstaller\vendor || exit /b +copy ..\build\Release\Win32\WriteZipToSetup.pdb ..\build\artifacts\electron-winstaller\vendor || exit /b + + +goto LExit + +:StartDeveloperCommandPrompt +if not "%SquirrelSkipVsDevCmd%"=="" ( + echo Skipping initializing developer command prompt + exit /b +) + +echo Initializing developer command prompt + +if not exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" ( + "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" + exit /b 2 +) + +for /f "usebackq delims=" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version [16.0^,18.0^) -property installationPath`) do ( + if exist "%%i\Common7\Tools\vsdevcmd.bat" ( + call "%%i\Common7\Tools\vsdevcmd.bat" -no_logo + exit /b + ) + echo developer command prompt not found in %%i +) + +echo No versions of developer command prompt found +exit /b 2 + +:LExit + +popd +endlocal From 1f35efeb4f575a8326704788c7c2f6873d063b7f Mon Sep 17 00:00:00 2001 From: beyondkmp Date: Sat, 15 Mar 2025 17:14:07 +0800 Subject: [PATCH 3/5] update actions/upload-artifact to v4 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 94033e80c..a1c15e624 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,7 +36,7 @@ jobs: run: ./test/test_official.cmd - name: Save build - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: artifacts path: build/artifacts/ From cc2d4361bb197742c983708538025eeed9b1e58e Mon Sep 17 00:00:00 2001 From: beyondkmp Date: Sat, 15 Mar 2025 17:54:07 +0800 Subject: [PATCH 4/5] exclude _ExecutionStub.exe self --- src/Update/Program.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Update/Program.cs b/src/Update/Program.cs index 91a002194..9d0d9d1ba 100644 --- a/src/Update/Program.cs +++ b/src/Update/Program.cs @@ -632,6 +632,10 @@ bool isPEFileSigned(string path) async Task createExecutableStubForExe(string fullName) { + if(fullName.EndsWith("_ExecutionStub.exe")) { + return; + } + var target = Path.Combine( Path.GetDirectoryName(fullName), Path.GetFileNameWithoutExtension(fullName) + "_ExecutionStub.exe"); From cbc4887979bd518f672606459756a3889d72b3cb Mon Sep 17 00:00:00 2001 From: beyondkmp Date: Tue, 18 Mar 2025 19:07:35 +0800 Subject: [PATCH 5/5] revert build_official.cmd --- src/build_official.cmd | 172 ++++++++++++++++++++--------------------- 1 file changed, 86 insertions(+), 86 deletions(-) diff --git a/src/build_official.cmd b/src/build_official.cmd index 6ad87d7e4..22211a419 100644 --- a/src/build_official.cmd +++ b/src/build_official.cmd @@ -1,86 +1,86 @@ -@echo off - -setlocal -pushd %~dp0 - -:parse_args -if not "%1"=="" shift & goto parse_args - -:: Init - -if "%VCToolsVersion%"=="" call :StartDeveloperCommandPrompt || exit /b - - -:: Clean - -rd /s /q ..\build ..\packages 2> nul - - -:: Build - -nuget restore ..\Squirrel.sln || exit /b - -msbuild -Restore ..\Squirrel.sln -p:Configuration=Release -v:m -m -nr:false -bl:..\build\logs\build.binlog || exit /b - - -:: Pack .nupkg - -nuget pack Squirrel.nuspec -OutputDirectory ..\build\artifacts || exit /b - - -:: Layout electron-winstaller -:: -:: The NPM package electron-winstaller allows developers to -:: build Windows installers for Electron apps using Squirrel -:: (https://github.com/electron/windows-installer) -:: -:: The following copies the required files into a single folder -:: which can then be copied to the electron-winstaller/vendor folder -:: (either manually or in an automated way). - -md ..\build\artifacts\electron-winstaller\vendor - -copy ..\build\Release\net45\Update.exe ..\build\artifacts\electron-winstaller\vendor\Squirrel.exe || exit /b -copy ..\build\Release\net45\update.com ..\build\artifacts\electron-winstaller\vendor\Squirrel.com || exit /b -copy ..\build\Release\net45\Update.pdb ..\build\artifacts\electron-winstaller\vendor\Squirrel.pdb || exit /b -copy ..\build\Release\Win32\Setup.exe ..\build\artifacts\electron-winstaller\vendor || exit /b -copy ..\build\Release\Win32\Setup.pdb ..\build\artifacts\electron-winstaller\vendor || exit /b -copy ..\build\Release\net45\Update-Mono.exe ..\build\artifacts\electron-winstaller\vendor\Squirrel-Mono.exe || exit /b -copy ..\build\Release\net45\Update-Mono.pdb ..\build\artifacts\electron-winstaller\vendor\Squirrel-Mono.pdb || exit /b -copy ..\build\Release\Win32\StubExecutable.exe ..\build\artifacts\electron-winstaller\vendor || exit /b -copy ..\build\Release\net45\SyncReleases.exe ..\build\artifacts\electron-winstaller\vendor || exit /b -copy ..\build\Release\net45\SyncReleases.pdb ..\build\artifacts\electron-winstaller\vendor || exit /b -copy ..\build\Release\Win32\WriteZipToSetup.exe ..\build\artifacts\electron-winstaller\vendor || exit /b -copy ..\build\Release\Win32\WriteZipToSetup.pdb ..\build\artifacts\electron-winstaller\vendor || exit /b - - -goto LExit - -:StartDeveloperCommandPrompt -if not "%SquirrelSkipVsDevCmd%"=="" ( - echo Skipping initializing developer command prompt - exit /b -) - -echo Initializing developer command prompt - -if not exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" ( - "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" - exit /b 2 -) - -for /f "usebackq delims=" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version [16.0^,18.0^) -property installationPath`) do ( - if exist "%%i\Common7\Tools\vsdevcmd.bat" ( - call "%%i\Common7\Tools\vsdevcmd.bat" -no_logo - exit /b - ) - echo developer command prompt not found in %%i -) - -echo No versions of developer command prompt found -exit /b 2 - -:LExit - -popd -endlocal +@echo off + +setlocal +pushd %~dp0 + +:parse_args +if not "%1"=="" shift & goto parse_args + +:: Init + +if "%VCToolsVersion%"=="" call :StartDeveloperCommandPrompt || exit /b + + +:: Clean + +rd /s /q ..\build ..\packages 2> nul + + +:: Build + +nuget restore ..\Squirrel.sln || exit /b + +msbuild -Restore ..\Squirrel.sln -p:Configuration=Release -v:m -m -nr:false -bl:..\build\logs\build.binlog || exit /b + + +:: Pack .nupkg + +nuget pack Squirrel.nuspec -OutputDirectory ..\build\artifacts || exit /b + + +:: Layout electron-winstaller +:: +:: The NPM package electron-winstaller allows developers to +:: build Windows installers for Electron apps using Squirrel +:: (https://github.com/electron/windows-installer) +:: +:: The following copies the required files into a single folder +:: which can then be copied to the electron-winstaller/vendor folder +:: (either manually or in an automated way). + +md ..\build\artifacts\electron-winstaller\vendor + +copy ..\build\Release\net45\Update.exe ..\build\artifacts\electron-winstaller\vendor\Squirrel.exe || exit /b +copy ..\build\Release\net45\update.com ..\build\artifacts\electron-winstaller\vendor\Squirrel.com || exit /b +copy ..\build\Release\net45\Update.pdb ..\build\artifacts\electron-winstaller\vendor\Squirrel.pdb || exit /b +copy ..\build\Release\Win32\Setup.exe ..\build\artifacts\electron-winstaller\vendor || exit /b +copy ..\build\Release\Win32\Setup.pdb ..\build\artifacts\electron-winstaller\vendor || exit /b +copy ..\build\Release\net45\Update-Mono.exe ..\build\artifacts\electron-winstaller\vendor\Squirrel-Mono.exe || exit /b +copy ..\build\Release\net45\Update-Mono.pdb ..\build\artifacts\electron-winstaller\vendor\Squirrel-Mono.pdb || exit /b +copy ..\build\Release\Win32\StubExecutable.exe ..\build\artifacts\electron-winstaller\vendor || exit /b +copy ..\build\Release\net45\SyncReleases.exe ..\build\artifacts\electron-winstaller\vendor || exit /b +copy ..\build\Release\net45\SyncReleases.pdb ..\build\artifacts\electron-winstaller\vendor || exit /b +copy ..\build\Release\Win32\WriteZipToSetup.exe ..\build\artifacts\electron-winstaller\vendor || exit /b +copy ..\build\Release\Win32\WriteZipToSetup.pdb ..\build\artifacts\electron-winstaller\vendor || exit /b + + +goto LExit + +:StartDeveloperCommandPrompt +if not "%SquirrelSkipVsDevCmd%"=="" ( + echo Skipping initializing developer command prompt + exit /b +) + +echo Initializing developer command prompt + +if not exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" ( + "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" + exit /b 2 +) + +for /f "usebackq delims=" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version [16.0^,18.0^) -property installationPath`) do ( + if exist "%%i\Common7\Tools\vsdevcmd.bat" ( + call "%%i\Common7\Tools\vsdevcmd.bat" -no_logo + exit /b + ) + echo developer command prompt not found in %%i +) + +echo No versions of developer command prompt found +exit /b 2 + +:LExit + +popd +endlocal