Skip to content

Commit

Permalink
Bazel for win test
Browse files Browse the repository at this point in the history
  • Loading branch information
yukawa committed Nov 13, 2023
1 parent b82b8de commit f62c7c9
Show file tree
Hide file tree
Showing 16 changed files with 99 additions and 26 deletions.
12 changes: 3 additions & 9 deletions src/.bazelrc
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
# Common options
build --cxxopt "-std=c++20"
build --copt "-funsigned-char"
build --copt "-Wno-sign-compare"
build --copt "-Wno-char-subscripts"
build --host_cxxopt "-std=c++20"
build --host_copt "-funsigned-char"
build --host_copt "-Wno-sign-compare"
build --host_copt "-Wno-char-subscripts"
build --objccopt "-fsigned-char"
build --cxxopt=-std:c++20
build --cxxopt=-utf-8
build --cxxopt=-J

# Linux
build:linux --define TARGET=oss_linux --copt "-fPIC"
Expand Down
15 changes: 15 additions & 0 deletions src/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,18 @@ filegroup(
macos = ["//mac:package"],
),
)

cc_library(
name = "wil",
srcs = glob(["third_party/wil/include/wil/*.h"]),
includes = ["third_party/wil/include"],
linkopts = select({
"@platforms//os:windows": [
"advapi32.lib",
"ole32.lib",
"oleaut32.lib",
"user32.lib",
],
"//conditions:default": [],
}),
)
12 changes: 12 additions & 0 deletions src/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module(name = "mozc", repo_name = "mozc")

bazel_dep(name = "abseil-cpp", version = "20230802.0", repo_name = "com_google_absl")
bazel_dep(name = "bazel_skylib", version = "1.4.2")
bazel_dep(name = "googletest", version = "1.14.0", repo_name = "com_google_googletest")
bazel_dep(name = "platforms", version = "0.0.8")
bazel_dep(name = "protobuf", version = "25.0", repo_name = "com_google_protobuf")
bazel_dep(name = "rules_apple", version = "3.1.1", repo_name = "build_bazel_rules_apple")
bazel_dep(name = "rules_cc", version = "0.0.9")
bazel_dep(name = "rules_java", version = "6.1.1")
bazel_dep(name = "rules_python", version = "0.26.0")
bazel_dep(name = "wil", version = "1.0.231028.1", repo_name = "com_microsoft_wil")
Empty file added src/WORKSPACE.bzlmod
Empty file.
10 changes: 5 additions & 5 deletions src/base/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ mozc_cc_library(
] + mozc_select(
windows = [
"//base/win32:wide_char",
"//third_party/wil",
"//:wil",
],
),
)
Expand Down Expand Up @@ -607,7 +607,7 @@ mozc_cc_library(
"//base/win32:wide_char",
# win_util.h includes gunit_prod.h for FRIEND_TEST.
"//testing:gunit_prod",
"//third_party/wil",
"//:wil",
],
),
)
Expand Down Expand Up @@ -647,7 +647,7 @@ mozc_cc_library(
macos = ["//base/mac:mac_process"],
windows = [
"//base/win32:wide_char",
"//third_party/wil",
"//:wil",
],
),
)
Expand Down Expand Up @@ -676,7 +676,7 @@ mozc_cc_library(
windows = [
"//base/win32:wide_char",
"//base/win32:win_sandbox",
"//third_party/wil",
"//:wil",
],
),
)
Expand Down Expand Up @@ -716,7 +716,7 @@ mozc_cc_library(
windows = [
"//base/win32:wide_char",
"//base/win32:win_sandbox",
"//third_party/wil",
"//:wil",
],
),
)
Expand Down
2 changes: 1 addition & 1 deletion src/base/file/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ mozc_cc_library(
"//base/win32:hresult",
"//base/win32:wide_char",
"//bazel/win32:pathcch",
"//third_party/wil",
"//:wil",
],
),
)
Expand Down
16 changes: 8 additions & 8 deletions src/base/win32/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ mozc_cc_library(
"//base/strings:zstring_view",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/types:span",
"@com_microsoft_wil//:wil",
"//:wil",
],
)

Expand All @@ -138,7 +138,7 @@ mozc_cc_test(
":win_sandbox",
"//testing:gunit_main",
"@com_google_absl//absl/types:span",
"@com_microsoft_wil//:wil",
"//:wil",
],
)

Expand All @@ -152,7 +152,7 @@ mozc_cc_test(
":win_util_test_dll", # fixdeps: keep
"//base:system_util",
"//testing:gunit_main",
"@com_microsoft_wil//:wil",
"//:wil",
],
)

Expand Down Expand Up @@ -183,7 +183,7 @@ mozc_cc_library(
deps = [
":wide_char",
"//base:const",
"@com_microsoft_wil//:wil",
"//:wil",
],
)

Expand Down Expand Up @@ -236,7 +236,7 @@ mozc_cc_library(
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:str_format",
"@com_microsoft_wil//:wil",
"//:wil",
],
)

Expand Down Expand Up @@ -299,7 +299,7 @@ mozc_cc_library(
deps = [
":hresultor",
"@com_google_absl//absl/meta:type_traits",
"@com_microsoft_wil//:wil",
"//:wil",
],
)

Expand All @@ -314,7 +314,7 @@ mozc_cc_test(
":com_implements",
":scoped_com",
"//testing:gunit_main",
"@com_microsoft_wil//:wil",
"//:wil",
],
)

Expand All @@ -340,6 +340,6 @@ mozc_cc_test(
":com",
":com_implements",
"//testing:gunit_main",
"@com_microsoft_wil//:wil",
"//:wil",
],
)
3 changes: 3 additions & 0 deletions src/bazel_repository/bazel_registry.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"mirrors": []
}
11 changes: 11 additions & 0 deletions src/bazel_repository/modules/protobuf/25.0/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module(
name = "protobuf",
version = "25.0",
compatibility_level = 1,
)
bazel_dep(name = "bazel_skylib", version = "1.3.0")
bazel_dep(name = "zlib", version = "1.2.13")
bazel_dep(name = "rules_python", version = "0.26.0")
bazel_dep(name = "rules_cc", version = "0.0.9")
bazel_dep(name = "rules_proto", version = "5.3.0-21.7")
bazel_dep(name = "rules_java", version = "6.0.0")
5 changes: 5 additions & 0 deletions src/bazel_repository/modules/protobuf/25.0/source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"integrity": "sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=",
"strip_prefix": "protobuf-25.0",
"url": "https://github.com/protocolbuffers/protobuf/releases/download/v25.0/protobuf-25.0.zip"
}
10 changes: 10 additions & 0 deletions src/bazel_repository/modules/protobuf/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"homepage": "https://github.com/protocolbuffers/protobuf",
"maintainers": [],
"repository": [
"github:protocolbuffers/protobuf"
],
"versions": [
"25.0"
]
}
4 changes: 4 additions & 0 deletions src/bazel_repository/modules/wil/1.0.231028.1/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module(
name = "wil",
version = "1.0.231028.1",
)
Binary file not shown.
9 changes: 9 additions & 0 deletions src/bazel_repository/modules/wil/1.0.231028.1/source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"integrity": "sha256-ufBrZhzrStp0QC6zhFm6giiIcrgqC6VIz50Ryh6eRJo=",
"patch_strip": 1,
"patches": {
"add_build_file.patch": "sha256-vlqWTiVM+eaZxr5+vd/SzPc9MMabBfnNQDlIwJV0iVo="
},
"strip_prefix": "wil-1.0.231028.1",
"url": "https://github.com/microsoft/wil/archive/refs/tags/v1.0.231028.1.zip"
}
10 changes: 10 additions & 0 deletions src/bazel_repository/modules/wil/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"homepage": "https://github.com/microsoft/wil",
"maintainers": [],
"repository": [
"github:microsoft/wil"
],
"versions": [
"1.0.231028.1"
]
}
6 changes: 3 additions & 3 deletions src/build_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def mozc_cc_library(deps = [], copts = [], visibility = None, **kwargs):
"""
native.cc_library(
deps = deps + ["//:macro"],
copts = copts + ["-funsigned-char"],
copts = copts + [],
visibility = _update_visibility(visibility),
**kwargs
)
Expand All @@ -80,7 +80,7 @@ def mozc_cc_binary(deps = [], copts = [], **kwargs):
"""
native.cc_binary(
deps = deps + ["//:macro"],
copts = copts + ["-funsigned-char"],
copts = copts + [],
**kwargs
)

Expand All @@ -105,7 +105,7 @@ def mozc_cc_test(name, tags = [], deps = [], copts = [], **kwargs):
name = name,
tags = tags,
deps = deps + ["//:macro"],
copts = copts + ["-funsigned-char"],
copts = copts + [],
**kwargs
)

Expand Down

0 comments on commit f62c7c9

Please sign in to comment.