[build metadata] Bazel to "other build systems" improvements (#33803)

- Extract build metadata for some external dependencies from bazel
build. This is achieved by letting extract_metadata_from_bazel_xml.py
analyze some external libraries and sources. The logic is basically the
same as for internal libraries, I only needed to teach
extract_metadata_from_bazel_xml.py which external libraries it is
allowed to analyze.
* currently, the list of source files is automatically determined for
`z`, `upb`, `re2` and `gtest` dependencies (at least for the case where
we're building in "embedded" mode - e.g. mostly native extensions for
python, php, ruby etc. - cmake has the ability to replace some of these
dependencies by actual cmake dependency.)
- Eliminate the need for manually written gen_build_yaml.py for some
dependencies.
- Make the info on target dependencies in build_autogenerated.yaml more
accurate and complete. Until now, there were some depdendencies that
were allowed to show up in build_autogenerated.yaml and some that were
being skipped. This made generating the CMakeLists.txt and Makefile
quite confusing (since some dependencies are being explicitly mentioned
and some had to be assumed by the build system).
- Overhaul the Makefile
* the Makefile is currently only used internally (e.g. for ruby and PHP
builds)
* until now, the makefile wasn't really using the info about which
targets depend on what libraries, but it was effectively hardcoding the
depedendency data (by magically "knowing" what is the list of all the
stuff that e.g. "grpc" depends on).
* After the overhaul, the Makefile.template now actually looks at the
library dependencies and uses them when generating the makefile. This
gives a more correct and easier to maintain makefile.
* since csharp is no longer on the master branch, remove all mentions of
"csharp" targets in the Makefile.

Other notable changes:
- make extract_metadata_from_bazel_xml.py capable of resolving workspace
bind() rules (so that it knows the real name of the target that is
referred to as e.g. `//external:xyz`)

TODO:
- [DONE] ~~pkgconfig C++ distribtest~~
- [DONE} ~~update third_party/README to reflect changes in how some deps
get updated now.~~


Planned followups:
- cleanup naming of some targets in build metadata and buildsystem
templates: libssl vs boringssl, ares vs cares etc.
- further cleanup of Makefile
- further cleanup of CMakeLists.txt
- remote the need from manually hardcoding extra metadata for targets in
build_autogenerated.yaml. Either add logic that determines the
properties of targets automatically, or use metadata from bazel BUILD.
pull/34079/head^2
Jan Tattermusch 1 year ago committed by GitHub
parent 4c3ff07dac
commit a8508ec465
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2747
      CMakeLists.txt
  2. 754
      Makefile
  3. 75
      Package.swift
  4. 1060
      build_autogenerated.yaml
  5. 1
      config.m4
  6. 5
      config.w32
  7. 38
      gRPC-C++.podspec
  8. 50
      gRPC-Core.podspec
  9. 11
      grpc.gemspec
  10. 328
      grpc.gyp
  11. 11
      package.xml
  12. 5
      src/python/grpcio/grpc_core_dependencies.py
  13. 48
      src/re2/gen_build_yaml.py
  14. 199
      src/upb/gen_build_yaml.py
  15. 58
      src/zlib/gen_build_yaml.py
  16. 174
      templates/CMakeLists.txt.template
  17. 299
      templates/Makefile.template
  18. 9
      templates/config.m4.template
  19. 8
      templates/config.w32.template
  20. 21
      templates/gRPC-C++.podspec.template
  21. 21
      templates/gRPC-Core.podspec.template
  22. 5
      templates/grpc.gemspec.template
  23. 9
      templates/package.xml.template
  24. 7
      third_party/README.md
  25. 245
      tools/buildgen/extract_metadata_from_bazel_xml.py
  26. 3
      tools/buildgen/generate_build_additions.sh
  27. 10
      tools/buildgen/plugins/transitive_dependencies.py

2747
CMakeLists.txt generated

File diff suppressed because it is too large Load Diff

754
Makefile generated

File diff suppressed because it is too large Load Diff

75
Package.swift generated

@ -1803,18 +1803,12 @@ let package = Package(
"third_party/re2/re2/unicode_groups.cc",
"third_party/re2/re2/unicode_groups.h",
"third_party/re2/re2/walker-inl.h",
"third_party/re2/util/benchmark.h",
"third_party/re2/util/flags.h",
"third_party/re2/util/logging.h",
"third_party/re2/util/malloc_counter.h",
"third_party/re2/util/mix.h",
"third_party/re2/util/mutex.h",
"third_party/re2/util/pcre.cc",
"third_party/re2/util/pcre.h",
"third_party/re2/util/rune.cc",
"third_party/re2/util/strutil.cc",
"third_party/re2/util/strutil.h",
"third_party/re2/util/test.h",
"third_party/re2/util/utf.h",
"third_party/re2/util/util.h",
"third_party/upb/upb/alloc.h",
@ -1836,20 +1830,12 @@ let package = Package(
"third_party/upb/upb/collections/map_sorter_internal.h",
"third_party/upb/upb/collections/message_value.h",
"third_party/upb/upb/decode.h",
"third_party/upb/upb/def.h",
"third_party/upb/upb/def.hpp",
"third_party/upb/upb/encode.h",
"third_party/upb/upb/extension_registry.h",
"third_party/upb/upb/hash/common.c",
"third_party/upb/upb/hash/common.h",
"third_party/upb/upb/hash/int_table.h",
"third_party/upb/upb/hash/str_table.h",
"third_party/upb/upb/json/decode.c",
"third_party/upb/upb/json/decode.h",
"third_party/upb/upb/json/encode.c",
"third_party/upb/upb/json/encode.h",
"third_party/upb/upb/json_decode.h",
"third_party/upb/upb/json_encode.h",
"third_party/upb/upb/lex/atoi.c",
"third_party/upb/upb/lex/atoi.h",
"third_party/upb/upb/lex/round_trip.c",
@ -1864,14 +1850,10 @@ let package = Package(
"third_party/upb/upb/mem/arena.c",
"third_party/upb/upb/mem/arena.h",
"third_party/upb/upb/mem/arena_internal.h",
"third_party/upb/upb/message/accessors.c",
"third_party/upb/upb/message/accessors.h",
"third_party/upb/upb/message/accessors_internal.h",
"third_party/upb/upb/message/extension_internal.h",
"third_party/upb/upb/message/internal.h",
"third_party/upb/upb/message/message.c",
"third_party/upb/upb/message/message.h",
"third_party/upb/upb/mini_table.h",
"third_party/upb/upb/mini_table/common.c",
"third_party/upb/upb/mini_table/common.h",
"third_party/upb/upb/mini_table/common_internal.h",
@ -1894,61 +1876,8 @@ let package = Package(
"third_party/upb/upb/port/def.inc",
"third_party/upb/upb/port/undef.inc",
"third_party/upb/upb/port/vsnprintf_compat.h",
"third_party/upb/upb/reflection.h",
"third_party/upb/upb/reflection.hpp",
"third_party/upb/upb/reflection/common.h",
"third_party/upb/upb/reflection/def.h",
"third_party/upb/upb/reflection/def.hpp",
"third_party/upb/upb/reflection/def_builder.c",
"third_party/upb/upb/reflection/def_builder_internal.h",
"third_party/upb/upb/reflection/def_pool.c",
"third_party/upb/upb/reflection/def_pool.h",
"third_party/upb/upb/reflection/def_pool_internal.h",
"third_party/upb/upb/reflection/def_type.c",
"third_party/upb/upb/reflection/def_type.h",
"third_party/upb/upb/reflection/desc_state.c",
"third_party/upb/upb/reflection/desc_state_internal.h",
"third_party/upb/upb/reflection/enum_def.c",
"third_party/upb/upb/reflection/enum_def.h",
"third_party/upb/upb/reflection/enum_def_internal.h",
"third_party/upb/upb/reflection/enum_reserved_range.c",
"third_party/upb/upb/reflection/enum_reserved_range.h",
"third_party/upb/upb/reflection/enum_reserved_range_internal.h",
"third_party/upb/upb/reflection/enum_value_def.c",
"third_party/upb/upb/reflection/enum_value_def.h",
"third_party/upb/upb/reflection/enum_value_def_internal.h",
"third_party/upb/upb/reflection/extension_range.c",
"third_party/upb/upb/reflection/extension_range.h",
"third_party/upb/upb/reflection/extension_range_internal.h",
"third_party/upb/upb/reflection/field_def.c",
"third_party/upb/upb/reflection/field_def.h",
"third_party/upb/upb/reflection/field_def_internal.h",
"third_party/upb/upb/reflection/file_def.c",
"third_party/upb/upb/reflection/file_def.h",
"third_party/upb/upb/reflection/file_def_internal.h",
"third_party/upb/upb/reflection/message.c",
"third_party/upb/upb/reflection/message.h",
"third_party/upb/upb/reflection/message.hpp",
"third_party/upb/upb/reflection/message_def.c",
"third_party/upb/upb/reflection/message_def.h",
"third_party/upb/upb/reflection/message_def_internal.h",
"third_party/upb/upb/reflection/message_reserved_range.c",
"third_party/upb/upb/reflection/message_reserved_range.h",
"third_party/upb/upb/reflection/message_reserved_range_internal.h",
"third_party/upb/upb/reflection/method_def.c",
"third_party/upb/upb/reflection/method_def.h",
"third_party/upb/upb/reflection/method_def_internal.h",
"third_party/upb/upb/reflection/oneof_def.c",
"third_party/upb/upb/reflection/oneof_def.h",
"third_party/upb/upb/reflection/oneof_def_internal.h",
"third_party/upb/upb/reflection/service_def.c",
"third_party/upb/upb/reflection/service_def.h",
"third_party/upb/upb/reflection/service_def_internal.h",
"third_party/upb/upb/status.h",
"third_party/upb/upb/string_view.h",
"third_party/upb/upb/text/encode.c",
"third_party/upb/upb/text/encode.h",
"third_party/upb/upb/text_encode.h",
"third_party/upb/upb/upb.h",
"third_party/upb/upb/upb.hpp",
"third_party/upb/upb/wire/common.h",
@ -1966,10 +1895,6 @@ let package = Package(
"third_party/upb/upb/wire/reader.h",
"third_party/upb/upb/wire/swap_internal.h",
"third_party/upb/upb/wire/types.h",
"third_party/utf8_range/naive.c",
"third_party/utf8_range/range2-neon.c",
"third_party/utf8_range/range2-sse.c",
"third_party/utf8_range/utf8_range.h",
"third_party/xxhash/xxhash.h",
],
publicHeadersPath: "spm-core-include",

File diff suppressed because it is too large Load Diff

1
config.m4 generated

@ -1281,7 +1281,6 @@ if test "$PHP_GRPC" != "no"; then
third_party/re2/re2/tostring.cc \
third_party/re2/re2/unicode_casefold.cc \
third_party/re2/re2/unicode_groups.cc \
third_party/re2/util/pcre.cc \
third_party/re2/util/rune.cc \
third_party/re2/util/strutil.cc \
third_party/upb/upb/base/status.c \

5
config.w32 generated

@ -1246,7 +1246,6 @@ if (PHP_GRPC != "no") {
"third_party\\re2\\re2\\tostring.cc " +
"third_party\\re2\\re2\\unicode_casefold.cc " +
"third_party\\re2\\re2\\unicode_groups.cc " +
"third_party\\re2\\util\\pcre.cc " +
"third_party\\re2\\util\\rune.cc " +
"third_party\\re2\\util\\strutil.cc " +
"third_party\\upb\\upb\\base\\status.c " +
@ -1297,10 +1296,6 @@ if (PHP_GRPC != "no") {
"third_party\\zlib\\compress.c " +
"third_party\\zlib\\crc32.c " +
"third_party\\zlib\\deflate.c " +
"third_party\\zlib\\gzclose.c " +
"third_party\\zlib\\gzlib.c " +
"third_party\\zlib\\gzread.c " +
"third_party\\zlib\\gzwrite.c " +
"third_party\\zlib\\infback.c " +
"third_party\\zlib\\inffast.c " +
"third_party\\zlib\\inflate.c " +

38
gRPC-C++.podspec generated

@ -1190,15 +1190,10 @@ Pod::Spec.new do |s|
'third_party/re2/re2/unicode_casefold.h',
'third_party/re2/re2/unicode_groups.h',
'third_party/re2/re2/walker-inl.h',
'third_party/re2/util/benchmark.h',
'third_party/re2/util/flags.h',
'third_party/re2/util/logging.h',
'third_party/re2/util/malloc_counter.h',
'third_party/re2/util/mix.h',
'third_party/re2/util/mutex.h',
'third_party/re2/util/pcre.h',
'third_party/re2/util/strutil.h',
'third_party/re2/util/test.h',
'third_party/re2/util/utf.h',
'third_party/re2/util/util.h',
'third_party/upb/upb/alloc.h',
@ -1240,7 +1235,6 @@ Pod::Spec.new do |s|
'third_party/upb/upb/message/extension_internal.h',
'third_party/upb/upb/message/internal.h',
'third_party/upb/upb/message/message.h',
'third_party/upb/upb/mini_table.h',
'third_party/upb/upb/mini_table/common.h',
'third_party/upb/upb/mini_table/common_internal.h',
'third_party/upb/upb/mini_table/decode.h',
@ -1310,7 +1304,18 @@ Pod::Spec.new do |s|
'third_party/upb/upb/wire/swap_internal.h',
'third_party/upb/upb/wire/types.h',
'third_party/utf8_range/utf8_range.h',
'third_party/xxhash/xxhash.h'
'third_party/xxhash/xxhash.h',
'third_party/zlib/crc32.h',
'third_party/zlib/deflate.h',
'third_party/zlib/gzguts.h',
'third_party/zlib/inffast.h',
'third_party/zlib/inffixed.h',
'third_party/zlib/inflate.h',
'third_party/zlib/inftrees.h',
'third_party/zlib/trees.h',
'third_party/zlib/zconf.h',
'third_party/zlib/zlib.h',
'third_party/zlib/zutil.h'
ss.private_header_files = 'src/core/ext/filters/backend_metrics/backend_metric_filter.h',
'src/core/ext/filters/backend_metrics/backend_metric_provider.h',
@ -2193,15 +2198,10 @@ Pod::Spec.new do |s|
'third_party/re2/re2/unicode_casefold.h',
'third_party/re2/re2/unicode_groups.h',
'third_party/re2/re2/walker-inl.h',
'third_party/re2/util/benchmark.h',
'third_party/re2/util/flags.h',
'third_party/re2/util/logging.h',
'third_party/re2/util/malloc_counter.h',
'third_party/re2/util/mix.h',
'third_party/re2/util/mutex.h',
'third_party/re2/util/pcre.h',
'third_party/re2/util/strutil.h',
'third_party/re2/util/test.h',
'third_party/re2/util/utf.h',
'third_party/re2/util/util.h',
'third_party/upb/upb/alloc.h',
@ -2243,7 +2243,6 @@ Pod::Spec.new do |s|
'third_party/upb/upb/message/extension_internal.h',
'third_party/upb/upb/message/internal.h',
'third_party/upb/upb/message/message.h',
'third_party/upb/upb/mini_table.h',
'third_party/upb/upb/mini_table/common.h',
'third_party/upb/upb/mini_table/common_internal.h',
'third_party/upb/upb/mini_table/decode.h',
@ -2313,7 +2312,18 @@ Pod::Spec.new do |s|
'third_party/upb/upb/wire/swap_internal.h',
'third_party/upb/upb/wire/types.h',
'third_party/utf8_range/utf8_range.h',
'third_party/xxhash/xxhash.h'
'third_party/xxhash/xxhash.h',
'third_party/zlib/crc32.h',
'third_party/zlib/deflate.h',
'third_party/zlib/gzguts.h',
'third_party/zlib/inffast.h',
'third_party/zlib/inffixed.h',
'third_party/zlib/inflate.h',
'third_party/zlib/inftrees.h',
'third_party/zlib/trees.h',
'third_party/zlib/zconf.h',
'third_party/zlib/zlib.h',
'third_party/zlib/zutil.h'
end
s.subspec 'Protobuf' do |ss|

50
gRPC-Core.podspec generated

@ -1900,18 +1900,12 @@ Pod::Spec.new do |s|
'third_party/re2/re2/unicode_groups.cc',
'third_party/re2/re2/unicode_groups.h',
'third_party/re2/re2/walker-inl.h',
'third_party/re2/util/benchmark.h',
'third_party/re2/util/flags.h',
'third_party/re2/util/logging.h',
'third_party/re2/util/malloc_counter.h',
'third_party/re2/util/mix.h',
'third_party/re2/util/mutex.h',
'third_party/re2/util/pcre.cc',
'third_party/re2/util/pcre.h',
'third_party/re2/util/rune.cc',
'third_party/re2/util/strutil.cc',
'third_party/re2/util/strutil.h',
'third_party/re2/util/test.h',
'third_party/re2/util/utf.h',
'third_party/re2/util/util.h',
'third_party/upb/upb/alloc.h',
@ -1968,7 +1962,6 @@ Pod::Spec.new do |s|
'third_party/upb/upb/message/internal.h',
'third_party/upb/upb/message/message.c',
'third_party/upb/upb/message/message.h',
'third_party/upb/upb/mini_table.h',
'third_party/upb/upb/mini_table/common.c',
'third_party/upb/upb/mini_table/common.h',
'third_party/upb/upb/mini_table/common_internal.h',
@ -2067,7 +2060,29 @@ Pod::Spec.new do |s|
'third_party/utf8_range/range2-neon.c',
'third_party/utf8_range/range2-sse.c',
'third_party/utf8_range/utf8_range.h',
'third_party/xxhash/xxhash.h'
'third_party/xxhash/xxhash.h',
'third_party/zlib/adler32.c',
'third_party/zlib/compress.c',
'third_party/zlib/crc32.c',
'third_party/zlib/crc32.h',
'third_party/zlib/deflate.c',
'third_party/zlib/deflate.h',
'third_party/zlib/gzguts.h',
'third_party/zlib/infback.c',
'third_party/zlib/inffast.c',
'third_party/zlib/inffast.h',
'third_party/zlib/inffixed.h',
'third_party/zlib/inflate.c',
'third_party/zlib/inflate.h',
'third_party/zlib/inftrees.c',
'third_party/zlib/inftrees.h',
'third_party/zlib/trees.c',
'third_party/zlib/trees.h',
'third_party/zlib/uncompr.c',
'third_party/zlib/zconf.h',
'third_party/zlib/zlib.h',
'third_party/zlib/zutil.c',
'third_party/zlib/zutil.h'
ss.private_header_files = 'src/core/ext/filters/backend_metrics/backend_metric_filter.h',
'src/core/ext/filters/backend_metrics/backend_metric_provider.h',
'src/core/ext/filters/channel_idle/channel_idle_filter.h',
@ -2917,15 +2932,10 @@ Pod::Spec.new do |s|
'third_party/re2/re2/unicode_casefold.h',
'third_party/re2/re2/unicode_groups.h',
'third_party/re2/re2/walker-inl.h',
'third_party/re2/util/benchmark.h',
'third_party/re2/util/flags.h',
'third_party/re2/util/logging.h',
'third_party/re2/util/malloc_counter.h',
'third_party/re2/util/mix.h',
'third_party/re2/util/mutex.h',
'third_party/re2/util/pcre.h',
'third_party/re2/util/strutil.h',
'third_party/re2/util/test.h',
'third_party/re2/util/utf.h',
'third_party/re2/util/util.h',
'third_party/upb/upb/alloc.h',
@ -2967,7 +2977,6 @@ Pod::Spec.new do |s|
'third_party/upb/upb/message/extension_internal.h',
'third_party/upb/upb/message/internal.h',
'third_party/upb/upb/message/message.h',
'third_party/upb/upb/mini_table.h',
'third_party/upb/upb/mini_table/common.h',
'third_party/upb/upb/mini_table/common_internal.h',
'third_party/upb/upb/mini_table/decode.h',
@ -3037,7 +3046,18 @@ Pod::Spec.new do |s|
'third_party/upb/upb/wire/swap_internal.h',
'third_party/upb/upb/wire/types.h',
'third_party/utf8_range/utf8_range.h',
'third_party/xxhash/xxhash.h'
'third_party/xxhash/xxhash.h',
'third_party/zlib/crc32.h',
'third_party/zlib/deflate.h',
'third_party/zlib/gzguts.h',
'third_party/zlib/inffast.h',
'third_party/zlib/inffixed.h',
'third_party/zlib/inflate.h',
'third_party/zlib/inftrees.h',
'third_party/zlib/trees.h',
'third_party/zlib/zconf.h',
'third_party/zlib/zlib.h',
'third_party/zlib/zutil.h'
end
# CFStream is now default. Leaving this subspec only for compatibility purpose.

11
grpc.gemspec generated

@ -2781,18 +2781,12 @@ Gem::Specification.new do |s|
s.files += %w( third_party/re2/re2/unicode_groups.cc )
s.files += %w( third_party/re2/re2/unicode_groups.h )
s.files += %w( third_party/re2/re2/walker-inl.h )
s.files += %w( third_party/re2/util/benchmark.h )
s.files += %w( third_party/re2/util/flags.h )
s.files += %w( third_party/re2/util/logging.h )
s.files += %w( third_party/re2/util/malloc_counter.h )
s.files += %w( third_party/re2/util/mix.h )
s.files += %w( third_party/re2/util/mutex.h )
s.files += %w( third_party/re2/util/pcre.cc )
s.files += %w( third_party/re2/util/pcre.h )
s.files += %w( third_party/re2/util/rune.cc )
s.files += %w( third_party/re2/util/strutil.cc )
s.files += %w( third_party/re2/util/strutil.h )
s.files += %w( third_party/re2/util/test.h )
s.files += %w( third_party/re2/util/utf.h )
s.files += %w( third_party/re2/util/util.h )
s.files += %w( third_party/upb/upb/alloc.h )
@ -2849,7 +2843,6 @@ Gem::Specification.new do |s|
s.files += %w( third_party/upb/upb/message/internal.h )
s.files += %w( third_party/upb/upb/message/message.c )
s.files += %w( third_party/upb/upb/message/message.h )
s.files += %w( third_party/upb/upb/mini_table.h )
s.files += %w( third_party/upb/upb/mini_table/common.c )
s.files += %w( third_party/upb/upb/mini_table/common.h )
s.files += %w( third_party/upb/upb/mini_table/common_internal.h )
@ -2955,11 +2948,7 @@ Gem::Specification.new do |s|
s.files += %w( third_party/zlib/crc32.h )
s.files += %w( third_party/zlib/deflate.c )
s.files += %w( third_party/zlib/deflate.h )
s.files += %w( third_party/zlib/gzclose.c )
s.files += %w( third_party/zlib/gzguts.h )
s.files += %w( third_party/zlib/gzlib.c )
s.files += %w( third_party/zlib/gzread.c )
s.files += %w( third_party/zlib/gzwrite.c )
s.files += %w( third_party/zlib/infback.c )
s.files += %w( third_party/zlib/inffast.c )
s.files += %w( third_party/zlib/inffast.h )

328
grpc.gyp generated

@ -249,6 +249,10 @@
'target_name': 'grpc',
'type': 'static_library',
'dependencies': [
're2',
'upb_json_lib',
'upb_textformat_lib',
'z',
'absl/algorithm:container',
'absl/cleanup:cleanup',
'absl/container:flat_hash_map',
@ -261,9 +265,9 @@
'absl/status:statusor',
'absl/types:span',
'absl/utility:utility',
'cares',
'gpr',
'address_sorting',
'upb',
],
'sources': [
'src/core/ext/filters/backend_metrics/backend_metric_filter.cc',
@ -1087,6 +1091,9 @@
'target_name': 'grpc_unsecure',
'type': 'static_library',
'dependencies': [
'upb_collections_lib',
'upb',
'z',
'absl/algorithm:container',
'absl/cleanup:cleanup',
'absl/container:flat_hash_map',
@ -1099,9 +1106,9 @@
'absl/status:statusor',
'absl/types:span',
'absl/utility:utility',
'cares',
'gpr',
'address_sorting',
'upb',
],
'sources': [
'src/core/ext/filters/backend_metrics/backend_metric_filter.cc',
@ -1483,6 +1490,204 @@
'src/core/tsi/transport_security_grpc.cc',
],
},
{
'target_name': 'gtest',
'type': 'static_library',
'dependencies': [
'absl/debugging:failure_signal_handler',
'absl/debugging:stacktrace',
'absl/debugging:symbolize',
'absl/strings:strings',
'absl/types:any',
'absl/types:optional',
'absl/types:variant',
],
'sources': [
'third_party/googletest/googlemock/src/gmock-cardinalities.cc',
'third_party/googletest/googlemock/src/gmock-internal-utils.cc',
'third_party/googletest/googlemock/src/gmock-matchers.cc',
'third_party/googletest/googlemock/src/gmock-spec-builders.cc',
'third_party/googletest/googlemock/src/gmock.cc',
'third_party/googletest/googletest/src/gtest-assertion-result.cc',
'third_party/googletest/googletest/src/gtest-death-test.cc',
'third_party/googletest/googletest/src/gtest-filepath.cc',
'third_party/googletest/googletest/src/gtest-matchers.cc',
'third_party/googletest/googletest/src/gtest-port.cc',
'third_party/googletest/googletest/src/gtest-printers.cc',
'third_party/googletest/googletest/src/gtest-test-part.cc',
'third_party/googletest/googletest/src/gtest-typed-test.cc',
'third_party/googletest/googletest/src/gtest.cc',
],
},
{
'target_name': 're2',
'type': 'static_library',
'dependencies': [
],
'sources': [
'third_party/re2/re2/bitstate.cc',
'third_party/re2/re2/compile.cc',
'third_party/re2/re2/dfa.cc',
'third_party/re2/re2/filtered_re2.cc',
'third_party/re2/re2/mimics_pcre.cc',
'third_party/re2/re2/nfa.cc',
'third_party/re2/re2/onepass.cc',
'third_party/re2/re2/parse.cc',
'third_party/re2/re2/perl_groups.cc',
'third_party/re2/re2/prefilter.cc',
'third_party/re2/re2/prefilter_tree.cc',
'third_party/re2/re2/prog.cc',
'third_party/re2/re2/re2.cc',
'third_party/re2/re2/regexp.cc',
'third_party/re2/re2/set.cc',
'third_party/re2/re2/simplify.cc',
'third_party/re2/re2/stringpiece.cc',
'third_party/re2/re2/tostring.cc',
'third_party/re2/re2/unicode_casefold.cc',
'third_party/re2/re2/unicode_groups.cc',
'third_party/re2/util/rune.cc',
'third_party/re2/util/strutil.cc',
],
},
{
'target_name': 'upb',
'type': 'static_library',
'dependencies': [
'utf8_range_lib',
],
'sources': [
'third_party/upb/upb/base/status.c',
'third_party/upb/upb/collections/array.c',
'third_party/upb/upb/collections/map.c',
'third_party/upb/upb/collections/map_sorter.c',
'third_party/upb/upb/hash/common.c',
'third_party/upb/upb/lex/atoi.c',
'third_party/upb/upb/lex/round_trip.c',
'third_party/upb/upb/lex/strtod.c',
'third_party/upb/upb/lex/unicode.c',
'third_party/upb/upb/mem/alloc.c',
'third_party/upb/upb/mem/arena.c',
'third_party/upb/upb/message/message.c',
'third_party/upb/upb/mini_table/common.c',
'third_party/upb/upb/mini_table/decode.c',
'third_party/upb/upb/mini_table/encode.c',
'third_party/upb/upb/mini_table/extension_registry.c',
'third_party/upb/upb/wire/decode.c',
'third_party/upb/upb/wire/decode_fast.c',
'third_party/upb/upb/wire/encode.c',
'third_party/upb/upb/wire/eps_copy_input_stream.c',
'third_party/upb/upb/wire/reader.c',
],
},
{
'target_name': 'upb_collections_lib',
'type': 'static_library',
'dependencies': [
],
'sources': [
'third_party/upb/upb/base/status.c',
'third_party/upb/upb/collections/array.c',
'third_party/upb/upb/collections/map.c',
'third_party/upb/upb/collections/map_sorter.c',
'third_party/upb/upb/hash/common.c',
'third_party/upb/upb/mem/alloc.c',
'third_party/upb/upb/mem/arena.c',
'third_party/upb/upb/message/message.c',
'third_party/upb/upb/mini_table/common.c',
'third_party/upb/upb/mini_table/decode.c',
'third_party/upb/upb/mini_table/encode.c',
'third_party/upb/upb/mini_table/extension_registry.c',
],
},
{
'target_name': 'upb_json_lib',
'type': 'static_library',
'dependencies': [
'upb_collections_lib',
'upb',
],
'sources': [
'src/core/ext/upb-generated/google/protobuf/descriptor.upb.c',
'third_party/upb/upb/json/decode.c',
'third_party/upb/upb/json/encode.c',
'third_party/upb/upb/message/accessors.c',
'third_party/upb/upb/reflection/def_builder.c',
'third_party/upb/upb/reflection/def_pool.c',
'third_party/upb/upb/reflection/def_type.c',
'third_party/upb/upb/reflection/desc_state.c',
'third_party/upb/upb/reflection/enum_def.c',
'third_party/upb/upb/reflection/enum_reserved_range.c',
'third_party/upb/upb/reflection/enum_value_def.c',
'third_party/upb/upb/reflection/extension_range.c',
'third_party/upb/upb/reflection/field_def.c',
'third_party/upb/upb/reflection/file_def.c',
'third_party/upb/upb/reflection/message.c',
'third_party/upb/upb/reflection/message_def.c',
'third_party/upb/upb/reflection/message_reserved_range.c',
'third_party/upb/upb/reflection/method_def.c',
'third_party/upb/upb/reflection/oneof_def.c',
'third_party/upb/upb/reflection/service_def.c',
],
},
{
'target_name': 'upb_textformat_lib',
'type': 'static_library',
'dependencies': [
'upb_collections_lib',
'upb',
],
'sources': [
'src/core/ext/upb-generated/google/protobuf/descriptor.upb.c',
'third_party/upb/upb/message/accessors.c',
'third_party/upb/upb/reflection/def_builder.c',
'third_party/upb/upb/reflection/def_pool.c',
'third_party/upb/upb/reflection/def_type.c',
'third_party/upb/upb/reflection/desc_state.c',
'third_party/upb/upb/reflection/enum_def.c',
'third_party/upb/upb/reflection/enum_reserved_range.c',
'third_party/upb/upb/reflection/enum_value_def.c',
'third_party/upb/upb/reflection/extension_range.c',
'third_party/upb/upb/reflection/field_def.c',
'third_party/upb/upb/reflection/file_def.c',
'third_party/upb/upb/reflection/message.c',
'third_party/upb/upb/reflection/message_def.c',
'third_party/upb/upb/reflection/message_reserved_range.c',
'third_party/upb/upb/reflection/method_def.c',
'third_party/upb/upb/reflection/oneof_def.c',
'third_party/upb/upb/reflection/service_def.c',
'third_party/upb/upb/text/encode.c',
],
},
{
'target_name': 'utf8_range_lib',
'type': 'static_library',
'dependencies': [
],
'sources': [
'third_party/utf8_range/naive.c',
'third_party/utf8_range/range2-neon.c',
'third_party/utf8_range/range2-sse.c',
],
},
{
'target_name': 'z',
'type': 'static_library',
'dependencies': [
],
'sources': [
'third_party/zlib/adler32.c',
'third_party/zlib/compress.c',
'third_party/zlib/crc32.c',
'third_party/zlib/deflate.c',
'third_party/zlib/infback.c',
'third_party/zlib/inffast.c',
'third_party/zlib/inflate.c',
'third_party/zlib/inftrees.c',
'third_party/zlib/trees.c',
'third_party/zlib/uncompr.c',
'third_party/zlib/zutil.c',
],
},
{
'target_name': 'benchmark_helpers',
'type': 'static_library',
@ -1515,6 +1720,7 @@
'type': 'static_library',
'dependencies': [
'grpc',
'protobuf',
],
'sources': [
'src/core/ext/transport/binder/client/binder_connector.cc',
@ -1621,6 +1827,7 @@
'target_name': 'grpc++_test',
'type': 'static_library',
'dependencies': [
'gtest',
'grpc++',
],
'sources': [
@ -1674,6 +1881,7 @@
'type': 'static_library',
'dependencies': [
'grpc_unsecure',
'protobuf',
],
'sources': [
'src/cpp/client/channel_cc.cc',
@ -1719,6 +1927,9 @@
'target_name': 'grpc_authorization_provider',
'type': 'static_library',
'dependencies': [
're2',
'upb',
'z',
'absl/cleanup:cleanup',
'absl/container:flat_hash_map',
'absl/container:flat_hash_set',
@ -1729,11 +1940,12 @@
'absl/status:statusor',
'absl/types:span',
'absl/utility:utility',
'cares',
'gpr',
'upb',
],
'sources': [
'src/core/ext/upb-generated/google/protobuf/any.upb.c',
'src/core/ext/upb-generated/google/protobuf/descriptor.upb.c',
'src/core/ext/upb-generated/google/rpc/status.upb.c',
'src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c',
'src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c',
@ -1996,6 +2208,8 @@
'target_name': 'grpc_plugin_support',
'type': 'static_library',
'dependencies': [
'protobuf',
'protoc',
],
'sources': [
'src/compiler/cpp_generator.cc',
@ -2333,113 +2547,5 @@
'third_party/benchmark/src/timers.cc',
],
},
{
'target_name': 're2',
'type': 'static_library',
'dependencies': [
],
'sources': [
'third_party/re2/re2/bitstate.cc',
'third_party/re2/re2/compile.cc',
'third_party/re2/re2/dfa.cc',
'third_party/re2/re2/filtered_re2.cc',
'third_party/re2/re2/mimics_pcre.cc',
'third_party/re2/re2/nfa.cc',
'third_party/re2/re2/onepass.cc',
'third_party/re2/re2/parse.cc',
'third_party/re2/re2/perl_groups.cc',
'third_party/re2/re2/prefilter.cc',
'third_party/re2/re2/prefilter_tree.cc',
'third_party/re2/re2/prog.cc',
'third_party/re2/re2/re2.cc',
'third_party/re2/re2/regexp.cc',
'third_party/re2/re2/set.cc',
'third_party/re2/re2/simplify.cc',
'third_party/re2/re2/stringpiece.cc',
'third_party/re2/re2/tostring.cc',
'third_party/re2/re2/unicode_casefold.cc',
'third_party/re2/re2/unicode_groups.cc',
'third_party/re2/util/pcre.cc',
'third_party/re2/util/rune.cc',
'third_party/re2/util/strutil.cc',
],
},
{
'target_name': 'upb',
'type': 'static_library',
'dependencies': [
],
'sources': [
'third_party/utf8_range/naive.c',
'third_party/utf8_range/range2-neon.c',
'third_party/utf8_range/range2-sse.c',
'third_party/upb/upb/base/status.c',
'third_party/upb/upb/collections/array.c',
'third_party/upb/upb/collections/map_sorter.c',
'third_party/upb/upb/collections/map.c',
'third_party/upb/upb/hash/common.c',
'third_party/upb/upb/json/decode.c',
'third_party/upb/upb/json/encode.c',
'third_party/upb/upb/lex/atoi.c',
'third_party/upb/upb/lex/round_trip.c',
'third_party/upb/upb/lex/strtod.c',
'third_party/upb/upb/lex/unicode.c',
'third_party/upb/upb/mem/alloc.c',
'third_party/upb/upb/mem/arena.c',
'third_party/upb/upb/message/accessors.c',
'third_party/upb/upb/message/message.c',
'third_party/upb/upb/mini_table/common.c',
'third_party/upb/upb/mini_table/decode.c',
'third_party/upb/upb/mini_table/encode.c',
'third_party/upb/upb/mini_table/extension_registry.c',
'third_party/upb/upb/reflection/def_builder.c',
'third_party/upb/upb/reflection/def_pool.c',
'third_party/upb/upb/reflection/def_type.c',
'third_party/upb/upb/reflection/desc_state.c',
'third_party/upb/upb/reflection/enum_def.c',
'third_party/upb/upb/reflection/enum_reserved_range.c',
'third_party/upb/upb/reflection/enum_value_def.c',
'third_party/upb/upb/reflection/extension_range.c',
'third_party/upb/upb/reflection/field_def.c',
'third_party/upb/upb/reflection/file_def.c',
'third_party/upb/upb/reflection/message_def.c',
'third_party/upb/upb/reflection/message_reserved_range.c',
'third_party/upb/upb/reflection/message.c',
'third_party/upb/upb/reflection/method_def.c',
'third_party/upb/upb/reflection/oneof_def.c',
'third_party/upb/upb/reflection/service_def.c',
'third_party/upb/upb/text/encode.c',
'third_party/upb/upb/wire/decode_fast.c',
'third_party/upb/upb/wire/decode.c',
'third_party/upb/upb/wire/encode.c',
'third_party/upb/upb/wire/eps_copy_input_stream.c',
'third_party/upb/upb/wire/reader.c',
'src/core/ext/upb-generated/google/protobuf/descriptor.upb.c',
'src/core/ext/upbdefs-generated/google/protobuf/descriptor.upbdefs.c',
],
},
{
'target_name': 'z',
'type': 'static_library',
'dependencies': [
],
'sources': [
'third_party/zlib/adler32.c',
'third_party/zlib/compress.c',
'third_party/zlib/crc32.c',
'third_party/zlib/deflate.c',
'third_party/zlib/gzclose.c',
'third_party/zlib/gzlib.c',
'third_party/zlib/gzread.c',
'third_party/zlib/gzwrite.c',
'third_party/zlib/infback.c',
'third_party/zlib/inffast.c',
'third_party/zlib/inflate.c',
'third_party/zlib/inftrees.c',
'third_party/zlib/trees.c',
'third_party/zlib/uncompr.c',
'third_party/zlib/zutil.c',
],
},
]
}

11
package.xml generated

@ -2695,18 +2695,12 @@
<file baseinstalldir="/" name="third_party/re2/re2/unicode_groups.cc" role="src" />
<file baseinstalldir="/" name="third_party/re2/re2/unicode_groups.h" role="src" />
<file baseinstalldir="/" name="third_party/re2/re2/walker-inl.h" role="src" />
<file baseinstalldir="/" name="third_party/re2/util/benchmark.h" role="src" />
<file baseinstalldir="/" name="third_party/re2/util/flags.h" role="src" />
<file baseinstalldir="/" name="third_party/re2/util/logging.h" role="src" />
<file baseinstalldir="/" name="third_party/re2/util/malloc_counter.h" role="src" />
<file baseinstalldir="/" name="third_party/re2/util/mix.h" role="src" />
<file baseinstalldir="/" name="third_party/re2/util/mutex.h" role="src" />
<file baseinstalldir="/" name="third_party/re2/util/pcre.cc" role="src" />
<file baseinstalldir="/" name="third_party/re2/util/pcre.h" role="src" />
<file baseinstalldir="/" name="third_party/re2/util/rune.cc" role="src" />
<file baseinstalldir="/" name="third_party/re2/util/strutil.cc" role="src" />
<file baseinstalldir="/" name="third_party/re2/util/strutil.h" role="src" />
<file baseinstalldir="/" name="third_party/re2/util/test.h" role="src" />
<file baseinstalldir="/" name="third_party/re2/util/utf.h" role="src" />
<file baseinstalldir="/" name="third_party/re2/util/util.h" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/alloc.h" role="src" />
@ -2763,7 +2757,6 @@
<file baseinstalldir="/" name="third_party/upb/upb/message/internal.h" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/message/message.c" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/message/message.h" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/mini_table.h" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/mini_table/common.c" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/mini_table/common.h" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/mini_table/common_internal.h" role="src" />
@ -2869,11 +2862,7 @@
<file baseinstalldir="/" name="third_party/zlib/crc32.h" role="src" />
<file baseinstalldir="/" name="third_party/zlib/deflate.c" role="src" />
<file baseinstalldir="/" name="third_party/zlib/deflate.h" role="src" />
<file baseinstalldir="/" name="third_party/zlib/gzclose.c" role="src" />
<file baseinstalldir="/" name="third_party/zlib/gzguts.h" role="src" />
<file baseinstalldir="/" name="third_party/zlib/gzlib.c" role="src" />
<file baseinstalldir="/" name="third_party/zlib/gzread.c" role="src" />
<file baseinstalldir="/" name="third_party/zlib/gzwrite.c" role="src" />
<file baseinstalldir="/" name="third_party/zlib/infback.c" role="src" />
<file baseinstalldir="/" name="third_party/zlib/inffast.c" role="src" />
<file baseinstalldir="/" name="third_party/zlib/inffast.h" role="src" />

@ -1305,7 +1305,6 @@ CORE_SOURCE_FILES = [
'third_party/re2/re2/tostring.cc',
'third_party/re2/re2/unicode_casefold.cc',
'third_party/re2/re2/unicode_groups.cc',
'third_party/re2/util/pcre.cc',
'third_party/re2/util/rune.cc',
'third_party/re2/util/strutil.cc',
'third_party/upb/upb/base/status.c',
@ -1356,10 +1355,6 @@ CORE_SOURCE_FILES = [
'third_party/zlib/compress.c',
'third_party/zlib/crc32.c',
'third_party/zlib/deflate.c',
'third_party/zlib/gzclose.c',
'third_party/zlib/gzlib.c',
'third_party/zlib/gzread.c',
'third_party/zlib/gzwrite.c',
'third_party/zlib/infback.c',
'third_party/zlib/inffast.c',
'third_party/zlib/inflate.c',

@ -1,48 +0,0 @@
#!/usr/bin/env python2.7
# Copyright 2015 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.
import os
import sys
import glob
import yaml
os.chdir(os.path.dirname(sys.argv[0]) + "/../..")
out = {}
out["libs"] = [
{
# TODO @donnadionne: extracting the list of source files from bazel build to reduce duplication
"name": "re2",
"build": "private",
"language": "c",
"secure": False,
"src": sorted(
glob.glob("third_party/re2/re2/*.cc")
+ [
"third_party/re2/util/pcre.cc",
"third_party/re2/util/rune.cc",
"third_party/re2/util/strutil.cc",
]
),
"headers": sorted(
glob.glob("third_party/re2/re2/*.h")
+ glob.glob("third_party/re2/util/*.h")
),
}
]
print(yaml.dump(out))

@ -1,199 +0,0 @@
#!/usr/bin/env python2.7
# Copyright 2015 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.
# TODO: This should ideally be in upb submodule to avoid hardcoding this here.
import re
import os
import sys
import yaml
out = {}
try:
out["libs"] = [
{
"name": "upb",
"build": "all",
"language": "c",
"src": [
"third_party/utf8_range/naive.c",
"third_party/utf8_range/range2-neon.c",
"third_party/utf8_range/range2-sse.c",
"third_party/upb/upb/base/status.c",
"third_party/upb/upb/collections/array.c",
"third_party/upb/upb/collections/map_sorter.c",
"third_party/upb/upb/collections/map.c",
"third_party/upb/upb/hash/common.c",
"third_party/upb/upb/json/decode.c",
"third_party/upb/upb/json/encode.c",
"third_party/upb/upb/lex/atoi.c",
"third_party/upb/upb/lex/round_trip.c",
"third_party/upb/upb/lex/strtod.c",
"third_party/upb/upb/lex/unicode.c",
"third_party/upb/upb/mem/alloc.c",
"third_party/upb/upb/mem/arena.c",
"third_party/upb/upb/message/accessors.c",
"third_party/upb/upb/message/message.c",
"third_party/upb/upb/mini_table/common.c",
"third_party/upb/upb/mini_table/decode.c",
"third_party/upb/upb/mini_table/encode.c",
"third_party/upb/upb/mini_table/extension_registry.c",
"third_party/upb/upb/reflection/def_builder.c",
"third_party/upb/upb/reflection/def_pool.c",
"third_party/upb/upb/reflection/def_type.c",
"third_party/upb/upb/reflection/desc_state.c",
"third_party/upb/upb/reflection/enum_def.c",
"third_party/upb/upb/reflection/enum_reserved_range.c",
"third_party/upb/upb/reflection/enum_value_def.c",
"third_party/upb/upb/reflection/extension_range.c",
"third_party/upb/upb/reflection/field_def.c",
"third_party/upb/upb/reflection/file_def.c",
"third_party/upb/upb/reflection/message_def.c",
"third_party/upb/upb/reflection/message_reserved_range.c",
"third_party/upb/upb/reflection/message.c",
"third_party/upb/upb/reflection/method_def.c",
"third_party/upb/upb/reflection/oneof_def.c",
"third_party/upb/upb/reflection/service_def.c",
"third_party/upb/upb/text/encode.c",
"third_party/upb/upb/wire/decode_fast.c",
"third_party/upb/upb/wire/decode.c",
"third_party/upb/upb/wire/encode.c",
"third_party/upb/upb/wire/eps_copy_input_stream.c",
"third_party/upb/upb/wire/reader.c",
"src/core/ext/upb-generated/google/protobuf/descriptor.upb.c",
"src/core/ext/upbdefs-generated/google/protobuf/descriptor.upbdefs.c",
],
"headers": [
"third_party/utf8_range/utf8_range.h",
"third_party/upb/upb/alloc.h",
"third_party/upb/upb/arena.h",
"third_party/upb/upb/array.h",
"third_party/upb/upb/base/descriptor_constants.h",
"third_party/upb/upb/base/log2.h",
"third_party/upb/upb/base/status.h",
"third_party/upb/upb/base/string_view.h",
"third_party/upb/upb/collections/array_internal.h",
"third_party/upb/upb/collections/array.h",
"third_party/upb/upb/collections/map_gencode_util.h",
"third_party/upb/upb/collections/map_internal.h",
"third_party/upb/upb/collections/map_sorter_internal.h",
"third_party/upb/upb/collections/map.h",
"third_party/upb/upb/collections/message_value.h",
"third_party/upb/upb/decode.h",
"third_party/upb/upb/def.h",
"third_party/upb/upb/def.hpp",
"third_party/upb/upb/encode.h",
"third_party/upb/upb/extension_registry.h",
"third_party/upb/upb/hash/common.h",
"third_party/upb/upb/hash/int_table.h",
"third_party/upb/upb/hash/str_table.h",
"third_party/upb/upb/json_decode.h",
"third_party/upb/upb/json_encode.h",
"third_party/upb/upb/json/decode.h",
"third_party/upb/upb/json/encode.h",
"third_party/upb/upb/lex/atoi.h",
"third_party/upb/upb/lex/round_trip.h",
"third_party/upb/upb/lex/strtod.h",
"third_party/upb/upb/lex/unicode.h",
"third_party/upb/upb/map.h",
"third_party/upb/upb/mem/alloc.h",
"third_party/upb/upb/mem/arena_internal.h",
"third_party/upb/upb/mem/arena.h",
"third_party/upb/upb/message/accessors_internal.h",
"third_party/upb/upb/message/accessors.h",
"third_party/upb/upb/message/extension_internal.h",
"third_party/upb/upb/message/internal.h",
"third_party/upb/upb/message/message.h",
"third_party/upb/upb/mini_table.h",
"third_party/upb/upb/mini_table/common_internal.h",
"third_party/upb/upb/mini_table/common.h",
"third_party/upb/upb/mini_table/decode.h",
"third_party/upb/upb/mini_table/encode_internal.h",
"third_party/upb/upb/mini_table/encode_internal.hpp",
"third_party/upb/upb/mini_table/enum_internal.h",
"third_party/upb/upb/mini_table/extension_internal.h",
"third_party/upb/upb/mini_table/extension_registry.h",
"third_party/upb/upb/mini_table/field_internal.h",
"third_party/upb/upb/mini_table/file_internal.h",
"third_party/upb/upb/mini_table/message_internal.h",
"third_party/upb/upb/mini_table/sub_internal.h",
"third_party/upb/upb/mini_table/types.h",
"third_party/upb/upb/msg.h",
"third_party/upb/upb/port/atomic.h",
"third_party/upb/upb/port/def.inc",
"third_party/upb/upb/port/undef.inc",
"third_party/upb/upb/port/vsnprintf_compat.h",
"third_party/upb/upb/reflection.h",
"third_party/upb/upb/reflection.hpp",
"third_party/upb/upb/reflection/common.h",
"third_party/upb/upb/reflection/def_builder_internal.h",
"third_party/upb/upb/reflection/def_pool_internal.h",
"third_party/upb/upb/reflection/def_pool.h",
"third_party/upb/upb/reflection/def_type.h",
"third_party/upb/upb/reflection/def.h",
"third_party/upb/upb/reflection/def.hpp",
"third_party/upb/upb/reflection/desc_state_internal.h",
"third_party/upb/upb/reflection/enum_def_internal.h",
"third_party/upb/upb/reflection/enum_def.h",
"third_party/upb/upb/reflection/enum_reserved_range_internal.h",
"third_party/upb/upb/reflection/enum_reserved_range.h",
"third_party/upb/upb/reflection/enum_value_def_internal.h",
"third_party/upb/upb/reflection/enum_value_def.h",
"third_party/upb/upb/reflection/extension_range_internal.h",
"third_party/upb/upb/reflection/extension_range.h",
"third_party/upb/upb/reflection/field_def_internal.h",
"third_party/upb/upb/reflection/field_def.h",
"third_party/upb/upb/reflection/file_def_internal.h",
"third_party/upb/upb/reflection/file_def.h",
"third_party/upb/upb/reflection/message_def_internal.h",
"third_party/upb/upb/reflection/message_def.h",
"third_party/upb/upb/reflection/message_reserved_range_internal.h",
"third_party/upb/upb/reflection/message_reserved_range.h",
"third_party/upb/upb/reflection/message.h",
"third_party/upb/upb/reflection/message.hpp",
"third_party/upb/upb/reflection/method_def_internal.h",
"third_party/upb/upb/reflection/method_def.h",
"third_party/upb/upb/reflection/oneof_def_internal.h",
"third_party/upb/upb/reflection/oneof_def.h",
"third_party/upb/upb/reflection/service_def_internal.h",
"third_party/upb/upb/reflection/service_def.h",
"third_party/upb/upb/status.h",
"third_party/upb/upb/string_view.h",
"third_party/upb/upb/text_encode.h",
"third_party/upb/upb/text/encode.h",
"third_party/upb/upb/upb.h",
"third_party/upb/upb/upb.hpp",
"third_party/upb/upb/wire/common_internal.h",
"third_party/upb/upb/wire/common.h",
"third_party/upb/upb/wire/decode_fast.h",
"third_party/upb/upb/wire/decode_internal.h",
"third_party/upb/upb/wire/decode.h",
"third_party/upb/upb/wire/encode.h",
"third_party/upb/upb/wire/eps_copy_input_stream.h",
"third_party/upb/upb/wire/reader.h",
"third_party/upb/upb/wire/swap_internal.h",
"third_party/upb/upb/wire/types.h",
"src/core/ext/upb-generated/google/protobuf/descriptor.upb.h",
"src/core/ext/upbdefs-generated/google/protobuf/descriptor.upbdefs.h",
],
"secure": False,
}
]
except:
pass
print(yaml.dump(out))

@ -1,58 +0,0 @@
#!/usr/bin/env python2.7
# Copyright 2015 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.
import re
import os
import sys
import yaml
os.chdir(os.path.dirname(sys.argv[0]) + "/../..")
out = {}
try:
with open("third_party/zlib/CMakeLists.txt") as f:
cmake = f.read()
def cmpath(x):
return "third_party/zlib/%s" % x.replace(
"${CMAKE_CURRENT_BINARY_DIR}/", ""
)
def cmvar(name):
regex = r"set\(\s*"
regex += name
regex += r"([^)]*)\)"
return [cmpath(x) for x in re.search(regex, cmake).group(1).split()]
out["libs"] = [
{
"name": "z",
"zlib": True,
"defaults": "zlib",
"build": "private",
"language": "c",
"secure": False,
"src": sorted(cmvar("ZLIB_SRCS")),
"headers": sorted(
cmvar("ZLIB_PUBLIC_HDRS") + cmvar("ZLIB_PRIVATE_HDRS")
),
}
]
except:
pass
print(yaml.dump(out))

@ -37,32 +37,117 @@
return path
def proto_replace_ext(filename, ext):
m = proto_re.match(filename)
if not m:
return filename
return '${_gRPC_PROTO_GENS_DIR}/' + third_party_proto_import_path(m.group(1)) + ext
"""Replace the .proto extension with given extension."""
m = proto_re.match(filename)
if not m:
return filename
return '${_gRPC_PROTO_GENS_DIR}/' + third_party_proto_import_path(m.group(1)) + ext
def is_absl_lib(lib_name):
return lib_name.startswith("absl/")
"""Returns True if the library is one of the abseil libraries."""
return lib_name.startswith("absl/")
def get_absl_dep(lib_name):
return lib_map[lib_name].cmake_target
def lib_and_transitive_deps(lib):
return list(sorted(set({lib} | set(lib_map[lib].transitive_deps))))
def get_transitive_deps(lib_name):
"""Get list of transitive deps for given library."""
transitive_deps = []
lib_metadata = lib_map.get(lib_name, None)
if lib_metadata:
transitive_deps = lib_metadata.transitive_deps
return list(transitive_deps)
def list_abseil_pkg_targets(lib):
# TODO(jtattermusch): this function is odd, try to eliminate it.
# This returns a list of abseil pkg targets which the given lib and
# its non-abseil transitive dependencies depend on.
# As a result, internal abseil libraries are excluded from the result.
absl_specs = set()
for lib_name in lib_and_transitive_deps(lib):
transitive_deps_and_self = [lib] + get_transitive_deps(lib)
for lib_name in transitive_deps_and_self:
if is_absl_lib(lib_name): continue
for dep in lib_map[lib_name].deps:
if is_absl_lib(dep):
absl_specs.add(get_absl_dep(dep).replace("::", "_"))
lib_metadata = lib_map.get(lib_name, None)
if lib_metadata:
for dep in lib_metadata.deps:
if is_absl_lib(dep):
absl_specs.add(get_absl_dep(dep).replace("::", "_"))
return list(sorted(absl_specs))
def lib_name_to_pkgconfig_requires_private_name(lib_name):
"""If library belongs to pkgconfig Requires.private section, return the name under which to include it."""
# TODO(jtattermusch): extract the metadata to a centralized location.
deps_to_pkgconfig_requires_private = {
"cares": "libcares",
"libssl": "openssl",
"re2": "re2",
"z": "zlib",
}
return deps_to_pkgconfig_requires_private.get(lib_name, None)
def is_pkgconfig_package(lib_name):
"""Returns True if a pkgconfig package exists for a given library."""
# TODO(jtattermusch): extract the metadata to a centralized location.
if lib_name in ["address_sorting", "utf8_range_lib"]:
return False
if lib_name == "upb" or lib_name.startswith("upb_"):
# TODO(jtattermusch): Add better detection for what are the "upb" libs.
return False
return True
def get_pkgconfig_requires(lib):
"""Returns "Requires" list for generating the pkgconfig .pc file for given library."""
requires = set()
requires.update(list_abseil_pkg_targets(lib))
for lib_name in get_transitive_deps(lib):
if not is_pkgconfig_package(lib_name):
# these deps go into Libs or Libs.Private
continue
if is_absl_lib(lib_name):
# absl libs have special handling
continue
if lib_name_to_pkgconfig_requires_private_name(lib_name) is not None:
# these deps go into Requires.private
continue
if lib_name == 'protobuf':
# TODO(jtattermusch): add better way of excluding explicit protobuf dependency.
continue
requires.add(lib_name)
return list(sorted(requires))
def get_pkgconfig_requires_private(lib):
"""Returns the "Requires.private" list for generating the pkgconfig .pc file for given library."""
private_requires = set()
for lib_name in get_transitive_deps(lib):
if is_absl_lib(lib_name):
# absl deps to into Requires
continue
require_name = lib_name_to_pkgconfig_requires_private_name(lib_name)
if require_name:
private_requires.add(require_name)
return list(sorted(private_requires))
def get_pkgconfig_libs(lib):
"""The "Libs" list for generating the pkgconfig .pc file for given library."""
libs = set()
# add self
libs.add("-l" + lib)
return list(sorted(libs))
def get_pkgconfig_libs_private(lib):
"""The "Libs.private" list for generating the pkgconfig .pc file for given library."""
private_libs = []
for lib_name in get_transitive_deps(lib):
if is_absl_lib(lib_name):
# absl deps to into Requires
continue
if is_pkgconfig_package(lib_name):
continue
# Transitive deps are pre-sorted in topological order.
# We must maintain that order to prevent linkage errors.
private_libs.append("-l" + lib_name)
return private_libs
def is_shared_only_lib(lib_name):
"""Returns True if only shared library should be generated."""
# grpc_csharp_ext is loaded by C# runtime and it
@ -76,11 +161,7 @@
deps.append("${_gRPC_PROTOBUF_PROTOC_LIBRARIES}")
if target_dict.language == 'c++':
deps.append("${_gRPC_PROTOBUF_LIBRARIES}")
deps.append("${_gRPC_ZLIB_LIBRARIES}")
if target_dict['name'] in ['grpc', 'grpc_cronet', 'grpc_unsecure']:
deps.append("${_gRPC_CARES_LIBRARIES}")
deps.append("${_gRPC_ADDRESS_SORTING_LIBRARIES}")
deps.append("${_gRPC_RE2_LIBRARIES}")
deps.append("${_gRPC_UPB_LIBRARIES}")
# TODO(yijiem): These targets depend on grpc_base instead of grpc. Since we don't populate grpc_base as a cmake target, the sources all get collapsed into these targets. This workaround adds c-ares and/or re2 dependencies to these targets. We should clean this up.
if target_dict['name'] in ['frame_test']:
@ -90,12 +171,25 @@
deps.append("${_gRPC_RE2_LIBRARIES}")
deps.append("${_gRPC_ALLTARGETS_LIBRARIES}")
for d in target_dict.get('deps', []):
if d == 'benchmark':
if d == 'z':
deps.append("${_gRPC_ZLIB_LIBRARIES}")
elif d == 'address_sorting':
deps.append("${_gRPC_ADDRESS_SORTING_LIBRARIES}")
elif d == 'benchmark':
deps.append("${_gRPC_BENCHMARK_LIBRARIES}")
elif d == 'libssl':
deps.append("${_gRPC_SSL_LIBRARIES}")
elif d == 're2':
deps.append("${_gRPC_RE2_LIBRARIES}")
elif d == 'cares':
deps.append("${_gRPC_CARES_LIBRARIES}")
elif d == 'protobuf':
deps.append("${_gRPC_PROTOBUF_LIBRARIES}")
elif d == 'protoc':
deps.append("${_gRPC_PROTOBUF_PROTOC_LIBRARIES}")
elif is_absl_lib(d):
deps.append(get_absl_dep(d))
# TODO(jtattermusch): add handling for upb libraries
else:
deps.append(d)
return deps
@ -685,7 +779,7 @@
<%text>${_gRPC_UPB_INCLUDE_DIR}</%text>
<%text>${_gRPC_XXHASH_INCLUDE_DIR}</%text>
<%text>${_gRPC_ZLIB_INCLUDE_DIR}</%text>
% if (lib.build in ['test', 'private'] and lib.language == 'c++') or lib.name == 'end2end_tests':
% if 'gtest' in lib.transitive_deps or lib.name == 'gtest':
third_party/googletest/googletest/include
third_party/googletest/googletest
third_party/googletest/googlemock/include
@ -748,10 +842,6 @@
${proto_replace_ext(src, '.grpc.pb.h')}
% endif
% endfor
% if tgt.build == 'test' and tgt.language == 'c++':
third_party/googletest/googletest/src/gtest-all.cc
third_party/googletest/googlemock/src/gmock-all.cc
% endif
)
target_compile_features(${tgt.name} PUBLIC cxx_std_14)
target_include_directories(${tgt.name}
@ -766,7 +856,7 @@
<%text>${_gRPC_UPB_INCLUDE_DIR}</%text>
<%text>${_gRPC_XXHASH_INCLUDE_DIR}</%text>
<%text>${_gRPC_ZLIB_INCLUDE_DIR}</%text>
% if tgt.build in ['test', 'private'] and tgt.language == 'c++':
% if 'gtest' in tgt.transitive_deps:
third_party/googletest/googletest/include
third_party/googletest/googletest
third_party/googletest/googlemock/include
@ -867,10 +957,10 @@
"gpr"
"gRPC platform support library"
"<%text>${gRPC_CORE_VERSION}</%text>"
"${" ".join(list_abseil_pkg_targets("gpr"))}"
""
"${" ".join(("-l" + l) for l in ["gpr"])}"
""
"${" ".join(get_pkgconfig_requires("gpr"))}"
"${" ".join(get_pkgconfig_requires_private("gpr"))}"
"${" ".join(get_pkgconfig_libs("gpr"))}"
"${" ".join(get_pkgconfig_libs_private("gpr"))}"
"gpr.pc")
# grpc .pc file
@ -878,10 +968,10 @@
"gRPC"
"high performance general RPC framework"
"<%text>${gRPC_CORE_VERSION}</%text>"
"${" ".join(["gpr"] + list_abseil_pkg_targets("grpc"))}"
"${" ".join(["openssl", "re2", "libcares", "zlib"])}"
"${" ".join(("-l" + l) for l in ["grpc",])}"
"${" ".join(("-l" + l) for l in ["address_sorting", "upb"])}"
"${" ".join(get_pkgconfig_requires("grpc"))}"
"${" ".join(get_pkgconfig_requires_private("grpc"))}"
"${" ".join(get_pkgconfig_libs("grpc"))}"
"${" ".join(get_pkgconfig_libs_private("grpc"))}"
"grpc.pc")
# grpc_unsecure .pc file
@ -889,10 +979,10 @@
"gRPC unsecure"
"high performance general RPC framework without SSL"
"<%text>${gRPC_CORE_VERSION}</%text>"
"${" ".join(["gpr"] + list_abseil_pkg_targets("grpc_unsecure"))}"
"${" ".join(["re2", "libcares", "zlib"])}"
"${" ".join(("-l" + l) for l in ["grpc_unsecure"])}"
"${" ".join(("-l" + l) for l in ["address_sorting", "upb"])}"
"${" ".join(get_pkgconfig_requires("grpc_unsecure"))}"
"${" ".join(get_pkgconfig_requires_private("grpc_unsecure"))}"
"${" ".join(get_pkgconfig_libs("grpc_unsecure"))}"
"${" ".join(get_pkgconfig_libs_private("grpc_unsecure"))}"
"grpc_unsecure.pc")
# grpc++ .pc file
@ -900,10 +990,10 @@
"gRPC++"
"C++ wrapper for gRPC"
"<%text>${gRPC_CPP_VERSION}</%text>"
"${" ".join(["grpc"] + list_abseil_pkg_targets("grpc++"))}"
""
"${" ".join(("-l" + l) for l in ["grpc++"])}"
""
"${" ".join(get_pkgconfig_requires("grpc++"))}"
"${" ".join(get_pkgconfig_requires_private("grpc++"))}"
"${" ".join(get_pkgconfig_libs("grpc++"))}"
"${" ".join(get_pkgconfig_libs_private("grpc++"))}"
"grpc++.pc")
# grpc++_unsecure .pc file
@ -911,8 +1001,8 @@
"gRPC++ unsecure"
"C++ wrapper for gRPC without SSL"
"<%text>${gRPC_CPP_VERSION}</%text>"
"${" ".join(["grpc_unsecure"] + list_abseil_pkg_targets("grpc++_unsecure"))}"
""
"${" ".join(("-l" + l) for l in ["grpc++_unsecure"])}"
""
"${" ".join(get_pkgconfig_requires("grpc++_unsecure"))}"
"${" ".join(get_pkgconfig_requires_private("grpc++_unsecure"))}"
"${" ".join(get_pkgconfig_libs("grpc++_unsecure"))}"
"${" ".join(get_pkgconfig_libs_private("grpc++_unsecure"))}"
"grpc++_unsecure.pc")

@ -25,7 +25,134 @@
import os
def is_absl_lib(target_name):
return target_name.startswith("absl/");
"""Returns True if the target name is one of the abseil libraries."""
return target_name.startswith("absl/")
def collapse_absl_deps(deps):
"""Replace first occurrence of absl dependency with grpc_abseil and remove the remaining absl dependencies."""
result = []
absl_dep_added = False
for dep in deps:
if is_absl_lib(dep):
if not absl_dep_added:
result.append('grpc_abseil')
absl_dep_added = True
else:
result.append(dep)
return result
def get_dep_expression(dep):
"""For given dependency, return the expression to be used in Makefile rule dependencies."""
if dep == 'z':
return "$(ZLIB_DEP)"
elif dep == 'cares':
return "$(CARES_DEP)"
elif dep == 'grpc_abseil':
return "$(GRPC_ABSEIL_DEP)"
elif dep == 'libssl':
return "$(OPENSSL_DEP)"
else:
return "$(LIBDIR)/$(CONFIG)/lib%s.a" % dep
def get_merge_libs_expression(dep):
"""For given dependency, return the lib archive expression to be used when linking."""
if dep == 'z':
return "$(ZLIB_MERGE_LIBS)"
elif dep == 'cares':
return "$(CARES_MERGE_LIBS)"
elif dep == 'grpc_abseil':
return "$(GRPC_ABSEIL_MERGE_LIBS)"
elif dep == 'libssl':
return "$(OPENSSL_MERGE_LIBS)"
else:
return "$(LIBDIR)/$(CONFIG)/lib%s.a" % dep
def get_objs_expression(dep):
"""For given dependency, return the expression with variable that has list of all object files."""
if dep == 'z':
return "$(ZLIB_MERGE_OBJS)"
elif dep == 'cares':
return "$(CARES_MERGE_OBJS)"
elif dep == 'grpc_abseil':
return "$(LIBGRPC_ABSEIL_OBJS)"
elif dep == 'libssl':
return "$(OPENSSL_MERGE_OBJS)"
else:
return "$(LIB%s_OBJS)" % dep.upper()
def get_make_rule_static_lib_deps(lib):
"""Generate make rule dependency list for given library, when building as static."""
make_rule_deps = []
collapsed_deps = collapse_absl_deps(lib.get('transitive_deps', []))
# depend on static libraries
for dep in collapsed_deps:
make_rule_deps.append(get_dep_expression(dep))
# depend of obj files of this library itself
make_rule_deps.append(get_objs_expression(lib.name))
# depend on obj files of dependencies
for dep in collapsed_deps:
make_rule_deps.append(get_objs_expression(dep))
return " ".join(make_rule_deps)
def get_merge_objs_for_deps(lib):
"""Get list of merge objs for all deps of a given library."""
result = []
collapsed_deps = collapse_absl_deps(lib.get('transitive_deps', []))
for dep in collapsed_deps:
result.append(get_objs_expression(dep))
return " ".join(result)
def get_make_rule_shared_lib_deps(lib):
"""Generate make rule dependency list given library, when built as shared."""
make_rule_deps = []
collapsed_deps = collapse_absl_deps(lib.get('transitive_deps', []))
# depend of obj files of this library itself
make_rule_deps.append(get_objs_expression(lib.name))
# depend on static libraries
for dep in collapsed_deps:
make_rule_deps.append(get_dep_expression(dep))
return " ".join(make_rule_deps)
def get_shared_lib_linklibs(lib):
"""Generate list of libraries to link given library, when built as shared."""
result = []
collapsed_deps = collapse_absl_deps(lib.get('transitive_deps', []))
# depend of obj files of this library itself
result.append(get_objs_expression(lib.name))
# depend on static libraries
for dep in collapsed_deps:
result.append(get_merge_libs_expression(dep))
if 'libssl' in collapsed_deps:
result.append("$(LDLIBS_SECURE)")
result.append("$(LDLIBS)")
return " ".join(result)
sources_that_need_openssl = set()
sources_that_don_t_need_openssl = set()
@ -46,7 +173,6 @@
lang_to_var = {
'c': 'CORE',
'c++': 'CPP',
'csharp': 'CSHARP'
}
%>
<%
@ -320,7 +446,6 @@
CORE_VERSION = ${settings.core_version}
CPP_VERSION = ${settings.cpp_version}
CSHARP_VERSION = ${settings.csharp_version}
CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES))
CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS)
@ -351,29 +476,24 @@
EXECUTABLE_SUFFIX = .exe
SHARED_EXT_CORE = dll
SHARED_EXT_CPP = dll
SHARED_EXT_CSHARP = dll
SHARED_PREFIX =
SHARED_VERSION_CORE = -${settings.core_version.major}
SHARED_VERSION_CPP = -${settings.cpp_version.major}
SHARED_VERSION_CSHARP = -${settings.csharp_version.major}
else ifeq ($(SYSTEM),Darwin)
EXECUTABLE_SUFFIX =
SHARED_EXT_CORE = dylib
SHARED_EXT_CPP = dylib
SHARED_EXT_CSHARP = dylib
SHARED_PREFIX = lib
SHARED_VERSION_CORE =
SHARED_VERSION_CPP =
SHARED_VERSION_CSHARP =
else
EXECUTABLE_SUFFIX =
SHARED_EXT_CORE = so.$(CORE_VERSION)
SHARED_EXT_CPP = so.$(CPP_VERSION)
SHARED_EXT_CSHARP = so.$(CSHARP_VERSION)
SHARED_PREFIX = lib
SHARED_VERSION_CORE =
SHARED_VERSION_CPP =
SHARED_VERSION_CSHARP =
endif
ifeq ($(wildcard .git),)
@ -430,9 +550,7 @@
# Setup address_sorting dependency
ADDRESS_SORTING_DEP = $(LIBDIR)/$(CONFIG)/libaddress_sorting.a
ADDRESS_SORTING_MERGE_OBJS = $(LIBADDRESS_SORTING_OBJS)
ADDRESS_SORTING_MERGE_LIBS = $(LIBDIR)/$(CONFIG)/libaddress_sorting.a
# TODO(jtattermusch): should the include be added elsewhere?
CPPFLAGS := -Ithird_party/address_sorting/include $(CPPFLAGS)
# Setup abseil dependency
@ -440,18 +558,6 @@
GRPC_ABSEIL_DEP = $(LIBDIR)/$(CONFIG)/libgrpc_abseil.a
GRPC_ABSEIL_MERGE_LIBS = $(LIBDIR)/$(CONFIG)/libgrpc_abseil.a
# Setup re2 dependency
RE2_DEP = $(LIBDIR)/$(CONFIG)/libre2.a
RE2_MERGE_OBJS = $(LIBRE2_OBJS)
RE2_MERGE_LIBS = $(LIBDIR)/$(CONFIG)/libre2.a
# Setup upb dependency
UPB_DEP = $(LIBDIR)/$(CONFIG)/libupb.a
UPB_MERGE_OBJS = $(LIBUPB_OBJS)
UPB_MERGE_LIBS = $(LIBDIR)/$(CONFIG)/libupb.a
# Setup boringssl dependency
ifeq ($(wildcard third_party/boringssl-with-bazel/src/include/openssl/ssl.h),)
@ -597,16 +703,6 @@
% endfor
static_csharp: static_c \
% for lib in filtered_libs:
% if 'Makefile' in lib.get('build_system', ['Makefile']):
% if lib.build == 'all' and lib.language == 'csharp':
$(LIBDIR)/$(CONFIG)/lib${lib.name}.a\
% endif
% endif
% endfor
shared: shared_c shared_cxx
shared_c: cache.mk\
@ -628,17 +724,6 @@
% endfor
shared_csharp: shared_c \
% for lib in filtered_libs:
% if 'Makefile' in lib.get('build_system', ['Makefile']):
% if lib.build == 'all' and lib.language == 'csharp':
$(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP)\
% endif
% endif
% endfor
grpc_csharp_ext: shared_csharp
privatelibs: privatelibs_c privatelibs_cxx
privatelibs_c: \
@ -739,20 +824,6 @@
% endfor
endif
strip-shared_csharp: shared_csharp
ifeq ($(CONFIG),opt)
% for lib in filtered_libs:
% if 'Makefile' in lib.get('build_system', ['Makefile']):
% if lib.language == "csharp":
% if lib.build == "all":
$(E) "[STRIP] Stripping $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP)"
$(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP)
% endif
% endif
% endif
% endfor
endif
cache.mk::
$(E) "[MAKE] Generating $@"
$(Q) echo "$(CACHE_MK)" | tr , '\n' >$@
@ -798,8 +869,6 @@
install_cxx: install_not_supported_error
install_csharp: install_not_supported_error
install-static: install_not_supported_error
install-certs: install_not_supported_error
@ -847,6 +916,8 @@
<%def name="makelib(lib)">
# start of build recipe for library "${lib.name}" (generated by makelib(lib) template function)
# deps: ${collapse_absl_deps(lib.get('deps', []))}
# transitive_deps: ${collapse_absl_deps(lib.get('transitive_deps', []))}
LIB${lib.name.upper()}_SRC = \\
% for src in lib.src:
@ -877,7 +948,7 @@
% endif
## If the library requires OpenSSL, let's add some restrictions.
% if 'libssl' in lib.get('deps', []):
% if 'libssl' in lib.get('transitive_deps', []):
ifeq ($(NO_SECURE),true)
# You can't build secure libraries if you don't have OpenSSL.
@ -890,130 +961,68 @@
else
$(LIBDIR)/$(CONFIG)/lib${lib.name}.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(RE2_DEP) $(UPB_DEP) $(GRPC_ABSEIL_DEP) \
## The else here corresponds to the if secure earlier.
% else:
$(LIBDIR)/$(CONFIG)/lib${lib.name}.a: \
% if lib.name not in ['z', 'ares', 'address_sorting', 're2', 'upb', 'grpc_abseil']:
$(ZLIB_DEP) \
$(CARES_DEP) \
$(ADDRESS_SORTING_DEP) \
$(RE2_DEP) \
$(UPB_DEP) \
$(GRPC_ABSEIL_DEP) \
% endif
% endif
$(LIB${lib.name.upper()}_OBJS) \
% if lib.get('baselib', False):
$(LIBGPR_OBJS) \
$(LIBGRPC_ABSEIL_OBJS) \
$(ZLIB_MERGE_OBJS) \
$(CARES_MERGE_OBJS) \
$(ADDRESS_SORTING_MERGE_OBJS) \
$(RE2_MERGE_OBJS) \
$(UPB_MERGE_OBJS) \
% if 'libssl' in lib.get('deps', []):
$(OPENSSL_MERGE_OBJS) \
## The following endif corresponds to the "If the library requires OpenSSL" above
% endif
% endif
# static library for "${lib.name}"
$(LIBDIR)/$(CONFIG)/lib${lib.name}.a: ${get_make_rule_static_lib_deps(lib)}
$(E) "[AR] Creating $@"
$(Q) mkdir -p `dirname $@`
$(Q) rm -f $(LIBDIR)/$(CONFIG)/lib${lib.name}.a
$(Q) $(AR) $(ARFLAGS) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a $(LIB${lib.name.upper()}_OBJS) \
% if lib.get('baselib', False):
$(LIBGPR_OBJS) \
$(LIBGRPC_ABSEIL_OBJS) \
$(ZLIB_MERGE_OBJS) \
$(CARES_MERGE_OBJS) \
$(ADDRESS_SORTING_MERGE_OBJS) \
$(RE2_MERGE_OBJS) \
$(UPB_MERGE_OBJS) \
% if 'libssl' in lib.get('deps', []):
$(OPENSSL_MERGE_OBJS) \
% endif
% endif
$(Q) $(AR) $(ARFLAGS) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a $(LIB${lib.name.upper()}_OBJS) ${get_merge_objs_for_deps(lib)}
ifeq ($(SYSTEM),Darwin)
$(Q) $(RANLIB) $(RANLIBFLAGS) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a
endif
<%
ld = '$(LDXX)'
out_mingbase = '$(LIBDIR)/$(CONFIG)/' + lib.name + '$(SHARED_VERSION_' + lang_to_var[lib.language] + ')'
out_libbase = '$(LIBDIR)/$(CONFIG)/lib' + lib.name + '$(SHARED_VERSION_' + lang_to_var[lib.language] + ')'
common = '$(LIB' + lib.name.upper() + '_OBJS)'
link_libs = ''
lib_deps = ' $(ZLIB_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(RE2_DEP) $(UPB_DEP) $(GRPC_ABSEIL_DEP)'
mingw_libs = ''
mingw_lib_deps = ' $(ZLIB_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(RE2_DEP) $(UPB_DEP) $(GRPC_ABSEIL_DEP)'
for dep in lib.get('deps', []):
if is_absl_lib(dep): continue
if 'libssl' == dep: continue
lib_archive = '$(LIBDIR)/$(CONFIG)/lib' + dep + '.a'
common = common + ' ' + lib_archive
lib_deps = lib_deps + ' ' + lib_archive
mingw_lib_deps = mingw_lib_deps + ' ' + lib_archive
security = 'libssl' in lib.get('deps', [])
if security == True:
common = common + ' $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE)'
common = common + ' $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(RE2_MERGE_LIBS) $(UPB_MERGE_LIBS) $(GRPC_ABSEIL_MERGE_LIBS)'
if security in [True, 'check']:
ldflags = '$(LDFLAGS)'
if lib.get('LDFLAGS', None):
ldflags += ' ' + lib['LDFLAGS']
if 'libssl' in lib.get('transitive_deps', []):
for src in lib.src:
sources_that_need_openssl.add(src)
else:
for src in lib.src:
sources_that_don_t_need_openssl.add(src)
if 'libssl' in lib.get('deps', []):
lib_deps = lib_deps + ' $(OPENSSL_DEP)'
mingw_lib_deps = mingw_lib_deps + ' $(OPENSSL_DEP)'
ldflags = '$(LDFLAGS)'
if lib.get('LDFLAGS', None):
ldflags += ' ' + lib['LDFLAGS']
common = common + ' $(LDLIBS)'
%>
# shared library for "${lib.name}"
% if lib.build == "all":
ifeq ($(SYSTEM),MINGW32)
${out_mingbase}.$(SHARED_EXT_${lang_to_var[lib.language]}): $(LIB${lib.name.upper()}_OBJS) ${mingw_lib_deps}
${out_mingbase}.$(SHARED_EXT_${lang_to_var[lib.language]}): ${get_make_rule_shared_lib_deps(lib)}
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) ${ld} ${ldflags} -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=${out_mingbase}.def -Wl,--out-implib=${out_libbase}-dll.a -o ${out_mingbase}.$(SHARED_EXT_${lang_to_var[lib.language]}) ${common}${mingw_libs}
$(Q) ${ld} ${ldflags} -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=${out_mingbase}.def -Wl,--out-implib=${out_libbase}-dll.a -o ${out_mingbase}.$(SHARED_EXT_${lang_to_var[lib.language]}) ${get_shared_lib_linklibs(lib)}
else
${out_libbase}.$(SHARED_EXT_${lang_to_var[lib.language]}): $(LIB${lib.name.upper()}_OBJS) ${lib_deps}
${out_libbase}.$(SHARED_EXT_${lang_to_var[lib.language]}): ${get_make_rule_shared_lib_deps(lib)}
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
ifeq ($(SYSTEM),Darwin)
$(Q) ${ld} ${ldflags} -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]}).$(SHARED_EXT_${lang_to_var[lib.language]}) -dynamiclib -o ${out_libbase}.$(SHARED_EXT_${lang_to_var[lib.language]}) ${common}${link_libs}
$(Q) ${ld} ${ldflags} -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]}).$(SHARED_EXT_${lang_to_var[lib.language]}) -dynamiclib -o ${out_libbase}.$(SHARED_EXT_${lang_to_var[lib.language]}) ${get_shared_lib_linklibs(lib)}
else
$(Q) ${ld} ${ldflags} -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,lib${lib.name}.so.${settings.get(lang_to_var[lib.language].lower() + '_version').major} -o ${out_libbase}.$(SHARED_EXT_${lang_to_var[lib.language]}) ${common}${link_libs}
$(Q) ${ld} ${ldflags} -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,lib${lib.name}.so.${settings.get(lang_to_var[lib.language].lower() + '_version').major} -o ${out_libbase}.$(SHARED_EXT_${lang_to_var[lib.language]}) ${get_shared_lib_linklibs(lib)}
$(Q) ln -sf $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]}).$(SHARED_EXT_${lang_to_var[lib.language]}) ${out_libbase}.so.${settings.get(lang_to_var[lib.language].lower() + '_version').major}
$(Q) ln -sf $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]}).$(SHARED_EXT_${lang_to_var[lib.language]}) ${out_libbase}.so
endif
endif
% endif
% if 'libssl' in lib.get('deps', []):
## If the lib was secure, we have to close the Makefile's if that tested
% if 'libssl' in lib.get('transitive_deps', []):
## If the lib was secure, we have to close the Makefile's ifeq that tested
## the presence of OpenSSL.
endif
endif # corresponds to the "ifeq ($(NO_SECURE),true)" above
% endif
% if 'libssl' in lib.get('deps', []):
% if 'libssl' in lib.get('transitive_deps', []):
ifneq ($(NO_SECURE),true)
% endif
ifneq ($(NO_DEPS),true)
-include $(LIB${lib.name.upper()}_OBJS:.o=.dep)
endif
% if 'libssl' in lib.get('deps', []):
% if 'libssl' in lib.get('transitive_deps', []):
endif
% endif
# end of build recipe for library "${lib.name}"
@ -1035,7 +1044,7 @@
dep_error openssl_dep_error openssl_dep_message git_update stop \
buildtests buildtests_c buildtests_cxx \
test test_c test_cxx \
install install_c install_cxx install_csharp install-static install-certs \
install install_c install_cxx install-static install-certs \
strip strip-shared strip-static \
strip_c strip-shared_c strip-static_c \
strip_cxx strip-shared_cxx strip-static_cxx \

@ -49,9 +49,14 @@
php_full_deps = []
for dep in php_deps:
php_full_deps.append(dep)
php_full_deps.extend(lib_maps[dep].transitive_deps)
lib = lib_maps.get(dep, None)
if lib:
php_full_deps.extend(lib.transitive_deps)
# construct list of all source files, but explicitly exclude zlib
for dep in set(php_full_deps) - set({'z'}):
srcs.extend(lib_maps[dep].src)
lib = lib_maps.get(dep, None)
if lib:
srcs.extend(lib.src)
srcs = sorted(set(srcs))
%>
PHP_NEW_EXTENSION(grpc,

@ -14,9 +14,13 @@
php_full_deps = []
for dep in php_deps:
php_full_deps.append(dep)
php_full_deps.extend(lib_maps[dep].transitive_deps)
lib = lib_maps.get(dep, None)
if lib:
php_full_deps.extend(lib.transitive_deps)
for dep in php_full_deps:
srcs.extend(lib_maps[dep].src)
lib = lib_maps.get(dep, None)
if lib:
srcs.extend(lib.src)
srcs = sorted(set(srcs))
%>
EXTENSION("grpc",

@ -35,7 +35,11 @@
return "abseil/" + label[5:].replace(":", "/")
def lib_and_transitive_deps(lib):
return list(sorted(set({lib} | set(lib_maps[lib].transitive_deps))))
transitive_deps = []
lib_metadata = lib_maps.get(lib, None)
if lib_metadata:
transitive_deps = lib_metadata.transitive_deps
return list(sorted(set({lib} | set(transitive_deps))))
def non_abseil_lib_and_transitive_deps(lib):
return [l for l in lib_and_transitive_deps(lib) if not is_absl_lib(l)]
@ -47,17 +51,20 @@
absl_specs = set()
for lib_name in lib_and_transitive_deps(lib):
if is_absl_lib(lib_name): continue
for dep in lib_maps[lib_name].deps:
if is_absl_lib(dep):
absl_specs.add(get_absl_spec_name(dep))
lib_metadata = lib_maps.get(lib_name, None)
if lib_metadata:
for dep in lib_metadata.deps:
if is_absl_lib(dep):
absl_specs.add(get_absl_spec_name(dep))
return list(sorted(absl_specs))
def list_lib_files(lib, fields):
files = set()
for lib_name in non_abseil_lib_and_transitive_deps(lib):
lib = lib_maps[lib_name]
for field in fields:
files.update(lib.get(field, []))
lib_metadata = lib_maps.get(lib_name, None)
if lib_metadata:
for field in fields:
files.update(lib_metadata.get(field, []))
return list(sorted(files))
def filter_grpcpp(files):

@ -34,7 +34,11 @@
return "abseil/" + label[5:].replace(":", "/")
def lib_and_transitive_deps(lib):
return list(sorted(set({lib} | set(lib_maps[lib].transitive_deps))))
transitive_deps = []
lib_metadata = lib_maps.get(lib, None)
if lib_metadata:
transitive_deps = lib_metadata.transitive_deps
return list(sorted(set({lib} | set(transitive_deps))))
def non_abseil_lib_and_transitive_deps(lib):
return [l for l in lib_and_transitive_deps(lib) if not is_absl_lib(l)]
@ -46,17 +50,20 @@
absl_specs = set()
for lib_name in lib_and_transitive_deps(lib):
if is_absl_lib(lib_name): continue
for dep in lib_maps[lib_name].deps:
if is_absl_lib(dep):
absl_specs.add(get_absl_spec_name(dep))
lib_metadata = lib_maps.get(lib_name, None)
if lib_metadata:
for dep in lib_metadata.deps:
if is_absl_lib(dep):
absl_specs.add(get_absl_spec_name(dep))
return list(sorted(absl_specs))
def list_lib_files(lib, fields):
files = set()
for lib_name in non_abseil_lib_and_transitive_deps(lib):
lib = lib_maps[lib_name]
for field in fields:
files.update(lib.get(field, []))
lib = lib_maps.get(lib_name, None)
if lib:
for field in fields:
files.update(lib.get(field, []))
return list(sorted(files))
# ObjectiveC doesn't use c-ares so we don't need address_sorting files at all

@ -55,8 +55,9 @@
for dep in ruby_deps[:]:
ruby_deps.extend(lib_maps[dep].transitive_deps)
for dep in ruby_deps:
lib = lib_maps[dep]
files.extend(lib.get('public_headers', []) + lib.headers + lib.src)
lib = lib_maps.get(dep, None)
if lib:
files.extend(lib.get('public_headers', []) + lib.headers + lib.src)
files = sorted(set(files))
%>
% for file in files:

@ -37,10 +37,13 @@
php_deps = php_config_m4.get('deps', [])
lib_maps = {lib.name: lib for lib in libs}
for dep in php_deps[:]:
php_deps.extend(lib_maps[dep].transitive_deps)
lib = lib_maps.get(dep, None)
if lib:
php_deps.extend(lib.transitive_deps)
for dep in php_deps:
lib = lib_maps[dep]
srcs.extend(lib.get('public_headers', []) + lib.headers + lib.src)
lib = lib_maps.get(dep, None)
if lib:
srcs.extend(lib.get('public_headers', []) + lib.headers + lib.src)
srcs = sorted(set(srcs))
%>
% for src in srcs:

@ -130,11 +130,8 @@ Since upb is vendored in the gRPC repo, you cannot use submodule to update it. P
- `mv $GRPC_ROOT/third_party/upb-main $GRPC_ROOT/third_party/upb`
2. Update the dependency in `grpc_deps.bzl` to the same commit
3. Populate the bazel download mirror by running `bazel/update_mirror.sh`
4. Inspect `src/upb/gen_build_yaml.py` and update it with added or removed upb files
- Running `cd third_party/upb; bazel query "deps(upb) union deps(json) union deps(textformat)"`
would give some idea on what needs to be included.
5. Run `tools/buildgen/generate_projects.sh` to regenerate the generated files
6. Run `tools/codegen/core/gen_upb_api.sh` to regenerate upb files.
4. Run `tools/buildgen/generate_projects.sh` to regenerate the generated files
5. Run `tools/codegen/core/gen_upb_api.sh` to regenerate upb files.
### Updating third_party/utf8_range

@ -94,12 +94,17 @@ EXTERNAL_PROTO_LIBRARIES = {
),
}
def _maybe_get_internal_path(name: str) -> Optional[str]:
for key in EXTERNAL_PROTO_LIBRARIES:
if name.startswith("@" + key):
return key
return None
# We want to get a list of source files for some external libraries
# to be able to include them in a non-bazel (e.g. make/cmake) build.
# For that we need mapping from external repo name to a corresponding
# path to a git submodule.
EXTERNAL_SOURCE_PREFIXES = {
"@upb": "third_party/upb",
"@utf8_range": "third_party/utf8_range",
"@com_googlesource_code_re2": "third_party/re2",
"@com_google_googletest": "third_party/googletest",
"@zlib": "third_party/zlib",
}
def _bazel_query_xml_tree(query: str) -> ET.Element:
@ -117,6 +122,7 @@ def _rule_dict_from_xml_node(rule_xml_node):
"name": rule_xml_node.attrib.get("name"),
"srcs": [],
"hdrs": [],
"textual_hdrs": [],
"deps": [],
"data": [],
"tags": [],
@ -130,7 +136,15 @@ def _rule_dict_from_xml_node(rule_xml_node):
# all the metadata we want is stored under "list" tags
if child.tag == "list":
list_name = child.attrib["name"]
if list_name in ["srcs", "hdrs", "deps", "data", "tags", "args"]:
if list_name in [
"srcs",
"hdrs",
"textual_hdrs",
"deps",
"data",
"tags",
"args",
]:
result[list_name] += [item.attrib["value"] for item in child]
if child.tag == "string":
string_name = child.attrib["name"]
@ -141,14 +155,14 @@ def _rule_dict_from_xml_node(rule_xml_node):
if bool_name in ["flaky"]:
result[bool_name] = child.attrib["value"] == "true"
if child.tag == "label":
# extract actual name for alias rules
# extract actual name for alias and bind rules
label_name = child.attrib["name"]
if label_name in ["actual"]:
actual_name = child.attrib.get("value", None)
if actual_name:
result["actual"] = actual_name
# HACK: since we do a lot of transitive dependency scanning,
# make it seem that the actual name is a dependency of the alias rule
# make it seem that the actual name is a dependency of the alias or bind rule
# (aliases don't have dependencies themselves)
result["deps"].append(actual_name)
return result
@ -172,6 +186,7 @@ def _extract_rules_from_bazel_xml(xml_tree):
"upb_proto_library",
"upb_proto_reflection_library",
"alias",
"bind",
]:
if rule_name in result:
raise Exception("Rule %s already present" % rule_name)
@ -188,37 +203,73 @@ def _get_bazel_label(target_name: str) -> str:
return "//:%s" % target_name
def _extract_source_file_path(label: str) -> str:
def _try_extract_source_file_path(label: str) -> str:
"""Gets relative path to source file from bazel deps listing"""
if label.startswith("//"):
label = label[len("//") :]
# labels in form //:src/core/lib/surface/call_test_only.h
if label.startswith(":"):
label = label[len(":") :]
# labels in form //test/core/util:port.cc
label = label.replace(":", "/")
return label
if label.startswith("@"):
# This is an external source file. We are only interested in sources
# for some of the external libraries.
for lib_name, prefix in EXTERNAL_SOURCE_PREFIXES.items():
if label.startswith(lib_name + "//"):
return (
label.replace("%s//" % lib_name, prefix + "/")
.replace(":", "/")
.replace("//", "/")
)
# This source file is external, and we need to translate the
# @REPO_NAME to a valid path prefix. At this stage, we need
# to check repo name, since the label/path mapping is not
# available in BUILD files.
for lib_name, external_proto_lib in EXTERNAL_PROTO_LIBRARIES.items():
if label.startswith("@" + lib_name + "//"):
return label.replace(
"@%s//" % lib_name,
external_proto_lib.proto_prefix,
).replace(":", "/")
# No external library match found
return None
else:
if label.startswith("//"):
label = label[len("//") :]
# labels in form //:src/core/lib/surface/call_test_only.h
if label.startswith(":"):
label = label[len(":") :]
# labels in form //test/core/util:port.cc
return label.replace(":", "/")
def _has_header_suffix(label: str) -> bool:
"""Returns True if the label has a suffix that looks like a C/C++ include file"""
return (
label.endswith(".h")
or label.endswith(".h")
or label.endswith(".hpp")
or label.endswith(".inc")
)
def _extract_public_headers(bazel_rule: BuildMetadata) -> List[str]:
"""Gets list of public headers from a bazel rule"""
result = []
for dep in bazel_rule["hdrs"]:
if dep.startswith("//:include/") and dep.endswith(".h"):
result.append(_extract_source_file_path(dep))
if dep.startswith("//:include/") and _has_header_suffix(dep):
source_file_maybe = _try_extract_source_file_path(dep)
if source_file_maybe:
result.append(source_file_maybe)
return list(sorted(result))
def _extract_nonpublic_headers(bazel_rule: BuildMetadata) -> List[str]:
"""Gets list of non-public headers from a bazel rule"""
result = []
for dep in bazel_rule["hdrs"]:
if (
dep.startswith("//")
and not dep.startswith("//:include/")
and dep.endswith(".h")
):
result.append(_extract_source_file_path(dep))
for dep in list(
bazel_rule["hdrs"] + bazel_rule["textual_hdrs"] + bazel_rule["srcs"]
):
if not dep.startswith("//:include/") and _has_header_suffix(dep):
source_file_maybe = _try_extract_source_file_path(dep)
if source_file_maybe:
result.append(source_file_maybe)
return list(sorted(result))
@ -227,24 +278,9 @@ def _extract_sources(bazel_rule: BuildMetadata) -> List[str]:
result = []
for src in bazel_rule["srcs"]:
if src.endswith(".cc") or src.endswith(".c") or src.endswith(".proto"):
if src.startswith("//"):
# This source file is local to gRPC
result.append(_extract_source_file_path(src))
else:
# This source file is external, and we need to translate the
# @REPO_NAME to a valid path prefix. At this stage, we need
# to check repo name, since the label/path mapping is not
# available in BUILD files.
external_proto_library_name = _maybe_get_internal_path(src)
if external_proto_library_name is not None:
result.append(
src.replace(
"@%s//" % external_proto_library_name,
EXTERNAL_PROTO_LIBRARIES[
external_proto_library_name
].proto_prefix,
).replace(":", "/")
)
source_file_maybe = _try_extract_source_file_path(src)
if source_file_maybe:
result.append(source_file_maybe)
return list(sorted(result))
@ -297,16 +333,24 @@ def _external_dep_name_from_bazel_dependency(bazel_dep: str) -> Optional[str]:
# special case for add dependency on one of the absl libraries (there is not just one absl library)
prefixlen = len("@com_google_absl//")
return bazel_dep[prefixlen:]
elif bazel_dep == "//external:upb_lib":
return "upb"
elif bazel_dep == "//external:benchmark":
elif bazel_dep == "@com_github_google_benchmark//:benchmark":
return "benchmark"
elif bazel_dep == "//external:libssl":
elif bazel_dep == "@boringssl//:ssl":
return "libssl"
elif bazel_dep == "@com_github_cares_cares//:ares":
return "cares"
elif (
bazel_dep == "@com_google_protobuf//:protobuf"
or bazel_dep == "@com_google_protobuf//:protobuf_headers"
):
return "protobuf"
elif bazel_dep == "@com_google_protobuf//:protoc_lib":
return "protoc"
else:
# all the other external deps such as protobuf, cares, zlib
# don't need to be listed explicitly, they are handled automatically
# by the build system (make, cmake)
# Two options here:
# * either this is not external dependency at all (which is fine, we will treat it as internal library)
# * this is external dependency, but we don't want to make the dependency explicit in the build metadata
# for other build systems.
return None
@ -493,7 +537,9 @@ def update_test_metadata_with_transitive_metadata(
lib_dict["defaults"] = "benchmark"
if "//external:gtest" in bazel_rule["_TRANSITIVE_DEPS"]:
# run_tests.py checks the "gtest" property to see if test should be run via gtest.
lib_dict["gtest"] = True
# TODO: this might be incorrect categorization of the test...
lib_dict["language"] = "c++"
@ -576,7 +622,14 @@ def _expand_upb_proto_library_rules(bazel_rules):
break
if proto_src.startswith("@"):
raise Exception('"{0}" is unknown workspace.'.format(name))
proto_src = _extract_source_file_path(proto_src)
proto_src_file = _try_extract_source_file_path(proto_src)
if not proto_src_file:
raise Exception(
'Failed to get source file for "{0}" in upb rule "{1}".'.format(
proto_src, name
)
)
ext = (
".upb"
if gen_func == "grpc_upb_proto_library"
@ -587,12 +640,41 @@ def _expand_upb_proto_library_rules(bazel_rules):
if gen_func == "grpc_upb_proto_library"
else GEN_UPBDEFS_ROOT
)
srcs.append(root + proto_src.replace(".proto", ext + ".c"))
hdrs.append(root + proto_src.replace(".proto", ext + ".h"))
srcs.append(root + proto_src_file.replace(".proto", ext + ".c"))
hdrs.append(root + proto_src_file.replace(".proto", ext + ".h"))
bazel_rule["srcs"] = srcs
bazel_rule["hdrs"] = hdrs
def _patch_grpc_proto_library_rules(bazel_rules):
for name, bazel_rule in bazel_rules.items():
contains_proto = any(
src.endswith(".proto") for src in bazel_rule.get("srcs", [])
)
generator_func = bazel_rule.get("generator_function", None)
if (
name.startswith("//")
and contains_proto
and generator_func == "grpc_proto_library"
):
# Add explicit protobuf dependency for internal c++ proto targets.
bazel_rule["deps"].append("//external:protobuf")
def _patch_descriptor_upb_proto_library(bazel_rules):
# The upb's descriptor_upb_proto library doesn't reference the generated descriptor.proto
# sources explicitly, so we add them manually.
bazel_rule = bazel_rules.get("@upb//:descriptor_upb_proto", None)
if bazel_rule:
bazel_rule["srcs"].append(
":src/core/ext/upb-generated/google/protobuf/descriptor.upb.c"
)
bazel_rule["hdrs"].append(
":src/core/ext/upb-generated/google/protobuf/descriptor.upb.h"
)
def _generate_build_metadata(
build_extra_metadata: BuildDict, bazel_rules: BuildDict
) -> BuildDict:
@ -880,7 +962,7 @@ def _generate_build_extra_metadata_for_tests(
# short test name without the path.
# There can be name collisions, but we will resolve them later
simple_test_name = os.path.basename(_extract_source_file_path(test))
simple_test_name = os.path.basename(_try_extract_source_file_path(test))
test_dict["_RENAME"] = simple_test_name
test_metadata[test] = test_dict
@ -977,6 +1059,49 @@ _BUILD_EXTRA_METADATA = {
"build": "all",
"_RENAME": "address_sorting",
},
"@upb//:upb": {
"language": "c",
"build": "all",
"_RENAME": "upb",
},
"@upb//:collections": {
"language": "c",
"build": "all",
"_RENAME": "upb_collections_lib",
},
"@upb//:json": {
"language": "c",
"build": "all",
"_RENAME": "upb_json_lib",
},
"@upb//:textformat": {
"language": "c",
"build": "all",
"_RENAME": "upb_textformat_lib",
},
"@utf8_range//:utf8_range": {
"language": "c",
"build": "all",
# rename to utf8_range_lib is necessary for now to avoid clash with utf8_range target in protobuf's cmake
"_RENAME": "utf8_range_lib",
},
"@com_googlesource_code_re2//:re2": {
"language": "c",
"build": "all",
"_RENAME": "re2",
},
"@com_google_googletest//:gtest": {
"language": "c",
"build": "private",
"_RENAME": "gtest",
},
"@zlib//:zlib": {
"language": "c",
"zlib": True,
"build": "private",
"defaults": "zlib",
"_RENAME": "z",
},
"gpr": {
"language": "c",
"build": "all",
@ -1165,6 +1290,8 @@ _BAZEL_DEPS_QUERIES = [
'deps("//test/...")',
'deps("//:all")',
'deps("//src/compiler/...")',
# allow resolving bind() workspace rules to the actual targets they point to
'kind(bind, "//external:*")',
# The ^ is needed to differentiate proto_library from go_proto_library
'deps(kind("^proto_library", @envoy_api//envoy/...))',
]
@ -1192,6 +1319,12 @@ for query in _BAZEL_DEPS_QUERIES:
# .upb.h and .upb.c files.
_expand_upb_proto_library_rules(bazel_rules)
# Step 1.6: Add explicit protobuf dependency to grpc_proto_library rules
_patch_grpc_proto_library_rules(bazel_rules)
# Step 1.7: Make sure upb descriptor.proto library uses the pre-generated sources.
_patch_descriptor_upb_proto_library(bazel_rules)
# Step 2: Extract the known bazel cc_test tests. While most tests
# will be buildable with other build systems just fine, some of these tests
# would be too difficult to build and run with other build systems,

@ -20,9 +20,6 @@ gen_build_yaml_dirs=" \
src/boringssl \
src/benchmark \
src/proto \
src/re2 \
src/upb \
src/zlib \
src/c-ares \
test/cpp/naming"

@ -30,13 +30,17 @@ def transitive_deps(lib_map, node):
start = node
def recursive_helper(node):
if node is None:
return
for dep in node.get("deps", []):
if dep not in seen:
seen.add(dep)
next_node = lib_map.get(dep)
recursive_helper(next_node)
if next_node:
recursive_helper(next_node)
else:
# For some deps, the corrensponding library entry doesn't exist,
# but we still want to preserve the dependency so that the build
# system can provide custom handling for that depdendency.
result.append(dep)
if node is not start:
result.insert(0, node["name"])

Loading…
Cancel
Save