|
| 1 | +# Copyright 2020 Google LLC |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file") |
| 16 | + |
| 17 | +def wasm_dependencies(): |
| 18 | + _http_archive( |
| 19 | + name = "emscripten_toolchain", |
| 20 | + build_file = "@proxy_wasm_cpp_sdk//:emscripten-toolchain.BUILD", |
| 21 | + patch_cmds = [ |
| 22 | + "./emsdk install 2.0.7", |
| 23 | + "./emsdk activate --embedded 2.0.7", |
| 24 | + ], |
| 25 | + strip_prefix = "emsdk-2.0.7", |
| 26 | + url = "https://github.com/emscripten-core/emsdk/archive/2.0.7.tar.gz", |
| 27 | + sha256 = "ce7a5c76e8b425aca874cea329fd9ac44b203b777053453b6a37b4496c5ce34f" |
| 28 | + ) |
| 29 | + |
| 30 | + # required by com_google_protobuf |
| 31 | + _http_archive( |
| 32 | + name = "bazel_skylib", |
| 33 | + sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44", |
| 34 | + urls = [ |
| 35 | + "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz", |
| 36 | + "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz", |
| 37 | + ], |
| 38 | + ) |
| 39 | + |
| 40 | + _http_archive( |
| 41 | + name = "rules_proto", |
| 42 | + sha256 = "602e7161d9195e50246177e7c55b2f39950a9cf7366f74ed5f22fd45750cd208", |
| 43 | + strip_prefix = "rules_proto-97d8af4dc474595af3900dd85cb3a29ad28cc313", |
| 44 | + urls = [ |
| 45 | + "https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/97d8af4dc474595af3900dd85cb3a29ad28cc313.tar.gz", |
| 46 | + "https://github.com/bazelbuild/rules_proto/archive/97d8af4dc474595af3900dd85cb3a29ad28cc313.tar.gz", |
| 47 | + ], |
| 48 | + ) |
| 49 | + |
| 50 | + _http_archive( |
| 51 | + name = "com_google_protobuf", |
| 52 | + sha256 = "59621f4011a95df270748dcc0ec1cc51946473f0e140d4848a2f20c8719e43aa", |
| 53 | + strip_prefix = "protobuf-655310ca192a6e3a050e0ca0b7084a2968072260", |
| 54 | + url = "https://github.com/protocolbuffers/protobuf/archive/655310ca192a6e3a050e0ca0b7084a2968072260.tar.gz", |
| 55 | + ) |
| 56 | + |
| 57 | +def _http_archive(name, **kwargs): |
| 58 | + existing_rule_keys = native.existing_rules().keys() |
| 59 | + if name in existing_rule_keys: |
| 60 | + # This repository has already been defined. |
| 61 | + return |
| 62 | + |
| 63 | + http_archive( |
| 64 | + name = name, |
| 65 | + **kwargs |
| 66 | + ) |
0 commit comments