Skip to content

Commit c7c12a7

Browse files
committed
Swift: add json and date dependencies
1 parent b56b843 commit c7c12a7

9 files changed

Lines changed: 43 additions & 31 deletions

File tree

misc/bazel/workspace.bzl

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,3 @@ def codeql_workspace(repository_name = "codeql"):
4343
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz",
4444
],
4545
)
46-
47-
maybe(
48-
repo_rule = http_archive,
49-
name = "absl",
50-
sha256 = "cec2e5bf780532bd0ac672eb8d43c0f8bbe84ca5df8718320184034b7f59a398",
51-
urls = [
52-
"https://github.com/abseil/abseil-cpp/archive/d2c5297a3c3948de765100cb7e5cccca1210d23c.tar.gz",
53-
],
54-
strip_prefix = "abseil-cpp-d2c5297a3c3948de765100cb7e5cccca1210d23c",
55-
)

swift/extractor/infra/log/BUILD.bazel

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@ cc_library(
33
srcs = glob(["*.cpp"]),
44
hdrs = glob(["*.h"]),
55
visibility = ["//visibility:public"],
6-
deps = ["@binlog"],
6+
deps = [
7+
"@binlog",
8+
"@json",
9+
],
710
)
File renamed without changes.

swift/third_party/BUILD.date.bazel

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
cc_library(
2+
name = "date",
3+
hdrs = glob(["include/date/*.h"]),
4+
includes = ["include"],
5+
visibility = ["//visibility:public"],
6+
)
File renamed without changes.

swift/third_party/swift-llvm-support/BUILD.swift-llvm-support.bazel renamed to swift/third_party/BUILD.swift-llvm-support.bazel

File renamed without changes.

swift/third_party/binlog/BUILD.bazel

Whitespace-only changes.

swift/third_party/load.bzl

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
2+
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
23

34
_swift_prebuilt_version = "swift-5.7.3-RELEASE.142"
45
_swift_sha_map = {
@@ -12,28 +13,20 @@ _swift_arch_map = {
1213
"macOS-X64": "darwin_x86_64",
1314
}
1415

15-
def _get_label(workspace_name, package, target):
16-
return "@%s//swift/third_party/%s:%s" % (workspace_name, package, target)
17-
18-
def _get_build(workspace_name, package):
19-
return _get_label(workspace_name, package, "BUILD.%s.bazel" % package)
20-
21-
def _get_patch(workspace_name, package, patch):
22-
return _get_label(workspace_name, package, "patches/%s.patch" % patch)
23-
24-
def _github_archive(*, name, workspace_name, repository, commit, sha256 = None, patches = None):
16+
def _github_archive(*, name, repository, commit, build_file = None, sha256 = None):
2517
github_name = repository[repository.index("/") + 1:]
26-
patches = [_get_patch(workspace_name, name, p) for p in patches or []]
27-
http_archive(
18+
maybe(
19+
repo_rule = http_archive,
2820
name = name,
2921
url = "https://github.com/%s/archive/%s.zip" % (repository, commit),
3022
strip_prefix = "%s-%s" % (github_name, commit),
31-
build_file = _get_build(workspace_name, name),
23+
build_file = build_file,
3224
sha256 = sha256,
33-
patch_args = ["-p1"],
34-
patches = patches,
3525
)
3626

27+
def _build(workspace_name, package):
28+
return "@%s//swift/third_party:BUILD.%s.bazel" % (workspace_name, package)
29+
3730
def load_dependencies(workspace_name):
3831
for repo_arch, arch in _swift_arch_map.items():
3932
sha256 = _swift_sha_map[repo_arch]
@@ -44,24 +37,44 @@ def load_dependencies(workspace_name):
4437
_swift_prebuilt_version,
4538
repo_arch,
4639
),
47-
build_file = _get_build(workspace_name, "swift-llvm-support"),
40+
build_file = _build(workspace_name, "swift-llvm-support"),
4841
sha256 = sha256,
49-
patch_args = ["-p1"],
50-
patches = [],
5142
)
5243

5344
_github_archive(
5445
name = "picosha2",
55-
workspace_name = workspace_name,
46+
build_file = _build(workspace_name, "picosha2"),
5647
repository = "okdshin/PicoSHA2",
5748
commit = "27fcf6979298949e8a462e16d09a0351c18fcaf2",
5849
sha256 = "d6647ca45a8b7bdaf027ecb68d041b22a899a0218b7206dee755c558a2725abb",
5950
)
6051

6152
_github_archive(
6253
name = "binlog",
63-
workspace_name = workspace_name,
54+
build_file = _build(workspace_name, "binlog"),
6455
repository = "morganstanley/binlog",
6556
commit = "3fef8846f5ef98e64211e7982c2ead67e0b185a6",
6657
sha256 = "f5c61d90a6eff341bf91771f2f465be391fd85397023e1b391c17214f9cbd045",
6758
)
59+
60+
_github_archive(
61+
name = "absl",
62+
repository = "abseil/abseil-cpp",
63+
commit = "d2c5297a3c3948de765100cb7e5cccca1210d23c",
64+
sha256 = "735a9efc673f30b3212bfd57f38d5deb152b543e35cd58b412d1363b15242049",
65+
)
66+
67+
_github_archive(
68+
name = "json",
69+
repository = "nlohmann/json",
70+
commit = "6af826d0bdb55e4b69e3ad817576745335f243ca",
71+
sha256 = "702bb0231a5e21c0374230fed86c8ae3d07ee50f34ffd420e7f8249854b7d85b",
72+
)
73+
74+
_github_archive(
75+
name = "date",
76+
build_file = _build(workspace_name, "date"),
77+
repository = "HowardHinnant/date",
78+
commit = "6e921e1b1d21e84a5c82416ba7ecd98e33a436d0",
79+
sha256 = "484c450ea1cec479716f7cfce9a54da1867dd4043dde08e7c262b812561fe3bc",
80+
)

swift/third_party/picosha2/BUILD.bazel

Whitespace-only changes.

0 commit comments

Comments
 (0)