chore: add possibility to ignore premake5 from path

This commit is contained in:
Jan 2025-01-13 01:13:08 +01:00
parent 32c0ecb04d
commit 419481b4da
No known key found for this signature in database
GPG Key ID: 44B581F78FF5C57C
4 changed files with 26 additions and 15 deletions

View File

@ -30,7 +30,7 @@ jobs:
- name: Premake generate - name: Premake generate
working-directory: ${{ github.workspace }} working-directory: ${{ github.workspace }}
env: env:
OAT_CI_NO_PROMPT: 1 PREMAKE_NO_PROMPT: 1
run: ./generate.sh run: ./generate.sh
- name: Build - name: Build
@ -61,7 +61,7 @@ jobs:
- name: Premake generate - name: Premake generate
working-directory: ${{ github.workspace }} working-directory: ${{ github.workspace }}
env: env:
OAT_CI_NO_PROMPT: 1 PREMAKE_NO_PROMPT: 1
run: ./generate.bat run: ./generate.bat
- name: Build - name: Build

View File

@ -27,7 +27,7 @@ jobs:
- name: Premake generate - name: Premake generate
working-directory: ${{ github.workspace }} working-directory: ${{ github.workspace }}
env: env:
OAT_CI_NO_PROMPT: 1 PREMAKE_NO_PROMPT: 1
run: ./generate.sh run: ./generate.sh
- name: Build - name: Build
@ -55,7 +55,7 @@ jobs:
- name: Premake generate - name: Premake generate
working-directory: ${{ github.workspace }} working-directory: ${{ github.workspace }}
env: env:
OAT_CI_NO_PROMPT: 1 PREMAKE_NO_PROMPT: 1
run: ./generate.bat run: ./generate.bat
- name: Build - name: Build

View File

@ -3,6 +3,10 @@
set PREMAKE_URL="https://github.com/premake/premake-core/releases/download/v5.0.0-beta4/premake-5.0.0-beta4-windows.zip" set PREMAKE_URL="https://github.com/premake/premake-core/releases/download/v5.0.0-beta4/premake-5.0.0-beta4-windows.zip"
set PREMAKE_HASH="12d741d3b70445b025c03e26148e2d129801041fa5ddde61b4ac888a76017395" set PREMAKE_HASH="12d741d3b70445b025c03e26148e2d129801041fa5ddde61b4ac888a76017395"
REM The following variables can be set:
REM PREMAKE_NO_GLOBAL - Ignore premake5 executable from path
REM PREMAKE_NO_PROMPT - Download premake5 without prompting
goto start goto start
:downloadpremake :downloadpremake
@ -45,10 +49,13 @@ exit /B 0
cd %~dp0 cd %~dp0
:start :start
where /q "premake5.exe"
IF %ERRORLEVEL% EQU 0 ( IF /i "%PREMAKE_NO_GLOBAL%" EQU "" (
set PREMAKE_BIN="premake5.exe" where /q "premake5.exe"
goto runpremake IF %ERRORLEVEL% EQU 0 (
set PREMAKE_BIN="premake5.exe"
goto runpremake
)
) )
IF EXIST build/premake5.exe ( IF EXIST build/premake5.exe (
@ -56,7 +63,7 @@ IF EXIST build/premake5.exe (
goto runpremake goto runpremake
) )
if "%OAT_CI_NO_PROMPT%" NEQ "" ( if "%PREMAKE_NO_PROMPT%" NEQ "" (
call:downloadpremake call:downloadpremake
set PREMAKE_BIN="build/premake5.exe" set PREMAKE_BIN="build/premake5.exe"
goto runpremake goto runpremake

View File

@ -3,6 +3,10 @@
PREMAKE_URL='https://github.com/premake/premake-core/releases/download/v5.0.0-beta4/premake-5.0.0-beta4-linux.tar.gz' PREMAKE_URL='https://github.com/premake/premake-core/releases/download/v5.0.0-beta4/premake-5.0.0-beta4-linux.tar.gz'
PREMAKE_HASH='4356ab7cdec6085183d68fb240089376eacdc2fb751ffbd8063d797ae43abeb3' PREMAKE_HASH='4356ab7cdec6085183d68fb240089376eacdc2fb751ffbd8063d797ae43abeb3'
# The following variables can be set:
# PREMAKE_NO_GLOBAL - Ignore premake5 executable from path
# PREMAKE_NO_PROMPT - Download premake5 without prompting
function install_premake { function install_premake {
if [[ ! -x "$(command -v wget)" ]]; then if [[ ! -x "$(command -v wget)" ]]; then
echo "Failed: Installation requires wget" >&2 echo "Failed: Installation requires wget" >&2
@ -51,13 +55,13 @@ if [[ ! -d ".git" ]]; then
fi fi
PREMAKE_BIN='' PREMAKE_BIN=''
if [[ -x "$(command -v premake5)" ]]; then if [[ -z "$PREMAKE_NO_GLOBAL" ]] && [[ -x "$(command -v premake5)" ]]; then
PREMAKE_BIN='premake5' PREMAKE_BIN='premake5'
elif [[ -x "$(command -v build/premake5)" ]]; then elif [[ -x "$(command -v build/premake5)" ]]; then
PREMAKE_BIN='build/premake5' PREMAKE_BIN='build/premake5'
else else
echo "Could not find premake5. You can either install it yourself or this script download it for you." echo "Could not find premake5. You can either install it yourself or this script download it for you."
if [[ ! -z "$OAT_CI_NO_PROMPT" ]] || [[ "$(read -e -p 'Do you wish to download it automatically? [y/N]> '; echo $REPLY)" == [Yy]* ]]; then if [[ ! -z "$PREMAKE_NO_PROMPT" ]] || [[ "$(read -e -p 'Do you wish to download it automatically? [y/N]> '; echo $REPLY)" == [Yy]* ]]; then
echo "Installing premake" echo "Installing premake"
install_premake install_premake
PREMAKE_BIN='build/premake5' PREMAKE_BIN='build/premake5'