Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated fix for refs/heads/bazel_to_cmake_improvements2 #183

Open
wants to merge 1 commit into
base: bazel_to_cmake_improvements2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11,980 changes: 8,393 additions & 3,587 deletions CMakeLists.txt

Large diffs are not rendered by default.

5,858 changes: 4,559 additions & 1,299 deletions Makefile

Large diffs are not rendered by default.

857 changes: 0 additions & 857 deletions Package.swift

Large diffs are not rendered by default.

13,020 changes: 6,193 additions & 6,827 deletions build_autogenerated.yaml

Large diffs are not rendered by default.

2,945 changes: 1,890 additions & 1,055 deletions grpc.gyp

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions include/grpc/module.modulemap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 24 additions & 22 deletions tools/buildgen/extract_metadata_from_bazel_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -1000,37 +1000,38 @@ def _generate_build_extra_metadata_for_tests(
return test_metadata


def _generate_build_extra_metadata_for_libraries(existing: BuildDict,
libraries: List[str], bazel_rules: BuildDict
def _generate_build_extra_metadata_for_libraries(
existing: BuildDict, libraries: List[str], bazel_rules: BuildDict
) -> BuildDict:
"""For given tests, generate the "extra metadata" that we need for our "build.yaml"-like output. The extra metadata is generated from the bazel rule metadata by using a bunch of heuristics."""
lib_metadata = {}
for lib in libraries:

# TODO: should we use: bazel_rule = bazel_rules[_get_bazel_label(test)]
bazel_rule = bazel_rules[lib]
prefix = '//:' # libs in top level BUILD file

prefix = "//:" # libs in top level BUILD file
if not lib.startswith(prefix):
continue

lib_name = lib[len(prefix):]
lib_name = lib[len(prefix) :]

if lib_name in existing:
print('skipping existing ' + lib_name)
print("skipping existing " + lib_name)
# skip existing
continue

print("examining " + lib_name)

# guess language of the library, based on sources and headers
lang = 'c'
for src in bazel_rule['srcs']:
if src.startswith('//:src/cpp'):
lang = 'c++'
for hdr in bazel_rule['hdrs']:
if hdr.startswith('//:include/grpcpp/') or src.startswith('//:include/grpc++/'):
lang = 'c++'
lang = "c"
for src in bazel_rule["srcs"]:
if src.startswith("//:src/cpp"):
lang = "c++"
for hdr in bazel_rule["hdrs"]:
if hdr.startswith("//:include/grpcpp/") or src.startswith(
"//:include/grpc++/"
):
lang = "c++"

lib_dict = {"build": "all", "language": lang}

Expand All @@ -1039,7 +1040,6 @@ def _generate_build_extra_metadata_for_libraries(existing: BuildDict,
bazel_tags = bazel_rule["tags"]
if "bazel_only" in bazel_tags:
continue


print(" adding " + str(lib_dict))
lib_metadata[lib_name] = lib_dict
Expand Down Expand Up @@ -1415,13 +1415,13 @@ def _detect_and_print_issues(build_yaml_like: BuildYaml) -> None:
import pprint

for lib in libraries:
if lib.startswith(':'):
rule = bazel_rules['//' + lib]
if lib.startswith(":"):
rule = bazel_rules["//" + lib]

print("------------------")
print(lib)
pprint.pprint(rule['srcs'], indent=2)
pprint.pprint(rule['hdrs'], indent=2)
print("------------------")
print(lib)
pprint.pprint(rule["srcs"], indent=2)
pprint.pprint(rule["hdrs"], indent=2)

# Step 3: Generate the "extra metadata" for all our build targets.
# While the bazel rules give us most of the information we need,
Expand Down Expand Up @@ -1456,7 +1456,9 @@ def _detect_and_print_issues(build_yaml_like: BuildYaml) -> None:
_generate_build_extra_metadata_for_tests(tests, bazel_rules)
)
all_extra_metadata.update(
_generate_build_extra_metadata_for_libraries(_BUILD_EXTRA_METADATA, libraries, bazel_rules)
_generate_build_extra_metadata_for_libraries(
_BUILD_EXTRA_METADATA, libraries, bazel_rules
)
)

# Step 4: Compute the build metadata that will be used in the final build.yaml.
Expand Down
26 changes: 1 addition & 25 deletions tools/doxygen/Doxyfile.c++

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading