Move uuid to //aos:uuid
It is getting usage significantly further outside the logger. Time to
promote it somewhere better. I only see it getting used more.
Change-Id: I754739347212f5a3154f68c7b7fc84b9a9074d90
diff --git a/aos/BUILD b/aos/BUILD
index b87f7bc..535c0b2 100644
--- a/aos/BUILD
+++ b/aos/BUILD
@@ -595,3 +595,26 @@
srcs = ["flatbuffers_static.py"],
visibility = ["//visibility:public"],
)
+
+cc_library(
+ name = "uuid",
+ srcs = ["uuid.cc"],
+ hdrs = ["uuid.h"],
+ target_compatible_with = ["@platforms//os:linux"],
+ visibility = ["//visibility:public"],
+ deps = [
+ "@com_github_google_flatbuffers//:flatbuffers",
+ "@com_github_google_glog//:glog",
+ "@com_google_absl//absl/types:span",
+ ],
+)
+
+cc_test(
+ name = "uuid_test",
+ srcs = ["uuid_test.cc"],
+ target_compatible_with = ["@platforms//os:linux"],
+ deps = [
+ ":uuid",
+ "//aos/testing:googletest",
+ ],
+)
diff --git a/aos/events/BUILD b/aos/events/BUILD
index a1a4c6e..1a72db9 100644
--- a/aos/events/BUILD
+++ b/aos/events/BUILD
@@ -83,7 +83,7 @@
"//aos:configuration_fbs",
"//aos:flatbuffers",
"//aos:ftrace",
- "//aos/events/logging:uuid",
+ "//aos:uuid",
"//aos/ipc_lib:data_alignment",
"//aos/logging:implementations",
"//aos/time",
diff --git a/aos/events/event_loop.h b/aos/events/event_loop.h
index 5320e1e..b8f8d2d 100644
--- a/aos/events/event_loop.h
+++ b/aos/events/event_loop.h
@@ -12,7 +12,6 @@
#include "aos/events/channel_preallocated_allocator.h"
#include "aos/events/event_loop_event.h"
#include "aos/events/event_loop_generated.h"
-#include "aos/events/logging/uuid.h"
#include "aos/events/timing_statistics.h"
#include "aos/flatbuffers.h"
#include "aos/ftrace.h"
@@ -20,6 +19,7 @@
#include "aos/json_to_flatbuffer.h"
#include "aos/time/time.h"
#include "aos/util/phased_loop.h"
+#include "aos/uuid.h"
#include "absl/container/btree_set.h"
#include "flatbuffers/flatbuffers.h"
diff --git a/aos/events/logging/BUILD b/aos/events/logging/BUILD
index a3513d1..0b6adeb 100644
--- a/aos/events/logging/BUILD
+++ b/aos/events/logging/BUILD
@@ -27,7 +27,7 @@
deps = [
":buffer_encoder",
":logger_fbs",
- ":uuid",
+ "//aos:uuid",
"//aos:configuration",
"//aos:flatbuffer_merge",
"//aos:flatbuffers",
@@ -176,7 +176,7 @@
deps = [
":logfile_utils",
":logger_fbs",
- ":uuid",
+ "//aos:uuid",
"@com_github_google_flatbuffers//:flatbuffers",
],
)
@@ -214,7 +214,7 @@
":log_writer",
":logfile_utils",
":logger_fbs",
- ":uuid",
+ "//aos:uuid",
"//aos/events:event_loop",
"//aos/events:simulated_event_loop",
"//aos/network:message_bridge_server_fbs",
@@ -377,29 +377,6 @@
],
)
-cc_library(
- name = "uuid",
- srcs = ["uuid.cc"],
- hdrs = ["uuid.h"],
- target_compatible_with = ["@platforms//os:linux"],
- visibility = ["//visibility:public"],
- deps = [
- "@com_github_google_flatbuffers//:flatbuffers",
- "@com_github_google_glog//:glog",
- "@com_google_absl//absl/types:span",
- ],
-)
-
-cc_test(
- name = "uuid_test",
- srcs = ["uuid_test.cc"],
- target_compatible_with = ["@platforms//os:linux"],
- deps = [
- ":uuid",
- "//aos/testing:googletest",
- ],
-)
-
cc_test(
name = "logfile_utils_test",
srcs = ["logfile_utils_test.cc"],
diff --git a/aos/events/logging/log_namer.cc b/aos/events/logging/log_namer.cc
index 18138d9..a0625d0 100644
--- a/aos/events/logging/log_namer.cc
+++ b/aos/events/logging/log_namer.cc
@@ -9,7 +9,7 @@
#include "absl/strings/str_cat.h"
#include "aos/events/logging/logfile_utils.h"
#include "aos/events/logging/logger_generated.h"
-#include "aos/events/logging/uuid.h"
+#include "aos/uuid.h"
#include "flatbuffers/flatbuffers.h"
#include "glog/logging.h"
diff --git a/aos/events/logging/log_namer.h b/aos/events/logging/log_namer.h
index 2d4c23e..8f3f712 100644
--- a/aos/events/logging/log_namer.h
+++ b/aos/events/logging/log_namer.h
@@ -9,7 +9,7 @@
#include "aos/events/logging/logfile_utils.h"
#include "aos/events/logging/logger_generated.h"
-#include "aos/events/logging/uuid.h"
+#include "aos/uuid.h"
#include "flatbuffers/flatbuffers.h"
namespace aos {
diff --git a/aos/events/logging/log_reader.cc b/aos/events/logging/log_reader.cc
index 881f9c1..07b423f 100644
--- a/aos/events/logging/log_reader.cc
+++ b/aos/events/logging/log_reader.cc
@@ -13,7 +13,6 @@
#include "aos/events/event_loop.h"
#include "aos/events/logging/logfile_sorting.h"
#include "aos/events/logging/logger_generated.h"
-#include "aos/events/logging/uuid.h"
#include "aos/flatbuffer_merge.h"
#include "aos/network/multinode_timestamp_filter.h"
#include "aos/network/remote_message_generated.h"
@@ -22,6 +21,7 @@
#include "aos/network/timestamp_channel.h"
#include "aos/time/time.h"
#include "aos/util/file.h"
+#include "aos/uuid.h"
#include "flatbuffers/flatbuffers.h"
#include "openssl/sha.h"
diff --git a/aos/events/logging/log_reader.h b/aos/events/logging/log_reader.h
index 24ac5c9..37163c1 100644
--- a/aos/events/logging/log_reader.h
+++ b/aos/events/logging/log_reader.h
@@ -11,13 +11,13 @@
#include "aos/events/logging/logfile_sorting.h"
#include "aos/events/logging/logfile_utils.h"
#include "aos/events/logging/logger_generated.h"
-#include "aos/events/logging/uuid.h"
#include "aos/events/simulated_event_loop.h"
#include "aos/network/message_bridge_server_generated.h"
#include "aos/network/multinode_timestamp_filter.h"
#include "aos/network/remote_message_generated.h"
#include "aos/network/timestamp_filter.h"
#include "aos/time/time.h"
+#include "aos/uuid.h"
#include "flatbuffers/flatbuffers.h"
namespace aos {
diff --git a/aos/events/logging/log_writer.h b/aos/events/logging/log_writer.h
index eb08bb7..0e88b4f 100644
--- a/aos/events/logging/log_writer.h
+++ b/aos/events/logging/log_writer.h
@@ -9,11 +9,11 @@
#include "aos/events/logging/log_namer.h"
#include "aos/events/logging/logfile_utils.h"
#include "aos/events/logging/logger_generated.h"
-#include "aos/events/logging/uuid.h"
#include "aos/events/simulated_event_loop.h"
#include "aos/network/message_bridge_server_generated.h"
#include "aos/network/remote_message_generated.h"
#include "aos/time/time.h"
+#include "aos/uuid.h"
#include "flatbuffers/flatbuffers.h"
namespace aos {
diff --git a/aos/events/logging/logfile_sorting.h b/aos/events/logging/logfile_sorting.h
index f479d62..95a6431 100644
--- a/aos/events/logging/logfile_sorting.h
+++ b/aos/events/logging/logfile_sorting.h
@@ -6,8 +6,8 @@
#include <vector>
#include "aos/configuration.h"
-#include "aos/events/logging/uuid.h"
#include "aos/time/time.h"
+#include "aos/uuid.h"
namespace aos {
namespace logger {
diff --git a/aos/events/simulated_event_loop.h b/aos/events/simulated_event_loop.h
index 3ef7c96..348e7dd 100644
--- a/aos/events/simulated_event_loop.h
+++ b/aos/events/simulated_event_loop.h
@@ -13,11 +13,11 @@
#include "absl/container/btree_map.h"
#include "aos/events/event_loop.h"
#include "aos/events/event_scheduler.h"
-#include "aos/events/logging/uuid.h"
#include "aos/events/simple_channel.h"
#include "aos/flatbuffer_merge.h"
#include "aos/flatbuffers.h"
#include "aos/ipc_lib/index.h"
+#include "aos/uuid.h"
#include "glog/logging.h"
namespace aos {
diff --git a/aos/network/BUILD b/aos/network/BUILD
index 8e7d476..789b093 100644
--- a/aos/network/BUILD
+++ b/aos/network/BUILD
@@ -148,7 +148,7 @@
"//aos:configuration",
"//aos:flatbuffer_merge",
"//aos:flatbuffers",
- "//aos/events/logging:uuid",
+ "//aos:uuid",
"@com_github_google_flatbuffers//:flatbuffers",
],
)
diff --git a/aos/network/message_bridge_protocol.h b/aos/network/message_bridge_protocol.h
index fed859b..d0a28a1 100644
--- a/aos/network/message_bridge_protocol.h
+++ b/aos/network/message_bridge_protocol.h
@@ -4,8 +4,8 @@
#include <string_view>
#include "aos/configuration.h"
-#include "aos/events/logging/uuid.h"
#include "aos/network/connect_generated.h"
+#include "aos/uuid.h"
namespace aos {
namespace message_bridge {
diff --git a/aos/events/logging/uuid.cc b/aos/uuid.cc
similarity index 98%
rename from aos/events/logging/uuid.cc
rename to aos/uuid.cc
index ce3411d..71e688c 100644
--- a/aos/events/logging/uuid.cc
+++ b/aos/uuid.cc
@@ -1,4 +1,4 @@
-#include "aos/events/logging/uuid.h"
+#include "aos/uuid.h"
#include <fcntl.h>
#include <sys/stat.h>
diff --git a/aos/events/logging/uuid.h b/aos/uuid.h
similarity index 92%
rename from aos/events/logging/uuid.h
rename to aos/uuid.h
index 1379369..d12bedf 100644
--- a/aos/events/logging/uuid.h
+++ b/aos/uuid.h
@@ -57,12 +57,8 @@
return absl::Span<const uint8_t>(data_.data(), data_.size());
}
- bool operator==(const UUID &other) const {
- return other.span() == span();
- }
- bool operator!=(const UUID &other) const {
- return other.span() != span();
- }
+ bool operator==(const UUID &other) const { return other.span() == span(); }
+ bool operator!=(const UUID &other) const { return other.span() != span(); }
private:
friend std::ostream &operator<<(std::ostream &os, const UUID &uuid);
diff --git a/aos/events/logging/uuid_test.cc b/aos/uuid_test.cc
similarity index 97%
rename from aos/events/logging/uuid_test.cc
rename to aos/uuid_test.cc
index 5ec8f83..33ec6ef 100644
--- a/aos/events/logging/uuid_test.cc
+++ b/aos/uuid_test.cc
@@ -1,4 +1,4 @@
-#include "aos/events/logging/uuid.h"
+#include "aos/uuid.h"
#include "glog/logging.h"
#include "gtest/gtest.h"