From 0e17ba9480d2900bb24d2b0df1e0f23480fa1719 Mon Sep 17 00:00:00 2001 From: Jacob Heider Date: Mon, 20 Nov 2023 15:19:25 -0500 Subject: [PATCH] add(protoc-gen-jsonschema) closes #4135 --- .../chrusty/protoc-gen-jsonschema/package.yml | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 projects/github.com/chrusty/protoc-gen-jsonschema/package.yml diff --git a/projects/github.com/chrusty/protoc-gen-jsonschema/package.yml b/projects/github.com/chrusty/protoc-gen-jsonschema/package.yml new file mode 100644 index 00000000..86f9fdda --- /dev/null +++ b/projects/github.com/chrusty/protoc-gen-jsonschema/package.yml @@ -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"