[bazel] Cleanup style with Buildifier.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Change-Id: I5b924b02b56c66c186518cbfa372a82b960f1242
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3379226
Reviewed-by: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78559}
This commit is contained in:
Piotr Sikora 2022-01-10 13:23:25 -08:00 committed by V8 LUCI CQ
parent 39f55fc7ba
commit d82b4b6699
6 changed files with 83 additions and 48 deletions

View File

@ -3348,7 +3348,7 @@ cc_library(
":torque_base_files", ":torque_base_files",
], ],
copts = select({ copts = select({
"@v8//bazel/config:is_posix": [ "-fexceptions" ], "@v8//bazel/config:is_posix": ["-fexceptions"],
"//conditions:default": [], "//conditions:default": [],
}), }),
features = ["-use_header_modules"], features = ["-use_header_modules"],
@ -3462,7 +3462,7 @@ v8_binary(
":torque_base_files", ":torque_base_files",
], ],
copts = select({ copts = select({
"@v8//bazel/config:is_posix": [ "-fexceptions" ], "@v8//bazel/config:is_posix": ["-fexceptions"],
"//conditions:default": [], "//conditions:default": [],
}), }),
features = ["-use_header_modules"], features = ["-use_header_modules"],

View File

@ -5,15 +5,18 @@
workspace(name = "v8") workspace(name = "v8")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive( http_archive(
name = "bazel_skylib", name = "bazel_skylib",
sha256 = "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c",
urls = [ urls = [
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz", "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz", "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz",
], ],
sha256 = "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c",
) )
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
bazel_skylib_workspace() bazel_skylib_workspace()
http_archive( http_archive(
@ -33,8 +36,8 @@ pip_install(
new_local_repository( new_local_repository(
name = "com_googlesource_chromium_zlib", name = "com_googlesource_chromium_zlib",
path = "third_party/zlib",
build_file = "bazel/BUILD.zlib", build_file = "bazel/BUILD.zlib",
path = "third_party/zlib",
) )
bind( bind(
@ -49,8 +52,8 @@ bind(
new_local_repository( new_local_repository(
name = "com_googlesource_chromium_icu", name = "com_googlesource_chromium_icu",
path = "third_party/icu",
build_file = "bazel/BUILD.icu", build_file = "bazel/BUILD.icu",
path = "third_party/icu",
) )
bind( bind(
@ -60,8 +63,8 @@ bind(
new_local_repository( new_local_repository(
name = "com_googlesource_chromium_base_trace_event_common", name = "com_googlesource_chromium_base_trace_event_common",
path = "base/trace_event/common",
build_file = "bazel/BUILD.trace_event_common", build_file = "bazel/BUILD.trace_event_common",
path = "base/trace_event/common",
) )
bind( bind(

View File

@ -4,15 +4,31 @@
filegroup( filegroup(
name = "icudata", name = "icudata",
srcs = [ "common/icudtl.dat" ] srcs = ["common/icudtl.dat"],
) )
cc_library( cc_library(
name = "icuuc", name = "icuuc",
srcs = glob([ srcs = glob([
"source/common/**/*.h", "source/common/**/*.h",
"source/common/**/*.cpp" "source/common/**/*.cpp",
]), ]),
copts = select({
"@platforms//os:windows": [
"/wd4005", # Macro redefinition.
"/wd4068", # Unknown pragmas.
"/wd4267", # Conversion from size_t on 64-bits.
"/utf-8", # ICU source files are in UTF-8.
],
"//conditions:default": [
"-Wno-unused-function",
"-Wno-parentheses",
"-Wno-unused-function",
"-Wno-unused-variable",
"-Wno-deprecated-declarations",
],
}),
data = [":icudata"],
defines = [ defines = [
"U_COMMON_IMPLEMENTATION", "U_COMMON_IMPLEMENTATION",
"U_ICUDATAENTRY_IN_COMMON", "U_ICUDATAENTRY_IN_COMMON",
@ -34,35 +50,19 @@ cc_library(
], ],
"//conditions:default": [], "//conditions:default": [],
}), }),
copts = select({
"@platforms//os:windows": [
"/wd4005", # Macro redefinition.
"/wd4068", # Unknown pragmas.
"/wd4267", # Conversion from size_t on 64-bits.
"/utf-8", # ICU source files are in UTF-8.
],
"//conditions:default": [
"-Wno-unused-function",
"-Wno-parentheses",
"-Wno-unused-function",
"-Wno-unused-variable",
"-Wno-deprecated-declarations",
],
}),
includes = [ includes = [
"source/common", "source/common",
"source/i18n", "source/i18n",
], ],
tags = ["requires-rtti"], tags = ["requires-rtti"],
data = [ ":icudata" ],
alwayslink = 1, alwayslink = 1,
) )
cc_library( cc_library(
name = "icui18n", name = "icui18n",
srcs = glob([ srcs = glob([
"source/i18n/**/*.h", "source/i18n/**/*.h",
"source/i18n/**/*.cpp" "source/i18n/**/*.cpp",
]), ]),
copts = select({ copts = select({
"@platforms//os:windows": [ "@platforms//os:windows": [
@ -83,19 +83,19 @@ cc_library(
], ],
"//conditions:default": [], "//conditions:default": [],
}), }),
deps = [ ":icuuc" ], deps = [":icuuc"],
alwayslink = 1, alwayslink = 1,
) )
cc_library( cc_library(
name = "icu", name = "icu",
srcs = [
"source/stubdata/stubdata.cpp",
],
hdrs = glob([ hdrs = glob([
"source/common/unicode/*.h", "source/common/unicode/*.h",
"source/i18n/unicode/*.h", "source/i18n/unicode/*.h",
]), ]),
srcs = [
"source/stubdata/stubdata.cpp",
],
copts = select({ copts = select({
"@platforms//os:windows": [ "@platforms//os:windows": [
"/wd4005", # Macro redefinition. "/wd4005", # Macro redefinition.
@ -116,10 +116,10 @@ cc_library(
"//conditions:default": [], "//conditions:default": [],
}), }),
include_prefix = "third_party/icu", include_prefix = "third_party/icu",
deps = [
":icuuc",
":icui18n"
],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [
":icui18n",
":icuuc",
],
alwayslink = 1, alwayslink = 1,
) )

View File

@ -40,7 +40,6 @@ cc_library(
hdrs = [ hdrs = [
"zlib.h", "zlib.h",
], ],
include_prefix = "third_party/zlib",
defines = [ defines = [
"CHROMIUM_ZLIB_NO_CHROMECONF", "CHROMIUM_ZLIB_NO_CHROMECONF",
"CPU_NO_SIMD", "CPU_NO_SIMD",
@ -50,6 +49,7 @@ cc_library(
"HAVE_HIDDEN", "HAVE_HIDDEN",
], ],
}), }),
include_prefix = "third_party/zlib",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )

View File

@ -182,57 +182,87 @@ selects.config_setting_group(
match_all = [ match_all = [
":is_posix", ":is_posix",
":is_x64", ":is_x64",
] ],
) )
selects.config_setting_group( selects.config_setting_group(
name = "is_inline_asm_x64", name = "is_inline_asm_x64",
match_all = [":is_posix", ":is_x64"], match_all = [
":is_posix",
":is_x64",
],
) )
selects.config_setting_group( selects.config_setting_group(
name = "is_inline_asm_ia32", name = "is_inline_asm_ia32",
match_all = [":is_posix", ":is_ia32"], match_all = [
":is_posix",
":is_ia32",
],
) )
selects.config_setting_group( selects.config_setting_group(
name = "is_inline_asm_arm64", name = "is_inline_asm_arm64",
match_all = [":is_posix", ":is_arm64"], match_all = [
":is_posix",
":is_arm64",
],
) )
selects.config_setting_group( selects.config_setting_group(
name = "is_inline_asm_arm", name = "is_inline_asm_arm",
match_all = [":is_posix", ":is_arm"], match_all = [
":is_posix",
":is_arm",
],
) )
selects.config_setting_group( selects.config_setting_group(
name = "is_inline_asm_s390x", name = "is_inline_asm_s390x",
match_all = [":is_posix", ":is_s390x"], match_all = [
":is_posix",
":is_s390x",
],
) )
selects.config_setting_group( selects.config_setting_group(
name = "is_inline_asm_riscv64", name = "is_inline_asm_riscv64",
match_all = [":is_posix", ":is_riscv64"], match_all = [
":is_posix",
":is_riscv64",
],
) )
selects.config_setting_group( selects.config_setting_group(
name = "is_inline_asm_ppc64le", name = "is_inline_asm_ppc64le",
match_all = [":is_posix", ":is_ppc64le"], match_all = [
":is_posix",
":is_ppc64le",
],
) )
selects.config_setting_group( selects.config_setting_group(
name = "is_msvc_asm_x64", name = "is_msvc_asm_x64",
match_all = [":is_windows", ":is_x64"], match_all = [
":is_windows",
":is_x64",
],
) )
selects.config_setting_group( selects.config_setting_group(
name = "is_msvc_asm_ia32", name = "is_msvc_asm_ia32",
match_all = [":is_windows", ":is_ia32"], match_all = [
":is_windows",
":is_ia32",
],
) )
selects.config_setting_group( selects.config_setting_group(
name = "is_msvc_asm_arm64", name = "is_msvc_asm_arm64",
match_all = [":is_windows", ":is_arm64"], match_all = [
":is_windows",
":is_arm64",
],
) )
config_setting( config_setting(

View File

@ -93,7 +93,7 @@ def _default_args():
"UNICODE", "UNICODE",
"_UNICODE", "_UNICODE",
"_CRT_RAND_S", "_CRT_RAND_S",
"_WIN32_WINNT=0x0602", # Override bazel default to Windows 8 "_WIN32_WINNT=0x0602", # Override bazel default to Windows 8
], ],
"//conditions:default": [], "//conditions:default": [],
}), }),
@ -248,6 +248,7 @@ def v8_library(
linkstatic = 1, linkstatic = 1,
**kwargs **kwargs
) )
# Alias target used because of cc_library bug in bazel on windows # Alias target used because of cc_library bug in bazel on windows
# https://github.com/bazelbuild/bazel/issues/14237 # https://github.com/bazelbuild/bazel/issues/14237
# TODO(victorgomes): Remove alias once bug is fixed # TODO(victorgomes): Remove alias once bug is fixed
@ -266,6 +267,7 @@ def v8_library(
linkstatic = 1, linkstatic = 1,
**kwargs **kwargs
) )
# Alias target used because of cc_library bug in bazel on windows # Alias target used because of cc_library bug in bazel on windows
# https://github.com/bazelbuild/bazel/issues/14237 # https://github.com/bazelbuild/bazel/issues/14237
# TODO(victorgomes): Remove alias once bug is fixed # TODO(victorgomes): Remove alias once bug is fixed