googleapis / googleapis/google-cloud-cpp

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

オープン
#12,760 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る
cpp: operator type: feature request
主要言語
C++
スター
659
フォーク
462
平均マージ
1日 2時間
マージ済み PR(30日)
89

説明

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

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

BUILD.bazel の79-87行目から始め、トップレベルのライブラリ定義とそれらのヘッダーファイルグループを調べます。手作業で作成されたものを含むすべてのライブラリが意図されたヘッダーを公開していることを確認し、その後パッケージで layering_check を有効にして、quickstart プログラムがそれを使ってコンパイルできることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
cpp
領域
build-system
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。