Skip to content

Conversation

@benoit-nexthop
Copy link
Contributor

Pre-submission checklist

  • I've ran the linters locally and fixed lint errors related to the files I modified in this PR. You can install the linters by running pip install -r requirements-dev.txt && pre-commit install
  • pre-commit run

Summary

This commit adds missing dependencies to cmake targets that were present in the corresponding BUCK targets but missing in cmake. These dependencies were detected using the new buck_cmake_dep_checker.py tool.

This commit fixes all but 11 of the dependencies problems found by the tool. The remaining 11 will be fixed in a subsequent PR where a bit of restructuring is needed in the cmake files to match the BUCK files more closely.

Fixes in cmake/Agent.cmake:

  1. setup_thrift: Added thrift_method_rate_limit fboss/agent/BUCK has //fboss/lib:thrift_method_rate_limit in exported_deps for setup_thrift

  2. utils: Added hw_switch_fb303_stats fboss/agent/BUCK has //fboss/agent/hw:hw_switch_fb303_stats in exported_deps for utils

  3. stats: Added common_utils fboss/agent/BUCK has //fboss/lib:common_utils in exported_deps for stats

  4. ecmp_resource_manager: Added ref_map, stats, and utils fboss/agent/BUCK has //fboss/lib:ref_map, :stats, and :utils in exported_deps for ecmp_resource_manager

  5. platform_base: Added utils, product_info, and fboss_event_base fboss/agent/BUCK has :utils, //fboss/lib/platforms:product-info, and :fboss_event_base in exported_deps for platform_base

  6. hw_switch_handler: Added fboss_event_base fboss/agent/BUCK has :fboss_event_base in exported_deps for hw_switch_handler

  7. switchinfo_utils: Added fboss_error and load_agent_config fboss/agent/BUCK has :fboss-error and :load_agent_config in exported_deps for switchinfo_utils

  8. core: Added packet_factory to core_libs variable fboss/agent/BUCK has //fboss/agent/packet:packet_factory in deps for core

  9. fboss_event_base: Added agent_features fboss/agent/BUCK has :agent_features in exported_deps for fboss_event_base

  10. agent_netwhoami: Added common_file_utils fboss/agent/BUCK has //fboss/lib:common_file_utils in exported_deps for agent_netwhoami

Fixes in cmake/AgentHw.cmake:

  1. hw_fb303_stats: Added error fboss/agent/hw/BUCK has //fboss/agent:fboss-error in exported_deps for hw_fb303_stats

  2. hw_port_fb303_stats: Added hw_fb303_stats and fboss_types fboss/agent/hw/BUCK has :hw_fb303_stats and //fboss/agent:fboss-types in exported_deps for hw_port_fb303_stats

Fixes in cmake/AgentHwMock.cmake:

  1. hw_mock: Added handler fboss/agent/hw/mock/BUCK has //fboss/agent:handler in exported_deps for mock

Fixes in cmake/AgentHwSaiHwTest.cmake:

  1. agent_hw_test_thrift_handler: Added hw_switch fboss/agent/hw/bcm/tests/BUCK has //fboss/agent:hw_switch in exported_deps for agent_hw_test_thrift_handler

Fixes in cmake/AgentHwSwitchAsics.cmake:

  1. switch_asics: Added agent_features, error, and fboss_types fboss/agent/hw/switch_asics/BUCK has //fboss/agent:agent_features, //fboss/agent:fboss-error, and //fboss/agent:fboss-types in exported_deps for switch_asics

Fixes in cmake/AgentHwTest.cmake:

  1. config_factory: Added acl_test_utils, split_agent_thrift_syncer, multiswitch_test_server fboss/agent/hw/test/BUCK has //fboss/agent/test/utils:acl_test_utils, //fboss/agent:split_agent_thrift_syncer, and //fboss/agent/test:multiswitch_test_server in exported_deps for config_factory

  2. hw_packet_utils: Added agent_test_utils fboss/agent/hw/test/BUCK has //fboss/agent/test:utils in exported_deps for hw_packet_utils

  3. hw_copp_utils: Added copp_test_utils and hw_packet_utils fboss/agent/hw/test/BUCK has //fboss/agent/test/utils:copp_test_utils and :hw_packet_utils in exported_deps for hw_copp_utils

  4. hw_link_state_toggler: Added test_ensemble_if fboss/agent/test/BUCK has :test_ensemble_if in exported_deps for linkstate_toggler

  5. load_balancer_utils: Added load_balancer_test_utils fboss/agent/hw/test/BUCK has //fboss/agent/test/utils:load_balancer_test_utils in exported_deps for load_balancer_utils

Fixes in cmake/AgentLldp.cmake:

  1. lldp: Added agent_features and cow_storage fboss/agent/lldp/BUCK has //fboss/agent:agent_features and //fboss/thrift_cow/storage:cow_storage in exported_deps for lldp

Fixes in cmake/AgentPacket.cmake:

  1. packet_factory: Added hw_switch fboss/agent/packet/BUCK has //fboss/agent:hw_switch in deps for packet_factory

Fixes in cmake/AgentPlatformsCommon.cmake:

  1. platform_mapping_utils: Added platform_mode fboss/agent/platforms/common/BUCK has //fboss/lib/platforms:platform_mode in exported_deps for platform_mapping_utils

Fixes in cmake/AgentPlatformsCommonGalaxy.cmake:

  1. galaxy_platform_mapping: Added utils fboss/agent/platforms/common/galaxy/BUCK has //fboss/agent:utils in exported_deps for galaxy_platform_mapping

Fixes in cmake/AgentPlatformsCommonMinipack.cmake:

  1. minipack_platform_mapping: Added platform_mode fboss/agent/platforms/common/minipack/BUCK has //fboss/lib/platforms:platform_mode in exported_deps for minipack_platform_mapping

Fixes in cmake/AgentPlatformsCommonUtils.cmake:

  1. wedge_led_utils: Added wedge_transceiver fboss/agent/platforms/common/utils/BUCK has //fboss/qsfp_service/platforms/wedge:wedge-transceiver in exported_deps for wedge-led-utils

Fixes in cmake/AgentRib.cmake:

  1. standalone_rib: Added fboss_event_base and utils fboss/agent/rib/BUCK has //fboss/agent:fboss_event_base and //fboss/agent:utils in exported_deps for standalone_rib

  2. network_to_route_map: Added state fboss/agent/rib/BUCK has //fboss/agent/state:state in exported_deps for network_to_route_map

Fixes in cmake/AgentState.cmake:

  1. state: Added address_utils fboss/agent/state/BUCK has //fboss/agent:address_utils in exported_deps for state

  2. state_utils: Added hwswitch_matcher and state fboss/agent/state/BUCK has :state and //fboss/agent:hwswitch_matcher in exported_deps for state_utils

Fixes in cmake/AgentTest.cmake:

  1. agent_test_utils: Added route_distribution_gen fboss/agent/test/BUCK has :route_distribution_gen in exported_deps for utils

  2. multinode_tests: Added agent_test_utils, hw_copp_utils, hw_packet_utils, load_balancer_utils fboss/agent/test/BUCK has :utils, //fboss/agent/hw/test:hw_copp_utils, //fboss/agent/hw/test:hw_packet_utils, and //fboss/agent/hw/test:load_balancer_utils in exported_deps for multinode_tests

  3. agent_ensemble: Added sw_agent_initializer fboss/agent/test/BUCK has //fboss/agent:sw_agent_initializer in exported_deps for agent_ensemble

  4. linkstate_toggler: Added test_ensemble_if fboss/agent/test/BUCK has :test_ensemble_if in exported_deps for linkstate_toggler

  5. system_scale_test_utils: Added trap_packet_utils fboss/agent/test/utils/BUCK has :trap_packet_utils in exported_deps for system_scale_test_utils

Fixes in cmake/AgentTestAgentHwTests.cmake:

  1. agent_hw_test_src: Added load_balancer_test_runner_h fboss/agent/test/agent_hw_tests/BUCK has //fboss/agent/test/utils:load_balancer_test_runner_h in exported_deps for agent_hw_test_src

Fixes in cmake/AgentTestLinkTests.cmake:

  1. link_tests: Added trap_packet_utils, hw_qos_utils, hw_test_fabric_utils fboss/agent/test/link_tests/BUCK has //fboss/agent/test/utils:trap_packet_utils, //fboss/agent/hw/test:hw_qos_utils, and //fboss/agent/hw/test:hw_test_fabric_utils in exported_deps for link_tests

  2. agent_ensemble_link_tests: Added trap_packet_utils and agent_test_utils fboss/agent/test/link_tests/BUCK has //fboss/agent/test/utils:trap_packet_utils and //fboss/agent/test:utils in exported_deps for agent_ensemble_link_tests

Fixes in cmake/AgentTestUtils.cmake:

  1. traffic_policy_utils: Added copp_test_utils fboss/agent/test/utils/BUCK has :copp_test_utils in exported_deps for traffic_policy_utils

  2. qos_test_utils: Added voq_test_utils, resourcelibutil, and pkt_test_utils fboss/agent/test/utils/BUCK has :voq_test_utils, //fboss/agent/test:resourcelibutil, and :pkt_test_utils in exported_deps for qos_test_utils

  3. l2learn_observer_util: Added agent_ensemble fboss/agent/test/utils/BUCK has //fboss/agent/test:agent_ensemble in exported_deps for l2learn_observer_util

  4. mac_test_utils: Added core fboss/agent/test/utils/BUCK has //fboss/agent:core in exported_deps for mac_test_utils

  5. pfc_test_utils: Added test_ensemble_if, agent_ensemble, and resourcelibutil fboss/agent/test/utils/BUCK has //fboss/agent/test:test_ensemble_if, //fboss/agent/test:agent_ensemble, and //fboss/agent/test:resourcelibutil in exported_deps for pfc_test_utils

Fixes in cmake/LedService.cmake:

  1. led_manager_lib: Added wedge400_fpga and common_port_utils fboss/led_service/BUCK has //fboss/lib/fpga:wedge400_fpga and //fboss/lib:common_port_utils in exported_deps for led_manager

Fixes in cmake/Lib.cmake:

  1. common_thrift_utils: Added thrift_service_client fboss/lib/BUCK has //fboss/lib/thrift_service_client:thrift-service-client in exported_deps for common_thrift_utils

  2. common_utils: Added common_file_utils fboss/lib/BUCK has :common_file_utils in exported_deps for common_utils

Fixes in cmake/LibFpga.cmake:

  1. fpga_multi_pim_container: Added fpga_device and qsfp_stats fboss/lib/fpga/BUCK has :fpga_device and //fboss/qsfp_service:stats in exported_deps for multi_pim_container

  2. fb_fpga_i2c: Added i2c_ctrl and i2_api fboss/lib/fpga/BUCK has //fboss/lib/i2c:i2c_ctrl and //fboss/lib/usb:i2-api in exported_deps for fb_fpga_i2c

  3. wedge400_i2c: Added i2_api fboss/lib/fpga/BUCK has //fboss/lib/usb:i2-api in exported_deps for wedge400_i2c

Fixes in cmake/LibI2c.cmake:

  1. i2c_ctrl: Added utils fboss/lib/i2c/BUCK has //fboss/agent:utils in exported_deps for i2c_ctrl

Fixes in cmake/LibPhy.cmake:

  1. external_phy: Added mdio, alert_logger, and fboss_types fboss/lib/phy/BUCK has //fboss/mdio:mdio, //fboss/lib:alert_logger, and //fboss/agent:fboss-types in exported_deps for external_phy

Fixes in cmake/PlatformBspTests.cmake:

  1. bsp_test_utils: Added platform_manager_i2c_explorer fboss/platform/bsp_tests/BUCK has //fboss/platform/platform_manager:i2c_explorer in exported_deps for utils

Fixes in cmake/PlatformPlatformChecks.cmake:

  1. platform_check: Added platform_config_lib fboss/platform/platform_checks/BUCK has //fboss/platform/config_lib:config_lib in exported_deps for platform_check

Fixes in cmake/PlatformPlatformManager.cmake:

  1. platform_manager_i2c_explorer: Added platform_fs_utils fboss/platform/platform_manager/BUCK has //fboss/platform/helpers:platform_fs_utils in exported_deps for i2c_explorer

  2. platform_manager_presence_checker: Added platform_fs_utils fboss/platform/platform_manager/BUCK has //fboss/platform/helpers:platform_fs_utils in exported_deps for presence_checker

Fixes in cmake/QsfpService.cmake:

56-72. Added bsp_platform_mapping to 17 BSP targets:
meru400bfu_bsp, meru400bia_bsp, meru400biu_bsp, meru800bia_bsp,
meru800bfa_bsp, montblanc_bsp, icecube800bc_bsp, icetea800bc_bsp,
minipack3n_bsp, morgan800cc_bsp, janga800bic_bsp, tahan800bc_bsp,
tahansb800bc_bsp, nh4010_bsp, wedge800bact_bsp, wedge800cact_bsp,
ladakh800bcls_bsp

All these targets in fboss/lib/bsp/*/BUCK have `//fboss/lib/bsp:bsp_platform_mapping_lib`
in exported_deps (example: fboss/lib/bsp/meru400bfu/BUCK has this for meru400bfu_bsp)
  1. qsfp_stats: Added fboss_types fboss/qsfp_service/BUCK has //fboss/agent:fboss-types in exported_deps for stats

  2. qsfp_bsp_core: Added gpiod_line and i2_api fboss/lib/bsp/BUCK has //fboss/lib:gpiod_line and //fboss/lib/usb:i2-api in exported_deps for bsp_core

  3. transceiver_validator: Added alert_logger fboss/qsfp_service/BUCK has //fboss/lib:alert_logger in exported_deps for transceiver_validator

Fixes in cmake/QsfpServiceTestHwTest.cmake:

  1. hw_transceiver_utils: Added platform_mapping fboss/qsfp_service/test/hw_test/BUCK has //fboss/agent/platforms/common:platform_mapping in exported_deps for hw_transceiver_utils

Fixes in cmake/ThriftCowVisitors.cmake:

  1. thrift_cow_visitors: Added thrift_cow_serializer fboss/thrift_cow/visitors/BUCK has //fboss/thrift_cow/nodes:serializer in exported_deps for visitors

Fixes in cmake/fsdb/FsdbClient.cmake:

  1. fsdb_sub_mgr: Added fsdb_flags and thrift_service_client fboss/fsdb/client/BUCK has //fboss/fsdb/common:flags and //fboss/lib/thrift_service_client:thrift-service-client in exported_deps for fsdb_sub_manager

Fixes in cmake/fsdb/FsdbIf.cmake:

  1. fsdb_model_cpp2: Added fsdb_common_cpp2 to DEPENDS fboss/fsdb/if/oss/BUCK has //fboss/fsdb/if:fsdb_common in deps for fsdb_model

Fixes in cmake/fsdb/FsdbOperInstantiations.cmake:

  1. fsdb_cow_stats_sub_mgr: Added fsdb_cow_state_sub_mgr fboss/fsdb/client/BUCK (fsdb_cow_stats_sub_manager target) has :fsdb_cow_state_sub_manager in exported_deps

Fixes in cmake/fsdb/FsdbServer.cmake:

  1. fsdb_server: Added restart_time_tracker fboss/fsdb/server/BUCK has //fboss/lib/restart_tracker:restart_time_tracker in exported_deps for fsdb_server

Fixes in cmake/fsdb/FsdbTests.cmake:

  1. fsdb_test_subscriber: Changed fsdb_model_cpp2 to fsdb_model fboss/fsdb/tests/utils/BUCK has //fboss/fsdb/if:fsdb_model in exported_deps for fsdb_test_subscriber (fsdb_model includes both cpp2 types and thriftpath)

  2. fsdb_test_clients: Changed fsdb_model_cpp2 to fsdb_model fboss/fsdb/tests/client/BUCK has //fboss/fsdb/if:fsdb_model in exported_deps for fsdb_test_clients

New tool added:

tools/buck_cmake_dep_checker.py - A tool to detect missing dependencies between Buck and cmake build systems by:

  • Parsing BUCK and cmake files to extract targets and their dependencies
  • Matching cmake targets to Buck targets based on source file overlap
  • Identifying dependencies present in Buck but missing in cmake
  • Supporting cmake variable expansion and transitive dependency analysis

Test Plan

The cmake build still succeeds, even in a heavily parallel build (make -j305).

@meta-cla meta-cla bot added the CLA Signed label Jan 23, 2026
This commit adds missing dependencies to cmake targets that were present
in the corresponding BUCK targets but missing in cmake. These dependencies
were detected using the new `buck_cmake_dep_checker.py` tool.

This commit fixes all but 11 of the dependencies problems found by the
tool. The remaining 11 will be fixed in a subsequent change where a bit
of restructuring is needed in the cmake files to match the BUCK files
more closely.

## Fixes in cmake/Agent.cmake:

1. setup_thrift: Added thrift_method_rate_limit
   fboss/agent/BUCK has `//fboss/lib:thrift_method_rate_limit` in exported_deps for setup_thrift

2. utils: Added hw_switch_fb303_stats
   fboss/agent/BUCK has `//fboss/agent/hw:hw_switch_fb303_stats` in exported_deps for utils

3. stats: Added common_utils
   fboss/agent/BUCK has `//fboss/lib:common_utils` in exported_deps for stats

4. ecmp_resource_manager: Added ref_map, stats, and utils
   fboss/agent/BUCK has `//fboss/lib:ref_map`, `:stats`, and `:utils` in exported_deps
   for ecmp_resource_manager

5. platform_base: Added utils, product_info, and fboss_event_base
   fboss/agent/BUCK has `:utils`, `//fboss/lib/platforms:product-info`, and `:fboss_event_base`
   in exported_deps for platform_base

6. hw_switch_handler: Added fboss_event_base
   fboss/agent/BUCK has `:fboss_event_base` in exported_deps for hw_switch_handler

7. switchinfo_utils: Added fboss_error and load_agent_config
   fboss/agent/BUCK has `:fboss-error` and `:load_agent_config` in exported_deps for switchinfo_utils

8. core: Added packet_factory to core_libs variable
   fboss/agent/BUCK has `//fboss/agent/packet:packet_factory` in deps for core

9. fboss_event_base: Added agent_features
   fboss/agent/BUCK has `:agent_features` in exported_deps for fboss_event_base

10. agent_netwhoami: Added common_file_utils
    fboss/agent/BUCK has `//fboss/lib:common_file_utils` in exported_deps for agent_netwhoami

## Fixes in cmake/AgentHw.cmake:

11. hw_fb303_stats: Added error
    fboss/agent/hw/BUCK has `//fboss/agent:fboss-error` in exported_deps for hw_fb303_stats

12. hw_port_fb303_stats: Added hw_fb303_stats and fboss_types
    fboss/agent/hw/BUCK has `:hw_fb303_stats` and `//fboss/agent:fboss-types`
    in exported_deps for hw_port_fb303_stats

## Fixes in cmake/AgentHwMock.cmake:

13. hw_mock: Added handler
    fboss/agent/hw/mock/BUCK has `//fboss/agent:handler` in exported_deps for mock

## Fixes in cmake/AgentHwSaiHwTest.cmake:

14. agent_hw_test_thrift_handler: Added hw_switch
    fboss/agent/hw/bcm/tests/BUCK has `//fboss/agent:hw_switch` in exported_deps
    for agent_hw_test_thrift_handler

## Fixes in cmake/AgentHwSwitchAsics.cmake:

15. switch_asics: Added agent_features, error, and fboss_types
    fboss/agent/hw/switch_asics/BUCK has `//fboss/agent:agent_features`,
    `//fboss/agent:fboss-error`, and `//fboss/agent:fboss-types` in exported_deps for switch_asics

## Fixes in cmake/AgentHwTest.cmake:

16. config_factory: Added acl_test_utils, split_agent_thrift_syncer, multiswitch_test_server
    fboss/agent/hw/test/BUCK has `//fboss/agent/test/utils:acl_test_utils`,
    `//fboss/agent:split_agent_thrift_syncer`, and `//fboss/agent/test:multiswitch_test_server`
    in exported_deps for config_factory

17. hw_packet_utils: Added agent_test_utils
    fboss/agent/hw/test/BUCK has `//fboss/agent/test:utils` in exported_deps for hw_packet_utils

18. hw_copp_utils: Added copp_test_utils and hw_packet_utils
    fboss/agent/hw/test/BUCK has `//fboss/agent/test/utils:copp_test_utils` and
    `:hw_packet_utils` in exported_deps for hw_copp_utils

19. hw_link_state_toggler: Added test_ensemble_if
    fboss/agent/test/BUCK has `:test_ensemble_if` in exported_deps for linkstate_toggler

20. load_balancer_utils: Added load_balancer_test_utils
    fboss/agent/hw/test/BUCK has `//fboss/agent/test/utils:load_balancer_test_utils`
    in exported_deps for load_balancer_utils

## Fixes in cmake/AgentLldp.cmake:

21. lldp: Added agent_features and cow_storage
    fboss/agent/lldp/BUCK has `//fboss/agent:agent_features` and
    `//fboss/thrift_cow/storage:cow_storage` in exported_deps for lldp

## Fixes in cmake/AgentPacket.cmake:

22. packet_factory: Added hw_switch
    fboss/agent/packet/BUCK has `//fboss/agent:hw_switch` in deps for packet_factory

## Fixes in cmake/AgentPlatformsCommon.cmake:

23. platform_mapping_utils: Added platform_mode
    fboss/agent/platforms/common/BUCK has `//fboss/lib/platforms:platform_mode`
    in exported_deps for platform_mapping_utils

## Fixes in cmake/AgentPlatformsCommonGalaxy.cmake:

24. galaxy_platform_mapping: Added utils
    fboss/agent/platforms/common/galaxy/BUCK has `//fboss/agent:utils`
    in exported_deps for galaxy_platform_mapping

## Fixes in cmake/AgentPlatformsCommonMinipack.cmake:

25. minipack_platform_mapping: Added platform_mode
    fboss/agent/platforms/common/minipack/BUCK has `//fboss/lib/platforms:platform_mode`
    in exported_deps for minipack_platform_mapping

## Fixes in cmake/AgentPlatformsCommonUtils.cmake:

26. wedge_led_utils: Added wedge_transceiver
    fboss/agent/platforms/common/utils/BUCK has `//fboss/qsfp_service/platforms/wedge:wedge-transceiver`
    in exported_deps for wedge-led-utils

## Fixes in cmake/AgentRib.cmake:

27. standalone_rib: Added fboss_event_base and utils
    fboss/agent/rib/BUCK has `//fboss/agent:fboss_event_base` and `//fboss/agent:utils`
    in exported_deps for standalone_rib

28. network_to_route_map: Added state
    fboss/agent/rib/BUCK has `//fboss/agent/state:state` in exported_deps
    for network_to_route_map

## Fixes in cmake/AgentState.cmake:

29. state: Added address_utils
    fboss/agent/state/BUCK has `//fboss/agent:address_utils` in exported_deps for state

30. state_utils: Added hwswitch_matcher and state
    fboss/agent/state/BUCK has `:state` and `//fboss/agent:hwswitch_matcher`
    in exported_deps for state_utils

## Fixes in cmake/AgentTest.cmake:

31. agent_test_utils: Added route_distribution_gen
    fboss/agent/test/BUCK has `:route_distribution_gen` in exported_deps for utils

32. multinode_tests: Added agent_test_utils, hw_copp_utils, hw_packet_utils, load_balancer_utils
    fboss/agent/test/BUCK has `:utils`, `//fboss/agent/hw/test:hw_copp_utils`,
    `//fboss/agent/hw/test:hw_packet_utils`, and `//fboss/agent/hw/test:load_balancer_utils`
    in exported_deps for multinode_tests

33. agent_ensemble: Added sw_agent_initializer
    fboss/agent/test/BUCK has `//fboss/agent:sw_agent_initializer` in exported_deps
    for agent_ensemble

34. linkstate_toggler: Added test_ensemble_if
    fboss/agent/test/BUCK has `:test_ensemble_if` in exported_deps for linkstate_toggler

35. system_scale_test_utils: Added trap_packet_utils
    fboss/agent/test/utils/BUCK has `:trap_packet_utils` in exported_deps
    for system_scale_test_utils

## Fixes in cmake/AgentTestAgentHwTests.cmake:

36. agent_hw_test_src: Added load_balancer_test_runner_h
    fboss/agent/test/agent_hw_tests/BUCK has `//fboss/agent/test/utils:load_balancer_test_runner_h`
    in exported_deps for agent_hw_test_src

## Fixes in cmake/AgentTestLinkTests.cmake:

37. link_tests: Added trap_packet_utils, hw_qos_utils, hw_test_fabric_utils
    fboss/agent/test/link_tests/BUCK has `//fboss/agent/test/utils:trap_packet_utils`,
    `//fboss/agent/hw/test:hw_qos_utils`, and `//fboss/agent/hw/test:hw_test_fabric_utils`
    in exported_deps for link_tests

38. agent_ensemble_link_tests: Added trap_packet_utils and agent_test_utils
    fboss/agent/test/link_tests/BUCK has `//fboss/agent/test/utils:trap_packet_utils`
    and `//fboss/agent/test:utils` in exported_deps for agent_ensemble_link_tests

## Fixes in cmake/AgentTestUtils.cmake:

39. traffic_policy_utils: Added copp_test_utils
    fboss/agent/test/utils/BUCK has `:copp_test_utils` in exported_deps for traffic_policy_utils

40. qos_test_utils: Added voq_test_utils, resourcelibutil, and pkt_test_utils
    fboss/agent/test/utils/BUCK has `:voq_test_utils`, `//fboss/agent/test:resourcelibutil`,
    and `:pkt_test_utils` in exported_deps for qos_test_utils

41. l2learn_observer_util: Added agent_ensemble
    fboss/agent/test/utils/BUCK has `//fboss/agent/test:agent_ensemble`
    in exported_deps for l2learn_observer_util

42. mac_test_utils: Added core
    fboss/agent/test/utils/BUCK has `//fboss/agent:core` in exported_deps for mac_test_utils

43. pfc_test_utils: Added test_ensemble_if, agent_ensemble, and resourcelibutil
    fboss/agent/test/utils/BUCK has `//fboss/agent/test:test_ensemble_if`,
    `//fboss/agent/test:agent_ensemble`, and `//fboss/agent/test:resourcelibutil`
    in exported_deps for pfc_test_utils

## Fixes in cmake/LedService.cmake:

44. led_manager_lib: Added wedge400_fpga and common_port_utils
    fboss/led_service/BUCK has `//fboss/lib/fpga:wedge400_fpga` and
    `//fboss/lib:common_port_utils` in exported_deps for led_manager

## Fixes in cmake/Lib.cmake:

45. common_thrift_utils: Added thrift_service_client
    fboss/lib/BUCK has `//fboss/lib/thrift_service_client:thrift-service-client`
    in exported_deps for common_thrift_utils

46. common_utils: Added common_file_utils
    fboss/lib/BUCK has `:common_file_utils` in exported_deps for common_utils

## Fixes in cmake/LibFpga.cmake:

47. fpga_multi_pim_container: Added fpga_device and qsfp_stats
    fboss/lib/fpga/BUCK has `:fpga_device` and `//fboss/qsfp_service:stats`
    in exported_deps for multi_pim_container

48. fb_fpga_i2c: Added i2c_ctrl and i2_api
    fboss/lib/fpga/BUCK has `//fboss/lib/i2c:i2c_ctrl` and `//fboss/lib/usb:i2-api`
    in exported_deps for fb_fpga_i2c

49. wedge400_i2c: Added i2_api
    fboss/lib/fpga/BUCK has `//fboss/lib/usb:i2-api` in exported_deps for wedge400_i2c

## Fixes in cmake/LibI2c.cmake:

50. i2c_ctrl: Added utils
    fboss/lib/i2c/BUCK has `//fboss/agent:utils` in exported_deps for i2c_ctrl

## Fixes in cmake/LibPhy.cmake:

51. external_phy: Added mdio, alert_logger, and fboss_types
    fboss/lib/phy/BUCK has `//fboss/mdio:mdio`, `//fboss/lib:alert_logger`,
    and `//fboss/agent:fboss-types` in exported_deps for external_phy

## Fixes in cmake/PlatformBspTests.cmake:

52. bsp_test_utils: Added platform_manager_i2c_explorer
    fboss/platform/bsp_tests/BUCK has `//fboss/platform/platform_manager:i2c_explorer`
    in exported_deps for utils

## Fixes in cmake/PlatformPlatformChecks.cmake:

53. platform_check: Added platform_config_lib
    fboss/platform/platform_checks/BUCK has `//fboss/platform/config_lib:config_lib`
    in exported_deps for platform_check

## Fixes in cmake/PlatformPlatformManager.cmake:

54. platform_manager_i2c_explorer: Added platform_fs_utils
    fboss/platform/platform_manager/BUCK has `//fboss/platform/helpers:platform_fs_utils`
    in exported_deps for i2c_explorer

55. platform_manager_presence_checker: Added platform_fs_utils
    fboss/platform/platform_manager/BUCK has `//fboss/platform/helpers:platform_fs_utils`
    in exported_deps for presence_checker

## Fixes in cmake/QsfpService.cmake:

56-72. Added bsp_platform_mapping to 17 BSP targets:
    meru400bfu_bsp, meru400bia_bsp, meru400biu_bsp, meru800bia_bsp,
    meru800bfa_bsp, montblanc_bsp, icecube800bc_bsp, icetea800bc_bsp,
    minipack3n_bsp, morgan800cc_bsp, janga800bic_bsp, tahan800bc_bsp,
    tahansb800bc_bsp, nh4010_bsp, wedge800bact_bsp, wedge800cact_bsp,
    ladakh800bcls_bsp

    All these targets in fboss/lib/bsp/*/BUCK have `//fboss/lib/bsp:bsp_platform_mapping_lib`
    in exported_deps (example: fboss/lib/bsp/meru400bfu/BUCK has this for meru400bfu_bsp)

73. qsfp_stats: Added fboss_types
    fboss/qsfp_service/BUCK has `//fboss/agent:fboss-types` in exported_deps for stats

74. qsfp_bsp_core: Added gpiod_line and i2_api
    fboss/lib/bsp/BUCK has `//fboss/lib:gpiod_line` and `//fboss/lib/usb:i2-api`
    in exported_deps for bsp_core

75. transceiver_validator: Added alert_logger
    fboss/qsfp_service/BUCK has `//fboss/lib:alert_logger` in exported_deps
    for transceiver_validator

## Fixes in cmake/QsfpServiceTestHwTest.cmake:

76. hw_transceiver_utils: Added platform_mapping
    fboss/qsfp_service/test/hw_test/BUCK has `//fboss/agent/platforms/common:platform_mapping`
    in exported_deps for hw_transceiver_utils

## Fixes in cmake/ThriftCowVisitors.cmake:

77. thrift_cow_visitors: Added thrift_cow_serializer
    fboss/thrift_cow/visitors/BUCK has `//fboss/thrift_cow/nodes:serializer`
    in exported_deps for visitors

## Fixes in cmake/fsdb/FsdbClient.cmake:

78. fsdb_sub_mgr: Added fsdb_flags and thrift_service_client
    fboss/fsdb/client/BUCK has `//fboss/fsdb/common:flags` and
    `//fboss/lib/thrift_service_client:thrift-service-client` in exported_deps
    for fsdb_sub_manager

## Fixes in cmake/fsdb/FsdbIf.cmake:

79. fsdb_model_cpp2: Added fsdb_common_cpp2 to DEPENDS
    fboss/fsdb/if/oss/BUCK has `//fboss/fsdb/if:fsdb_common` in deps for fsdb_model

## Fixes in cmake/fsdb/FsdbOperInstantiations.cmake:

80. fsdb_cow_stats_sub_mgr: Added fsdb_cow_state_sub_mgr
    fboss/fsdb/client/BUCK (fsdb_cow_stats_sub_manager target) has
    `:fsdb_cow_state_sub_manager` in exported_deps

## Fixes in cmake/fsdb/FsdbServer.cmake:

81. fsdb_server: Added restart_time_tracker
    fboss/fsdb/server/BUCK has `//fboss/lib/restart_tracker:restart_time_tracker`
    in exported_deps for fsdb_server

## Fixes in cmake/fsdb/FsdbTests.cmake:

82. fsdb_test_subscriber: Changed fsdb_model_cpp2 to fsdb_model
    fboss/fsdb/tests/utils/BUCK has `//fboss/fsdb/if:fsdb_model` in exported_deps
    for fsdb_test_subscriber (fsdb_model includes both cpp2 types and thriftpath)

83. fsdb_test_clients: Changed fsdb_model_cpp2 to fsdb_model
    fboss/fsdb/tests/client/BUCK has `//fboss/fsdb/if:fsdb_model` in exported_deps
    for fsdb_test_clients

## New tool added:

`tools/buck_cmake_dep_checker.py` - A tool to detect missing dependencies
between Buck and cmake build systems by:
- Parsing BUCK and cmake files to extract targets and their dependencies
- Matching cmake targets to Buck targets based on source file overlap
- Identifying dependencies present in Buck but missing in cmake
- Supporting cmake variable expansion and transitive dependency analysis
@meta-codesync
Copy link

meta-codesync bot commented Jan 23, 2026

@KevinYakar has imported this pull request. If you are a Meta employee, you can view this in D91347206.

@meta-codesync
Copy link

meta-codesync bot commented Jan 23, 2026

@KevinYakar merged this pull request in 9c72b3b.

@benoit-nexthop benoit-nexthop deleted the dep-fixer branch January 24, 2026 00:08
benoit-nexthop added a commit to nexthop-ai/fboss that referenced this pull request Jan 24, 2026
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)
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.

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.
benoit-nexthop added a commit to nexthop-ai/fboss that referenced this pull request Jan 24, 2026
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.

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.
benoit-nexthop added a commit to nexthop-ai/fboss that referenced this pull request Jan 24, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants