Skip to content

Commit

Permalink
regen-gapic: export SetGoogleClientInfo in places that need it
Browse files Browse the repository at this point in the history
This is a no-op with the monolithic generator but microgenerator will need this to work.

The (S|s)etGoogleClientInfo function is meant to be used only by manual
cloud clients to add version information. If the API has no manual
clients, exporting the function adds unnecessary clutter and confusion.

In the monolithic generator, we have the "domain_layer_location" GAPIC config (the
name is rather cryptic and I cannot recall its origin) that points to
the manual client. The generator has the logic to export the function if
and only if the config is not empty.

Now that microgenerators read only the proto annotations and not GAPIC
config, we don't have access to domain_layer_location anymore, but we
still don't want to unconditionally export this function. Thus, this CL
adds a small tool to post-process.

Change-Id: I9e275c594d1e0ef86a9c7d01eb75dd36a6fe8a4d
Reviewed-on: https://code-review.googlesource.com/c/36770
Reviewed-by: kokoro <[email protected]>
Reviewed-by: Jean de Klerk <[email protected]>
  • Loading branch information
pongad committed Jan 10, 2019
1 parent 2f1497b commit 8173a08
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions regen-gapic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,20 @@ pushd $GOPATH/src/cloud.google.com/go/
dir=${modified%/*.*}
find . -path "*/$dir/doc.go" -exec sed -i.backup -e "s/^const versionClient.*/const versionClient = \"$ver\"/" '{}' +
done
find $GOPATH/src/cloud.google.com/go/ -name '*.backup' -delete
popd

#go list cloud.google.com/go/... | grep apiv | xargs go test

#go test -short cloud.google.com/go/...
HASMANUAL=(
errorreporting/apiv1beta1
firestore/apiv1beta1
logging/apiv2
longrunning/autogen
pubsub/apiv1
spanner/apiv1
trace/apiv1
)
for dir in "${HASMANUAL[@]}"; do
find "$GOPATH/src/cloud.google.com/go/$dir" -name '*.go' -exec sed -i.backup -e 's/setGoogleClientInfo/SetGoogleClientInfo/g' '{}' '+'
done

#echo "googleapis version: $(git rev-parse HEAD)"
find $GOPATH/src/cloud.google.com/go/ -name '*.backup' -delete

0 comments on commit 8173a08

Please sign in to comment.