Skip to content

Commit 5b58507

Browse files
Consolidate cmake error targets to match BUCK fboss-error
The BUCK build has a single `fboss-error` target containing: - `FbossError.h` - `FbossHwUpdateError.h` - `SysError.h` The cmake build previously had two separate targets: - `error` (only `FbossError.h`) - `fboss_error` (`FbossError.h` and `SysError.h`) This caused divergence between the two build systems. Changes made: 1. Remove the `error` target from `cmake/Agent.cmake` 2. Update `fboss_error` to include all three headers to match BUCK: - `FbossError.h` - `FbossHwUpdateError.h` (was missing) - `SysError.h` 3. Update `fboss_error` dependencies to match BUCK exactly: - `fboss_cpp2` (matches `//fboss/agent/if:fboss-cpp2-types`) - `Folly::folly` (matches `//folly:conv` and `//folly/logging:logging`) - Remove `fboss_types` (not in BUCK dependencies) - Plot twist: add`switch_config_cpp2` dependency to `logging_util` target. This was previously provided transitively via `fboss_error` -> `fboss_types` -> `switch_config_cpp2`, but removing `fboss_types` from `fboss_error` broke that chain. The `logging_util` target directly includes `switch_config_types.h` so it needs to declare this dependency explicitly. 4. Replace all 23 instances of `error` dependency with `fboss_error` across 16 cmake files 5. Add missing `fboss_error` dependency to `external_phy` target (required in the BUCK file but was missing in cmake) Additionally, two more fixes had to be fixed to address all the remaining issue with `system_scale_test_utils` found by the script, and those were resolved once again by matching BUCK files: - Remove bundled source files (`PortFlapHelper.cpp`, `MacLearningFloodHelper.cpp`) - Add dependencies on existing `port_flap_helper` and `mac_learning_flood_helper` targets (defined in `AgentTestUtils.cmake`) Oh and a few more errors that sneaked into the code more recently and that I missed in facebook#833 because I was working off a fork a few days old: 1. In `cmake/AgentState.cmake`, the `state` library was missing a dependency on `agent_features` (from Buck dep: `//fboss/agent:agent_features`) 2. In `cmake/fsdb/FsdbIf.cmake`, the `thriftpath_lib` library was missing a dependency on `fsdb_utils` (from Buck dep: `//fboss/fsdb/common:utils`) 3. In `cmake/fsdb/FsdbTests.cmake`, the `thriftpath_test_cpp2` library was missing a dependency on `common_cpp2` (from Buck dep: `//fboss/agent/if:common`) Bonus: add duplicate cmake target detection to `buck_cmake_dep_checker.py`, because while fixing that last error I inadvertently made the mistake of creating a duplicate rule in a cmake file that was defined in another. Also fix the tool to handle thrift sub-targets. Buck thrift_library generates sub-targets like `//path:name-cpp2-types`, `//path:name-cpp2-services`, etc. The tool now maps these to the corresponding cmake thrift target, which uncovered 9 additional pre-existing missing dependencies that are now fixed: - Add `switch_config_cpp2` to `logging_util` (includes `switch_config_types.h`) - Add `ctrl_cpp2` to `label_forwarding_action` (includes `ctrl_types.h`) - Add `agent_hw_test_ctrl_cpp2` to `aqm_test_utils` - Add `data_corral_service_cpp2`, `fan_service_cpp2`, `rackmon_cpp2` to `fboss2_lib` - Add `fboss_common_cpp2` to `product_info` - Add `fan_service_cpp2` to `cross_config_validator` - Add `fan_service_cpp2` to `fan_service_config_validator` - Add `transceiver_cpp2` to `qsfp_stats` Now the script doesn't report any errors anymore and could potentially be used in CI to ensure no further differences between the BUCK build and the cmake build are introduced.
1 parent ccd34a4 commit 5b58507

26 files changed

+87
-41
lines changed

cmake/Agent.cmake

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ add_library(utils
148148
target_link_libraries(utils
149149
agent_dir_util
150150
asic_utils
151-
error
151+
fboss_error
152152
ctrl_cpp2
153153
hw_switch_fb303_stats
154154
load_agent_config
@@ -260,7 +260,7 @@ add_library(hw_switch_thrift_client_table
260260
)
261261

262262
target_link_libraries(hw_switch_thrift_client_table
263-
error
263+
fboss_error
264264
fboss_types
265265
hw_ctrl_cpp2
266266
Folly::folly
@@ -432,15 +432,6 @@ set(core_libs
432432

433433
target_link_libraries(core ${core_libs})
434434

435-
add_library(error
436-
fboss/agent/FbossError.h
437-
)
438-
439-
target_link_libraries(error
440-
ctrl_cpp2
441-
Folly::folly
442-
)
443-
444435
add_library(thrifthandler_utils
445436
fboss/agent/ThriftHandlerUtils.cpp
446437
)
@@ -491,12 +482,12 @@ target_link_libraries(fboss_event_base
491482

492483
add_library(fboss_error
493484
fboss/agent/FbossError.h
485+
fboss/agent/FbossHwUpdateError.h
494486
fboss/agent/SysError.h
495487
)
496488

497489
target_link_libraries(fboss_error
498490
fboss_cpp2
499-
fboss_types
500491
Folly::folly
501492
)
502493

@@ -514,7 +505,7 @@ target_link_libraries(platform_base
514505
agent_config_cpp2
515506
agent_dir_util
516507
ctrl_cpp2
517-
error
508+
fboss_error
518509
fboss_event_base
519510
fboss_types
520511
Folly::folly

cmake/AgentHw.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ target_link_libraries(hw_switch_fb303_stats
8484

8585
target_link_libraries(hw_fb303_stats
8686
counter_utils
87-
error
87+
fboss_error
8888
fb303::fb303
8989
Folly::folly
9090
switch_config_cpp2

cmake/AgentHwSaiApi.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ add_library(logging_util
1818
target_link_libraries(logging_util
1919
fboss_cpp2
2020
fboss_error
21+
switch_config_cpp2
2122
Folly::folly
2223
)
2324

cmake/AgentHwSaiDiag.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ add_library(diag_shell
1111
target_link_libraries(diag_shell
1212
sai_repl
1313
python_repl
14-
error
14+
fboss_error
1515
sai_switch
1616
sai_tracer
1717
Folly::folly
@@ -32,7 +32,7 @@ add_library(python_repl
3232
target_include_directories(python_repl PRIVATE Python3::Python)
3333

3434
target_link_libraries(python_repl
35-
error
35+
fboss_error
3636
Folly::folly
3737
Python3::Python
3838
# Python3::Python requires forkpty and openpty provided by libutil.
@@ -46,7 +46,7 @@ add_library(sai_repl
4646
)
4747

4848
target_link_libraries(sai_repl
49-
error
49+
fboss_error
5050
sai_api
5151
Folly::folly
5252
)

cmake/AgentHwSwitchAsics.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ add_library(switch_asics
3232

3333
target_link_libraries(switch_asics
3434
agent_features
35-
error
35+
fboss_error
3636
fboss_cpp2
3737
fboss_types
3838
phy_cpp2

cmake/AgentPacket.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ add_library(pktutil
4444
)
4545

4646
target_link_libraries(pktutil
47-
error
47+
fboss_error
4848
Folly::folly
4949
)
5050

cmake/AgentPlatformsCommon.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ add_library(platform_mapping
1111

1212
target_link_libraries(platform_mapping
1313
agent_features
14-
error
14+
fboss_error
1515
fboss_config_utils
1616
platform_config_cpp2
1717
state
@@ -23,7 +23,7 @@ add_library(platform_mapping_utils
2323
)
2424

2525
target_link_libraries(platform_mapping_utils
26-
error
26+
fboss_error
2727
minipack_platform_mapping
2828
elbert_platform_mapping
2929
yamp_platform_mapping

cmake/AgentPlatformsCommonUtils.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ add_library(wedge_led_utils
1313
)
1414

1515
target_link_libraries(wedge_led_utils
16-
error
16+
fboss_error
1717
ctrl_cpp2
1818
fboss_types
1919
transceiver_cpp2

cmake/AgentRib.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ add_library(standalone_rib
1313
target_link_libraries(standalone_rib
1414
network_to_route_map
1515
address_utils
16-
error
16+
fboss_error
1717
fboss_event_base
1818
fboss_types
1919
switch_config_cpp2

cmake/AgentState.cmake

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ add_library(state
118118

119119
target_link_libraries(state
120120
address_utils
121-
error
121+
agent_features
122+
fboss_error
122123
platform_config_cpp2
123124
switch_config_cpp2
124125
switch_state_cpp2
@@ -143,7 +144,7 @@ add_library(state_utils
143144
)
144145

145146
target_link_libraries(state_utils
146-
error
147+
fboss_error
147148
fboss_types
148149
hwswitch_matcher
149150
state
@@ -156,7 +157,8 @@ add_library(label_forwarding_action
156157
)
157158

158159
target_link_libraries(label_forwarding_action
159-
error
160+
ctrl_cpp2
161+
fboss_error
160162
fboss_cpp2
161163
Folly::folly
162164
)

0 commit comments

Comments
 (0)