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