p2p/Justfile
Lucas Schwiderski 99425bc79b
All checks were successful
lint/clippy Check for common mistakes and opportunities for code improvement
build Build for the target platform
Remove unused Just command
2025-05-08 16:56:28 +02:00

88 lines
2.8 KiB
Makefile

set dotenv-load
set dotenv-filename := '.envrc'
set dotenv-required
fly_target := "main"
image_name := "dt-p2p-builder"
steam_library := env("steam_library")
game_dir := steam_library / "steamapps" / "common" / "Warhammer 40,000 DARKTIDE"
log_dir := env("appdata") / "Fatshark" / "Darktide" / "console_logs"
proton_dir := env("HOME") / ".steam" / "steam"
export STEAM_COMPAT_DATA_PATH := steam_library / "steamapps" / "compatdata" / "1361210"
export SteamAppId := "1361210"
release := env("RELEASE", "false")
image:
docker build -t {{image_name}} .
# Compile the Windows DLL through a Docker image
[unix]
compile:
docker run \
--rm \
-t \
--user "$(id -u):$(id -g)" \
-v $HOME/.cargo/registry:/usr/local/cargo/registry \
-v $HOME/.cargo/git:/usr/local/cargo/git \
-v $HOME/.rustup/toolchains:/usr/local/rustup/toolchains \
-v ./:/src/plugin \
{{image_name}} \
cargo build -Zbuild-std --target x86_64-pc-windows-msvc {{ if release != "false" { "--release" } else { "" } }}
# Compile the DLL and install it to the game's plugin directory
[unix]
build: compile
cp target/x86_64-pc-windows-msvc/{{ if release != "false" { "release" } else { "debug" } }}/dt_p2p.dll "{{game_dir}}/binaries/plugins/dt_p2p_pluginw64_release.dll"
# Open the newest game log file
[unix]
log:
#!/bin/sh
set -e
file="$(\ls "{{log_dir}}" | tail -1)"
echo "$(tput bold)Opening log file $file$(tput sgr0)"
exec bat "{{log_dir}}/$file"
# Run the game through Proton
[unix]
game:
#!/bin/sh
set -e
cd "{{game_dir / "binaries"}}"
proton waitforexitandrun ./Darktide.exe \
-eac-untrusted \
--bundle-dir ../bundle \
--ini settings \
--backend-auth-service-url https://bsp-auth-prod.atoma.cloud \
--backend-title-service-url https://bsp-td-prod.atoma.cloud \
-game \
-launcher_verification_passed_crashify_property false
# Compile the plugin through a Docker image
#
# Make sure to run `just image` first, to build the image.
# Untested: I don't know, if this works with Windows' Docker Desktop.
# I also don't know if/where cargo and rustup keep their caches on Windows.
[windows]
compile-docker:
docker run \
--rm \
-t \
-v ./:/src/plugin \
{{image_name}} \
cargo build -Zbuild-std --target x86_64-pc-windows-msvc {{ if release != "false" { "--release" } else { "" } }}
set-base-pipeline:
fly -t {{fly_target}} set-pipeline \
--pipeline dt-p2p \
--config .ci/pipelines/set-pr-pipelines.yml \
-v forgejo_url=https://git.sclu1034.dev \
-v forgejo_api_key=${FORGEJO_API_KEY} \
-v registry_user=${REGISTRY_USER} \
-v registry_password=${REGISTRY_PASSWORD} \
-v owner=bitsquid_dt \
-v repo=p2p