From c1273a9c1cafc9227681e3ec8d4ba8955148d8a8 Mon Sep 17 00:00:00 2001 From: "A. Cody Schuffelen" Date: Tue, 28 Jan 2025 13:54:22 -0800 Subject: [PATCH] Move `instances/{instance_lock,lock_file}.{cpp,h} ... to a new subdirectory. This is one step to making the filesystem organization match the build system. Bug: b/392949844 Test: bazel test '//...' --- .../host/commands/cvd/acloud/BUILD.bazel | 2 +- .../host/commands/cvd/acloud/converter.cpp | 2 +- .../commands/cvd/cli/selector/BUILD.bazel | 2 +- .../cvd/cli/selector/creation_analyzer.h | 2 +- .../host/commands/cvd/instances/BUILD.bazel | 25 +----------------- .../commands/cvd/instances/instance_manager.h | 2 +- .../commands/cvd/instances/lock/BUILD.bazel | 26 +++++++++++++++++++ .../instances/{ => lock}/instance_lock.cpp | 2 +- .../cvd/instances/{ => lock}/instance_lock.h | 2 +- .../cvd/instances/{ => lock}/lock_file.cpp | 2 +- .../cvd/instances/{ => lock}/lock_file.h | 0 11 files changed, 35 insertions(+), 32 deletions(-) create mode 100644 base/cvd/cuttlefish/host/commands/cvd/instances/lock/BUILD.bazel rename base/cvd/cuttlefish/host/commands/cvd/instances/{ => lock}/instance_lock.cpp (99%) rename base/cvd/cuttlefish/host/commands/cvd/instances/{ => lock}/instance_lock.h (97%) rename base/cvd/cuttlefish/host/commands/cvd/instances/{ => lock}/lock_file.cpp (99%) rename base/cvd/cuttlefish/host/commands/cvd/instances/{ => lock}/lock_file.h (100%) diff --git a/base/cvd/cuttlefish/host/commands/cvd/acloud/BUILD.bazel b/base/cvd/cuttlefish/host/commands/cvd/acloud/BUILD.bazel index b0478cbfefe..87f7ff60c98 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/acloud/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/cvd/acloud/BUILD.bazel @@ -38,8 +38,8 @@ cc_library( "//cuttlefish/host/commands/cvd/cli/selector:parser", "//cuttlefish/host/commands/cvd/cli:types", "//cuttlefish/host/commands/cvd/cli:utils", + "//cuttlefish/host/commands/cvd/instances/lock", "//cuttlefish/host/commands/cvd/instances:instance_database_utils", - "//cuttlefish/host/commands/cvd/instances:lock", "//cuttlefish/host/commands/cvd/utils", "//cuttlefish/host/libs/config", "//libbase", diff --git a/base/cvd/cuttlefish/host/commands/cvd/acloud/converter.cpp b/base/cvd/cuttlefish/host/commands/cvd/acloud/converter.cpp index 3f8e8685307..ae1c8026f96 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/acloud/converter.cpp +++ b/base/cvd/cuttlefish/host/commands/cvd/acloud/converter.cpp @@ -36,7 +36,7 @@ #include "host/commands/cvd/acloud/config.h" #include "host/commands/cvd/acloud/create_converter_parser.h" #include "host/commands/cvd/utils/common.h" -#include "host/commands/cvd/instances/lock_file.h" +#include "host/commands/cvd/instances/lock/lock_file.h" #include "host/commands/cvd/instances/instance_database_utils.h" #include "host/commands/cvd/cli/selector/selector_constants.h" #include "host/commands/cvd/cli/command_request.h" diff --git a/base/cvd/cuttlefish/host/commands/cvd/cli/selector/BUILD.bazel b/base/cvd/cuttlefish/host/commands/cvd/cli/selector/BUILD.bazel index 418f4fcb3c4..1be00451d66 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/cli/selector/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/cvd/cli/selector/BUILD.bazel @@ -25,9 +25,9 @@ cc_library( "//cuttlefish/common/libs/utils", "//cuttlefish/common/libs/utils:result", "//cuttlefish/host/commands/cvd/cli:types", + "//cuttlefish/host/commands/cvd/instances/lock", "//cuttlefish/host/commands/cvd/instances:cvd_persistent_data", "//cuttlefish/host/commands/cvd/instances:instance_database_utils", - "//cuttlefish/host/commands/cvd/instances:lock", "//cuttlefish/host/commands/cvd/utils", "//cuttlefish/host/libs/config", "//libbase", diff --git a/base/cvd/cuttlefish/host/commands/cvd/cli/selector/creation_analyzer.h b/base/cvd/cuttlefish/host/commands/cvd/cli/selector/creation_analyzer.h index 20635b44ca3..c10d14cac5b 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/cli/selector/creation_analyzer.h +++ b/base/cvd/cuttlefish/host/commands/cvd/cli/selector/creation_analyzer.h @@ -26,7 +26,7 @@ #include "common/libs/utils/result.h" #include "common/libs/utils/unique_resource_allocator.h" #include "cuttlefish/host/commands/cvd/instances/cvd_persistent_data.pb.h" -#include "host/commands/cvd/instances/instance_lock.h" +#include "host/commands/cvd/instances/lock/instance_lock.h" #include "host/commands/cvd/cli/selector/start_selector_parser.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/cvd/instances/BUILD.bazel b/base/cvd/cuttlefish/host/commands/cvd/instances/BUILD.bazel index a68c0c7edbe..64de3bd0c28 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/instances/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/cvd/instances/BUILD.bazel @@ -12,29 +12,6 @@ cc_proto_library( deps = [":cvd_persistent_data_proto"], ) -cc_library( - name = "lock", - srcs = [ - "instance_lock.cpp", - "lock_file.cpp", - ], - hdrs = [ - "instance_lock.h", - "lock_file.h", - ], - copts = [ - "-Werror=sign-compare", - "-std=c++17", - ], - strip_include_prefix = "//cuttlefish", - deps = [ - "//cuttlefish/common/libs/fs", - "//cuttlefish/common/libs/utils", - "//cuttlefish/common/libs/utils:result", - "//libbase", - ], -) - cc_library( name = "instances", srcs = [ @@ -63,7 +40,6 @@ cc_library( deps = [ ":cvd_persistent_data", ":instance_database_utils", - ":lock", "//cuttlefish/common/libs/fs", "//cuttlefish/common/libs/utils", "//cuttlefish/common/libs/utils:result", @@ -72,6 +48,7 @@ cc_library( "//cuttlefish/host/commands/cvd/cli:command_request", "//cuttlefish/host/commands/cvd/cli:types", "//cuttlefish/host/commands/cvd/cli:utils", + "//cuttlefish/host/commands/cvd/instances/lock", "//cuttlefish/host/commands/cvd/legacy:cvd_server_cc_proto", "//cuttlefish/host/commands/cvd/utils", "//cuttlefish/host/libs/config", diff --git a/base/cvd/cuttlefish/host/commands/cvd/instances/instance_manager.h b/base/cvd/cuttlefish/host/commands/cvd/instances/instance_manager.h index f97dfd462ee..0b923540aa7 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/instances/instance_manager.h +++ b/base/cvd/cuttlefish/host/commands/cvd/instances/instance_manager.h @@ -29,8 +29,8 @@ #include "host/commands/cvd/cli/selector/creation_analyzer.h" #include "host/commands/cvd/instances/instance_database.h" #include "host/commands/cvd/instances/instance_group_record.h" -#include "host/commands/cvd/instances/instance_lock.h" #include "host/commands/cvd/instances/instance_record.h" +#include "host/commands/cvd/instances/lock/instance_lock.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/cvd/instances/lock/BUILD.bazel b/base/cvd/cuttlefish/host/commands/cvd/instances/lock/BUILD.bazel new file mode 100644 index 00000000000..6eb74485294 --- /dev/null +++ b/base/cvd/cuttlefish/host/commands/cvd/instances/lock/BUILD.bazel @@ -0,0 +1,26 @@ +package( + default_visibility = ["//:android_cuttlefish"], +) + +cc_library( + name = "lock", + srcs = [ + "instance_lock.cpp", + "lock_file.cpp", + ], + hdrs = [ + "instance_lock.h", + "lock_file.h", + ], + copts = [ + "-Werror=sign-compare", + "-std=c++17", + ], + strip_include_prefix = "//cuttlefish", + deps = [ + "//cuttlefish/common/libs/fs", + "//cuttlefish/common/libs/utils", + "//cuttlefish/common/libs/utils:result", + "//libbase", + ], +) diff --git a/base/cvd/cuttlefish/host/commands/cvd/instances/instance_lock.cpp b/base/cvd/cuttlefish/host/commands/cvd/instances/lock/instance_lock.cpp similarity index 99% rename from base/cvd/cuttlefish/host/commands/cvd/instances/instance_lock.cpp rename to base/cvd/cuttlefish/host/commands/cvd/instances/lock/instance_lock.cpp index 0ec7c24a670..dccf43e3b42 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/instances/instance_lock.cpp +++ b/base/cvd/cuttlefish/host/commands/cvd/instances/lock/instance_lock.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "host/commands/cvd/instances/instance_lock.h" +#include "host/commands/cvd/instances/lock/instance_lock.h" #include diff --git a/base/cvd/cuttlefish/host/commands/cvd/instances/instance_lock.h b/base/cvd/cuttlefish/host/commands/cvd/instances/lock/instance_lock.h similarity index 97% rename from base/cvd/cuttlefish/host/commands/cvd/instances/instance_lock.h rename to base/cvd/cuttlefish/host/commands/cvd/instances/lock/instance_lock.h index f90da9f8276..64dacd4353a 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/instances/instance_lock.h +++ b/base/cvd/cuttlefish/host/commands/cvd/instances/lock/instance_lock.h @@ -18,7 +18,7 @@ #include #include -#include "host/commands/cvd/instances/lock_file.h" +#include "host/commands/cvd/instances/lock/lock_file.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/cvd/instances/lock_file.cpp b/base/cvd/cuttlefish/host/commands/cvd/instances/lock/lock_file.cpp similarity index 99% rename from base/cvd/cuttlefish/host/commands/cvd/instances/lock_file.cpp rename to base/cvd/cuttlefish/host/commands/cvd/instances/lock/lock_file.cpp index 996a888e09d..8e29be12a8b 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/instances/lock_file.cpp +++ b/base/cvd/cuttlefish/host/commands/cvd/instances/lock/lock_file.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "host/commands/cvd/instances/lock_file.h" +#include "host/commands/cvd/instances/lock/lock_file.h" #include diff --git a/base/cvd/cuttlefish/host/commands/cvd/instances/lock_file.h b/base/cvd/cuttlefish/host/commands/cvd/instances/lock/lock_file.h similarity index 100% rename from base/cvd/cuttlefish/host/commands/cvd/instances/lock_file.h rename to base/cvd/cuttlefish/host/commands/cvd/instances/lock/lock_file.h