Skip to content

Commit

Permalink
chore: add possibility to ignore premake5 from path
Browse files Browse the repository at this point in the history
  • Loading branch information
Laupetin committed Jan 13, 2025
1 parent 32c0ecb commit 419481b
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -93,4 +93,4 @@ jobs:
allowUpdates: true
draft: true
omitBodyDuringUpdate: true
omitDraftDuringUpdate: true
omitDraftDuringUpdate: true
17 changes: 12 additions & 5 deletions generate.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -45,18 +49,21 @@ 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 (
set PREMAKE_BIN="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
Expand Down
8 changes: 6 additions & 2 deletions generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'
Expand Down

0 comments on commit 419481b

Please sign in to comment.