TRX/justfile

99 lines
4.2 KiB
Makefile
Raw Normal View History

2024-02-26 15:11:00 +01:00
CWD := `pwd`
HOST_USER_UID := `id -u`
HOST_USER_GID := `id -g`
2024-10-03 10:34:19 +02:00
default: (tr1-build-win "debug") (tr2-build-win "debug")
2024-02-26 15:11:00 +01:00
2024-03-23 13:34:59 +01:00
_docker_push tag:
docker push {{tag}}
2024-02-26 15:11:00 +01:00
_docker_build dockerfile tag force="0":
#!/usr/bin/env sh
2024-03-23 13:34:59 +01:00
if [ "{{force}}" = "0" ]; then
2024-10-02 10:23:23 +02:00
docker images --format '{''{.Repository}}' | grep '^{{tag}}$' >/dev/null
2024-03-23 13:34:59 +01:00
if [ $? -eq 0 ]; then
echo "Docker image {{tag}} found"
exit 0
fi
echo "Docker image {{tag}} not found, trying to download from DockerHub"
if docker pull {{tag}}; then
echo "Docker image {{tag}} downloaded from DockerHub"
exit 0
fi
echo "Docker image {{tag}} not found, trying to build"
2024-02-26 15:11:00 +01:00
fi
2024-03-23 13:34:59 +01:00
echo "Building Docker image: {{dockerfile}} → {{tag}}"
docker build \
--progress plain \
. \
-f {{dockerfile}} \
-t {{tag}}
2024-02-26 15:11:00 +01:00
_docker_run *args:
@echo "Running docker image: {{args}}"
docker run \
--rm \
--user \
{{HOST_USER_UID}}:{{HOST_USER_GID}} \
--network host \
-v {{CWD}}:/app/ \
{{args}}
2024-10-02 10:23:23 +02:00
tr1-image-linux force="1": (_docker_build "tools/tr1/docker/game-linux/Dockerfile" "rrdash/tr1x-linux" force)
tr1-image-win force="1": (_docker_build "tools/tr1/docker/game-win/Dockerfile" "rrdash/tr1x" force)
tr1-image-win-config force="1": (_docker_build "tools/tr1/docker/config/Dockerfile" "rrdash/tr1x-config" force)
tr1-image-win-installer force="1": (_docker_build "tools/tr1/docker/installer/Dockerfile" "rrdash/tr1x-installer" force)
2024-03-23 13:34:59 +01:00
2024-10-02 10:23:23 +02:00
tr1-push-image-linux: (tr1-image-linux "0") (_docker_push "rrdash/tr1x-linux")
tr1-push-image-win: (tr1-image-win "0") (_docker_push "rrdash/tr1x")
2024-03-23 13:34:59 +01:00
2024-10-02 10:23:23 +02:00
tr1-build-linux target='debug': (tr1-image-linux "0") (_docker_run "-e" "TARGET="+target "rrdash/tr1x-linux")
tr1-build-win target='debug': (tr1-image-win "0") (_docker_run "-e" "TARGET="+target "rrdash/tr1x")
tr1-build-win-config: (tr1-image-win-config "0") (_docker_run "rrdash/tr1x-config")
tr1-build-win-installer: (tr1-image-win-installer "0") (_docker_run "rrdash/tr1x-installer")
2024-03-23 13:34:59 +01:00
2024-10-02 10:23:23 +02:00
tr1-package-linux: (tr1-build-linux "release") (_docker_run "rrdash/tr1x-linux" "package")
tr1-package-win: (tr1-build-win "release") (_docker_run "rrdash/tr1x" "package")
tr1-package-win-all: (tr1-build-win "release") (tr1-build-win-config) (_docker_run "rrdash/tr1x" "package")
tr1-package-win-installer: (tr1-build-win "release") (tr1-build-win-config) (_docker_run "rrdash/tr1x" "package" "-o" "tools/tr1/installer/Installer/Resources/release.zip") (tr1-build-win-installer)
2024-03-23 13:34:59 +01:00
#!/bin/sh
2024-10-02 10:16:45 +02:00
git checkout "tools/tr1/installer/Installer/Resources/release.zip"
2024-10-02 10:23:23 +02:00
exe_name=TR1X-$(tools/get_version 1)-Installer.exe
2024-10-02 10:16:45 +02:00
cp tools/tr1/installer/out/TR1X_Installer.exe "${exe_name}"
echo "Created ${exe_name}"
2024-02-26 15:11:00 +01:00
2024-10-02 10:23:23 +02:00
tr2-image-win force="1": (_docker_build "tools/tr2/docker/game-win/Dockerfile" "rrdash/tr2x" force)
tr2-image-win-config force="1": (_docker_build "tools/tr2/docker/config/Dockerfile" "rrdash/tr2x-config" force)
2024-10-02 10:23:23 +02:00
tr2-push-image-win: (tr2-image-win "0") (_docker_push "rrdash/tr2x")
tr2-build-win target='debug': (tr2-image-win "0") (_docker_run "-e" "TARGET="+target "rrdash/tr2x")
tr2-build-win-config: (tr2-image-win-config "0") (_docker_run "rrdash/tr2x-config")
tr2-package-win target='release': (tr2-build-win target) (_docker_run "rrdash/tr2x" "package")
tr2-package-win-all target='release': (tr2-build-win target) (tr2-build-win-config) (_docker_run "rrdash/tr2x" "package")
output-release-name tr_version:
tools/output_release_name {{tr_version}}
output-current-version tr_version:
tools/get_version {{tr_version}}
output-current-changelog tr_version:
tools/output_current_changelog {{tr_version}}
2024-02-26 15:11:00 +01:00
clean:
-find build/ -type f -delete
-find tools/ -type f \( -ipath '*/out/*' -or -ipath '*/bin/*' -or -ipath '*/obj/*' \) -delete
-find . -mindepth 1 -empty -type d -delete
lint-imports:
tools/sort_imports
lint-format:
pre-commit run -a
2024-02-26 15:11:00 +01:00
lint: (lint-imports) (lint-format)