Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: improve Justfile doc #61

Merged
merged 1 commit into from
Apr 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 36 additions & 28 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

set dotenv-load := true


# === Aliases ===

[private]
Expand All @@ -22,26 +21,22 @@ main_dir := home_dir / ".mkflower"
cache_dir := main_dir / "cache"
bin_dir := main_dir / "bin"

# Local directories
# Local directories for game exports
build_dir := justfile_directory() / "build"
dist_dir := justfile_directory() / "dist"

# Godot variables
godot_version := env_var('GODOT_VERSION')
godot_platform := if arch() == "x86" {
"linux.x86_32"
} else {
if arch() == "x86_64" {
} else if arch() == "x86_64" {
"linux.x86_64"
} else {
if arch() == "arm" {
"linux.arm32"
} else {
if arch() == "aarch64" {
"linux.arm64"
} else { "" }
}
}
} else if arch() == "arm" {
"linux.arm32"
} else if arch() == "aarch64" {
"linux.arm64"
} else {
""
}
godot_filename := "Godot_v" + godot_version + "_" + godot_platform
godot_template := "Godot_v" + godot_version + "_export_templates.tpz"
Expand All @@ -64,7 +59,13 @@ venv_dir := justfile_directory() / "venv"

# Butler binary
butler_bin := bin_dir / "butler"
butler_platform := if arch() == "x86" { "linux-386" } else { if arch() == "x86_64" { "linux-amd64" } else{ "" } }
butler_platform := if arch() == "x86" {
"linux-386"
} else if arch() == "x86_64" {
"linux-amd64"
} else {
""
}

# === Commands ===

Expand All @@ -80,9 +81,8 @@ butler_platform := if arch() == "x86" { "linux-386" } else { if arch() == "x86_6

# === Installer ===
#
# Recipes that check and/or install some binaries like Godot, Bulter ...
# This means the user doesn't have to worry about installation,
# and can be sure that the same code is running in CI and locally.
# Recipes for checking and/or installing binaries like Godot and Butler.
# Ensures consistent environments across CI and local development.

# Download Godot
[private]
Expand All @@ -91,7 +91,7 @@ install-godot: makedirs
unzip -o {{ cache_dir }}/{{ godot_filename }}.zip -d {{ cache_dir }}
cp {{ cache_dir }}/{{ godot_filename }} {{ godot_bin }}

# Download Godot if not already done
# Check and download Godot if not already installed
[private]
@check-godot:
[ ! -e {{ godot_bin }} ] && just install-godot || true
Expand All @@ -104,7 +104,7 @@ install-templates: makedirs
mkdir -p {{ godot_templates_dir }}
cp {{ cache_dir }}/templates/* {{ godot_templates_dir }}

# Download Godot export templates if not already done
# Check and download Godot export templates if not already installed
[private]
@check-templates:
[ ! -d {{ godot_templates_dir }} ] && just install-templates || true
Expand All @@ -117,15 +117,16 @@ install-butler: makedirs
mv {{ cache_dir }}/butler {{ butler_bin }}
chmod +x {{ butler_bin }}

# Download Butler if not already done
# Check and download Butler if not already installed
[private]
@check-butler:
[ ! -e {{ butler_bin }} ] && just install-butler || true

# === Python ===
#
# Recipes that use python or python packages.
# This ensures that all python packages are installed in a virtual environment.
# Recipes for working with Python and Python packages.
# These recipes ensure that Python packages are installed within a virtual environment,
# providing a clean and isolated environment.

export PIP_REQUIRE_VIRTUALENV := "true"

Expand All @@ -146,8 +147,10 @@ credits:

# === Godot ===
#
# Recipes around the Godot binary.
# This simplifies some recurring tasks, such as installing addons.
# Recipes for managing the Godot binary.
# These recipes simplify common tasks such as installing addons, importing game resources,
# and opening the Godot editor.


# Godot binary wrapper
godot *ARGS: check-godot check-templates
Expand All @@ -169,12 +172,18 @@ godot *ARGS: check-godot check-templates
just godot --editor

# === Butler ===
#
# Recipes for managing the Butler binary.

# Bulter wrapper
butler *ARGS: check-butler
{{ butler_bin }} {{ ARGS }}

# === Export ===
#
# Recipes for exporting the game to different platforms.
# Handles tasks such as updating version information, preparing directories,
# and exporting the game for Windows, MacOS, Linux, and the web.

# Updates the game version for export
@bump-version:
Expand Down Expand Up @@ -230,8 +239,7 @@ export: export-windows export-mac export-linux

# === Clean ===
#
# Recipes that clean up the project, deleting
# files and folders created by this Justfile.
# Recipes for cleaning up the project, removing files and folders created by this Justfile.

# Remove game plugins
clean-addons:
Expand All @@ -251,8 +259,8 @@ clean: clean-addons clean-resources clean-export

# === CI ===
#
# Recipes launched by CI steps.
# They can be run locally, but requires the setup of some environment variables.
# Recipes triggered by CI steps.
# Can be run locally but requires setup of environment variables.

# Add some variables to Github env
ci-load-dotenv:
Expand Down
Loading