# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. load("@rules_cc//cc:cc_library.bzl", "cc_library") load("@rules_cc//cc:cc_test.bzl", "cc_test") licenses(["notice"]) cc_library( name = "types", hdrs = [ "atomic_boolean.h", "atomic_reference.h", "bluetooth_adapter.h", "cancelable.h", "condition_variable.h", "count_down_latch.h", "crypto.h", "device_info.h", "executor.h", "input_file.h", "log_message.h", "mutex.h", "output_file.h", "preferences_manager.h", "scheduled_executor.h", "submittable_executor.h", "system_clock.h", "timer.h", ], visibility = [ "//connections/implementation:__subpackages__", "//connections/implementation/analytics:__subpackages__", "//internal/crypto_cros:__pkg__", "//internal/platform:__pkg__", "//internal/platform/implementation:__subpackages__", "//internal/preferences:__subpackages__", "//internal/test:__subpackages__", "//location/nearby/analytics/cpp:__subpackages__", "//location/nearby/cpp/sharing:__subpackages__", "//sharing:__subpackages__", "//third_party/nearby/presence:__subpackages__", ], deps = [ "//internal/base:file_path", "//internal/base:files", "//internal/crypto_cros", "//internal/platform:base", "//internal/platform:mac_address", "//internal/platform/implementation/shared:crypto", # Non-chromium impl "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/functional:any_invocable", "@com_google_absl//absl/strings", "@com_google_absl//absl/time", "@com_google_absl//absl/types:span", "@com_google_protobuf//:protobuf", "@nlohmann_json//:json", ], ) cc_library( name = "wifi_utils", srcs = [ "wifi_utils.cc", ], hdrs = [ "wifi.h", "wifi_utils.h", ], visibility = [ "//:__subpackages__", ], deps = [ "@com_google_absl//absl/strings", "@com_google_absl//absl/strings:str_format", ], ) cc_library( name = "webrtc_platform", hdrs = [ "webrtc.h", "webrtc_platform.h", ], compatible_with = ["//buildenv/target:non_prod"], visibility = [ "//:__subpackages__", ], deps = [ "//connections/implementation/proto:offline_wire_formats_cc_proto", "//internal/platform:base", "//third_party/webrtc/files/stable/webrtc/api:peer_connection_interface", "//third_party/webrtc/files/stable/webrtc/api:scoped_refptr", "@com_google_absl//absl/functional:any_invocable", "@com_google_absl//absl/strings:string_view", ], ) cc_library( name = "comm", hdrs = [ "app_lifecycle_monitor.h", "awdl.h", "ble.h", "bluetooth_adapter.h", "bluetooth_classic.h", "credential_callbacks.h", "credential_storage.h", "http_loader.h", "psk_info.h", "upgrade_address_info.h", "wifi.h", "wifi_direct.h", "wifi_hotspot.h", "wifi_lan.h", ], visibility = [ "//connections/implementation:__subpackages__", "//internal/network:__subpackages__", "//internal/platform:__pkg__", "//internal/platform/implementation:__subpackages__", "//third_party/nearby/presence:__subpackages__", "//third_party/nearby/presence/implementation:__subpackages__", ], deps = [ "//internal/platform:base", "//internal/platform:cancellation_flag", "//internal/platform:mac_address", "//internal/platform:uuid", "//internal/proto:credential_cc_proto", "//internal/proto:local_credential_cc_proto", # "//third_party/webrtc/files/stable/webrtc/api:create_peerconnection_factory", # buildcleaner: keep # "//third_party/webrtc/files/stable/webrtc/api:peer_connection_interface", "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/functional:any_invocable", "@com_google_absl//absl/status", "@com_google_absl//absl/status:statusor", "@com_google_absl//absl/strings", "@com_google_absl//absl/strings:str_format", "@com_google_absl//absl/time", ], ) cc_library( name = "platform", hdrs = [ "platform.h", ], visibility = [ "//connections/implementation:__subpackages__", "//internal:__subpackages__", "//internal/network:__subpackages__", "//internal/platform:__pkg__", "//internal/platform/implementation:__subpackages__", "//location/nearby/analytics/cpp:__subpackages__", "//location/nearby/apps/better_together/plugins/preferences_native:__subpackages__", "//location/nearby/cpp/sharing:__subpackages__", "//sharing/internal/impl/common:__subpackages__", ], deps = [ ":comm", ":types", "//internal/platform:base", "@com_google_absl//absl/status:statusor", "@com_google_absl//absl/strings", ], ) cc_library( name = "platform_impl", testonly = True, tags = ["keep_dep"], # Prevent build_cleaner from removing the dependency. visibility = [ "//:__subpackages__", "//location/nearby/analytics/cpp:__subpackages__", "//location/nearby/cpp:__subpackages__", "//location/nearby/sharing/lib:__subpackages__", ], deps = [ ] + select({ "@platforms//os:platform_macos": [ "//internal/platform/implementation/apple", ], "@platforms//os:windows": [ "//internal/platform/implementation/windows", ], "@platforms//os:linux": [ "//internal/platform/implementation/linux:linux_platform_impl", ], # Add other platforms as needed "//conditions:default": [ "//internal/platform/implementation/g3", ], }), ) cc_test( name = "wifi_utils_test", size = "small", timeout = "moderate", srcs = ["wifi_utils_test.cc"], shard_count = 8, deps = [ ":wifi_utils", "@com_github_protobuf_matchers//protobuf-matchers", "@com_google_absl//absl/strings", "@com_google_googletest//:gtest_main", ], ) cc_test( name = "device_info_test", size = "small", timeout = "moderate", srcs = ["device_info_test.cc"], deps = [ ":types", "@com_github_protobuf_matchers//protobuf-matchers", "@com_google_absl//absl/strings", "@com_google_googletest//:gtest_main", ], )