Skip to content

Commit 17c3054

Browse files
committed
Enforce include cleaner and regroup includes in cuttlefish/io
- Enable clang-tidy with 'with_include_cleaner' config for cuttlefish/io. - Fix all include cleaner errors by adding direct includes and removing unused ones. - Regroup all includes in cuttlefish/io to follow the 5-group style: 1. Corresponding header 2. C headers 3. C++ headers 4. Other projects (absl, gtest, etc.) 5. Current project (cuttlefish/) - Update BUILD.bazel dependencies for strict deps. Assisted-by: Gemini:Next
1 parent 5fe3744 commit 17c3054

28 files changed

Lines changed: 78 additions & 24 deletions

base/cvd/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ filegroup(
2727
name = "clang_tidy_config",
2828
srcs = [
2929
".clang-tidy",
30+
"//cuttlefish/io:.clang-tidy",
3031
"//cuttlefish/common/libs/key_equals_value:.clang-tidy",
3132
"//cuttlefish/host/commands/assemble_cvd/android_build:.clang-tidy",
3233
"//cuttlefish/host/commands/cvd/cli/commands:.clang-tidy",

base/cvd/cuttlefish/io/.clang-tidy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../clang_tidy_configs/with_include_cleaner

base/cvd/cuttlefish/io/BUILD.bazel

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ package(
66
default_visibility = ["//:android_cuttlefish"],
77
)
88

9+
exports_files([".clang-tidy"])
10+
911
cf_cc_library(
1012
name = "chroot",
1113
srcs = ["chroot.cc"],
@@ -31,6 +33,7 @@ cf_cc_test(
3133
"//cuttlefish/io:filesystem",
3234
"//cuttlefish/io:in_memory",
3335
"//cuttlefish/io:string",
36+
"//cuttlefish/result",
3437
"//cuttlefish/result:result_matchers",
3538
],
3639
)
@@ -58,6 +61,7 @@ cf_cc_test(
5861
"//cuttlefish/io:concat",
5962
"//cuttlefish/io:in_memory",
6063
"//cuttlefish/io:string",
64+
"//cuttlefish/result",
6165
"//cuttlefish/result:result_matchers",
6266
],
6367
)
@@ -108,10 +112,12 @@ cf_cc_test(
108112
srcs = ["cpio_test.cc"],
109113
clang_format_enabled = True,
110114
deps = [
115+
":io",
111116
"//cuttlefish/io:cpio",
112117
"//cuttlefish/io:in_memory",
113118
"//cuttlefish/io:read_exact",
114119
"//cuttlefish/io:string",
120+
"//cuttlefish/result",
115121
"//cuttlefish/result:result_matchers",
116122
],
117123
)
@@ -222,6 +228,7 @@ cf_cc_test(
222228
srcs = ["in_memory_test.cc"],
223229
clang_format_enabled = True,
224230
deps = [
231+
":io",
225232
"//cuttlefish/io:in_memory",
226233
"//cuttlefish/result:result_matchers",
227234
"//cuttlefish/result:result_type",
@@ -300,12 +307,14 @@ cf_cc_test(
300307
srcs = ["lz4_legacy_test.cc"],
301308
clang_format_enabled = True,
302309
deps = [
310+
":io",
303311
"//cuttlefish/io:filesystem",
304312
"//cuttlefish/io:in_memory",
305313
"//cuttlefish/io:lz4_legacy",
306314
"//cuttlefish/io:read_exact",
307315
"//cuttlefish/io:string",
308316
"//cuttlefish/io:write_exact",
317+
"//cuttlefish/result",
309318
"//cuttlefish/result:result_matchers",
310319
],
311320
)
@@ -344,6 +353,7 @@ cf_cc_library(
344353
hdrs = ["read_window_view.h"],
345354
clang_format_enabled = True,
346355
deps = [
356+
":io",
347357
"//cuttlefish/io:fake_seek",
348358
"//cuttlefish/result:expect",
349359
"//cuttlefish/result:result_type",

base/cvd/cuttlefish/io/chroot.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <stdint.h>
1919

2020
#include <list>
21+
#include <memory>
2122
#include <string>
2223
#include <string_view>
2324

base/cvd/cuttlefish/io/chroot.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@
1515

1616
#pragma once
1717

18-
#include "cuttlefish/io/filesystem.h"
19-
2018
#include <stdint.h>
2119

2220
#include <string>
2321
#include <string_view>
2422

23+
#include "cuttlefish/io/filesystem.h"
2524
#include "cuttlefish/io/io.h"
2625
#include "cuttlefish/result/result_type.h"
2726

base/cvd/cuttlefish/io/chroot_test.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,18 @@
1515

1616
#include "cuttlefish/io/chroot.h"
1717

18-
#include <string>
18+
#include <memory>
1919
#include <string_view>
2020

2121
#include "gmock/gmock.h"
2222
#include "gtest/gtest.h"
2323

2424
#include "cuttlefish/io/copy.h"
25+
#include "cuttlefish/io/filesystem.h"
2526
#include "cuttlefish/io/in_memory.h"
2627
#include "cuttlefish/io/io.h"
2728
#include "cuttlefish/io/string.h"
29+
#include "cuttlefish/result/result.h"
2830
#include "cuttlefish/result/result_matchers.h"
2931

3032
namespace cuttlefish {

base/cvd/cuttlefish/io/concat.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515

1616
#include "cuttlefish/io/concat.h"
1717

18+
#include <cstdint>
1819
#include <map>
1920
#include <memory>
21+
#include <utility>
2022
#include <vector>
2123

2224
#include "cuttlefish/io/fake_seek.h"

base/cvd/cuttlefish/io/concat_test.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,18 @@
1515

1616
#include "cuttlefish/io/concat.h"
1717

18-
#include <string>
18+
#include <memory>
1919
#include <string_view>
20+
#include <utility>
21+
#include <vector>
2022

2123
#include "gmock/gmock.h"
2224
#include "gtest/gtest.h"
2325

2426
#include "cuttlefish/io/in_memory.h"
2527
#include "cuttlefish/io/io.h"
2628
#include "cuttlefish/io/string.h"
29+
#include "cuttlefish/result/result.h"
2730
#include "cuttlefish/result/result_matchers.h"
2831

2932
namespace cuttlefish {

base/cvd/cuttlefish/io/copy.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <stddef.h>
1919
#include <stdint.h>
2020

21+
#include <array>
2122
#include <memory>
2223

2324
#include "cuttlefish/io/io.h"

base/cvd/cuttlefish/io/copy_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
#include "cuttlefish/io/copy.h"
1717

1818
#include <memory>
19-
#include <string>
2019
#include <vector>
2120

2221
#include "gmock/gmock-matchers.h"
2322
#include "gtest/gtest.h"
2423

2524
#include "cuttlefish/io/in_memory.h"
25+
#include "cuttlefish/io/io.h"
2626
#include "cuttlefish/io/read_exact.h"
2727
#include "cuttlefish/result/result_matchers.h"
2828

0 commit comments

Comments
 (0)