@@ -172,6 +172,7 @@ void GenerateScaffold(
172172 {" quickstart/Makefile" , GenerateQuickstartMakefile},
173173 {" quickstart/WORKSPACE.bazel" , GenerateQuickstartWorkspace},
174174 {" quickstart/BUILD.bazel" , GenerateQuickstartBuild},
175+ {" quickstart/.bazelrc" , GenerateQuickstartBazelrc},
175176 };
176177
177178 auto const vars = ScaffoldVars (googleapis_path, output_path, service);
@@ -1093,6 +1094,37 @@ cc_binary(
10931094 printer.Print (variables, kText );
10941095}
10951096
1097+ void GenerateQuickstartBazelrc (
1098+ std::ostream& os, std::map<std::string, std::string> const & variables) {
1099+ auto constexpr kText = R"""( # Copyright $copyright_year$ Google LLC
1100+ #
1101+ # Licensed under the Apache License, Version 2.0 (the "License");
1102+ # you may not use this file except in compliance with the License.
1103+ # You may obtain a copy of the License at
1104+ #
1105+ # https://www.apache.org/licenses/LICENSE-2.0
1106+ #
1107+ # Unless required by applicable law or agreed to in writing, software
1108+ # distributed under the License is distributed on an "AS IS" BASIS,
1109+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1110+ # See the License for the specific language governing permissions and
1111+ # limitations under the License.
1112+
1113+ # To workaround a bug in Bazel [1], gRPC requires this flag on macOS builds,
1114+ # and there is (AFAIK) no way to "inherit" their definitions.
1115+ # [1]: https://github.com/bazelbuild/bazel/issues/4341
1116+ build --copt=-DGRPC_BAZEL_BUILD
1117+
1118+ # Do not create the convenience links, they are inconvenient when the build
1119+ # runs inside a docker image or if one builds a quickstart and then builds
1120+ # the project separately.
1121+ build --experimental_convenience_symlinks=ignore
1122+ )""" ;
1123+ google::protobuf::io::OstreamOutputStream output (&os);
1124+ google::protobuf::io::Printer printer (&output, ' $' );
1125+ printer.Print (variables, kText );
1126+ }
1127+
10961128} // namespace generator_internal
10971129} // namespace cloud
10981130} // namespace google
0 commit comments