From 419481b4da6c89204f26dc85eb904de6500feb53 Mon Sep 17 00:00:00 2001 From: Jan Date: Mon, 13 Jan 2025 01:13:08 +0100 Subject: [PATCH] chore: add possibility to ignore premake5 from path --- .github/workflows/ci.yaml | 4 ++-- .github/workflows/release.yaml | 12 ++++++------ generate.bat | 17 ++++++++++++----- generate.sh | 8 ++++++-- 4 files changed, 26 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9c748a62..68a7a71f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -30,7 +30,7 @@ jobs: - name: Premake generate working-directory: ${{ github.workspace }} env: - OAT_CI_NO_PROMPT: 1 + PREMAKE_NO_PROMPT: 1 run: ./generate.sh - name: Build @@ -61,7 +61,7 @@ jobs: - name: Premake generate working-directory: ${{ github.workspace }} env: - OAT_CI_NO_PROMPT: 1 + PREMAKE_NO_PROMPT: 1 run: ./generate.bat - name: Build diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 9078eb7b..5cb96fe0 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -27,7 +27,7 @@ jobs: - name: Premake generate working-directory: ${{ github.workspace }} env: - OAT_CI_NO_PROMPT: 1 + PREMAKE_NO_PROMPT: 1 run: ./generate.sh - name: Build @@ -55,22 +55,22 @@ jobs: - name: Premake generate working-directory: ${{ github.workspace }} env: - OAT_CI_NO_PROMPT: 1 + PREMAKE_NO_PROMPT: 1 run: ./generate.bat - name: Build working-directory: ${{ github.workspace }} run: msbuild /m /p:Configuration=Release /p:Platform=Win32 build - + - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: oat-windows path: | ${{ github.workspace }}/build/bin/Release_x86 - + release: - needs: + needs: - build-release-linux - build-release-windows runs-on: ubuntu-latest @@ -93,4 +93,4 @@ jobs: allowUpdates: true draft: true omitBodyDuringUpdate: true - omitDraftDuringUpdate: true \ No newline at end of file + omitDraftDuringUpdate: true diff --git a/generate.bat b/generate.bat index 5a0cacab..4c3ff1fe 100644 --- a/generate.bat +++ b/generate.bat @@ -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_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 :downloadpremake @@ -45,10 +49,13 @@ exit /B 0 cd %~dp0 :start -where /q "premake5.exe" -IF %ERRORLEVEL% EQU 0 ( - set PREMAKE_BIN="premake5.exe" - goto runpremake + +IF /i "%PREMAKE_NO_GLOBAL%" EQU "" ( + where /q "premake5.exe" + IF %ERRORLEVEL% EQU 0 ( + set PREMAKE_BIN="premake5.exe" + goto runpremake + ) ) IF EXIST build/premake5.exe ( @@ -56,7 +63,7 @@ IF EXIST build/premake5.exe ( goto runpremake ) -if "%OAT_CI_NO_PROMPT%" NEQ "" ( +if "%PREMAKE_NO_PROMPT%" NEQ "" ( call:downloadpremake set PREMAKE_BIN="build/premake5.exe" goto runpremake diff --git a/generate.sh b/generate.sh index 09a7a6fe..0e81374d 100755 --- a/generate.sh +++ b/generate.sh @@ -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_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 { if [[ ! -x "$(command -v wget)" ]]; then echo "Failed: Installation requires wget" >&2 @@ -51,13 +55,13 @@ if [[ ! -d ".git" ]]; then fi PREMAKE_BIN='' -if [[ -x "$(command -v premake5)" ]]; then +if [[ -z "$PREMAKE_NO_GLOBAL" ]] && [[ -x "$(command -v premake5)" ]]; then PREMAKE_BIN='premake5' elif [[ -x "$(command -v build/premake5)" ]]; then PREMAKE_BIN='build/premake5' else 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" install_premake PREMAKE_BIN='build/premake5'