diff options
| author | ruki <[email protected]> | 2024-03-19 23:27:01 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-03-19 14:52:03 +0800 |
| commit | 2d8b2fe62d4dfac8cc4e8f098f98268aa2ca7b57 (patch) | |
| tree | 2e60e232cd468810caa8c75519d65e0a20bfad8e /scripts | |
| parent | 1eb61cd2e7723cb0614c2723379f3a7e3023dea5 (diff) | |
improve xrepo script
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/srcenv.bat | 3 | ||||
| -rwxr-xr-x | scripts/xrepo.bat | 40 | ||||
| -rw-r--r-- | scripts/xrepo.ps1 | 6 |
3 files changed, 26 insertions, 23 deletions
diff --git a/scripts/srcenv.bat b/scripts/srcenv.bat index 297de4501..4c511faee 100755 --- a/scripts/srcenv.bat +++ b/scripts/srcenv.bat @@ -3,5 +3,6 @@ setlocal set script_dir=%~dp0 set PATH=%script_dir%..\core\build;%cd%;%PATH% set XMAKE_PROGRAM_DIR=%script_dir%..\xmake +set XMAKE_PROGRAM_FILE=%script_dir%..\core\build\xmake.exe start cmd /k cd %script_dir%..\ -endlocal
\ No newline at end of file +endlocal diff --git a/scripts/xrepo.bat b/scripts/xrepo.bat index ccb3e987f..c07c85fa1 100755 --- a/scripts/xrepo.bat +++ b/scripts/xrepo.bat @@ -1,5 +1,7 @@ @set "XMAKE_ROOTDIR=%~dp0" -@set "XMAKE_EXE=%XMAKE_ROOTDIR%xmake.exe" +IF NOT DEFINED XMAKE_PROGRAM_FILE ( + @set "XMAKE_PROGRAM_FILE=%XMAKE_ROOTDIR%xmake.exe" +) @if [%1]==[env] ( if [%2]==[quit] ( @@ -19,11 +21,11 @@ call %XMAKE_ENV_BACKUP% setlocal EnableDelayedExpansion if !errorlevel! neq 0 exit /B !errorlevel! - "%XMAKE_EXE%" lua private.xrepo.action.env.info config + "%XMAKE_PROGRAM_FILE%" lua private.xrepo.action.env.info config if !errorlevel! neq 0 ( exit /B !errorlevel! ) - @"%XMAKE_EXE%" lua --quiet private.xrepo.action.env.info prompt 1>nul + @"%XMAKE_PROGRAM_FILE%" lua --quiet private.xrepo.action.env.info prompt 1>nul if !errorlevel! neq 0 ( echo error: xmake.lua not found^^! exit /B !errorlevel! @@ -36,31 +38,31 @@ exit /B 1 ) else ( setlocal EnableDelayedExpansion - "%XMAKE_EXE%" lua private.xrepo.action.env.info config + "%XMAKE_PROGRAM_FILE%" lua private.xrepo.action.env.info config if !errorlevel! neq 0 ( exit /B !errorlevel! ) - @"%XMAKE_EXE%" lua --quiet private.xrepo.action.env | findstr . && ( + @"%XMAKE_PROGRAM_FILE%" lua --quiet private.xrepo.action.env | findstr . && ( echo error: corrupt xmake.lua detected in the current directory^^! exit /B 1 ) - @"%XMAKE_EXE%" lua --quiet private.xrepo.action.env.info prompt 1>nul + @"%XMAKE_PROGRAM_FILE%" lua --quiet private.xrepo.action.env.info prompt 1>nul if !errorlevel! neq 0 ( echo error: xmake.lua not found^^! exit /B !errorlevel! ) endlocal - for /f %%i in ('@"%XMAKE_EXE%" lua --quiet private.xrepo.action.env.info prompt') do @( + for /f %%i in ('@"%XMAKE_PROGRAM_FILE%" lua --quiet private.xrepo.action.env.info prompt') do @( @set "PROMPT=%%i %PROMPT%" ) @set XMAKE_PROMPT_BACKUP=%PROMPT% ) - for /f %%i in ('@"%XMAKE_EXE%" lua private.xrepo.action.env.info envfile') do @( + for /f %%i in ('@"%XMAKE_PROGRAM_FILE%" lua private.xrepo.action.env.info envfile') do @( @set "XMAKE_ENV_BACKUP=%%i.bat" - @"%XMAKE_EXE%" lua private.xrepo.action.env.info backup.cmd 1>"%%i.bat" + @"%XMAKE_PROGRAM_FILE%" lua private.xrepo.action.env.info backup.cmd 1>"%%i.bat" ) - for /f %%i in ('@"%XMAKE_EXE%" lua private.xrepo.action.env.info envfile') do @( - @"%XMAKE_EXE%" lua private.xrepo.action.env.info script.cmd 1>"%%i.bat" + for /f %%i in ('@"%XMAKE_PROGRAM_FILE%" lua private.xrepo.action.env.info envfile') do @( + @"%XMAKE_PROGRAM_FILE%" lua private.xrepo.action.env.info script.cmd 1>"%%i.bat" call "%%i.bat" ) goto :ENDXREPO @@ -87,29 +89,29 @@ ) else ( pushd %XMAKE_ROOTDIR% setlocal EnableDelayedExpansion - %XMAKE_EXE% lua private.xrepo.action.env.info config %3 + %XMAKE_PROGRAM_FILE% lua private.xrepo.action.env.info config %3 if !errorlevel! neq 0 ( popd exit /B !errorlevel! ) - @%XMAKE_EXE% lua --quiet private.xrepo.action.env.info prompt %3 1>nul + @%XMAKE_PROGRAM_FILE% lua --quiet private.xrepo.action.env.info prompt %3 1>nul if !errorlevel! neq 0 ( popd echo error: environment not found^^! exit /B !errorlevel! ) endlocal - for /f %%i in ('@%XMAKE_EXE% lua --quiet private.xrepo.action.env.info prompt %3') do @( + for /f %%i in ('@%XMAKE_PROGRAM_FILE% lua --quiet private.xrepo.action.env.info prompt %3') do @( @set "PROMPT=%%i %PROMPT%" ) @set XMAKE_PROMPT_BACKUP=%PROMPT% ) - for /f %%i in ('@%XMAKE_EXE% lua private.xrepo.action.env.info envfile %3') do @( + for /f %%i in ('@%XMAKE_PROGRAM_FILE% lua private.xrepo.action.env.info envfile %3') do @( @set "XMAKE_ENV_BACKUP=%%i.bat" - @"%XMAKE_EXE%" lua --quiet private.xrepo.action.env.info backup.cmd %3 1>"%%i.bat" + @"%XMAKE_PROGRAM_FILE%" lua --quiet private.xrepo.action.env.info backup.cmd %3 1>"%%i.bat" ) - for /f %%i in ('@%XMAKE_EXE% lua private.xrepo.action.env.info envfile %3') do @( - @"%XMAKE_EXE%" lua --quiet private.xrepo.action.env.info script.cmd %3 1>"%%i.bat" + for /f %%i in ('@%XMAKE_PROGRAM_FILE% lua private.xrepo.action.env.info envfile %3') do @( + @"%XMAKE_PROGRAM_FILE%" lua --quiet private.xrepo.action.env.info script.cmd %3 1>"%%i.bat" call "%%i.bat" ) popd @@ -117,6 +119,6 @@ ) ) -@call "%XMAKE_EXE%" lua private.xrepo %* +@call "%XMAKE_PROGRAM_FILE%" lua private.xrepo %* :ENDXREPO diff --git a/scripts/xrepo.ps1 b/scripts/xrepo.ps1 index 74e5e4682..e897208e3 100644 --- a/scripts/xrepo.ps1 +++ b/scripts/xrepo.ps1 @@ -1,11 +1,11 @@ $script:SCRIPT_PATH = $myinvocation.mycommand.path $script:BASE_DIR = Split-Path $SCRIPT_PATH -Parent -$Env:XMAKE_EXE = Join-Path $BASE_DIR xmake.exe +$Env:XMAKE_PROGRAM_FILE = Join-Path $BASE_DIR xmake.exe if ($Args.Count -eq 0) { # No args, just call the underlying xmake executable. - & $Env:XMAKE_EXE lua private.xrepo; + & $Env:XMAKE_PROGRAM_FILE lua private.xrepo; } else { $Command = $Args[0]; if (($Command -eq "env") -and ($Args.Count -ge 2)) { @@ -43,5 +43,5 @@ if ($Args.Count -eq 0) { } } - & $Env:XMAKE_EXE lua private.xrepo $Args; + & $Env:XMAKE_PROGRAM_FILE lua private.xrepo $Args; } |
