# https://taskfile.dev

version: "3"

vars:
  TARGET: vss

includes:
  build: ./misc/Taskfile_{{OS}}.yml

tasks:
  echo:
    cmds:
      - echo {{.ARCHIVE_DIR}}
    vars:
      ARCHIVE_DIR: "{{.TARGET}}_{{OS}}_{{ARCH}}"

  setup:
    desc: Setup vss project
    cmds:
      - v install markdown

  doc:
    desc: Update module document
    cmds:
      - v doc -o docs/ -f markdown .
      - mv docs/index.md docs/vdotenv.md

  test:
    desc: Run test
    cmds:
      - v test .

  vet:
    desc: Report suspicious code constructs
    cmds:
      - v vet .

  format:
    desc: Format .v files
    cmds:
      - v fmt -w .

  clean:
    desc: Clean test files
    cmds:
      - rm -rf dist/

  dist:
    desc: Mkdir dist
    cmds:
      - task: clean
      - task: build
      - task build:archive

  build:
    desc: Build vss
    cmds:
      - v . -o {{.TARGET}}

  prod-build:
    desc: Build vss for production
    cmds:
      - v -prod . -o {{.TARGET}}

  example:
    desc: Setup for example
    cmds:
      - rm -rf example/vss
      - task: build
      - cp vss example
      - task: example-run

  example-run:
    dir: example
    cmds:
      - ./vss build
