// swift-tools-version:5.7 // The swift-tools-version declares the minimum version of Swift required to build this package. // Copyright 2022 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. import PackageDescription let package = Package( name: "NearbyConnections", platforms: [ .iOS(.v13), .macOS(.v10_15), .tvOS(.v11), .watchOS(.v4), ], products: [ // Products define the executables and libraries a package produces, and make them visible to other packages. .library( name: "NearbyConnections", targets: ["NearbyConnections"] ), .library( name: "NearbyConnectionsDynamic", type: .dynamic, targets: ["NearbyConnections"] ), ], dependencies: [ // Dependencies declare other packages that this package depends on. .package( url: "https://github.com/bourdakos1/abseil-cpp-SwiftPM.git", branch: "jan-lts" ), .package( url: "https://github.com/firebase/boringssl-SwiftPM.git", "0.7.1"..<"0.8.0" ), ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. // Targets can depend on other targets in this package, and on products in packages this package depends on. .target( name: "smhasher", path: "third_party/smhasher", sources: ["smhasher/src/MurmurHash3.cpp"], publicHeadersPath: "include", cSettings: [ .headerSearchPath("smhasher/src/") ] ), .target( name: "ukey2", dependencies: [ "protobuf", .product(name: "abseil", package: "abseil-cpp-SwiftPM"), .product( name: "openssl_grpc", package: "boringssl-SwiftPM", moduleAliases: ["NearbySSL": "openssl_grpc"]), ], path: "third_party/ukey2", exclude: ["ukey2/src/main/cpp/src/securegcm/ukey2_shell.cc"], sources: [ "ukey2/src/securemessage/src/securemessage", "ukey2/src/main/cpp/src/securegcm", "compiled_proto", ], publicHeadersPath: "include", cSettings: [ .headerSearchPath("ukey2/"), .headerSearchPath("compiled_proto/"), .headerSearchPath("compiled_proto/src/main/proto"), ] ), .target( name: "json", path: "third_party/json", sources: ["EmptySwiftPackageManagerFile.cpp"], publicHeadersPath: "json/include" ), .target( name: "protobuf-utf8", dependencies: [ .product(name: "abseil", package: "abseil-cpp-SwiftPM"), ], path: "third_party/protobuf/third_party/utf8_range", sources: [ "utf8_validity.h", "utf8_range.h", "utf8_range.c", ], publicHeadersPath: ".", cSettings: [ .headerSearchPath("./"), ], ), .target( name: "protobuf", dependencies: [ "protobuf-utf8", ], path: "third_party/protobuf/src", exclude: [ "google/protobuf/bridge", "google/protobuf/compiler", "google/protobuf/testdata", "google/protobuf/testing", "google/protobuf/util", "google/protobuf/unittest_import_public_lite.proto", "google/protobuf/unittest_import.proto", "google/protobuf/unittest_lite_imports_nonlite.proto", "google/protobuf/no_field_presence_test.cc", "google/protobuf/unittest_lazy_dependencies_custom_option.proto", "google/protobuf/unittest_well_known_types.proto", "google/protobuf/arenastring_unittest.cc", "google/protobuf/descriptor.proto", "google/protobuf/reflection_ops_unittest.cc", "google/protobuf/empty.proto", "google/protobuf/map_lite_unittest.proto", "google/protobuf/test_util_lite.cc", "google/protobuf/any_test.cc", "google/protobuf/unittest_proto3_arena_lite.proto", "google/protobuf/unittest_preserve_unknown_enum.proto", "google/protobuf/any_test.proto", "google/protobuf/timestamp.proto", "google/protobuf/io/tokenizer_unittest.cc", "google/protobuf/test_util.cc", "google/protobuf/map_test.cc", "google/protobuf/drop_unknown_fields_test.cc", "google/protobuf/descriptor_database_unittest.cc", "google/protobuf/unittest_no_generic_services.proto", "google/protobuf/unittest_mset_wire_format.proto", "google/protobuf/map_unittest.proto", "google/protobuf/unittest_no_field_presence.proto", "google/protobuf/unittest_proto3_arena.proto", "google/protobuf/unittest_optimize_for.proto", "google/protobuf/repeated_field_reflection_unittest.cc", "google/protobuf/unittest_import_public.proto", "google/protobuf/io/printer_unittest.cc", "google/protobuf/test_messages_proto3.proto", "google/protobuf/io/zero_copy_stream_unittest.cc", "google/protobuf/text_format_unittest.cc", "google/protobuf/unittest_lazy_dependencies_enum.proto", "google/protobuf/test_messages_proto2.proto", "google/protobuf/unittest_arena.proto", "google/protobuf/unittest_lite.proto", "google/protobuf/type.proto", "google/protobuf/extension_set_unittest.cc", "google/protobuf/preserve_unknown_enum_test.cc", "google/protobuf/unittest_lazy_dependencies.proto", "google/protobuf/io/io_win32_unittest.cc", "google/protobuf/unittest_embed_optimize_for.proto", "google/protobuf/lite_unittest.cc", "google/protobuf/unknown_field_set_unittest.cc", "google/protobuf/wire_format_unittest.cc", "google/protobuf/unittest_proto3_lite.proto", "google/protobuf/api.proto", "google/protobuf/generated_message_reflection_unittest.cc", "google/protobuf/unittest_custom_options.proto", "google/protobuf/map_field_test.cc", "google/protobuf/field_mask.proto", "google/protobuf/proto3_arena_lite_unittest.cc", "google/protobuf/lite_arena_unittest.cc", "google/protobuf/repeated_field_unittest.cc", "google/protobuf/unittest_mset.proto", "google/protobuf/duration.proto", "google/protobuf/proto3_arena_unittest.cc", "google/protobuf/unittest_import_lite.proto", "google/protobuf/inlined_string_field_unittest.cc", "google/protobuf/io/coded_stream_unittest.cc", "google/protobuf/unittest_drop_unknown_fields.proto", "google/protobuf/source_context.proto", "google/protobuf/map_proto2_unittest.proto", "google/protobuf/proto3_lite_unittest.cc", "google/protobuf/descriptor_unittest.cc", "google/protobuf/proto3_lite_unittest.inc", "google/protobuf/wrappers.proto", "google/protobuf/any.proto", "google/protobuf/stubs/common_unittest.cc", "google/protobuf/arena_unittest.cc", "google/protobuf/unittest_enormous_descriptor.proto", "google/protobuf/unittest_proto3.proto", "google/protobuf/struct.proto", "google/protobuf/unittest_preserve_unknown_enum2.proto", "google/protobuf/unittest_empty.proto", "google/protobuf/port_def.inc", "google/protobuf/dynamic_message_unittest.cc", "google/protobuf/unittest_proto3_optional.proto", "google/protobuf/port_undef.inc", "google/protobuf/message_unittest.cc", "google/protobuf/message_unittest.inc", "google/protobuf/unittest.proto", "google/protobuf/well_known_types_unittest.cc", "google/protobuf/map_test.inc", "google/protobuf/reflection_tester.cc", "google/protobuf/varint_shuffle_test.cc", "google/protobuf/unredacted_debug_format_for_test_test.cc", "google/protobuf/wire_format_unittest.h", "google/protobuf/wire_format_unittest.cc", "google/protobuf/string_view_test.cc", "google/protobuf/string_block_test.cc", "google/protobuf/arena_align_test.cc", "google/protobuf/arenaz_sampler_test.cc", "google/protobuf/debug_counter_test.cc", "google/protobuf/descriptor_visitor_test.cc", "google/protobuf/edition_message_unittest.cc", "google/protobuf/feature_resolver_test.cc", "google/protobuf/generated_enum_util_test.cc", "google/protobuf/generated_message_tctable_lite_test.cc", "google/protobuf/has_bits_test.cc", "google/protobuf/internal_feature_helper_test.cc", "google/protobuf/internal_message_util_unittest.cc", "google/protobuf/map_probe_benchmark.cc", "google/protobuf/map_test_util.h", "google/protobuf/message_unittest_legacy_apis.inc", "google/protobuf/micro_string_test.cc", "google/protobuf/no_field_presence_map_test.cc", "google/protobuf/port_test.cc", "google/protobuf/raw_ptr_test.cc", "google/protobuf/redaction_metric_test.cc", "google/protobuf/reflection_mode_test.cc", "google/protobuf/reflection_tester.h", "google/protobuf/reflection_visit_fields_test.cc", "google/protobuf/repeated_field_reflection_unittest.inc", "google/protobuf/repeated_ptr_field_unittest.cc", "google/protobuf/retention_test.cc", "google/protobuf/string_piece_field_support_unittest.cc", "google/protobuf/test_textproto.h", "google/protobuf/test_util.h", "google/protobuf/test_util2.h", "google/protobuf/test_util_lite.h", "google/protobuf/os_macros_undef.inc", "google/protobuf/os_macros_restore.inc", "google/protobuf/lazily_build_dependencies_test.cc", "google/protobuf/edition_unittest.proto", "google/protobuf/internal_options.proto", "google/protobuf/late_loaded_option.proto", "google/protobuf/late_loaded_option_user.proto", "google/protobuf/map_proto3_unittest.proto", "google/protobuf/only_one_enum_test.proto", "google/protobuf/sample_messages_edition.proto", "google/protobuf/cpp_features.proto", "google/protobuf/unittest_custom_features.proto", "google/protobuf/unittest_custom_options_unlinked.proto", "google/protobuf/unittest_delimited.proto", "google/protobuf/unittest_delimited_import.proto", "google/protobuf/unittest_extension_set.proto", "google/protobuf/unittest_features.proto", "google/protobuf/unittest_import_option.proto", "google/protobuf/unittest_invalid_features.proto", "google/protobuf/unittest_legacy_features.proto", "google/protobuf/unittest_lite_edition_2024.proto", "google/protobuf/unittest_proto3_bad_macros.proto", "google/protobuf/unittest_proto3_extensions.proto", "google/protobuf/unittest_redaction.proto", "google/protobuf/unittest_retention.proto", "google/protobuf/unittest_string_type.proto", "google/protobuf/unittest_string_view.proto", "google/protobuf/BUILD.bazel", "google/protobuf/bridge/BUILD.bazel", "google/protobuf/io/BUILD.bazel", "google/protobuf/json/BUILD.bazel", "google/protobuf/stubs/BUILD.bazel", "google/protobuf/json/BUILD.bazel", "google/protobuf/json/json_test.cc", "google/protobuf/json/internal/lexer_test.cc", "google/protobuf/json/internal/zero_copy_buffered_stream_test.cc", "google/protobuf/io/printer_death_test.cc", "google/protobuf/io/test_zero_copy_stream.h", "google/protobuf/io/test_zero_copy_stream_test.cc", "google/protobuf/io/zero_copy_sink_test.cc", ], sources: [ "google/protobuf", ], publicHeadersPath: ".", cSettings: [ .headerSearchPath("./"), ] ), .target( name: "NearbyCommon", dependencies: [ "json", "smhasher", "ukey2", "protobuf", .product(name: "abseil", package: "abseil-cpp-SwiftPM"), ], path: ".", exclude: [ "compiled_proto/connections/cpp", "connections/c", "connections/dart", "connections/README.md", "connections/swift", "internal/platform/implementation/g3", "internal/platform/implementation/apple/Flags/Tests", "internal/platform/implementation/apple/Log/Tests", "internal/platform/implementation/apple/Mediums/BLE/Tests", "internal/platform/implementation/apple/Mediums/BLE/Sockets/Tests", "internal/platform/implementation/apple/Mediums/CoreLocation/CLLocationManager/Fake/", "internal/platform/implementation/apple/Mediums/Hotspot/Tests", "internal/platform/implementation/apple/Mediums/WiFiCommon/Tests", "internal/platform/implementation/apple/Tests", "internal/platform/implementation/windows", "third_party", // build files "connections/implementation/analytics/BUILD", "connections/implementation/flags/BUILD", "connections/implementation/mediums/advertisements/BUILD", "connections/implementation/mediums/ble/BUILD", "connections/implementation/mediums/multiplex/BUILD", "connections/implementation/mediums/BUILD", "connections/implementation/BUILD", "connections/implementation/fuzzers", "connections/v3/BUILD", "connections/BUILD", "internal/crypto/BUILD", "internal/crypto_cros/BUILD", "internal/encoding/BUILD", "internal/interop/BUILD", "internal/weave/BUILD", "internal/weave/sockets/BUILD", "internal/platform/flags/BUILD", "internal/platform/implementation/shared/BUILD", "internal/platform/implementation/apple/BUILD", "internal/platform/implementation/apple/Flags/BUILD", "internal/platform/implementation/apple/Log/BUILD", "internal/platform/implementation/apple/Mediums/BUILD", "internal/platform/implementation/apple/Mediums/BLE/BUILD", "internal/platform/implementation/apple/Mediums/BLE/Sockets/BUILD", "internal/platform/implementation/apple/Mediums/CoreLocation/CLLocationManager/Fake/BUILD", "internal/platform/implementation/apple/Mediums/Hotspot/BUILD", "internal/platform/implementation/apple/Mediums/WiFiCommon/BUILD", "internal/platform/implementation/BUILD", "internal/platform/BUILD", "internal/analytics/BUILD", "internal/flags/BUILD", "internal/network/BUILD", "internal/rpc/BUILD", "internal/base/BUILD", "internal/data/BUILD", "internal/test/BUILD", // tests "connections/listeners_test.cc", "connections/strategy_test.cc", "connections/implementation/offline_frames_test.cc", "connections/implementation/offline_service_controller_test.cc", "connections/implementation/encryption_runner_test.cc", "connections/implementation/p2p_cluster_pcp_handler_test.cc", "connections/implementation/p2p_point_to_point_pcp_handler_test.cc", "connections/implementation/p2p_star_pcp_handler_test.cc", "connections/implementation/base_pcp_handler_test.cc", "connections/implementation/injected_bluetooth_device_store_test.cc", "connections/implementation/internal_payload_factory_test.cc", "connections/implementation/client_proxy_test.cc", "connections/implementation/payload_manager_test.cc", "connections/implementation/offline_frames_validator_test.cc", "connections/implementation/service_controller_router_test.cc", "connections/implementation/awdl_bwu_handler_test.cc", "connections/implementation/bluetooth_bwu_test.cc", "connections/implementation/wifi_direct_bwu_test.cc", "connections/implementation/wifi_hotspot_bwu_test.cc", "connections/implementation/wifi_lan_bwu_handler_test.cc", "connections/implementation/analytics/analytics_recorder_test.cc", "connections/implementation/analytics/throughput_recorder_test.cc", "connections/implementation/mediums/advertisements/data_element_test.cc", "connections/implementation/mediums/advertisements/dct_advertisement_test.cc", "connections/implementation/mediums/advertisements/advertisement_util_test.cc", "connections/implementation/mediums/awdl_test.cc", "connections/implementation/mediums/ble_test.cc", "connections/implementation/mediums/ble/bloom_filter_test.cc", "connections/implementation/mediums/ble/ble_l2cap_packet_test.cc", "connections/implementation/mediums/ble/ble_packet_test.cc", "connections/implementation/mediums/ble/ble_advertisement_test.cc", "connections/implementation/mediums/ble/advertisement_read_result_test.cc", "connections/implementation/mediums/ble/ble_advertisement_header_test.cc", "connections/implementation/mediums/ble/ble_socket_test.cc", "connections/implementation/mediums/ble/ble_utils_test.cc", "connections/implementation/mediums/ble/discovered_peripheral_tracker_test.cc", "connections/implementation/mediums/ble/instant_on_lost_advertisement_test.cc", "connections/implementation/mediums/ble/instant_on_lost_manager_test.cc", "connections/implementation/mediums/multiplex/multiplex_frames_test.cc", "connections/implementation/mediums/multiplex/multiplex_socket_test.cc", "connections/implementation/mediums/multiplex/multiplex_output_stream_test.cc", "connections/implementation/mediums/webrtc_peer_id_test.cc", "connections/implementation/mediums/wifi_lan_test.cc", "connections/implementation/mediums/bluetooth_classic_test.cc", "connections/implementation/mediums/ble_test.cc", "connections/implementation/mediums/webrtc_test.cc", "connections/implementation/mediums/lost_entity_tracker_test.cc", "connections/implementation/mediums/bluetooth_radio_test.cc", "connections/implementation/mediums/wifi_direct_test.cc", "connections/implementation/mediums/wifi_hotspot_test.cc", "connections/implementation/mediums/wifi_test.cc", "connections/implementation/endpoint_channel_manager_test.cc", "connections/implementation/bwu_manager_test.cc", "connections/implementation/base_bwu_handler_test.cc", "connections/implementation/endpoint_manager_test.cc", "connections/implementation/bluetooth_device_name_test.cc", "connections/implementation/wifi_lan_service_info_test.cc", "connections/implementation/pcp_manager_test.cc", "connections/implementation/ble_advertisement_test.cc", "connections/implementation/base_endpoint_channel_test.cc", "connections/v3/connections_device_test.cc", "connections/v3/connections_device_provider_test.cc", "connections/implementation/connections_authentication_transport_test.cc", "connections/core_test.cc", "connections/status_test.cc", "connections/payload_test.cc", "internal/base/bluetooth_address_test.cc", "internal/base/file_path_test.cc", "internal/base/files_test.cc", "internal/base/masker_test.cc", "internal/crypto/ed25519_unittest.cc", "internal/crypto_cros/aead_unittest.cc", "internal/crypto_cros/ec_private_key_unittest.cc", "internal/crypto_cros/ec_signature_creator_unittest.cc", "internal/crypto_cros/encryptor_unittest.cc", "internal/crypto_cros/hmac_unittest.cc", "internal/crypto_cros/rsa_private_key_unittest.cc", "internal/crypto_cros/secure_hash_unittest.cc", "internal/crypto_cros/sha2_unittest.cc", "internal/crypto_cros/signature_verifier_unittest.cc", "internal/crypto_cros/symmetric_key_unittest.cc", "internal/encoding/base85_test.cc", "internal/data/leveldb_data_set_test.cc", "internal/flags/nearby_flags_test.cc", "internal/proto/analytics/connections_log_test.cc", "internal/platform/feature_flags_test.cc", "internal/platform/file_test.cc", "internal/platform/cancelable_alarm_test.cc", "internal/platform/crypto_test.cc", "internal/platform/byte_array_test.cc", "internal/platform/credential_storage_impl_test.cc", "internal/platform/implementation/g3/awdl_test.cc", "internal/platform/implementation/g3/ble_test.cc", "internal/platform/input_stream_test.cc", "internal/platform/mac_address_test.cc", "internal/platform/single_thread_executor_test.cc", "internal/platform/scheduled_executor_test.cc", "internal/platform/stream_reader_test.cc", "internal/platform/stream_writer_test.cc", "internal/platform/count_down_latch_test.cc", "internal/platform/pipe_test.cc", "internal/platform/timer_impl_test.cc", "internal/platform/task_runner_impl_test.cc", "internal/platform/uuid_test.cc", "internal/platform/wifi_lan_connection_info_test.cc", "internal/platform/wifi_direct_test.cc", "internal/platform/wifi_hotspot_test.cc", "internal/platform/wifi_lan_test.cc", "internal/platform/wifi_test.cc", "internal/platform/connection_info_test.cc", "internal/platform/condition_variable_test.cc", "internal/platform/thread_check_nocompile_test.py", "internal/platform/bluetooth_classic_test.cc", "internal/platform/bluetooth_connection_info_test.cc", "internal/platform/mutex_test.cc", "internal/platform/atomic_reference_test.cc", "internal/platform/multi_thread_executor_test.cc", "internal/platform/ble_connection_info_test.cc", "internal/platform/ble_test.cc", "internal/platform/prng_test.cc", "internal/platform/implementation/apple/count_down_latch_test.cc", "internal/platform/implementation/apple/condition_variable_test.cc", "internal/platform/implementation/apple/mutex_test.cc", "internal/platform/implementation/apple/atomic_boolean_test.cc", "internal/platform/implementation/apple/atomic_uint32_test.cc", "internal/platform/implementation/shared/file_test.cc", "internal/platform/implementation/wifi_utils_test.cc", "internal/platform/atomic_boolean_test.cc", "internal/platform/exception_test.cc", "internal/platform/expected_test.cc", "internal/platform/error_code_recorder_test.cc", "internal/platform/future_test.cc", "internal/platform/cancellation_flag_test.cc", "internal/platform/bluetooth_adapter_test.cc", "internal/platform/byte_utils_test.cc", "internal/platform/direct_executor_test.cc", "internal/platform/borrowable_test.cc", "internal/platform/implementation/windows/http_loader_test.cc", "internal/platform/blocking_queue_stream_test.cc", "internal/platform/service_address_test.cc", "internal/network/utils_test.cc", "internal/network/url_test.cc", "internal/network/http_response_test.cc", "internal/network/http_request_test.cc", "internal/network/http_client_impl_test.cc", "internal/network/http_status_code_test.cc", "internal/test/fake_clock_test.cc", "internal/test/fake_webrtc.cc", "internal/test/fake_timer_test.cc", "internal/test/fake_device_info_test.cc", "internal/test/fake_task_runner_test.cc", "internal/test/fake_http_client_test.cc", "internal/weave/base_socket_test.cc", "internal/weave/control_packet_write_request_test.cc", "internal/weave/message_write_request_test.cc", "internal/weave/packet_test.cc", "internal/weave/packet_sequence_number_generator_test.cc", "internal/weave/packetizer_test.cc", "internal/weave/sockets/client_socket_test.cc", "internal/weave/sockets/server_socket_test.cc", // simulation "connections/implementation/offline_simulation_user.cc", "connections/implementation/simulation_user.cc", // proto "connections/implementation/proto", "internal/proto", "proto", "internal/data/leveldb_data_set_test.proto", // webrtc "connections/implementation/webrtc_bwu_handler.cc", "connections/implementation/webrtc_endpoint_channel.cc", "connections/implementation/mediums/webrtc.cc", "connections/implementation/mediums/webrtc_peer_id.cc", "connections/implementation/mediums/webrtc", "internal/platform/tachyon_express_signaling_messenger.cc", "internal/platform/tachyon_express_signaling_messenger.h", "internal/platform/implementation/apple/webrtc.h", "internal/platform/implementation/apple/webrtc.mm", // This breaks the build, but seems to work fine without it? "internal/platform/medium_environment.cc", ], sources: [ "compiled_proto", "connections", "internal", "proto", ], publicHeadersPath: "connections", cSettings: [ .headerSearchPath("./"), .headerSearchPath("compiled_proto/"), .headerSearchPath("third_party/ukey2/ukey2/"), .headerSearchPath("third_party/ukey2/compiled_proto/src/main/proto"), .define("NO_WEBRTC"), ] ), .target( name: "NearbyConnectionsC", dependencies: ["NearbyCommon"], path: ".", exclude: [ "connections/c/BUILD", "connections/c/macOS_exported_symbols.txt", "third_party", ], sources: ["connections/c"], publicHeadersPath: "connections/c", cSettings: [ .headerSearchPath("./"), .headerSearchPath("compiled_proto/"), .define("NO_WEBRTC"), ] ), .target( name: "NearbyCoreAdapter", dependencies: ["NearbyCommon"], path: ".", exclude: ["third_party"], sources: ["connections/swift/NearbyCoreAdapter/Sources"], publicHeadersPath: "connections/swift/NearbyCoreAdapter/Sources/Public", cSettings: [ .headerSearchPath("./"), .headerSearchPath("compiled_proto/"), .define("NO_WEBRTC"), ] ), .target( name: "NearbyConnections", dependencies: ["NearbyCoreAdapter"], path: ".", exclude: ["third_party"], sources: ["connections/swift/NearbyConnections/Sources"] ), .testTarget( name: "NearbyCoreAdapterTests", dependencies: ["NearbyCoreAdapter"], path: "connections/swift/NearbyCoreAdapter/Tests" ), .testTarget( name: "NearbyConnectionsTests", dependencies: ["NearbyConnections"], path: "connections/swift/NearbyConnections/Tests" ), ], cLanguageStandard: .c99, cxxLanguageStandard: .cxx20 )