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 \
|
|
|
|
. \
|
|
|
|
-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}} \
|
|
|
|
-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-23 23:22:39 +02:00
|
|
|
tr1-package-linux target='release': (tr1-build-linux target) (_docker_run "rrdash/tr1x-linux" "package")
|
|
|
|
tr1-package-win target='release': (tr1-build-win target) (_docker_run "rrdash/tr1x" "package")
|
|
|
|
tr1-package-win-all target='release': (tr1-build-win target) (tr1-build-win-config) (_docker_run "rrdash/tr1x" "package")
|
2025-03-24 21:16:26 +00:00
|
|
|
tr1-package-win-installer target='release': (tr1-build-win target) (tr1-build-win-config) (_docker_run "rrdash/tr1x" "package" "-o" "tools/installer/TR1X_Installer/Resources/release.zip") (tr1-build-win-installer)
|
2024-03-23 13:34:59 +01:00
|
|
|
#!/bin/sh
|
2025-03-24 21:16:26 +00:00
|
|
|
git checkout "tools/installer/TR1X_Installer/Resources/release.zip"
|
2024-10-02 10:23:23 +02:00
|
|
|
exe_name=TR1X-$(tools/get_version 1)-Installer.exe
|
2025-03-24 21:16:26 +00:00
|
|
|
cp tools/installer/out/TR1X_Installer.exe "${exe_name}"
|
2024-03-25 11:35:08 +01:00
|
|
|
echo "Created ${exe_name}"
|
2024-02-26 15:11:00 +01:00
|
|
|
|
2025-01-01 21:42:03 +01:00
|
|
|
tr2-image-linux force="1": (_docker_build "tools/tr2/docker/game-linux/Dockerfile" "rrdash/tr2x-linux" force)
|
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)
|
2025-03-30 11:44:07 +02:00
|
|
|
tr2-image-win-installer force="1": (_docker_build "tools/tr2/docker/installer/Dockerfile" "rrdash/tr2x-installer" force)
|
2024-04-24 21:53:22 +02:00
|
|
|
|
2025-01-01 21:42:03 +01:00
|
|
|
tr2-push-image-linux: (tr2-image-linux "0") (_docker_push "rrdash/tr2x-linux")
|
2024-10-02 10:23:23 +02:00
|
|
|
tr2-push-image-win: (tr2-image-win "0") (_docker_push "rrdash/tr2x")
|
|
|
|
|
2025-01-01 21:42:03 +01:00
|
|
|
tr2-build-linux target='debug': (tr2-image-linux "0") (_docker_run "-e" "TARGET="+target "rrdash/tr2x-linux")
|
2024-10-02 10:23:23 +02:00
|
|
|
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")
|
2025-03-30 11:44:07 +02:00
|
|
|
tr2-build-win-installer: (tr2-image-win-installer "0") (_docker_run "rrdash/tr2x-installer")
|
2024-10-02 10:23:23 +02:00
|
|
|
|
2025-01-01 21:42:03 +01:00
|
|
|
tr2-package-linux target='release': (tr2-build-linux target) (_docker_run "rrdash/tr2x-linux" "package")
|
2024-10-02 10:23:23 +02:00
|
|
|
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")
|
2025-03-30 11:44:07 +02:00
|
|
|
tr2-package-win-installer target='release': (tr2-build-win target) (tr2-build-win-config) (_docker_run "rrdash/tr2x" "package" "-o" "tools/installer/TR2X_Installer/Resources/release.zip") (tr2-build-win-installer)
|
|
|
|
#!/bin/sh
|
|
|
|
git checkout "tools/installer/TR2X_Installer/Resources/release.zip"
|
|
|
|
exe_name=TR2X-$(tools/get_version 1)-Installer.exe
|
|
|
|
cp tools/installer/out/TR2X_Installer.exe "${exe_name}"
|
|
|
|
echo "Created ${exe_name}"
|
2024-10-02 10:23:23 +02:00
|
|
|
|
|
|
|
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:
|
2024-04-09 14:09:05 +02:00
|
|
|
pre-commit run -a
|
2024-02-26 15:11:00 +01:00
|
|
|
|
|
|
|
lint: (lint-imports) (lint-format)
|