11load ("@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+
3730def 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+ )
0 commit comments