fork/rules_rust
git clone https://git.julia.blue/fork/rules_rust
6c285eb2
0.8.1
1# Copyright 2019 The Bazel Authors. All rights reserved. 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# buildifier: disable=module-docstring 16load ( "@bazel_tools//tools/build_defs/repo:http.bzl" , "http_archive" ) 17load ( "@bazel_tools//tools/build_defs/repo:utils.bzl" , "maybe" ) 18load ( "//wasm_bindgen/3rdparty/crates:defs.bzl" , "crate_repositories" ) 19 20WASM_BINDGEN_VERSION = "0.2.81" 21 22# buildifier: disable=unnamed-macro 23def rust_wasm_bindgen_dependencies (): 24"""Declare dependencies needed for the `rules_rust` [wasm-bindgen][wb] rules. 25 26[wb]: https://github.com/rustwasm/wasm-bindgen 27""" 28 29maybe ( 30http_archive , 31name = "rules_rust_wasm_bindgen_cli" , 32sha256 = "b255b6ab0d645af253319a990ad1f62e9efe2e72d353155f30834c10ecdb0af3" , 33urls = [ "https://crates.io/api/v1/crates/wasm-bindgen-cli/{}/download" . format ( WASM_BINDGEN_VERSION )], 34type = "tar.gz" , 35strip_prefix = "wasm-bindgen-cli-{}" . format ( WASM_BINDGEN_VERSION ), 36build_file = Label ( "//wasm_bindgen/3rdparty:BUILD.wasm-bindgen-cli.bazel" ), 37) 38 39maybe ( 40http_archive , 41name = "rules_nodejs" , 42sha256 = "017e2348bb8431156d5cf89b6f502c2e7fcffc568729f74f89e4a12bd8279e90" , 43urls = [ "https://github.com/bazelbuild/rules_nodejs/releases/download/5.5.2/rules_nodejs-core-5.5.2.tar.gz" ], 44) 45 46crate_repositories () 47 48# buildifier: disable=unnamed-macro 49def rust_wasm_bindgen_register_toolchains ( register_toolchains = True ): 50"""Registers the default toolchains for the `rules_rust` [wasm-bindgen][wb] rules. 51 52[wb]: https://github.com/rustwasm/wasm-bindgen 53 54Args: 55register_toolchains (bool, optional): Whether or not to register toolchains. 56""" 57 58if register_toolchains : 59native . register_toolchains ( str ( Label ( "//wasm_bindgen:default_wasm_bindgen_toolchain" ))) 60 61# buildifier: disable=unnamed-macro 62def rust_wasm_bindgen_repositories ( register_default_toolchain = True ): 63"""Declare dependencies needed for [rust_wasm_bindgen](#rust_wasm_bindgen). 64 65**Deprecated**: Use [rust_wasm_bindgen_dependencies](#rust_wasm_bindgen_depednencies) and [rust_wasm_bindgen_register_toolchains](#rust_wasm_bindgen_register_toolchains). 66 67Args: 68register_default_toolchain (bool, optional): If True, the default [rust_wasm_bindgen_toolchain](#rust_wasm_bindgen_toolchain) 69(`@rules_rust//wasm_bindgen:default_wasm_bindgen_toolchain`) is registered. This toolchain requires a set of dependencies 70that were generated using [cargo raze](https://github.com/google/cargo-raze). These will also be loaded. 71""" 72 73rust_wasm_bindgen_dependencies () 74 75rust_wasm_bindgen_register_toolchains ( register_toolchains = register_default_toolchain )