pantry/projects/github.com/chrusty/protoc-gen-jsonschema/package.yml
2023-11-20 15:26:21 -05:00

42 lines
1.2 KiB
YAML

distributable:
url: https://github.com/chrusty/protoc-gen-jsonschema/archive/refs/tags/{{version}}.tar.gz
strip-components: 1
versions:
github: chrusty/protoc-gen-jsonschema
dependencies:
protobuf.dev: '*' # requires the CLI; no lib dependency
build:
dependencies:
go.dev: ^1.11
script:
- run: |
sed -i.bak -e's/const version =.*/const version = "v{{version}}"/' main.go
rm main.go.bak
working-directory: cmd/protoc-gen-jsonschema
- go build -ldflags="$LDFLAGS" -o "{{prefix}}/bin/protoc-gen-jsonschema" cmd/protoc-gen-jsonschema/main.go
- mkdir -p "{{prefix}}/share"
- cp -a internal/converter/testdata "{{prefix}}/share/"
env:
LDFLAGS:
- -s
- -w
linux:
LDFLAGS:
- -buildmode=pie
provides:
- bin/protoc-gen-jsonschema
test:
dependencies:
perl.org: ^5
script:
- test "$(protoc-gen-jsonschema -version)" = "v{{version}}"
- protoc
--jsonschema_out=.
--proto_path="{{prefix}}"/share/testdata/proto
"{{prefix}}"/share/testdata/proto/ArrayOfPrimitives.proto
- test "$(shasum ArrayOfPrimitives.json)" = "1ad855b587988fc0b5d672de7e7146e04ff7d3e4 ArrayOfPrimitives.json"