From 3b7c19fa14c4b08dedfd00df7cb8d9aad41c8355 Mon Sep 17 00:00:00 2001 From: agracio Date: Thu, 6 Jun 2024 19:21:05 +0100 Subject: [PATCH] updating build tools --- tools/build.bat | 25 +++++++++++++++++++++---- tools/download_double.js | 20 ++++++++++---------- tools/test.js | 2 +- 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/tools/build.bat b/tools/build.bat index 154fb0b1..b1c6fd6c 100644 --- a/tools/build.bat +++ b/tools/build.bat @@ -24,10 +24,16 @@ if "%1" neq "" ( shift goto :harvestVersions ) -if "%VERSIONS%" equ "" set VERSIONS=0.10.0 +if "%VERSIONS%" equ "" set VERSIONS=20.14.0 pushd %SELF%\.. -for %%V in (%VERSIONS%) do call :build ia32 x86 %%V -for %%V in (%VERSIONS%) do call :build x64 x64 %%V + +if "%PROCESSOR_ARCHITECTURE%" == "ARM64" ( + for %%V in (%VERSIONS%) do call :build arm64 arm64 %%V +) else ( + for %%V in (%VERSIONS%) do call :build ia32 x86 %%V + for %%V in (%VERSIONS%) do call :build x64 x64 %%V + +) popd exit /b 0 @@ -35,6 +41,7 @@ exit /b 0 :build set DESTDIR=%DESTDIRROOT%\%1\%3 + if exist "%DESTDIR%\node.exe" goto gyp if not exist "%DESTDIR%\NUL" mkdir "%DESTDIR%" echo Downloading node.exe %2 %3... @@ -56,12 +63,22 @@ if not exist "%GYP%" ( exit /b -1 ) -"%NODEEXE%" "%GYP%" configure build --msvs_version=2019 -%FLAVOR% +"%NODEEXE%" "%GYP%" configure --msvs_version=2022 -%FLAVOR% if %ERRORLEVEL% neq 0 ( echo Error building edge.node %FLAVOR% for node.js %2 v%3 exit /b -1 ) +REM Conflict when building arm64 binaries +if "%PROCESSOR_ARCHITECTURE%" == "ARM64" ( + FOR %%F IN (build\*.vcxproj) DO ( + echo Patch /fp:strict in %%F + powershell -Command "(Get-Content -Raw %%F) -replace 'Strict', '' | Out-File -Encoding Utf8 %%F" + ) +) + +"%NODEEXE%" "%GYP%" build + echo %DESTDIR% copy /y .\build\%FLAVOR%\edge_*.node "%DESTDIR%" if %ERRORLEVEL% neq 0 ( diff --git a/tools/download_double.js b/tools/download_double.js index 030877a1..41ef02f5 100644 --- a/tools/download_double.js +++ b/tools/download_double.js @@ -1,14 +1,14 @@ var {http} = require('follow-redirects'); - console.log('Trying download from', process.argv[2]); - http.get(process.argv[2], function (res) { - console.log('HTTP', res.statusCode); - if (res.statusCode !== 200) { - throw new Error(`Unable to download ${process.argv[2]}`); - } - - var stream = require('fs').createWriteStream(process.argv[3]); - res.pipe(stream); - }); +console.log('Trying download from', process.argv[2]); +http.get(process.argv[2], function (res) { + console.log('HTTP', res.statusCode); + if (res.statusCode !== 200) { + throw new Error(`Unable to download ${process.argv[2]}`); + } + + var stream = require('fs').createWriteStream(process.argv[3]); + res.pipe(stream); +}); diff --git a/tools/test.js b/tools/test.js index 05013379..9432202a 100644 --- a/tools/test.js +++ b/tools/test.js @@ -25,7 +25,7 @@ if (!process.env.EDGE_USE_CORECLR) { buildParameters = buildParameters.concat(['-sdk:4.5']); } - var compiler = runner === 'circleci' || runner === 'CI' ? 'C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\csc.exe' : 'csc' + var compiler = 'C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\csc.exe' run(process.platform === 'win32' ? compiler : 'mcs', buildParameters, runOnSuccess); }