TRX/justfile

85 lines
3.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`
default: (build-win "debug")
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
docker images --format '{''{.Repository}}' | grep '^{{tag}}$'
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:16:45 +02:00
image-linux force="1": (_docker_build "tools/tr1/docker/game-linux/Dockerfile" "rrdash/tr1x-linux" force)
image-win force="1": (_docker_build "tools/tr1/docker/game-win/Dockerfile" "rrdash/tr1x" force)
image-win-config force="1": (_docker_build "tools/tr1/docker/config/Dockerfile" "rrdash/tr1x-config" force)
image-win-installer force="1": (_docker_build "tools/tr1/docker/installer/Dockerfile" "rrdash/tr1x-installer" force)
2024-03-23 13:34:59 +01:00
push-image-linux: (image-linux "0") (_docker_push "rrdash/tr1x-linux")
push-image-win: (image-win "0") (_docker_push "rrdash/tr1x")
build-linux target='debug': (image-linux "0") (_docker_run "-e" "TARGET="+target "rrdash/tr1x-linux")
build-win target='debug': (image-win "0") (_docker_run "-e" "TARGET="+target "rrdash/tr1x")
build-win-config: (image-win-config "0") (_docker_run "rrdash/tr1x-config")
build-win-installer: (image-win-installer "0") (_docker_run "rrdash/tr1x-installer")
package-linux: (build-linux "release") (_docker_run "rrdash/tr1x-linux" "package")
package-win: (build-win "release") (_docker_run "rrdash/tr1x" "package")
package-win-all: (build-win "release") (build-win-config) (_docker_run "rrdash/tr1x" "package")
2024-10-02 10:16:45 +02:00
package-win-installer: (build-win "release") (build-win-config) (_docker_run "rrdash/tr1x" "package" "-o" "tools/tr1/installer/Installer/Resources/release.zip") (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"
exe_name=TR1X-$(tools/get_version)-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
output-current-version:
tools/get_version
2024-03-23 13:34:59 +01:00
output-current-changelog:
tools/output_current_changelog
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)