diff --git a/base/cvd/allocd/BUILD.bazel b/base/cvd/allocd/BUILD.bazel index e60de5e3a3..7712f0b194 100644 --- a/base/cvd/allocd/BUILD.bazel +++ b/base/cvd/allocd/BUILD.bazel @@ -1,3 +1,5 @@ +load("//:build_variables.bzl", "COPTS") + package( default_visibility = ["//:android_cuttlefish"], ) @@ -16,14 +18,13 @@ cc_binary( "utils.cpp", "utils.h", ], - copts = [ + copts = COPTS + [ "-Wno-reorder", "-Wno-unknown-pragmas", "-Wno-attributes", "-Wno-sign-compare", "-Wno-write-strings", "-DNODISCARD_EXPECTED=true", - "-std=c++17", ], includes = [""], deps = [ diff --git a/base/cvd/build_variables.bzl b/base/cvd/build_variables.bzl new file mode 100644 index 0000000000..87aa0f32cd --- /dev/null +++ b/base/cvd/build_variables.bzl @@ -0,0 +1,3 @@ +COPTS = [ + "-std=c++17" + ] diff --git a/base/cvd/cuttlefish/common/libs/fs/BUILD.bazel b/base/cvd/cuttlefish/common/libs/fs/BUILD.bazel index 502cb3e8a4..51c0cf7092 100644 --- a/base/cvd/cuttlefish/common/libs/fs/BUILD.bazel +++ b/base/cvd/cuttlefish/common/libs/fs/BUILD.bazel @@ -1,3 +1,5 @@ +load("//:build_variables.bzl", "COPTS") + package( default_visibility = ["//:android_cuttlefish"], ) @@ -17,9 +19,7 @@ cc_library( "shared_fd_stream.h", "shared_select.h", ], - copts = [ - "-std=c++17", - ], + copts = COPTS, strip_include_prefix = "//cuttlefish", deps = [ "//cuttlefish/common/libs/utils:result", @@ -33,9 +33,7 @@ cc_test( srcs = [ "shared_fd_test.cpp", ], - copts = [ - "-std=c++17", - ], + copts = COPTS, includes = [""], deps = [ ":fs", diff --git a/base/cvd/cuttlefish/common/libs/utils/BUILD.bazel b/base/cvd/cuttlefish/common/libs/utils/BUILD.bazel index b63a99b24e..ead10f46cb 100644 --- a/base/cvd/cuttlefish/common/libs/utils/BUILD.bazel +++ b/base/cvd/cuttlefish/common/libs/utils/BUILD.bazel @@ -1,3 +1,5 @@ +load("//:build_variables.bzl", "COPTS") + package( default_visibility = ["//:android_cuttlefish"], ) @@ -10,9 +12,7 @@ cc_library( hdrs = [ "result.h", ], - copts = [ - "-std=c++17", - ], + copts = COPTS, strip_include_prefix = "//cuttlefish", deps = [ "//libbase", @@ -26,9 +26,7 @@ cc_library( hdrs = [ "result_matchers.h", ], - copts = [ - "-std=c++17", - ], + copts = COPTS, strip_include_prefix = "//cuttlefish", deps = [ ":result", @@ -79,9 +77,7 @@ cc_library( "unix_sockets.h", "users.h", ], - copts = [ - "-std=c++17", - ], + copts = COPTS, strip_include_prefix = "//cuttlefish", deps = [ ":result", @@ -101,10 +97,7 @@ cc_test( srcs = [ "result_test.cpp", ], - copts = [ - "-std=c++17", - "-Icuttlefish", - ], + copts = COPTS + [ "-Icuttlefish" ], deps = [ ":result", ":result_matchers", @@ -127,9 +120,8 @@ cc_test( "unique_resource_allocator_test.h", "unix_sockets_test.cpp", ], - copts = [ + copts = COPTS + [ "-Wno-ctad-maybe-unsupported", - "-std=c++17", "-Icuttlefish", ], deps = [ diff --git a/base/cvd/cuttlefish/host/commands/assemble_cvd/BUILD.bazel b/base/cvd/cuttlefish/host/commands/assemble_cvd/BUILD.bazel index 3259fe33a5..916208bb10 100644 --- a/base/cvd/cuttlefish/host/commands/assemble_cvd/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/assemble_cvd/BUILD.bazel @@ -1,3 +1,5 @@ +load("//:build_variables.bzl", "COPTS") + package( default_visibility = ["//:android_cuttlefish"], ) @@ -7,10 +9,7 @@ cc_library( hdrs = [ "flags_defaults.h", ], - copts = [ - "-Werror=sign-compare", - "-std=c++17", - ], + copts = COPTS + [ "-Werror=sign-compare" ], strip_include_prefix = "//cuttlefish", deps = [ "//cuttlefish/host/libs/config", diff --git a/base/cvd/cuttlefish/host/commands/cvd/BUILD.bazel b/base/cvd/cuttlefish/host/commands/cvd/BUILD.bazel index 0a1ba586f3..5237ed0e83 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/cvd/BUILD.bazel @@ -1,3 +1,5 @@ +load("//:build_variables.bzl", "COPTS") + package( default_visibility = ["//:android_cuttlefish"], ) @@ -6,10 +8,7 @@ cc_library( name = "libcvd", srcs = ["cvd.cpp" ], hdrs = ["cvd.h"], - copts = [ - "-Werror=sign-compare", - "-std=c++17", - ], + copts = COPTS + [ "-Werror=sign-compare" ], strip_include_prefix = "//cuttlefish", deps = [ "//cuttlefish/common/libs/utils", @@ -28,9 +27,7 @@ cc_library( cc_binary( name = "cvd", srcs = ["main.cc" ], - copts = [ - "-std=c++17", - ], + copts = COPTS, deps = [ ":libcvd", "//cuttlefish/common/libs/utils", diff --git a/base/cvd/cuttlefish/host/commands/cvd/acloud/BUILD.bazel b/base/cvd/cuttlefish/host/commands/cvd/acloud/BUILD.bazel index 87f7ff60c9..531231b211 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/acloud/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/cvd/acloud/BUILD.bazel @@ -1,3 +1,5 @@ +load("//:build_variables.bzl", "COPTS") + package( default_visibility = ["//:android_cuttlefish"], ) @@ -24,10 +26,7 @@ cc_library( "converter.h", "create_converter_parser.h", ], - copts = [ - "-Werror=sign-compare", - "-std=c++17", - ], + copts = COPTS + [ "-Werror=sign-compare" ], strip_include_prefix = "//cuttlefish", deps = [ ":user_config_cc_proto", diff --git a/base/cvd/cuttlefish/host/commands/cvd/cache/BUILD.bazel b/base/cvd/cuttlefish/host/commands/cvd/cache/BUILD.bazel index 902511b4be..1a4b41121c 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/cache/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/cvd/cache/BUILD.bazel @@ -1,3 +1,5 @@ +load("//:build_variables.bzl", "COPTS") + package( default_visibility = ["//:android_cuttlefish"], ) @@ -6,10 +8,7 @@ cc_library( name = "cache", srcs = ["cache.cpp"], hdrs = ["cache.h"], - copts = [ - "-Werror=sign-compare", - "-std=c++17", - ], + copts = COPTS + [ "-Werror=sign-compare" ], strip_include_prefix = "//cuttlefish", deps = [ "//cuttlefish/common/libs/utils:result", diff --git a/base/cvd/cuttlefish/host/commands/cvd/fetch/BUILD.bazel b/base/cvd/cuttlefish/host/commands/cvd/fetch/BUILD.bazel index 88d8ded4be..e0e28f5af0 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/fetch/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/cvd/fetch/BUILD.bazel @@ -1,3 +1,5 @@ +load("//:build_variables.bzl", "COPTS") + package( default_visibility = ["//:android_cuttlefish"], ) @@ -14,10 +16,7 @@ cc_library( "fetch_cvd_parser.h", "fetch_tracer.h", ], - copts = [ - "-Werror=sign-compare", - "-std=c++17", - ], + copts = COPTS + [ "-Werror=sign-compare" ], strip_include_prefix = "//cuttlefish", deps = [ "//cuttlefish/common/libs/utils:result", diff --git a/base/cvd/cuttlefish/host/commands/cvd/instances/lock/BUILD.bazel b/base/cvd/cuttlefish/host/commands/cvd/instances/lock/BUILD.bazel index 6eb7448529..38963bbc5a 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/instances/lock/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/cvd/instances/lock/BUILD.bazel @@ -1,3 +1,5 @@ +load("//:build_variables.bzl", "COPTS") + package( default_visibility = ["//:android_cuttlefish"], ) @@ -12,10 +14,7 @@ cc_library( "instance_lock.h", "lock_file.h", ], - copts = [ - "-Werror=sign-compare", - "-std=c++17", - ], + copts = COPTS + [ "-Werror=sign-compare" ], strip_include_prefix = "//cuttlefish", deps = [ "//cuttlefish/common/libs/fs", diff --git a/base/cvd/cuttlefish/host/commands/cvd/unittests/fetch/BUILD.bazel b/base/cvd/cuttlefish/host/commands/cvd/unittests/fetch/BUILD.bazel index fdf9fde27f..1f02de1948 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/unittests/fetch/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/cvd/unittests/fetch/BUILD.bazel @@ -1,3 +1,5 @@ +load("//:build_variables.bzl", "COPTS") + package( default_visibility = ["//:android_cuttlefish"], ) @@ -8,10 +10,7 @@ cc_test( "fetch_cvd_parser_test.cpp", "fetch_cvd_test.cpp", ], - copts = [ - "-std=c++17", - "-Icuttlefish", - ], + copts = COPTS + [ "-Icuttlefish" ], deps = [ "//cuttlefish/common/libs/utils", "//cuttlefish/common/libs/utils:result", diff --git a/base/cvd/cuttlefish/host/commands/cvd/unittests/parser/BUILD.bazel b/base/cvd/cuttlefish/host/commands/cvd/unittests/parser/BUILD.bazel index 46fa0dea35..26f33bbf8b 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/unittests/parser/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/cvd/unittests/parser/BUILD.bazel @@ -1,3 +1,5 @@ +load("//:build_variables.bzl", "COPTS") + package( default_visibility = ["//:android_cuttlefish"], ) @@ -15,10 +17,7 @@ cc_test( "test_common.cc", "test_common.h", ], - copts = [ - "-std=c++17", - "-Icuttlefish", - ], + copts = COPTS + [ "-Icuttlefish" ], deps = [ "//cuttlefish/common/libs/utils", "//cuttlefish/common/libs/utils:result", diff --git a/base/cvd/cuttlefish/host/commands/cvd/unittests/selector/BUILD.bazel b/base/cvd/cuttlefish/host/commands/cvd/unittests/selector/BUILD.bazel index db5fcc2af9..221caf74af 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/unittests/selector/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/cvd/unittests/selector/BUILD.bazel @@ -1,3 +1,5 @@ +load("//:build_variables.bzl", "COPTS") + package( default_visibility = ["//:android_cuttlefish"], ) @@ -18,10 +20,7 @@ cc_test( "parser_names_helper.h", "parser_names_test.cpp", ], - copts = [ - "-std=c++17", - "-Icuttlefish", - ], + copts = COPTS + [ "-Icuttlefish" ], deps = [ "//cuttlefish/common/libs/fs", "//cuttlefish/common/libs/utils", diff --git a/base/cvd/cuttlefish/host/commands/cvd/unittests/server/BUILD.bazel b/base/cvd/cuttlefish/host/commands/cvd/unittests/server/BUILD.bazel index 476fad11c5..ab8d5b9c79 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/unittests/server/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/cvd/unittests/server/BUILD.bazel @@ -1,3 +1,5 @@ +load("//:build_variables.bzl", "COPTS") + package( default_visibility = ["//:android_cuttlefish"], ) @@ -8,10 +10,7 @@ cc_test( "frontline_parser_test.cpp", "utils.h", ], - copts = [ - "-std=c++17", - "-Icuttlefish", - ], + copts = COPTS + [ "-Icuttlefish" ], deps = [ "//cuttlefish/common/libs/utils:result_matchers", "//cuttlefish/host/commands/cvd/cli:frontline_parser", diff --git a/base/cvd/cuttlefish/host/commands/cvd/utils/BUILD.bazel b/base/cvd/cuttlefish/host/commands/cvd/utils/BUILD.bazel index 4a57d9058d..82f76b782c 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/utils/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/cvd/utils/BUILD.bazel @@ -1,3 +1,5 @@ +load("//:build_variables.bzl", "COPTS") + package( default_visibility = ["//:android_cuttlefish"], ) @@ -16,10 +18,7 @@ cc_library( "interrupt_listener.h", "subprocess_waiter.h", ], - copts = [ - "-Werror=sign-compare", - "-std=c++17", - ], + copts = COPTS + [ "-Werror=sign-compare" ], strip_include_prefix = "//cuttlefish", deps = [ "//cuttlefish/common/libs/utils:result", diff --git a/base/cvd/cuttlefish/host/commands/logcat_receiver/BUILD.bazel b/base/cvd/cuttlefish/host/commands/logcat_receiver/BUILD.bazel index 513fadf80c..85b1b595fa 100644 --- a/base/cvd/cuttlefish/host/commands/logcat_receiver/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/logcat_receiver/BUILD.bazel @@ -1,3 +1,5 @@ +load("//:build_variables.bzl", "COPTS") + package( default_visibility = ["//:android_cuttlefish"], ) @@ -13,7 +15,5 @@ cc_binary( srcs = [ "main.cpp", ], - cxxopts = [ - "-std=c++17", - ], + copts = COPTS, ) diff --git a/base/cvd/cuttlefish/host/commands/metrics/BUILD.bazel b/base/cvd/cuttlefish/host/commands/metrics/BUILD.bazel index 1ad4573c27..5a6479ffe8 100644 --- a/base/cvd/cuttlefish/host/commands/metrics/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/metrics/BUILD.bazel @@ -1,3 +1,5 @@ +load("//:build_variables.bzl", "COPTS") + package( default_visibility = ["//:android_cuttlefish"], ) @@ -7,9 +9,6 @@ cc_library( hdrs = [ "metrics_defs.h", ], - copts = [ - "-Werror=sign-compare", - "-std=c++17", - ], + copts = COPTS + [ "-Werror=sign-compare" ], strip_include_prefix = "//cuttlefish", ) diff --git a/base/cvd/cuttlefish/host/libs/command_util/BUILD.bazel b/base/cvd/cuttlefish/host/libs/command_util/BUILD.bazel index 6e3a7acb25..fee1426537 100644 --- a/base/cvd/cuttlefish/host/libs/command_util/BUILD.bazel +++ b/base/cvd/cuttlefish/host/libs/command_util/BUILD.bazel @@ -1,3 +1,5 @@ +load("//:build_variables.bzl", "COPTS") + package( default_visibility = ["//:android_cuttlefish"], ) @@ -14,9 +16,7 @@ cc_library( "runner/defs.h", "util.h", ], - copts = [ - "-std=c++17", - ], + copts = COPTS, strip_include_prefix = "//cuttlefish", deps = [ "//cuttlefish/common/libs/fs", diff --git a/base/cvd/cuttlefish/host/libs/config/BUILD.bazel b/base/cvd/cuttlefish/host/libs/config/BUILD.bazel index 326b097780..f76eb2ab77 100644 --- a/base/cvd/cuttlefish/host/libs/config/BUILD.bazel +++ b/base/cvd/cuttlefish/host/libs/config/BUILD.bazel @@ -1,3 +1,5 @@ +load("//:build_variables.bzl", "COPTS") + package( default_visibility = ["//:android_cuttlefish"], ) @@ -24,9 +26,7 @@ cc_library( "instance_nums.h", "logging.h", ], - copts = [ - "-std=c++17", - ], + copts = COPTS, strip_include_prefix = "//cuttlefish", deps = [ "//cuttlefish/common/libs/utils", diff --git a/base/cvd/cuttlefish/host/libs/directories/BUILD.bazel b/base/cvd/cuttlefish/host/libs/directories/BUILD.bazel index fb8afc4313..a78ce616e9 100644 --- a/base/cvd/cuttlefish/host/libs/directories/BUILD.bazel +++ b/base/cvd/cuttlefish/host/libs/directories/BUILD.bazel @@ -1,3 +1,5 @@ +load("//:build_variables.bzl", "COPTS") + package( default_visibility = ["//:android_cuttlefish"], ) @@ -10,9 +12,7 @@ cc_library( hdrs = [ "xdg.h", ], - copts = [ - "-std=c++17", - ], + copts = COPTS, strip_include_prefix = "//cuttlefish", deps = [ "//cuttlefish/common/libs/fs", diff --git a/base/cvd/cuttlefish/host/libs/image_aggregator/BUILD.bazel b/base/cvd/cuttlefish/host/libs/image_aggregator/BUILD.bazel index eab12c6c7b..584a355f0d 100644 --- a/base/cvd/cuttlefish/host/libs/image_aggregator/BUILD.bazel +++ b/base/cvd/cuttlefish/host/libs/image_aggregator/BUILD.bazel @@ -1,3 +1,5 @@ +load("//:build_variables.bzl", "COPTS") + package( default_visibility = ["//:android_cuttlefish"], ) @@ -10,9 +12,7 @@ cc_library( hdrs = [ "sparse_image_utils.h", ], - copts = [ - "-std=c++17", - ], + copts = COPTS, strip_include_prefix = "//cuttlefish", deps = [ "//cuttlefish/common/libs/fs", diff --git a/base/cvd/cuttlefish/host/libs/web/BUILD.bazel b/base/cvd/cuttlefish/host/libs/web/BUILD.bazel index 5b4e811cb1..39d720e9fb 100644 --- a/base/cvd/cuttlefish/host/libs/web/BUILD.bazel +++ b/base/cvd/cuttlefish/host/libs/web/BUILD.bazel @@ -1,3 +1,5 @@ +load("//:build_variables.bzl", "COPTS") + package( default_visibility = ["//:android_cuttlefish"], ) @@ -31,9 +33,7 @@ cc_library( "luci_build_api.h", "oauth2_consent.h" ], - copts = [ - "-std=c++17", - ], + copts = COPTS, strip_include_prefix = "//cuttlefish", deps = [ "//cuttlefish/common/libs/fs", @@ -56,9 +56,7 @@ cc_test( "cas/cas_downloader_test.cpp", "http_client/unittest/http_client_util_test.cc", ], - copts = [ - "-std=c++17", - ], + copts = COPTS, includes = [""], deps = [ ":web",