set windows-shell := ["powershell.exe", "-NoLogo", "-Command"]

# To build and test:
# $ just
#
# To make a release:
# $ just package upload

all: build run

build:
    dotnet tool restore
    just build-clientside
    just build-networked

build-clientside:
    dotnet build -c Release
    dotnet tcli build --config-path ./ScrapValueDetector67/Thunderstore/thunderstore.toml

build-networked:
    dotnet build -c Release /p:CLIENTSIDE=true
    dotnet tcli build --config-path ./ScrapValueDetector67/Thunderstore/thunderstore.toml \
        --package-name "ScrapValueDetector67_ClientSide"

run:
    &"C:\Program Files (x86)\Steam\steam.exe" -applaunch 1966720 --doorstop-enable true --doorstop-target-assembly "C:\Users\user\AppData\Roaming\com.kesomannen.gale\lethal-company\profiles\ScrapValueDetector67 Dev\BepInEx\core\BepInEx.Preloader.dll"

package: build
    # dotnet tcli publish --config-path ./ScrapValueDetector67/Thunderstore/thunderstore.toml --file ScrapValueDetector67/Packages/Ratijas-ScrapValueDetector67-{version}.zip
    if (Test-Path dist) { Remove-Item -Recurse -Force dist }
    mkdir dist
    mkdir dist/releases
    git archive master --format tar.gz --output dist/releases/Ratijas-ScrapValueDetector67-master.tar.gz
    cp ScrapValueDetector67/Packages/*.zip dist/releases/
    cp -Recurse assets dist/
    cp ScrapValueDetector67/README.md dist/
    cp ScrapValueDetector67/Thunderstore/CHANGELOG.md dist/

upload:
    scp -r dist/* "user@ratijas.me:/var/www/html/docs/public/LC/ScrapValueDetector67/"
