mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 14:46:12 -04:00
Reorganize build targets.
PiperOrigin-RevId: 733814491
This commit is contained in:
committed by
Copybara-Service
parent
553f5dbf01
commit
d911c194c8
@@ -119,6 +119,7 @@ cc_library(
|
||||
"//connections/implementation/flags:connections_flags",
|
||||
"//connections/implementation/mediums",
|
||||
"//connections/implementation/mediums:utils",
|
||||
"//connections/implementation/mediums:webrtc_utils",
|
||||
"//connections/implementation/mediums/advertisements:dct_advertisement",
|
||||
"//connections/implementation/mediums/advertisements:util",
|
||||
"//connections/implementation/proto:offline_wire_formats_cc_proto",
|
||||
|
||||
@@ -46,6 +46,7 @@ cc_library(
|
||||
],
|
||||
deps = [
|
||||
":utils",
|
||||
":webrtc_utils",
|
||||
"//connections:core_types",
|
||||
"//connections/implementation/flags:connections_flags",
|
||||
"//connections/implementation/mediums/ble_v2",
|
||||
@@ -78,35 +79,56 @@ cc_library(
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "utils",
|
||||
name = "webrtc_utils",
|
||||
srcs = [
|
||||
"utils.cc",
|
||||
"webrtc_peer_id.cc",
|
||||
"webrtc_peer_id_stub.cc",
|
||||
],
|
||||
hdrs = [
|
||||
"lost_entity_tracker.h",
|
||||
"utils.h",
|
||||
"webrtc_peer_id.h",
|
||||
"webrtc_peer_id_stub.h",
|
||||
"webrtc_socket.h",
|
||||
"webrtc_socket_stub.h",
|
||||
],
|
||||
visibility = [
|
||||
"//connections/implementation:__pkg__",
|
||||
"//connections/implementation/mediums:__pkg__",
|
||||
"//connections/implementation/mediums/webrtc:__pkg__",
|
||||
],
|
||||
deps = [
|
||||
":utils",
|
||||
"//connections/implementation/mediums/webrtc:data_types",
|
||||
"//internal/platform:base",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "lost_entity_tracker",
|
||||
hdrs = ["lost_entity_tracker.h"],
|
||||
visibility = [
|
||||
"//connections/implementation/mediums/ble_v2:__pkg__",
|
||||
],
|
||||
deps = [
|
||||
"//internal/platform:types",
|
||||
"@com_google_absl//absl/container:flat_hash_set",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "utils",
|
||||
srcs = ["utils.cc"],
|
||||
hdrs = ["utils.h"],
|
||||
copts = ["-DNO_WEBRTC"],
|
||||
visibility = [
|
||||
"//connections/implementation:__pkg__",
|
||||
"//connections/implementation/mediums/ble_v2:__subpackages__",
|
||||
"//connections/implementation/mediums/multiplex:__pkg__",
|
||||
"//connections/implementation/mediums/webrtc:__pkg__",
|
||||
"//internal/platform/implementation/windows:__pkg__",
|
||||
],
|
||||
deps = [
|
||||
"//connections/implementation/mediums/webrtc:data_types",
|
||||
"//connections/implementation/proto:offline_wire_formats_cc_proto",
|
||||
"//internal/platform:base",
|
||||
"//internal/platform:types",
|
||||
"@com_google_absl//absl/base:core_headers",
|
||||
"@com_google_absl//absl/container:flat_hash_set",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -126,6 +148,7 @@ cc_test(
|
||||
],
|
||||
shard_count = 16,
|
||||
deps = [
|
||||
":lost_entity_tracker",
|
||||
":mediums",
|
||||
":utils",
|
||||
"//connections:core_types",
|
||||
@@ -140,9 +163,7 @@ cc_test(
|
||||
"//internal/platform/implementation:types",
|
||||
"//internal/platform/implementation/g3", # build_cleaner: keep
|
||||
"@com_github_protobuf_matchers//protobuf-matchers",
|
||||
"@com_google_absl//absl/base:core_headers",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/synchronization",
|
||||
"@com_google_absl//absl/time",
|
||||
"@com_google_googletest//:gtest_main",
|
||||
],
|
||||
@@ -162,7 +183,7 @@ cc_test(
|
||||
],
|
||||
deps = [
|
||||
":mediums",
|
||||
":utils",
|
||||
":webrtc_utils",
|
||||
"//internal/platform:base",
|
||||
"//internal/platform:cancellation_flag",
|
||||
"//internal/platform:comm",
|
||||
|
||||
@@ -45,6 +45,7 @@ cc_library(
|
||||
],
|
||||
deps = [
|
||||
"//connections/implementation/flags:connections_flags",
|
||||
"//connections/implementation/mediums:lost_entity_tracker",
|
||||
"//connections/implementation/mediums:utils",
|
||||
"//internal/flags:nearby_flags",
|
||||
"//internal/platform:base",
|
||||
@@ -66,7 +67,6 @@ cc_library(
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/strings:str_format",
|
||||
"@com_google_absl//absl/time",
|
||||
"@com_google_absl//absl/types:optional",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -103,7 +103,6 @@ cc_test(
|
||||
"@com_google_absl//absl/status:statusor",
|
||||
"@com_google_absl//absl/strings:string_view",
|
||||
"@com_google_absl//absl/time",
|
||||
"@com_google_absl//absl/types:span",
|
||||
"@com_google_googletest//:gtest_main",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -30,29 +30,16 @@ cc_library(
|
||||
],
|
||||
deps = [
|
||||
"//connections:core_types",
|
||||
"//connections/implementation/flags:connections_flags",
|
||||
"//connections/implementation/mediums:utils",
|
||||
"//internal/flags:nearby_flags",
|
||||
"//internal/platform:base",
|
||||
"//internal/platform:comm",
|
||||
"//internal/platform:types",
|
||||
"//internal/platform:util",
|
||||
"//internal/platform:uuid",
|
||||
"//internal/platform/implementation:comm",
|
||||
"//internal/platform/implementation:types",
|
||||
"//proto:connections_enums_cc_proto",
|
||||
"//proto/mediums:multiplex_frames_cc_proto",
|
||||
"@com_google_absl//absl/base:core_headers",
|
||||
"@com_google_absl//absl/container:flat_hash_map",
|
||||
"@com_google_absl//absl/container:flat_hash_set",
|
||||
"@com_google_absl//absl/functional:any_invocable",
|
||||
"@com_google_absl//absl/numeric:int128",
|
||||
"@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",
|
||||
"@com_google_absl//absl/types:optional",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@@ -30,9 +30,6 @@ namespace {
|
||||
constexpr int kDefaultSaltLength = 16;
|
||||
} // namespace
|
||||
|
||||
using ::location::nearby::connections::LocationHint;
|
||||
using ::location::nearby::connections::LocationStandard;
|
||||
|
||||
ByteArray Utils::GenerateRandomBytes(size_t length) {
|
||||
Prng prng;
|
||||
std::string data;
|
||||
@@ -63,21 +60,6 @@ ByteArray Utils::Sha256Hash(const std::string& source, size_t length) {
|
||||
return full_hash;
|
||||
}
|
||||
|
||||
LocationHint Utils::BuildLocationHint(const std::string& location) {
|
||||
LocationHint location_hint;
|
||||
location_hint.set_format(LocationStandard::UNKNOWN);
|
||||
|
||||
if (!location.empty()) {
|
||||
location_hint.set_location(location);
|
||||
if (location.at(0) == '+') {
|
||||
location_hint.set_format(LocationStandard::E164_CALLING);
|
||||
} else {
|
||||
location_hint.set_format(LocationStandard::ISO_3166_1_ALPHA_2);
|
||||
}
|
||||
}
|
||||
return location_hint;
|
||||
}
|
||||
|
||||
// Generates salts.
|
||||
std::string Utils::GenerateSalt() { return GenerateSalt(kDefaultSaltLength); }
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
|
||||
#include "connections/implementation/proto/offline_wire_formats.pb.h"
|
||||
#include "internal/platform/byte_array.h"
|
||||
|
||||
namespace nearby {
|
||||
@@ -29,8 +28,6 @@ class Utils {
|
||||
static ByteArray GenerateRandomBytes(size_t length);
|
||||
static ByteArray Sha256Hash(const ByteArray& source, size_t length);
|
||||
static ByteArray Sha256Hash(const std::string& source, size_t length);
|
||||
static location::nearby::connections::LocationHint BuildLocationHint(
|
||||
const std::string& location);
|
||||
static std::string GenerateSalt();
|
||||
static std::string GenerateSalt(size_t length);
|
||||
};
|
||||
|
||||
@@ -36,7 +36,7 @@ cc_library(
|
||||
deps = [
|
||||
":data_types",
|
||||
"//connections:core_types",
|
||||
"//connections/implementation/mediums:utils",
|
||||
"//connections/implementation/mediums:webrtc_utils",
|
||||
"//internal/platform:base",
|
||||
"//internal/platform:comm",
|
||||
"//internal/platform:types",
|
||||
@@ -86,7 +86,7 @@ cc_test(
|
||||
deps = [
|
||||
":data_types",
|
||||
":webrtc",
|
||||
"//connections/implementation/mediums:utils",
|
||||
"//connections/implementation/mediums:webrtc_utils",
|
||||
"//internal/platform:base",
|
||||
"//internal/platform:comm",
|
||||
"//internal/platform:test_util",
|
||||
|
||||
@@ -26,10 +26,10 @@
|
||||
#include "connections/implementation/client_proxy.h"
|
||||
#include "connections/implementation/endpoint_channel.h"
|
||||
#include "connections/implementation/mediums/mediums.h"
|
||||
#include "connections/implementation/mediums/utils.h"
|
||||
#include "connections/implementation/mediums/webrtc_peer_id.h"
|
||||
#include "connections/implementation/mediums/webrtc_socket.h"
|
||||
#include "connections/implementation/offline_frames.h"
|
||||
#include "connections/implementation/proto/offline_wire_formats.pb.h"
|
||||
#include "connections/implementation/webrtc_endpoint_channel.h"
|
||||
#include "internal/platform/byte_array.h"
|
||||
#include "internal/platform/expected.h"
|
||||
@@ -42,6 +42,22 @@ namespace {
|
||||
using ::location::nearby::connections::LocationHint;
|
||||
using ::location::nearby::connections::LocationStandard;
|
||||
using ::location::nearby::proto::connections::OperationResultCode;
|
||||
|
||||
LocationHint BuildLocationHint(const std::string& location) {
|
||||
LocationHint location_hint;
|
||||
location_hint.set_format(LocationStandard::UNKNOWN);
|
||||
|
||||
if (!location.empty()) {
|
||||
location_hint.set_location(location);
|
||||
if (location.at(0) == '+') {
|
||||
location_hint.set_format(LocationStandard::E164_CALLING);
|
||||
} else {
|
||||
location_hint.set_format(LocationStandard::ISO_3166_1_ALPHA_2);
|
||||
}
|
||||
}
|
||||
return location_hint;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
WebrtcBwuHandler::WebrtcIncomingSocket::WebrtcIncomingSocket(
|
||||
@@ -122,7 +138,7 @@ ByteArray WebrtcBwuHandler::HandleInitializeUpgradedMediumForEndpoint(
|
||||
ClientProxy* client, const std::string& upgrade_service_id,
|
||||
const std::string& endpoint_id) {
|
||||
LocationHint location_hint =
|
||||
Utils::BuildLocationHint(webrtc_.GetDefaultCountryCode());
|
||||
BuildLocationHint(webrtc_.GetDefaultCountryCode());
|
||||
|
||||
mediums::WebrtcPeerId self_id{mediums::WebrtcPeerId::FromRandom()};
|
||||
if (!webrtc_.IsAcceptingConnections(upgrade_service_id)) {
|
||||
|
||||
Reference in New Issue
Block a user