From 89cf5a409355ec4dd2083da0fcf01e964606d219 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 2 Oct 2017 13:19:56 -0700 Subject: [PATCH] Eliminate gRPC-Core umbrella header warning by tweaking module.modulemap and excluding some files for other build systems --- gRPC-Core.podspec | 11 ---- include/grpc/module.modulemap | 63 ++++++++++++++++++- templates/gRPC-Core.podspec.template | 10 ++- .../include/grpc/module.modulemap.template | 32 ++++++++++ 4 files changed, 101 insertions(+), 15 deletions(-) create mode 100644 templates/include/grpc/module.modulemap.template diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index c76b9a3f4bd51..d34c271dbaf65 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -105,8 +105,6 @@ Pod::Spec.new do |s| ss.source_files = 'include/grpc/support/alloc.h', 'include/grpc/support/atm.h', 'include/grpc/support/atm_gcc_atomic.h', - 'include/grpc/support/atm_gcc_sync.h', - 'include/grpc/support/atm_windows.h', 'include/grpc/support/avl.h', 'include/grpc/support/cmdline.h', 'include/grpc/support/cpu.h', @@ -121,18 +119,13 @@ Pod::Spec.new do |s| 'include/grpc/support/sync_custom.h', 'include/grpc/support/sync_generic.h', 'include/grpc/support/sync_posix.h', - 'include/grpc/support/sync_windows.h', 'include/grpc/support/thd.h', 'include/grpc/support/time.h', 'include/grpc/support/tls.h', - 'include/grpc/support/tls_gcc.h', - 'include/grpc/support/tls_msvc.h', 'include/grpc/support/tls_pthread.h', 'include/grpc/support/useful.h', 'include/grpc/impl/codegen/atm.h', 'include/grpc/impl/codegen/atm_gcc_atomic.h', - 'include/grpc/impl/codegen/atm_gcc_sync.h', - 'include/grpc/impl/codegen/atm_windows.h', 'include/grpc/impl/codegen/gpr_slice.h', 'include/grpc/impl/codegen/gpr_types.h', 'include/grpc/impl/codegen/port_platform.h', @@ -140,7 +133,6 @@ Pod::Spec.new do |s| 'include/grpc/impl/codegen/sync_custom.h', 'include/grpc/impl/codegen/sync_generic.h', 'include/grpc/impl/codegen/sync_posix.h', - 'include/grpc/impl/codegen/sync_windows.h', 'include/grpc/impl/codegen/byte_buffer.h', 'include/grpc/impl/codegen/byte_buffer_reader.h', 'include/grpc/impl/codegen/compression_types.h', @@ -152,8 +144,6 @@ Pod::Spec.new do |s| 'include/grpc/impl/codegen/status.h', 'include/grpc/impl/codegen/atm.h', 'include/grpc/impl/codegen/atm_gcc_atomic.h', - 'include/grpc/impl/codegen/atm_gcc_sync.h', - 'include/grpc/impl/codegen/atm_windows.h', 'include/grpc/impl/codegen/gpr_slice.h', 'include/grpc/impl/codegen/gpr_types.h', 'include/grpc/impl/codegen/port_platform.h', @@ -161,7 +151,6 @@ Pod::Spec.new do |s| 'include/grpc/impl/codegen/sync_custom.h', 'include/grpc/impl/codegen/sync_generic.h', 'include/grpc/impl/codegen/sync_posix.h', - 'include/grpc/impl/codegen/sync_windows.h', 'include/grpc/grpc_security.h', 'include/grpc/byte_buffer.h', 'include/grpc/byte_buffer_reader.h', diff --git a/include/grpc/module.modulemap b/include/grpc/module.modulemap index 51bfef2cc93d6..226cc6cf87143 100644 --- a/include/grpc/module.modulemap +++ b/include/grpc/module.modulemap @@ -1,12 +1,69 @@ + framework module grpc { umbrella header "grpc.h" - header "byte_buffer_reader.h" - header "grpc_security.h" - header "grpc_security_constants.h" header "support/alloc.h" + header "support/atm.h" + header "support/atm_gcc_atomic.h" + header "support/avl.h" + header "support/cmdline.h" + header "support/cpu.h" + header "support/histogram.h" + header "support/host_port.h" + header "support/log.h" + header "support/log_windows.h" header "support/port_platform.h" header "support/string_util.h" + header "support/subprocess.h" + header "support/sync.h" + header "support/sync_custom.h" + header "support/sync_generic.h" + header "support/sync_posix.h" + header "support/thd.h" + header "support/time.h" + header "support/tls.h" + header "support/tls_pthread.h" + header "support/useful.h" + header "impl/codegen/atm.h" + header "impl/codegen/atm_gcc_atomic.h" + header "impl/codegen/gpr_slice.h" + header "impl/codegen/gpr_types.h" + header "impl/codegen/port_platform.h" + header "impl/codegen/sync.h" + header "impl/codegen/sync_custom.h" + header "impl/codegen/sync_generic.h" + header "impl/codegen/sync_posix.h" + header "impl/codegen/byte_buffer.h" + header "impl/codegen/byte_buffer_reader.h" + header "impl/codegen/compression_types.h" + header "impl/codegen/connectivity_state.h" + header "impl/codegen/exec_ctx_fwd.h" + header "impl/codegen/grpc_types.h" + header "impl/codegen/propagation_bits.h" + header "impl/codegen/slice.h" + header "impl/codegen/status.h" + header "impl/codegen/atm.h" + header "impl/codegen/atm_gcc_atomic.h" + header "impl/codegen/gpr_slice.h" + header "impl/codegen/gpr_types.h" + header "impl/codegen/port_platform.h" + header "impl/codegen/sync.h" + header "impl/codegen/sync_custom.h" + header "impl/codegen/sync_generic.h" + header "impl/codegen/sync_posix.h" + header "grpc_security.h" + header "byte_buffer.h" + header "byte_buffer_reader.h" + header "compression.h" + header "grpc.h" + header "grpc_posix.h" + header "grpc_security_constants.h" + header "load_reporting.h" + header "slice.h" + header "slice_buffer.h" + header "status.h" + header "support/workaround_list.h" + header "census.h" export * module * { export * } diff --git a/templates/gRPC-Core.podspec.template b/templates/gRPC-Core.podspec.template index 6077f8098dd16..2281484917281 100644 --- a/templates/gRPC-Core.podspec.template +++ b/templates/gRPC-Core.podspec.template @@ -31,11 +31,19 @@ return [f for f in out if not f.startswith("third_party/nanopb/")] def grpc_public_headers(libs): + excluded_files = ["include/grpc/support/atm_gcc_sync.h", + "include/grpc/support/atm_windows.h", + "include/grpc/support/sync_windows.h", + "include/grpc/support/tls_gcc.h", + "include/grpc/support/tls_msvc.h", + "include/grpc/impl/codegen/atm_gcc_sync.h", + "include/grpc/impl/codegen/atm_windows.h", + "include/grpc/impl/codegen/sync_windows.h"] out = [] for lib in libs: if lib.name in ("grpc", "gpr"): out += lib.get('public_headers', []) - return out + return [f for f in out if not f in excluded_files] def grpc_private_headers(libs): out = [] diff --git a/templates/include/grpc/module.modulemap.template b/templates/include/grpc/module.modulemap.template new file mode 100644 index 0000000000000..8edc4b56acddb --- /dev/null +++ b/templates/include/grpc/module.modulemap.template @@ -0,0 +1,32 @@ +%YAML 1.2 +--- | + <%! + def grpc_public_headers_no_dir(libs): + excluded_files = ["include/grpc/support/atm_gcc_sync.h", + "include/grpc/support/atm_windows.h", + "include/grpc/support/sync_windows.h", + "include/grpc/support/tls_gcc.h", + "include/grpc/support/tls_msvc.h", + "include/grpc/impl/codegen/atm_gcc_sync.h", + "include/grpc/impl/codegen/atm_windows.h", + "include/grpc/impl/codegen/sync_windows.h"] + out = [] + for lib in libs: + if lib.name in ("grpc", "gpr"): + out += lib.get('public_headers', []) + out = [f for f in out if f not in excluded_files] + out = [hdr.split('/', 2)[2] for hdr in out] + return out + + def header_lines(files): + return ('\n ').join('header "%s"' % f for f in files) + %> + framework module grpc { + umbrella header "grpc.h" + + ${header_lines(grpc_public_headers_no_dir(libs))} + + export * + module * { export * } + } +