Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 11 additions & 33 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

PROTOC_IMAGE = protoc-base
PROTOC_GO_IMAGE = protoc-go
PROTOC_JSONSCHEMA_IMAGE = protoc-jsonschema
PROTOC_PYTHON_IMAGE = protoc-python
PROTOC_RUBY_IMAGE = protoc-ruby
PROTOC_RUST_IMAGE = protoc-rust
Expand All @@ -32,24 +31,24 @@ GID ?= $(shell id -g)
DOCKER_BUILD = docker build --platform ${PLATFORM} --build-arg UID=${UID}
DOCKER_RUN = docker run --platform ${PLATFORM} --user ${UID}:${GID}

PROTOS = $(shell find protos/ -iname "*.proto" | sed 's|^|/defs/|')
PROTOS = $(shell find protos/ service-protos/ -iname "*.proto" | sed 's|^|/defs/|')
PROTO_INCLUDES=-I/opt/include -I/googleapis -I/defs/protos -I/defs/service-protos

include protoc-builder/versions.mk

# generate all language protobuf code
all: go python typescript ruby jsonschema rust
all: go python typescript ruby rust

# generate Go protobuf code
go: base-image-go
@echo "Generating go proto Docker image"
cd protoc-builder && ${DOCKER_BUILD} -t ${PROTOC_GO_IMAGE} -f Dockerfile.go .
@echo "Generating go protobuf files"
${DOCKER_RUN} -v ${PWD}:/defs ${PROTOC_GO_IMAGE} \
-I/opt/include -I/googleapis -I/defs/protos \
${DOCKER_RUN} -v ${PWD}:/defs ${PROTOC_GO_IMAGE} ${PROTO_INCLUDES}\
--go_opt=module=github.com/sigstore/protobuf-specs/gen/pb-go --go_out=/defs/gen/pb-go ${PROTOS}

# an image on ghcr for generating defintions for sigstore services
services-image: go
services-image: base-image-go
@echo "Generating go proto base image"
cd protoc-builder && ${DOCKER_BUILD} -t ${PROTOC_GO_IMAGE} -f Dockerfile.go .
@echo "Generating services Docker image"
Expand All @@ -60,33 +59,22 @@ python: base-image-python
@echo "Generating python proto Docker image"
cd protoc-builder && ${DOCKER_BUILD} -t ${PROTOC_PYTHON_IMAGE} -f Dockerfile.python .
@echo "Generating python protobuf files"
${DOCKER_RUN} -v ${PWD}:/defs ${PROTOC_PYTHON_IMAGE} \
-I/opt/include -I/googleapis -I/defs/protos \
${DOCKER_RUN} -v ${PWD}:/defs ${PROTOC_PYTHON_IMAGE} ${PROTO_INCLUDES}\
--python_betterproto_opt=pydantic_dataclasses --python_betterproto_out=/defs/gen/pb-python/sigstore_protobuf_specs ${PROTOS}

typescript: base-image-typescript
@echo "Generating typescript proto Docker image"
cd protoc-builder && ${DOCKER_BUILD} -t ${PROTOC_TYPESCRIPT_IMAGE} -f Dockerfile.typescript .
@echo "Generating javascript protobuf files"
${DOCKER_RUN} -v ${PWD}:/defs ${PROTOC_TYPESCRIPT_IMAGE} \
-I/opt/include -I/googleapis -I/defs/protos \
${DOCKER_RUN} -v ${PWD}:/defs ${PROTOC_TYPESCRIPT_IMAGE} ${PROTO_INCLUDES}\
--ts_proto_out=/defs/gen/pb-typescript/src/__generated__ --ts_proto_opt=oneof=unions,forceLong=string,env=node,exportCommonSymbols=false,outputPartialMethods=false,outputEncodeMethods=false,unrecognizedEnum=false ${PROTOS}

ruby: base-image-ruby
@echo "Generating ruby proto Docker image"
cd protoc-builder && ${DOCKER_BUILD} -t ${PROTOC_RUBY_IMAGE} -f Dockerfile.ruby .
@echo "Generating ruby protobuf files"
${DOCKER_RUN} -v ${PWD}:/defs ${PROTOC_RUBY_IMAGE} \
-I/opt/include -I/googleapis -I/defs/protos --ruby_out=/defs/gen/pb-ruby/lib ${PROTOS}

jsonschema: base-image-jsonschema
@echo "Generating jsonschema proto Docker image"
cd protoc-builder && ${DOCKER_BUILD} -t ${PROTOC_JSONSCHEMA_IMAGE} -f Dockerfile.jsonschema .
@echo "Generating JSON schema files"
mkdir -p gen/jsonschema/schemas
${DOCKER_RUN} -v ${PWD}:/defs ${PROTOC_JSONSCHEMA_IMAGE} \
-I/opt/include -I/googleapis -I/defs/protos \
--jsonschema_out=/defs/gen/jsonschema/schemas --jsonschema_opt=disallow_additional_properties --jsonschema_opt=enforce_oneof --jsonschema_opt=enums_as_strings_only --jsonschema_opt=file_extension=schema.json --jsonschema_opt=json_fieldnames ${PROTOS}
${DOCKER_RUN} -v ${PWD}:/defs ${PROTOC_RUBY_IMAGE} ${PROTO_INCLUDES}\
--ruby_out=/defs/gen/pb-ruby/lib ${PROTOS}

rust: base-image-rust
@echo "Generating rust proto Docker image"
Expand All @@ -103,14 +91,6 @@ base-image-go:
--build-arg PROTOC_CHECKSUM=${GO_PROTOC_CHECKSUM} \
--build-arg GOOGLEAPIS_COMMIT=${GO_GOOGLEAPIS_COMMIT} .

.PHONY: base-image-jsonschema
base-image-jsonschema:
@echo "Building base docker image for jsonschema"
cd protoc-builder && ${DOCKER_BUILD} ${DOCKER_CACHE} -t ${PROTOC_IMAGE}:jsonschema -f Dockerfile.protoc \
--build-arg PROTOC_VERSION=${JSONSCHEMA_PROTOC_VERSION} \
--build-arg PROTOC_CHECKSUM=${JSONSCHEMA_PROTOC_CHECKSUM} \
--build-arg GOOGLEAPIS_COMMIT=${JSONSCHEMA_GOOGLEAPIS_COMMIT} .

.PHONY: base-image-python
base-image-python:
@echo "Building base docker image for Python"
Expand Down Expand Up @@ -150,7 +130,6 @@ base-image-typescript:
base-image-no-cache:
@echo "Building development docker images with disabled cache"
@DOCKER_CACHE="--no-cache" make base-image-go
@DOCKER_CACHE="--no-cache" make base-image-jsonschema
@DOCKER_CACHE="--no-cache" make base-image-python
@DOCKER_CACHE="--no-cache" make base-image-ruby
@DOCKER_CACHE="--no-cache" make base-image-rust
Expand All @@ -162,10 +141,9 @@ clean:
gen/pb-typescript/src/__generated__/* \
gen/pb-python/sigstore_protobuf_specs/dev \
gen/pb-python/sigstore_protobuf_specs/io \
gen/pb-rust/target \
gen/jsonschema/schemas
gen/pb-rust/target
find gen/pb-ruby/ -type f -name '*_pb.rb' -delete
docker rmi -f ${PROTOC_IMAGE}:go ${PROTOC_GO_IMAGE} \
${PROTOC_IMAGE}:jsonschema ${PROTOC_JSONSCHEMA_IMAGE} \
${PROTOC_IMAGE}:python ${PROTOC_PYTHON_IMAGE} \
${PROTOC_IMAGE}:ruby ${PROTOC_RUBY_IMAGE} \
${PROTOC_IMAGE}:rust ${PROTOC_RUST_IMAGE} \
Expand Down
248 changes: 248 additions & 0 deletions gen/pb-go/rekor/v2/dsse.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading