Commit cfad96f8 authored by qq_38816927's avatar qq_38816927

修改win的打包脚本

parent 403a10a0
...@@ -33,7 +33,7 @@ set PLATFORM= ...@@ -33,7 +33,7 @@ set PLATFORM=
set TARGET_ID= set TARGET_ID=
REM Parse options (supports options in any position, e.g. ohosArm64 62Q0226107024702 -m release) REM Parse options (supports options in any position, e.g. ohosArm64 62Q0226107024702 -m release)
REM NOTE: Do not use "goto" inside parenthesized IF blocks cmd.exe may fail with REM NOTE: Do not use "goto" inside parenthesized IF blocks - cmd.exe may fail with
REM "The system cannot find the batch label specified - parse" and mis-handle -b/-a. REM "The system cannot find the batch label specified - parse" and mis-handle -b/-a.
:parse :parse
if "%~1"=="" goto done_parse if "%~1"=="" goto done_parse
...@@ -83,7 +83,7 @@ if "!PLATFORM!"=="" set "PLATFORM=%DEFAULT_PLATFORM%" ...@@ -83,7 +83,7 @@ if "!PLATFORM!"=="" set "PLATFORM=%DEFAULT_PLATFORM%"
if "!TARGET_ID!"=="" set "TARGET_ID=%DEFAULT_TARGET_ID%" if "!TARGET_ID!"=="" set "TARGET_ID=%DEFAULT_TARGET_ID%"
REM Record script start time (epoch seconds for elapsed calculation) REM Record script start time (epoch seconds for elapsed calculation)
for /f %%t in ('powershell -NoProfile -Command "[int][double]::Parse((Get-Date -UFormat '%%s'))"') do set START_TIME=%%t for /f "usebackq tokens=*" %%t in (`powershell -NoProfile -Command "[DateTimeOffset]::UtcNow.ToUnixTimeSeconds()"`) do set START_TIME=%%t
echo Run environment configuration: echo Run environment configuration:
echo - Platform: %PLATFORM% echo - Platform: %PLATFORM%
...@@ -112,12 +112,15 @@ echo Checking environment configuration... ...@@ -112,12 +112,15 @@ echo Checking environment configuration...
set "MIN_VERSION=6.0.0" set "MIN_VERSION=6.0.0"
set "PRODUCT_INFO=%DEVECO_PATH%\product-info.json" set "PRODUCT_INFO=%DEVECO_PATH%\product-info.json"
REM Read version without "(expr).prop" in PowerShell: a closing ")" inside in ('...') breaks cmd parsing.
set "CURRENT_VERSION="
if exist "%PRODUCT_INFO%" ( if exist "%PRODUCT_INFO%" (
for /f "tokens=*" %%v in ('powershell -NoProfile -Command "(Get-Content '%PRODUCT_INFO%' | ConvertFrom-Json).version"') do set "CURRENT_VERSION=%%v" for /f "usebackq tokens=*" %%v in (`powershell -NoProfile -Command "Get-Content -LiteralPath '%PRODUCT_INFO%' ^| ConvertFrom-Json ^| Select-Object -ExpandProperty version"`) do set "CURRENT_VERSION=%%v"
) else ( ) else (
echo Warning: product-info.json not found, skipping version check. echo Warning: product-info.json not found, skipping version check.
set "CURRENT_VERSION=unknown" set "CURRENT_VERSION=unknown"
) )
if "!CURRENT_VERSION!"=="" set "CURRENT_VERSION=unknown"
if not "%CURRENT_VERSION%"=="unknown" ( if not "%CURRENT_VERSION%"=="unknown" (
echo Current DevEco version: %CURRENT_VERSION% echo Current DevEco version: %CURRENT_VERSION%
...@@ -204,9 +207,9 @@ if "%PLATFORM%"=="ohosArm64" ( ...@@ -204,9 +207,9 @@ if "%PLATFORM%"=="ohosArm64" (
if errorlevel 1 exit /b %errorlevel% if errorlevel 1 exit /b %errorlevel%
echo [Harmony-Debug-Pipeline] Build: KMP publish finished next ohpm/hvigor HAP (incremental builds may be faster) echo [Harmony-Debug-Pipeline] Build: KMP publish finished - next ohpm/hvigor HAP (incremental builds may be faster)
REM SO packaging end time / HAP build start time REM SO packaging end time / HAP build start time
for /f %%t in ('powershell -NoProfile -Command "[int][double]::Parse((Get-Date -UFormat '%%s'))"') do set HAP_START_TIME=%%t for /f "usebackq tokens=*" %%t in (`powershell -NoProfile -Command "[DateTimeOffset]::UtcNow.ToUnixTimeSeconds()"`) do set HAP_START_TIME=%%t
REM ====================== HAP build ====================== REM ====================== HAP build ======================
if not "%LOCAL_OHOS_PATH%"=="" ( if not "%LOCAL_OHOS_PATH%"=="" (
...@@ -299,7 +302,7 @@ echo. ...@@ -299,7 +302,7 @@ echo.
echo App info: echo App info:
echo - Bundle: %BUNDLE_NAME% echo - Bundle: %BUNDLE_NAME%
echo - Device: %TARGET_ID% echo - Device: %TARGET_ID%
for /f %%t in ('powershell -NoProfile -Command "[int][double]::Parse((Get-Date -UFormat '%%s'))"') do set END_TIME=%%t for /f "usebackq tokens=*" %%t in (`powershell -NoProfile -Command "[DateTimeOffset]::UtcNow.ToUnixTimeSeconds()"`) do set END_TIME=%%t
set /a ELAPSED=HAP_START_TIME-START_TIME set /a ELAPSED=HAP_START_TIME-START_TIME
set /a MINUTES=ELAPSED/60 set /a MINUTES=ELAPSED/60
set /a SECONDS=ELAPSED%%60 set /a SECONDS=ELAPSED%%60
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment