fork/rules_rust
git clone https://git.julia.blue/fork/rules_rust
d7c532cb
0.5.0
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/raze:crates.bzl" , "rules_rust_wasm_bindgen_fetch_remote_crates" ) 19 20# buildifier: disable=unnamed-macro 21def rust_wasm_bindgen_dependencies (): 22"""Declare dependencies needed for the `rules_rust` [wasm-bindgen][wb] rules. 23 24[wb]: https://github.com/rustwasm/wasm-bindgen 25""" 26 27maybe ( 28http_archive , 29name = "rules_nodejs" , 30sha256 = "26766278d815a6e2c43d2f6c9c72fde3fec8729e84138ffa4dabee47edc7702a" , 31urls = [ "https://github.com/bazelbuild/rules_nodejs/releases/download/5.4.2/rules_nodejs-core-5.4.2.tar.gz" ], 32) 33 34rules_rust_wasm_bindgen_fetch_remote_crates () 35 36# buildifier: disable=unnamed-macro 37def rust_wasm_bindgen_register_toolchains ( register_toolchains = True ): 38"""Registers the default toolchains for the `rules_rust` [wasm-bindgen][wb] rules. 39 40[wb]: https://github.com/rustwasm/wasm-bindgen 41 42Args: 43register_toolchains (bool, optional): Whether or not to register toolchains. 44""" 45 46if register_toolchains : 47native . register_toolchains ( str ( Label ( "//wasm_bindgen:default_wasm_bindgen_toolchain" ))) 48 49# buildifier: disable=unnamed-macro 50def rust_wasm_bindgen_repositories ( register_default_toolchain = True ): 51"""Declare dependencies needed for [rust_wasm_bindgen](#rust_wasm_bindgen). 52 53**Deprecated**: Use [rust_wasm_bindgen_dependencies](#rust_wasm_bindgen_depednencies) and [rust_wasm_bindgen_register_toolchains](#rust_wasm_bindgen_register_toolchains). 54 55Args: 56register_default_toolchain (bool, optional): If True, the default [rust_wasm_bindgen_toolchain](#rust_wasm_bindgen_toolchain) 57(`@rules_rust//wasm_bindgen:default_wasm_bindgen_toolchain`) is registered. This toolchain requires a set of dependencies 58that were generated using [cargo raze](https://github.com/google/cargo-raze). These will also be loaded. 59""" 60 61rust_wasm_bindgen_dependencies () 62 63rust_wasm_bindgen_register_toolchains ( register_toolchains = register_default_toolchain )