diff --git a/.bazelrc b/.bazelrc index 4b8fa14..fc9b1d9 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,5 +1,6 @@ build --incompatible_strict_action_env -# build --disk_cache=/tmp/bazel +build --disk_cache=/tmp/bazel +build --symlink_prefix= build --cxxopt=-std=c++20 build --cxxopt=-Wall diff --git a/BUILD b/BUILD deleted file mode 100644 index e69de29..0000000 diff --git a/cmd/BUILD b/cmd/BUILD new file mode 100644 index 0000000..7010a75 --- /dev/null +++ b/cmd/BUILD @@ -0,0 +1,59 @@ +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") + +cc_binary( + name = "ponger", + srcs = ["ponger.cc"], + deps = [ + "//lib:IPCNode", + "@com_github_gabime_spdlog//:spdlog", + ], +) + +cc_binary( + name = "pinger", + srcs = ["pinger.cc"], + deps = [ + "//lib:IPCNode", + "@com_github_gabime_spdlog//:spdlog", + ], +) + +cc_binary( + name = "topology_node", + srcs = ["topology_node.cc"], + deps = [ + "//lib:TopologyManager", + "//lib:Utils", + "@com_github_gabime_spdlog//:spdlog", + ], +) + +cc_binary( + name = "unix_dgram_reader", + srcs = ["unix_dgram_reader.cc"], +) + +cc_binary( + name = "unix_dgram_writer", + srcs = ["unix_dgram_writer.cc"], +) + +cc_binary( + name = "standalone_publisher", + srcs = ["standalone_publisher.cc"], + linkopts = [ + "-pthread", + "-lpthread", + "-lrt", + ], +) + +cc_binary( + name = "standalone_subscriber", + srcs = ["standalone_subscriber.cc"], + linkopts = [ + "-pthread", + "-lpthread", + "-lrt", + ], +) diff --git a/src/pinger.cc b/cmd/pinger.cc similarity index 100% rename from src/pinger.cc rename to cmd/pinger.cc diff --git a/src/ponger.cc b/cmd/ponger.cc similarity index 100% rename from src/ponger.cc rename to cmd/ponger.cc diff --git a/src/standalone_publisher.cc b/cmd/standalone_publisher.cc similarity index 100% rename from src/standalone_publisher.cc rename to cmd/standalone_publisher.cc diff --git a/src/standalone_subscriber.cc b/cmd/standalone_subscriber.cc similarity index 100% rename from src/standalone_subscriber.cc rename to cmd/standalone_subscriber.cc diff --git a/src/topology_node.cc b/cmd/topology_node.cc similarity index 100% rename from src/topology_node.cc rename to cmd/topology_node.cc diff --git a/src/unix_dgram_reader.cc b/cmd/unix_dgram_reader.cc similarity index 100% rename from src/unix_dgram_reader.cc rename to cmd/unix_dgram_reader.cc diff --git a/src/unix_dgram_writer.cc b/cmd/unix_dgram_writer.cc similarity index 100% rename from src/unix_dgram_writer.cc rename to cmd/unix_dgram_writer.cc diff --git a/src/BUILD b/lib/BUILD similarity index 60% rename from src/BUILD rename to lib/BUILD index 314ee46..ae2af60 100644 --- a/src/BUILD +++ b/lib/BUILD @@ -1,4 +1,4 @@ -load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") +load("@rules_cc//cc:defs.bzl", "cc_library") cc_test( name = "test_topology_manager", @@ -10,44 +10,6 @@ cc_test( ], ) -cc_binary( - name = "ponger", - srcs = ["ponger.cc"], - deps = [ - ":IPCNode", - "@com_github_gabime_spdlog//:spdlog", - ], -) - -cc_binary( - name = "pinger", - srcs = ["pinger.cc"], - deps = [ - ":IPCNode", - "@com_github_gabime_spdlog//:spdlog", - ], -) - -cc_binary( - name = "topology_node", - srcs = ["topology_node.cc"], - deps = [ - ":TopologyManager", - ":Utils", - "@com_github_gabime_spdlog//:spdlog", - ], -) - -cc_binary( - name = "unix_dgram_reader", - srcs = ["unix_dgram_reader.cc"], -) - -cc_binary( - name = "unix_dgram_writer", - srcs = ["unix_dgram_writer.cc"], -) - cc_library( name = "TopologyServer", srcs = ["TopologyServer.cc"], @@ -68,6 +30,7 @@ cc_library( hdrs = ["IPCNode.h"], include_prefix = "ips", includes = ["."], + visibility = ["//visibility:public"], deps = [":TopologyManager"], ) @@ -77,6 +40,7 @@ cc_library( hdrs = ["TopologyManager.h"], include_prefix = "ips", includes = ["."], + visibility = ["//visibility:public"], deps = [ ":TopologyServer", ":UDSClient", @@ -116,24 +80,5 @@ cc_library( hdrs = ["Utils.h"], include_prefix = "ips", includes = ["."], -) - -cc_binary( - name = "standalone_publisher", - srcs = ["standalone_publisher.cc"], - linkopts = [ - "-pthread", - "-lpthread", - "-lrt", - ], -) - -cc_binary( - name = "standalone_subscriber", - srcs = ["standalone_subscriber.cc"], - linkopts = [ - "-pthread", - "-lpthread", - "-lrt", - ], + visibility = ["//visibility:public"], ) diff --git a/src/IPCNode.cc b/lib/IPCNode.cc similarity index 100% rename from src/IPCNode.cc rename to lib/IPCNode.cc diff --git a/src/IPCNode.h b/lib/IPCNode.h similarity index 100% rename from src/IPCNode.h rename to lib/IPCNode.h diff --git a/src/TopologyManager.cc b/lib/TopologyManager.cc similarity index 100% rename from src/TopologyManager.cc rename to lib/TopologyManager.cc diff --git a/src/TopologyManager.h b/lib/TopologyManager.h similarity index 100% rename from src/TopologyManager.h rename to lib/TopologyManager.h diff --git a/src/TopologyServer.cc b/lib/TopologyServer.cc similarity index 100% rename from src/TopologyServer.cc rename to lib/TopologyServer.cc diff --git a/src/TopologyServer.h b/lib/TopologyServer.h similarity index 100% rename from src/TopologyServer.h rename to lib/TopologyServer.h diff --git a/src/UDSClient.cc b/lib/UDSClient.cc similarity index 100% rename from src/UDSClient.cc rename to lib/UDSClient.cc diff --git a/src/UDSClient.h b/lib/UDSClient.h similarity index 100% rename from src/UDSClient.h rename to lib/UDSClient.h diff --git a/src/UDSServer.cc b/lib/UDSServer.cc similarity index 100% rename from src/UDSServer.cc rename to lib/UDSServer.cc diff --git a/src/UDSServer.h b/lib/UDSServer.h similarity index 100% rename from src/UDSServer.h rename to lib/UDSServer.h diff --git a/src/Utils.cc b/lib/Utils.cc similarity index 100% rename from src/Utils.cc rename to lib/Utils.cc diff --git a/src/Utils.h b/lib/Utils.h similarity index 100% rename from src/Utils.h rename to lib/Utils.h diff --git a/src/ipc_node_test.cc b/lib/ipc_node_test.cc similarity index 100% rename from src/ipc_node_test.cc rename to lib/ipc_node_test.cc diff --git a/src/test_topology_manager.cc b/lib/test_topology_manager.cc similarity index 100% rename from src/test_topology_manager.cc rename to lib/test_topology_manager.cc