From a28039cfa588800ba584cb6beb59b4203efb618e Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Thu, 9 Jan 2020 14:54:16 -0800 Subject: [PATCH] Add absl support --- packages/grpc-native-core/package.json | 2 +- .../grpc-native-core/templates/binding.gyp.template | 12 +++++++++--- .../grpc-native-core/templates/package.json.template | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/grpc-native-core/package.json b/packages/grpc-native-core/package.json index 6530430e..311054c6 100644 --- a/packages/grpc-native-core/package.json +++ b/packages/grpc-native-core/package.json @@ -68,7 +68,7 @@ "deps/grpc/include/grpc/**/*.h", "deps/grpc/src/core/**/*.{c,cc,h}", "deps/grpc/src/boringssl/err_data.c", - "deps/grpc/third_party/abseil-cpp/absl/**/*.{h,hh,inc}", + "deps/grpc/third_party/abseil-cpp/absl/**/*.{cc,h,inc}", "deps/grpc/third_party/boringssl/crypto/**/*.{c,cc,h}", "deps/grpc/third_party/boringssl/include/**/*.{c,cc,h}", "deps/grpc/third_party/boringssl/ssl/**/*.{c,cc,h}", diff --git a/packages/grpc-native-core/templates/binding.gyp.template b/packages/grpc-native-core/templates/binding.gyp.template index bd73397c..c3fa37b4 100644 --- a/packages/grpc-native-core/templates/binding.gyp.template +++ b/packages/grpc-native-core/templates/binding.gyp.template @@ -20,7 +20,13 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - + <% + def gyp_target_name(lib_name): + if lib_name.startswith("absl/"): + return lib_name.replace("/", "__").replace(":", "__") + else: + return lib_name + %> # Some of this file is built with the help of # https://n8.io/converting-a-c-library-to-gyp/ { @@ -332,12 +338,12 @@ % for lib in libs: % if lib.name == core.name or (lib.name in core.transitive_deps and lib.name not in ('boringssl', 'z')): { - 'target_name': '${lib.name}', + 'target_name': '${gyp_target_name(lib.name)}', 'product_prefix': 'lib', 'type': 'static_library', 'dependencies': [ % for dep in getattr(lib, 'deps', []): - '${dep}', + '${gyp_target_name(dep)}', % endfor ], 'sources': [ diff --git a/packages/grpc-native-core/templates/package.json.template b/packages/grpc-native-core/templates/package.json.template index 91ae513a..515614db 100644 --- a/packages/grpc-native-core/templates/package.json.template +++ b/packages/grpc-native-core/templates/package.json.template @@ -70,7 +70,7 @@ "deps/grpc/include/grpc/**/*.h", "deps/grpc/src/core/**/*.{c,cc,h}", "deps/grpc/src/boringssl/err_data.c", - "deps/grpc/third_party/abseil-cpp/absl/**/*.{h,hh,inc}", + "deps/grpc/third_party/abseil-cpp/absl/**/*.{cc,h,inc}", "deps/grpc/third_party/boringssl/crypto/**/*.{c,cc,h}", "deps/grpc/third_party/boringssl/include/**/*.{c,cc,h}", "deps/grpc/third_party/boringssl/ssl/**/*.{c,cc,h}",