@@ -29,6 +29,10 @@ case $key in
29
29
grpc_version=" $2 "
30
30
shift
31
31
;;
32
+ --proto_only)
33
+ proto_only=" $2 "
34
+ shift
35
+ ;;
32
36
--gapic_additional_protos)
33
37
gapic_additional_protos=" $2 "
34
38
shift
@@ -69,6 +73,10 @@ if [ -z "${grpc_version}" ]; then
69
73
grpc_version=$( get_grpc_version " ${gapic_generator_version} " )
70
74
fi
71
75
76
+ if [ -z " ${proto_only} " ]; then
77
+ proto_only=" false"
78
+ fi
79
+
72
80
if [ -z " ${gapic_additional_protos} " ]; then
73
81
gapic_additional_protos=" google/cloud/common_resources.proto"
74
82
fi
120
128
# ##################### Section 2 #####################
121
129
# # generate gapic-*/, part of proto-*/, samples/
122
130
# #####################################################
123
- " $protoc_path " /protoc --experimental_allow_proto3_optional \
124
- " --plugin=protoc-gen-java_gapic=${script_dir} /gapic-generator-java-wrapper" \
125
- " --java_gapic_out=metadata:${destination_path} /java_gapic_srcjar_raw.srcjar.zip" \
126
- " --java_gapic_opt=$( get_gapic_opts) " \
127
- ${proto_files} ${gapic_additional_protos}
131
+ if [[ " ${proto_only} " == " false" ]]; then
132
+ " $protoc_path " /protoc --experimental_allow_proto3_optional \
133
+ " --plugin=protoc-gen-java_gapic=${script_dir} /gapic-generator-java-wrapper" \
134
+ " --java_gapic_out=metadata:${destination_path} /java_gapic_srcjar_raw.srcjar.zip" \
135
+ " --java_gapic_opt=$( get_gapic_opts) " \
136
+ ${proto_files} ${gapic_additional_protos}
128
137
129
- unzip -o -q " ${destination_path} /java_gapic_srcjar_raw.srcjar.zip" -d " ${destination_path} "
130
- # Sync'\''d to the output file name in Writer.java.
131
- unzip -o -q " ${destination_path} /temp-codegen.srcjar" -d " ${destination_path} /java_gapic_srcjar"
132
- # Resource name source files.
133
- proto_dir=${destination_path} /java_gapic_srcjar/proto/src/main/java
134
- if [ ! -d " ${proto_dir} " ]; then
135
- # Some APIs don'\' 't have resource name helpers, like BigQuery v2.
136
- # Create an empty file so we can finish building. Gating the resource name rule definition
137
- # on file existences go against Bazel'\'' s design patterns, so we'\' 'll simply delete all empty
138
- # files during the final packaging process (see java_gapic_pkg.bzl)
139
- mkdir -p " ${proto_dir} "
140
- touch " ${proto_dir} " /PlaceholderFile.java
141
- fi
142
-
143
- # move java_gapic_srcjar/src/main to gapic-*/src.
144
- mv_src_files " gapic " " main"
145
- # remove empty files in gapic-*/src/main/java
146
- remove_empty_files " gapic"
147
- # move java_gapic_srcjar/src/test to gapic-*/src
148
- mv_src_files " gapic " " test "
149
- if [ " ${include_samples} " == " true " ] ; then
150
- # move java_gapic_srcjar/samples/snippets to samples/snippets
151
- mv_src_files " samples " " main "
138
+ unzip -o -q " ${destination_path} /java_gapic_srcjar_raw.srcjar.zip" -d " ${destination_path} "
139
+ # Sync'\''d to the output file name in Writer.java.
140
+ unzip -o -q " ${destination_path} /temp-codegen.srcjar" -d " ${destination_path} /java_gapic_srcjar"
141
+ # Resource name source files.
142
+ proto_dir=${destination_path} /java_gapic_srcjar/proto/src/main/java
143
+ if [ ! -d " ${proto_dir} " ]; then
144
+ # Some APIs don't have resource name helpers, like BigQuery v2.
145
+ # Create an empty file so we can finish building. Gating the resource name rule definition
146
+ # on file existences go against Bazel's design patterns, so we'll simply delete all empty
147
+ # files during the final packaging process (see java_gapic_pkg.bzl)
148
+ mkdir -p " ${proto_dir} "
149
+ touch " ${proto_dir} " /PlaceholderFile.java
150
+ fi
151
+ # move java_gapic_srcjar/src/main to gapic-*/src.
152
+ mv_src_files " gapic" " main "
153
+ # remove empty files in gapic-*/src/ main/java
154
+ remove_empty_files " gapic"
155
+ # move java_gapic_srcjar/src/test to gapic-*/src
156
+ mv_src_files " gapic" " test "
157
+ if [ " ${include_samples} " == " true " ] ; then
158
+ # move java_gapic_srcjar/samples/snippets to samples/snippets
159
+ mv_src_files " samples" " main "
160
+ fi
152
161
fi
153
162
# #################### Section 3 #####################
154
163
# generate proto-*/
155
164
# ####################################################
156
165
" $protoc_path " /protoc " --java_out=${destination_path} /java_proto.jar" ${proto_files}
157
- # move java_gapic_srcjar/proto/src/main/java (generated resource name helper class)
158
- # to proto-*/src/main
159
- mv_src_files " proto" " main"
166
+ if [[ " ${proto_only} " == " false" ]]; then
167
+ # move java_gapic_srcjar/proto/src/main/java (generated resource name helper class)
168
+ # to proto-*/src/main
169
+ mv_src_files " proto" " main"
170
+ fi
160
171
# unzip java_proto.jar to proto-*/src/main/java
161
172
unzip_src_files " proto"
162
173
# remove empty files in proto-*/src/main/java
0 commit comments