distributable:
  url: git+https://github.com/anchore/syft.git
  ref: ${{version.tag}}

versions:
  github: anchore/syft

build:
  dependencies:
    go.dev: ^1.21
  script:
    go build $ARGS -ldflags="$LDFLAGS" ./cmd/syft
  env:
    COMMIT: $(git describe --always --abbrev=8 --dirty)
    DATE: $(date -u +%FT%TZ)
    ARGS:
      - -trimpath
      - -o={{prefix}}/bin/syft
    linux:
      ARGS:
        - -buildmode=pie
    LDFLAGS:
      - -s
      - -w
      - -X main.version={{version}}
      - -X main.gitCommit=${COMMIT}
      - -X main.buildDate=${DATE}

provides:
  - bin/syft

test:
  dependencies:
    curl.se: '*'
  script:
    - curl -L "${TEST_JSON}" -o micronaut.json
    - syft convert micronaut.json | grep 'netty-codec-http2'
    - syft --version | grep {{version}}
  env:
    TEST_JSON: https://raw.githubusercontent.com/anchore/syft/934644232ab115b2518acdb5d240ae31aaf55989/syft/pkg/cataloger/java/test-fixtures/graalvm-sbom/micronaut.json
