googleapis / googleapis/google-cloud-cpp

Make top-level rules usable with Bazel's `layering_check`

Offen
#12,760 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
cpp: operator type: feature request
Vorherrschende Sprache
C++
Sterne
659
Forks
462
Ø Merge
1 T. 2 Std.
Gemergte PRs (30 T.)
89

Beschreibung

Bazel enforces "Header inclusion rules": https://bazel.build/reference/be/c-cpp#hdrs

When the `layering_check` feature is enabled, none of the top-level targets are usable. They have no `hdrs` value:

https://github.com/googleapis/google-cloud-cpp/blob/8ecdff6cd9ad79e2b2b847edd83205fb8ae65071/BUILD.bazel#L79-L87

- [x] I think we need to change the code to something like:
```bzl
[cc_library(
name = "{library}".format(library = library),
hdrs = ["//google/cloud/{dir}:hdrs".format(dir=google_cloud_cpp_library_dir_name(library)],
deps = [
"//google/cloud/{library_dir}:google_cloud_cpp_{library}".format(
library = library,
library_dir = google_cloud_cpp_library_dir_name(library),
),
],
) for library in GA_LIBRARIES + TRANSITION_LIBRARIES]
```

- [x] Verify all libraries, specially the hand-crafted libraries, have a `filegroup` defined for the headers.
- [x] It might be desirable to remove anything with `/internal/` in the name from this `filegroup` too.
- [ ] We should enable `layering_check` in the package once this is working
- [ ] We should verify the `quickstart` programs compile with `layering_check` once this is working

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.