add(protoc-gen-jsonschema)

closes #4135
This commit is contained in:
Jacob Heider 2023-11-20 15:19:25 -05:00 committed by Jacob Heider
parent b62313094a
commit 0e17ba9480

View file

@ -0,0 +1,42 @@
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"