Skip to content

Commit

Permalink
Update install script, add gradle task to generate proto docs
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpeters1208 committed Sep 10, 2024
1 parent 4e16aa4 commit 1eef697
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docker/registry/protoc-base/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
io.deephaven.project.ProjectType=DOCKER_REGISTRY
deephaven.registry.imageName=ghcr.io/deephaven/protoc-base:latest
deephaven.registry.imageId=ghcr.io/deephaven/protoc-base@sha256:70f31806515b4d160ab6ddf9b7b6612441b5918b0f1c5586ee2cc9ad8a4c81da
deephaven.registry.imageId=ghcr.io/deephaven/protoc-base@sha256:7b43037ce0cf2a82aff73605a689754620791238ed598b7ae41aa5b225a27ccf
# TODO(deephaven-base-images#54): arm64 native image for cpp-client-base
deephaven.registry.platform=linux/amd64
23 changes: 23 additions & 0 deletions proto/proto-backplane-grpc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,29 @@ TaskProvider<Task> generateProtobuf = Docker.registerDockerTask(project, 'genera
}
}

TaskProvider<Task> generateProtoDocs = Docker.registerDockerTask(project, 'generateProtoDocs') {
platform = 'linux/amd64'

copyIn {
from(layout.projectDirectory) {
include 'docs/'
include 'src/main/proto/'
}
}

dockerfile {
from('deephaven/protoc-base:local-build')
copyFile('docs/', '/docs')
copyFile('src/main/proto/', '/protos')
runCommand('mkdir /docs/out; ./docs/generate_docs.sh')
}

containerOutPath = '/docs/out'
copyOut {
into('docs/out')
}
}

// Provide js, go, python output as distinct artifacts - the java output will be consumed in this project by
// declaring it as a new sourceset, see below. This could definitely be more precisely stated, but given that
// all are generated in the same docker image creation step, we don't need to get too clever here.
Expand Down
6 changes: 0 additions & 6 deletions proto/proto-backplane-grpc/docs/docker_cmd

This file was deleted.

13 changes: 8 additions & 5 deletions proto/proto-backplane-grpc/docs/generate_docs.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
#!/bin/bash

# This script generates documentation for all .proto files in the /protos directory

# Find all .proto files in the /protos directory
for proto_file in `find /protos/ -name \*.proto`; do
# Extract the base name of the .proto file (e.g., myfile.proto -> myfile)
base_name=$(basename "$proto_file" .proto)

# Generate documentation for each .proto file
protoc \
-I/usr/include -I/protos \
--doc_out=/out --doc_opt=markdown,"${base_name}.md" \
"$proto_file"
# Generate documentation for each .proto file
/opt/protoc/bin/protoc \
--plugin=protoc-gen-doc=/usr/local/bin/protoc-gen-doc \
-I/usr/include -I/protos \
--doc_out=/docs/out --doc_opt=markdown,"${base_name}.md" \
"$proto_file"
done

0 comments on commit 1eef697

Please sign in to comment.