|
| 1 | +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") |
| 2 | + |
| 3 | +_swift_prebuilt_version = "swift-5.7.1-RELEASE.44428.89" |
| 4 | +_swift_sha_map = { |
| 5 | + "Linux-X64": "1fa0b62b3a87c6528bd21b3f3fa1b32ad00e2b6ff04c20652c93c7d00c4cf517", |
| 6 | + "macOS-X64": "6e1239335874cbde635ae9ca9eeb215efee4988888a75f4eda1abbcf97e4d038", |
| 7 | +} |
| 8 | + |
| 9 | +_swift_arch_map = { |
| 10 | + "Linux-X64": "linux", |
| 11 | + "macOS-X64": "darwin_x86_64", |
| 12 | +} |
| 13 | + |
| 14 | +def _get_label(repository_name, package, target): |
| 15 | + return "@%s//swift/third_party/%s:%s" % (repository_name, package, target) |
| 16 | + |
| 17 | +def _get_build(repository_name, package): |
| 18 | + return _get_label(repository_name, package, "BUILD.%s.bazel" % package) |
| 19 | + |
| 20 | +def _get_patch(repository_name, package, patch): |
| 21 | + return _get_label(repository_name, package, "patches/%s.patch" % patch) |
| 22 | + |
| 23 | +def load_dependencies(repository_name): |
| 24 | + for repo_arch, arch in _swift_arch_map.items(): |
| 25 | + sha256 = _swift_sha_map[repo_arch] |
| 26 | + |
| 27 | + http_archive( |
| 28 | + name = "swift_prebuilt_%s" % arch, |
| 29 | + url = "https://github.com/dsp-testing/codeql-swift-artifacts/releases/download/%s/swift-prebuilt-%s.zip" % ( |
| 30 | + _swift_prebuilt_version, |
| 31 | + repo_arch, |
| 32 | + ), |
| 33 | + build_file = _get_build(repository_name, "swift-llvm-support"), |
| 34 | + sha256 = sha256, |
| 35 | + patch_args = ["-p1"], |
| 36 | + ) |
| 37 | + |
| 38 | + http_archive( |
| 39 | + name = "fishhook", |
| 40 | + url = "https://github.com/facebook/fishhook/archive/aadc161ac3b80db07a9908851839a17ba63a9eb1.zip", |
| 41 | + build_file = "@%s//swift/third_party/fishhook:BUILD.fishhook.bazel" % repository_name, |
| 42 | + strip_prefix = "fishhook-aadc161ac3b80db07a9908851839a17ba63a9eb1", |
| 43 | + sha256 = "9f2cdee6dcc2039d4c47d25ab5141fe0678ce6ed27ef482cab17fe9fa38a30ce", |
| 44 | + ) |
| 45 | + |
| 46 | + http_archive( |
| 47 | + name = "picosha2", |
| 48 | + url = "https://github.com/okdshin/PicoSHA2/archive/27fcf6979298949e8a462e16d09a0351c18fcaf2.zip", |
| 49 | + strip_prefix = "PicoSHA2-27fcf6979298949e8a462e16d09a0351c18fcaf2", |
| 50 | + build_file = _get_build(repository_name, "picosha2"), |
| 51 | + sha256 = "d6647ca45a8b7bdaf027ecb68d041b22a899a0218b7206dee755c558a2725abb", |
| 52 | + ) |
0 commit comments