Skip to content

Commit

Permalink
fixup! build: use Justfile as command runner
Browse files Browse the repository at this point in the history
  • Loading branch information
florianvazelle committed Nov 4, 2023
1 parent 44cef48 commit 98fc8bc
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

set dotenv-load := true

export PIP_REQUIRE_VIRTUALENV := "true"

# === Aliases ===

[private]
Expand Down Expand Up @@ -42,10 +44,8 @@ short_version := replace_regex(game_version, "([0-9]+).([0-9]+).[0-9]+", "$1.$2"
build_date := `date +'%Y/%m/%d'`
commit_hash := `git log --pretty=format:"%H" -1`

# Python binaries
python_dir := if os_family() == "windows" { "./venv/Scripts" } else { "./venv/bin" }
python_bin := python_dir + if os_family() == "windows" { "/python.exe" } else { "/python3" }
system_python := if os_family() == "windows" { "py.exe -3" } else { "python3" }
# Python virtualenv
venv_dir := justfile_directory() / "venv"

# Butler binary
butler_bin := bin_dir / "butler"
Expand All @@ -63,11 +63,11 @@ default:
makedirs:
@mkdir -p {{ cache_dir }} {{ bin_dir }} {{ build_dir }} {{ dist_dir }}

# Setup python virtualenv
# Python virtualenv wrapper
[private]
venv:
[ ! -d venv ] && {{ system_python }} -m venv venv || true
{{ python_bin }} -m pip install pre-commit==3.3.3 reuse==2.1.0 gdtoolkit==4.*
@venv *ARGS:
[ ! -d {{ venv_dir }} ] && python3 -m venv {{ venv_dir }} || true
. {{ venv_dir }}/bin/activate && {{ ARGS }}

# Download Godot
[private]
Expand Down Expand Up @@ -116,16 +116,17 @@ bump-version:
echo -e "[build_info]\npackage/version={{ game_version }}\npackage/build_date={{ build_date }}\nsource/commit={{ commit_hash }}" > override.cfg

# Godot binary wrapper
godot *ARGS: makedirs install-godot install-templates
@godot *ARGS: makedirs install-godot install-templates
{{ godot_bin }} {{ ARGS }}

# Open the Godot editor
editor:
just godot --editor

# Run files formatters
fmt: venv
{{ python_dir }}/pre-commit run -a
fmt:
just venv pip install pre-commit==3.3.3 reuse==2.1.0 gdtoolkit==4.*
just venv pre-commit run -a

# Export game on Windows
export-windows: bump-version install-addons import-resources
Expand Down Expand Up @@ -154,6 +155,7 @@ export: export-windows export-mac export-linux
[private]
clean-mkflower:
rm -rf {{ main_dir }}
rm -rf {{ venv_dir }}

# Remove files created during the export
clean-export:
Expand Down Expand Up @@ -190,7 +192,7 @@ install-butler:
fi
# Bulter wrapper
butler *ARGS: install-butler
@butler *ARGS: install-butler
{{ butler_bin }} {{ ARGS }}

# Upload the game on Github and Itch.io
Expand Down

0 comments on commit 98fc8bc

Please sign in to comment.