From f096c8cd02299112fcb1ee6343155ddb3b2888ac Mon Sep 17 00:00:00 2001 From: Marco Farrugia Date: Sun, 27 Jan 2019 15:23:18 -0500 Subject: [PATCH 01/30] Update bindgen.bzl --- bindgen/BUILD | 6 ++ bindgen/bindgen.bzl | 165 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 171 insertions(+) create mode 100644 bindgen/BUILD create mode 100644 bindgen/bindgen.bzl diff --git a/bindgen/BUILD b/bindgen/BUILD new file mode 100644 index 0000000000..0ab47db7e0 --- /dev/null +++ b/bindgen/BUILD @@ -0,0 +1,6 @@ +package(default_visibility = ["//visibility:public"]) + +toolchain_type(name = "bindgen_toolchain") + +# TODO: Add a default Bindgen toolchain + diff --git a/bindgen/bindgen.bzl b/bindgen/bindgen.bzl new file mode 100644 index 0000000000..6360ea3da5 --- /dev/null +++ b/bindgen/bindgen.bzl @@ -0,0 +1,165 @@ +# Copyright 2015 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain") +load("@io_bazel_rules_rust//rust:rust.bzl", "rust_library") + +def rust_bindgen_library(name, header, cc_lib, bindgen_flags = []): + rust_bindgen( + name = name + "__bindgen", + header = header, + cc_lib = cc_lib, + bindgen_flags = bindgen_flags, + ) + rust_library( + name = name, + srcs = [name + "__bindgen.rs"], + deps = [cc_lib] + ) + +def _rust_bindgen_toolchain(ctx): + return platform_common.ToolchainInfo( + bindgen = ctx.executable.bindgen, + clang = ctx.executable.clang, + libclang = ctx.attr.libclang, + libstdcxx = ctx.attr.libstdcxx, + rustfmt = ctx.executable.rustfmt, + ) + +rust_bindgen_toolchain = rule( + _rust_bindgen_toolchain, + attrs = { + "bindgen": attr.label( + doc = "The location of a `bindgen` executable.", + executable = True, + cfg = "host", + ), + "clang": attr.label( + executable = True, + cfg = "host", + ), + "libclang": attr.label(), + "libstdcxx": attr.label(), + "rustfmt": attr.label( + executable = True, + cfg = "host", + ), + }, +) + +def _rust_bindgen(ctx): + bt = ctx.toolchains["@io_bazel_rules_rust//bindgen:bindgen_toolchain"] + + bindgen = bt.bindgen + rustfmt = bt.rustfmt + clang = bt.clang + libclang = bt.libclang + # TODO: This should not need to be explicitly provided, see below TODO. + libstdcxx = bt.libstdcxx + + cc_toolchain = find_cpp_toolchain(ctx) + + # nb. We can't grab the cc_library`s direct headers, so a header must be provided. + cc_lib = ctx.attr.cc_lib + if not hasattr(cc_lib, "cc"): + fail("{} is not a cc_library".format(cc_lib)) + header = ctx.file.header + if header not in cc_lib.cc.transitive_headers: + fail("Header {} is not in {}'s transitive closure of headers.".format(ctx.attr.header, cc_lib)) + + # rustfmt is not in the usual place, so bindgen would fail to find it + bindgen_args = ["--no-rustfmt-bindings"] + ctx.attr.bindgen_flags + clang_args = [] + + output = ctx.outputs.out + + libclang_dir = libclang.cc.libs.to_list()[0].dirname + include_directories = depset( + [f.dirname for f in cc_lib.cc.transitive_headers] + ) + + unformatted = ctx.actions.declare_file(output.basename + ".unformatted") + + args = ctx.actions.args() + args.add_all(bindgen_args) + args.add(header.path) + args.add("--output", unformatted.path) + args.add("--") + args.add_all(include_directories, before_each="-I") + args.add_all(clang_args) + ctx.actions.run( + executable=bindgen, + inputs=depset( + [header], + transitive=[cc_lib.cc.transitive_headers, libclang.cc.libs, libstdcxx.cc.libs], + ), + outputs=[unformatted], + mnemonic="RustBindgen", + progress_message="Generating bindings for {}..".format(header.path), + env={ + "RUST_BACKTRACE": "1", + "CLANG_PATH": clang.path, + # Bindgen loads libclang at runtime, which also needs libstdc++, so we setup LD_LIBRARY_PATH + "LIBCLANG_PATH": libclang_dir, + # TODO: If libclang were built by bazel w/ properly specified dependencies, it + # would have the correct rpaths and not require this nor would this rule + # have a direct dependency on libstdc++.so + "LD_LIBRARY_PATH": ":".join([f.dirname for f in libstdcxx.cc.libs]), + }, + arguments=[args], + tools=[clang], + ) + + ctx.actions.run_shell( + inputs=depset([rustfmt, unformatted]), + outputs=[output], + command="{} --emit stdout --quiet {} > {}".format(rustfmt.path, unformatted.path, output.path), + tools=[rustfmt], + ) + +rust_bindgen = rule( + _rust_bindgen, + attrs = { + "header": attr.label(allow_single_file = True), + "cc_lib": attr.label(), + # An instance of cc_toolchain, used to find the standard library headers. + "_cc_toolchain": attr.label(default = Label("@bazel_tools//tools/cpp:current_cc_toolchain")), + "libstdcxx": attr.label(), + "bindgen_flags": attr.string_list(), + }, + fragments = ["cpp"], + outputs = {"out": "%{name}.rs"}, + toolchains = [ + "@io_bazel_rules_rust//rust:toolchain", + "@io_bazel_rules_rust//bindgen:bindgen_toolchain", + ], +) + +""" +Generates a rust file from a cc_library and one of it's headers. + +TODO: Update docs for configuring toolchain. + +and then use it as follows: + +```python +load("@io_bazel_rules_rust//bindgen:bindgen.bzl", "rust_bindgen_library") + +rust_bindgen_library( + name = "example_ffi", + cc_lib = "//example:lib", + header = "//example:api.h", +) +``` +""" From 566f2fee01fb64675990313efe693879174c7366 Mon Sep 17 00:00:00 2001 From: Marco Farrugia Date: Sun, 27 Jan 2019 15:23:18 -0500 Subject: [PATCH 02/30] Get bindgen rule working locally. --- WORKSPACE | 4 ++ bindgen/BUILD | 16 ++++- bindgen/clang.BUILD | 14 ++++ bindgen/repositories.bzl | 80 +++++++++++++++++++++ examples/ffi/rust_calling_c/simple/BUILD | 19 +++++ examples/ffi/rust_calling_c/simple/main.rs | 4 ++ examples/ffi/rust_calling_c/simple/simple.h | 2 + 7 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 bindgen/clang.BUILD create mode 100644 bindgen/repositories.bzl create mode 100644 examples/ffi/rust_calling_c/simple/BUILD create mode 100644 examples/ffi/rust_calling_c/simple/main.rs create mode 100644 examples/ffi/rust_calling_c/simple/simple.h diff --git a/WORKSPACE b/WORKSPACE index f5b6eeef2e..198a6931a4 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -40,6 +40,10 @@ load("//proto:repositories.bzl", "rust_proto_repositories") rust_proto_repositories() +load("//bindgen:repositories.bzl", "rust_bindgen_repositories") + +rust_bindgen_repositories() + # Stardoc and its dependencies git_repository( name = "io_bazel_skydoc", diff --git a/bindgen/BUILD b/bindgen/BUILD index 0ab47db7e0..db60963f03 100644 --- a/bindgen/BUILD +++ b/bindgen/BUILD @@ -1,6 +1,20 @@ +load("@io_bazel_rules_rust//bindgen:bindgen.bzl", "rust_bindgen_toolchain") + package(default_visibility = ["//visibility:public"]) toolchain_type(name = "bindgen_toolchain") -# TODO: Add a default Bindgen toolchain +rust_bindgen_toolchain( + name = "example-bindgen-toolchain-impl", + bindgen = "@local_cargo//:bindgen", + clang = "@clang//:clang", + libclang = "@clang//:libclang.so", + libstdcxx = "@local_linux//:libstdc++", + rustfmt = "@local_cargo//:rustfmt", +) +toolchain( + name = "example-bindgen-toolchain", + toolchain = "example-bindgen-toolchain-impl", + toolchain_type = "@io_bazel_rules_rust//bindgen:bindgen_toolchain", +) diff --git a/bindgen/clang.BUILD b/bindgen/clang.BUILD new file mode 100644 index 0000000000..46e4eebf0b --- /dev/null +++ b/bindgen/clang.BUILD @@ -0,0 +1,14 @@ +package(default_visibility = ["//visibility:public"]) + +sh_binary( + name = "clang", + srcs = ["bin/clang"], + data = glob(["lib/**"]), +) + +cc_library( + name = "libclang.so", + srcs = [ + "lib/libclang.so", + ], +) diff --git a/bindgen/repositories.bzl b/bindgen/repositories.bzl new file mode 100644 index 0000000000..5f0b996ccc --- /dev/null +++ b/bindgen/repositories.bzl @@ -0,0 +1,80 @@ +# Copyright 2018 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# load("//bindgen/raze:crates.bzl", _cargo_repositories = "raze_fetch_remote_crates") +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +def maybe(workspace_rule, **kwargs): + if not native.existing_rule(kwargs["name"]): + workspace_rule(**kwargs) + +def rust_bindgen_repositories(): + # nb. The bindgen rule should work on any platform. + _linux_rust_bindgen_repositories() + +def _linux_rust_bindgen_repositories(): + """Declare dependencies needed for bindgen.""" + + maybe( + http_archive, + name = "clang", + urls = ["http://releases.llvm.org/7.0.1/clang+llvm-7.0.1-x86_64-linux-gnu-ubuntu-18.04.tar.xz"], + strip_prefix = "clang+llvm-7.0.1-x86_64-linux-gnu-ubuntu-18.04", + sha256 = "e74ce06d99ed9ce42898e22d2a966f71ae785bdf4edbded93e628d696858921a", + build_file = "@//bindgen:clang.BUILD", + ) + + # TODO: We should be able to pull libstdc++ out of the cc_toolchain eventually. + maybe( + native.new_local_repository, + name = "local_linux", + path = "/usr/lib/x86_64-linux-gnu", + build_file_content = """ +package(default_visibility = ["//visibility:public"]) + +cc_library( + name = "libstdc++", + srcs = [ + "libstdc++.so.6", + ], +) +""", + ) + + # TODO(marco): + # 1. Vendor bindgen with raze... + # 2. Make rustfmt optional + maybe( + native.new_local_repository, + name = "local_cargo", + path = "/home/marco/.cargo", + build_file_content = """ +package(default_visibility = ["//visibility:public"]) + +sh_binary( + name = "bindgen", + srcs = ["bin/bindgen"], +) + +sh_binary( + name = "rustfmt", + srcs = ["bin/rustfmt"], +) +""", + ) + + # Register toolchains + native.register_toolchains( + "@io_bazel_rules_rust//bindgen:example-bindgen-toolchain", + ) diff --git a/examples/ffi/rust_calling_c/simple/BUILD b/examples/ffi/rust_calling_c/simple/BUILD new file mode 100644 index 0000000000..4ca181a142 --- /dev/null +++ b/examples/ffi/rust_calling_c/simple/BUILD @@ -0,0 +1,19 @@ +load("@io_bazel_rules_rust//rust:rust.bzl", "rust_binary", "rust_doc", "rust_library", "rust_test") +load("@io_bazel_rules_rust//bindgen:bindgen.bzl", "rust_bindgen_library") + +cc_library( + name = "simple", + srcs = ["simple.h"], +) + +rust_bindgen_library( + name = "simple_bindgen", + cc_lib = ":simple", + header = "simple.h", +) + +rust_binary( + name = "simple_example", + srcs = ["main.rs"], + deps = [":simple_bindgen"], +) diff --git a/examples/ffi/rust_calling_c/simple/main.rs b/examples/ffi/rust_calling_c/simple/main.rs new file mode 100644 index 0000000000..7f3bdb2356 --- /dev/null +++ b/examples/ffi/rust_calling_c/simple/main.rs @@ -0,0 +1,4 @@ + +fn main() { + println!("The value is {}!", simple_bindgen::VALUE); +} diff --git a/examples/ffi/rust_calling_c/simple/simple.h b/examples/ffi/rust_calling_c/simple/simple.h new file mode 100644 index 0000000000..6039d5e04a --- /dev/null +++ b/examples/ffi/rust_calling_c/simple/simple.h @@ -0,0 +1,2 @@ + +const int VALUE = 43; From ebca9c3a7095b3877ab21616a0b096fcc957d508 Mon Sep 17 00:00:00 2001 From: Marco Farrugia Date: Sun, 27 Jan 2019 15:23:18 -0500 Subject: [PATCH 03/30] Add a test, too. --- examples/ffi/rust_calling_c/simple/BUILD | 5 +++++ examples/ffi/rust_calling_c/simple/main.rs | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/examples/ffi/rust_calling_c/simple/BUILD b/examples/ffi/rust_calling_c/simple/BUILD index 4ca181a142..28d4a8e379 100644 --- a/examples/ffi/rust_calling_c/simple/BUILD +++ b/examples/ffi/rust_calling_c/simple/BUILD @@ -17,3 +17,8 @@ rust_binary( srcs = ["main.rs"], deps = [":simple_bindgen"], ) + +rust_test( + name = "simple_test", + deps = [":simple_example"], +) diff --git a/examples/ffi/rust_calling_c/simple/main.rs b/examples/ffi/rust_calling_c/simple/main.rs index 7f3bdb2356..8f52e1bea7 100644 --- a/examples/ffi/rust_calling_c/simple/main.rs +++ b/examples/ffi/rust_calling_c/simple/main.rs @@ -1,4 +1,11 @@ - fn main() { println!("The value is {}!", simple_bindgen::VALUE); } + +#[cfg(test)] +mod test { + #[test] + fn do_the_test() { + assert_eq!(43, simple_bindgen::VALUE); + } +} \ No newline at end of file From a120a9910b46c710a3beadb5182515ce2664a9be Mon Sep 17 00:00:00 2001 From: Marco Farrugia Date: Sun, 27 Jan 2019 15:23:18 -0500 Subject: [PATCH 04/30] Make the test a teensy bit less simple. --- examples/ffi/rust_calling_c/simple/BUILD | 3 +++ examples/ffi/rust_calling_c/simple/main.rs | 4 ++-- examples/ffi/rust_calling_c/simple/simple.h | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/ffi/rust_calling_c/simple/BUILD b/examples/ffi/rust_calling_c/simple/BUILD index 28d4a8e379..2c5525421c 100644 --- a/examples/ffi/rust_calling_c/simple/BUILD +++ b/examples/ffi/rust_calling_c/simple/BUILD @@ -8,6 +8,9 @@ cc_library( rust_bindgen_library( name = "simple_bindgen", + bindgen_flags = [ + "--whitelist-var=SIMPLE_.*", + ], cc_lib = ":simple", header = "simple.h", ) diff --git a/examples/ffi/rust_calling_c/simple/main.rs b/examples/ffi/rust_calling_c/simple/main.rs index 8f52e1bea7..76d6b0d57a 100644 --- a/examples/ffi/rust_calling_c/simple/main.rs +++ b/examples/ffi/rust_calling_c/simple/main.rs @@ -1,11 +1,11 @@ fn main() { - println!("The value is {}!", simple_bindgen::VALUE); + println!("The value is {}!", simple_bindgen::SIMPLE_VALUE); } #[cfg(test)] mod test { #[test] fn do_the_test() { - assert_eq!(43, simple_bindgen::VALUE); + assert_eq!(43, simple_bindgen::SIMPLE_VALUE); } } \ No newline at end of file diff --git a/examples/ffi/rust_calling_c/simple/simple.h b/examples/ffi/rust_calling_c/simple/simple.h index 6039d5e04a..c32d11ddf7 100644 --- a/examples/ffi/rust_calling_c/simple/simple.h +++ b/examples/ffi/rust_calling_c/simple/simple.h @@ -1,2 +1,3 @@ +#include -const int VALUE = 43; +const int64_t SIMPLE_VALUE = 43; From bf76c50ab989b7118ce4201c81eace07cb35249b Mon Sep 17 00:00:00 2001 From: Marco Farrugia Date: Sun, 27 Jan 2019 15:23:18 -0500 Subject: [PATCH 05/30] raze --- bindgen/raze/BUILD | 20 + bindgen/raze/Cargo.toml | 23 + bindgen/raze/crates.bzl | 414 ++++++++++++++++++ bindgen/raze/libloading.BUILD | 43 ++ bindgen/raze/remote/BUILD | 0 bindgen/raze/remote/aho-corasick-0.6.9.BUILD | 66 +++ bindgen/raze/remote/ansi_term-0.11.0.BUILD | 43 ++ bindgen/raze/remote/atty-0.2.11.BUILD | 44 ++ bindgen/raze/remote/bindgen-0.40.0.BUILD | 141 ++++++ bindgen/raze/remote/bitflags-1.0.4.BUILD | 43 ++ bindgen/raze/remote/cc-1.0.28.BUILD | 63 +++ bindgen/raze/remote/cexpr-0.2.3.BUILD | 44 ++ bindgen/raze/remote/cfg-if-0.1.6.BUILD | 43 ++ bindgen/raze/remote/clang-sys-0.23.0.BUILD | 57 +++ bindgen/raze/remote/clap-2.32.0.BUILD | 56 +++ bindgen/raze/remote/env_logger-0.5.13.BUILD | 56 +++ bindgen/raze/remote/glob-0.2.11.BUILD | 43 ++ bindgen/raze/remote/humantime-1.2.0.BUILD | 45 ++ bindgen/raze/remote/lazy_static-1.2.0.BUILD | 44 ++ bindgen/raze/remote/libc-0.2.48.BUILD | 45 ++ bindgen/raze/remote/libloading-0.5.0.BUILD | 46 ++ bindgen/raze/remote/log-0.4.6.BUILD | 45 ++ bindgen/raze/remote/memchr-1.0.2.BUILD | 47 ++ bindgen/raze/remote/memchr-2.1.3.BUILD | 49 +++ bindgen/raze/remote/nom-3.2.1.BUILD | 64 +++ .../remote/peeking_take_while-0.1.2.BUILD | 42 ++ bindgen/raze/remote/proc-macro2-0.3.5.BUILD | 44 ++ bindgen/raze/remote/quick-error-1.2.2.BUILD | 43 ++ bindgen/raze/remote/quote-0.5.2.BUILD | 44 ++ .../raze/remote/redox_syscall-0.1.51.BUILD | 46 ++ bindgen/raze/remote/redox_termios-0.1.1.BUILD | 43 ++ bindgen/raze/remote/regex-1.1.0.BUILD | 65 +++ bindgen/raze/remote/regex-syntax-0.6.5.BUILD | 44 ++ bindgen/raze/remote/strsim-0.7.0.BUILD | 43 ++ bindgen/raze/remote/termcolor-1.0.4.BUILD | 42 ++ bindgen/raze/remote/termion-1.5.1.BUILD | 59 +++ bindgen/raze/remote/textwrap-0.10.0.BUILD | 47 ++ bindgen/raze/remote/thread_local-0.3.6.BUILD | 44 ++ bindgen/raze/remote/ucd-util-0.1.3.BUILD | 42 ++ bindgen/raze/remote/unicode-width-0.1.5.BUILD | 43 ++ bindgen/raze/remote/unicode-xid-0.1.0.BUILD | 43 ++ bindgen/raze/remote/utf8-ranges-1.0.2.BUILD | 44 ++ bindgen/raze/remote/vec_map-0.8.1.BUILD | 42 ++ bindgen/raze/remote/which-1.0.5.BUILD | 43 ++ bindgen/raze/remote/winapi-0.3.6.BUILD | 54 +++ .../winapi-i686-pc-windows-gnu-0.4.0.BUILD | 43 ++ bindgen/raze/remote/winapi-util-0.1.1.BUILD | 43 ++ .../winapi-x86_64-pc-windows-gnu-0.4.0.BUILD | 43 ++ bindgen/raze/remote/wincolor-1.0.1.BUILD | 45 ++ bindgen/repositories.bzl | 3 +- 50 files changed, 2677 insertions(+), 1 deletion(-) create mode 100644 bindgen/raze/BUILD create mode 100644 bindgen/raze/Cargo.toml create mode 100644 bindgen/raze/crates.bzl create mode 100644 bindgen/raze/libloading.BUILD create mode 100644 bindgen/raze/remote/BUILD create mode 100644 bindgen/raze/remote/aho-corasick-0.6.9.BUILD create mode 100644 bindgen/raze/remote/ansi_term-0.11.0.BUILD create mode 100644 bindgen/raze/remote/atty-0.2.11.BUILD create mode 100644 bindgen/raze/remote/bindgen-0.40.0.BUILD create mode 100644 bindgen/raze/remote/bitflags-1.0.4.BUILD create mode 100644 bindgen/raze/remote/cc-1.0.28.BUILD create mode 100644 bindgen/raze/remote/cexpr-0.2.3.BUILD create mode 100644 bindgen/raze/remote/cfg-if-0.1.6.BUILD create mode 100644 bindgen/raze/remote/clang-sys-0.23.0.BUILD create mode 100644 bindgen/raze/remote/clap-2.32.0.BUILD create mode 100644 bindgen/raze/remote/env_logger-0.5.13.BUILD create mode 100644 bindgen/raze/remote/glob-0.2.11.BUILD create mode 100644 bindgen/raze/remote/humantime-1.2.0.BUILD create mode 100644 bindgen/raze/remote/lazy_static-1.2.0.BUILD create mode 100644 bindgen/raze/remote/libc-0.2.48.BUILD create mode 100644 bindgen/raze/remote/libloading-0.5.0.BUILD create mode 100644 bindgen/raze/remote/log-0.4.6.BUILD create mode 100644 bindgen/raze/remote/memchr-1.0.2.BUILD create mode 100644 bindgen/raze/remote/memchr-2.1.3.BUILD create mode 100644 bindgen/raze/remote/nom-3.2.1.BUILD create mode 100644 bindgen/raze/remote/peeking_take_while-0.1.2.BUILD create mode 100644 bindgen/raze/remote/proc-macro2-0.3.5.BUILD create mode 100644 bindgen/raze/remote/quick-error-1.2.2.BUILD create mode 100644 bindgen/raze/remote/quote-0.5.2.BUILD create mode 100644 bindgen/raze/remote/redox_syscall-0.1.51.BUILD create mode 100644 bindgen/raze/remote/redox_termios-0.1.1.BUILD create mode 100644 bindgen/raze/remote/regex-1.1.0.BUILD create mode 100644 bindgen/raze/remote/regex-syntax-0.6.5.BUILD create mode 100644 bindgen/raze/remote/strsim-0.7.0.BUILD create mode 100644 bindgen/raze/remote/termcolor-1.0.4.BUILD create mode 100644 bindgen/raze/remote/termion-1.5.1.BUILD create mode 100644 bindgen/raze/remote/textwrap-0.10.0.BUILD create mode 100644 bindgen/raze/remote/thread_local-0.3.6.BUILD create mode 100644 bindgen/raze/remote/ucd-util-0.1.3.BUILD create mode 100644 bindgen/raze/remote/unicode-width-0.1.5.BUILD create mode 100644 bindgen/raze/remote/unicode-xid-0.1.0.BUILD create mode 100644 bindgen/raze/remote/utf8-ranges-1.0.2.BUILD create mode 100644 bindgen/raze/remote/vec_map-0.8.1.BUILD create mode 100644 bindgen/raze/remote/which-1.0.5.BUILD create mode 100644 bindgen/raze/remote/winapi-0.3.6.BUILD create mode 100644 bindgen/raze/remote/winapi-i686-pc-windows-gnu-0.4.0.BUILD create mode 100644 bindgen/raze/remote/winapi-util-0.1.1.BUILD create mode 100644 bindgen/raze/remote/winapi-x86_64-pc-windows-gnu-0.4.0.BUILD create mode 100644 bindgen/raze/remote/wincolor-1.0.1.BUILD diff --git a/bindgen/raze/BUILD b/bindgen/raze/BUILD new file mode 100644 index 0000000000..29312ca998 --- /dev/null +++ b/bindgen/raze/BUILD @@ -0,0 +1,20 @@ +""" +cargo-raze workspace build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = ["//visibility:public"]) + +licenses([ + "notice" # See individual crates for specific licenses +]) +alias( + name = "bindgen", + actual = "@raze__bindgen__0_40_0//:bindgen", +) +alias( + # Extra aliased target, from raze configuration + # N.B.: The exact form of this is subject to change. + name = "cargo_bin_bindgen", + actual = "@raze__bindgen__0_40_0//:cargo_bin_bindgen", +) diff --git a/bindgen/raze/Cargo.toml b/bindgen/raze/Cargo.toml new file mode 100644 index 0000000000..a0ecc8a3ca --- /dev/null +++ b/bindgen/raze/Cargo.toml @@ -0,0 +1,23 @@ +[raze] +genmode = "Remote" +workspace_path = "//bindgen/raze" + +[dependencies] +# TODO: 47 requires changes +bindgen = "0.40.0" + +[raze.crates.bindgen.'0.40.0'] +gen_buildrs = true +extra_aliased_targets = ["cargo_bin_bindgen"] + +[raze.crates.clang-sys.'0.23.0'] +# gen_buildrs = true + +# TODO: https://github.com/google/cargo-raze/issues/58 + +[package] +name = "fake_lib" +version = "0.0.1" + +[lib] +path = "fake_lib.rs" diff --git a/bindgen/raze/crates.bzl b/bindgen/raze/crates.bzl new file mode 100644 index 0000000000..4e0de7bdb9 --- /dev/null +++ b/bindgen/raze/crates.bzl @@ -0,0 +1,414 @@ +""" +cargo-raze crate workspace functions + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository") + +def _new_http_archive(name, **kwargs): + if not native.existing_rule(name): + http_archive(name=name, **kwargs) + +def _new_git_repository(name, **kwargs): + if not native.existing_rule(name): + new_git_repository(name=name, **kwargs) + +def raze_fetch_remote_crates(): + + _new_http_archive( + name = "raze__aho_corasick__0_6_9", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/aho-corasick/aho-corasick-0.6.9.crate", + type = "tar.gz", + sha256 = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e", + strip_prefix = "aho-corasick-0.6.9", + build_file = Label("//bindgen/raze/remote:aho-corasick-0.6.9.BUILD") + ) + + _new_http_archive( + name = "raze__ansi_term__0_11_0", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/ansi_term/ansi_term-0.11.0.crate", + type = "tar.gz", + sha256 = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b", + strip_prefix = "ansi_term-0.11.0", + build_file = Label("//bindgen/raze/remote:ansi_term-0.11.0.BUILD") + ) + + _new_http_archive( + name = "raze__atty__0_2_11", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/atty/atty-0.2.11.crate", + type = "tar.gz", + sha256 = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652", + strip_prefix = "atty-0.2.11", + build_file = Label("//bindgen/raze/remote:atty-0.2.11.BUILD") + ) + + _new_http_archive( + name = "raze__bindgen__0_40_0", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/bindgen/bindgen-0.40.0.crate", + type = "tar.gz", + sha256 = "8f4c4ffe91e0f26bdcc5a8dd58cbf0358ad772b8ec1ae274a11a0ba54ec175f4", + strip_prefix = "bindgen-0.40.0", + build_file = Label("//bindgen/raze/remote:bindgen-0.40.0.BUILD") + ) + + _new_http_archive( + name = "raze__bitflags__1_0_4", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/bitflags/bitflags-1.0.4.crate", + type = "tar.gz", + sha256 = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12", + strip_prefix = "bitflags-1.0.4", + build_file = Label("//bindgen/raze/remote:bitflags-1.0.4.BUILD") + ) + + _new_http_archive( + name = "raze__cc__1_0_28", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/cc/cc-1.0.28.crate", + type = "tar.gz", + sha256 = "bb4a8b715cb4597106ea87c7c84b2f1d452c7492033765df7f32651e66fcf749", + strip_prefix = "cc-1.0.28", + build_file = Label("//bindgen/raze/remote:cc-1.0.28.BUILD") + ) + + _new_http_archive( + name = "raze__cexpr__0_2_3", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/cexpr/cexpr-0.2.3.crate", + type = "tar.gz", + sha256 = "42aac45e9567d97474a834efdee3081b3c942b2205be932092f53354ce503d6c", + strip_prefix = "cexpr-0.2.3", + build_file = Label("//bindgen/raze/remote:cexpr-0.2.3.BUILD") + ) + + _new_http_archive( + name = "raze__cfg_if__0_1_6", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/cfg-if/cfg-if-0.1.6.crate", + type = "tar.gz", + sha256 = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4", + strip_prefix = "cfg-if-0.1.6", + build_file = Label("//bindgen/raze/remote:cfg-if-0.1.6.BUILD") + ) + + _new_http_archive( + name = "raze__clang_sys__0_23_0", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/clang-sys/clang-sys-0.23.0.crate", + type = "tar.gz", + sha256 = "d7f7c04e52c35222fffcc3a115b5daf5f7e2bfb71c13c4e2321afe1fc71859c2", + strip_prefix = "clang-sys-0.23.0", + build_file = Label("//bindgen/raze/remote:clang-sys-0.23.0.BUILD") + ) + + _new_http_archive( + name = "raze__clap__2_32_0", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/clap/clap-2.32.0.crate", + type = "tar.gz", + sha256 = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e", + strip_prefix = "clap-2.32.0", + build_file = Label("//bindgen/raze/remote:clap-2.32.0.BUILD") + ) + + _new_http_archive( + name = "raze__env_logger__0_5_13", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/env_logger/env_logger-0.5.13.crate", + type = "tar.gz", + sha256 = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38", + strip_prefix = "env_logger-0.5.13", + build_file = Label("//bindgen/raze/remote:env_logger-0.5.13.BUILD") + ) + + _new_http_archive( + name = "raze__glob__0_2_11", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/glob/glob-0.2.11.crate", + type = "tar.gz", + sha256 = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb", + strip_prefix = "glob-0.2.11", + build_file = Label("//bindgen/raze/remote:glob-0.2.11.BUILD") + ) + + _new_http_archive( + name = "raze__humantime__1_2_0", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/humantime/humantime-1.2.0.crate", + type = "tar.gz", + sha256 = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114", + strip_prefix = "humantime-1.2.0", + build_file = Label("//bindgen/raze/remote:humantime-1.2.0.BUILD") + ) + + _new_http_archive( + name = "raze__lazy_static__1_2_0", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/lazy_static/lazy_static-1.2.0.crate", + type = "tar.gz", + sha256 = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1", + strip_prefix = "lazy_static-1.2.0", + build_file = Label("//bindgen/raze/remote:lazy_static-1.2.0.BUILD") + ) + + _new_http_archive( + name = "raze__libc__0_2_48", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/libc/libc-0.2.48.crate", + type = "tar.gz", + sha256 = "e962c7641008ac010fa60a7dfdc1712449f29c44ef2d4702394aea943ee75047", + strip_prefix = "libc-0.2.48", + build_file = Label("//bindgen/raze/remote:libc-0.2.48.BUILD") + ) + + _new_http_archive( + name = "raze__libloading__0_5_0", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/libloading/libloading-0.5.0.crate", + type = "tar.gz", + sha256 = "9c3ad660d7cb8c5822cd83d10897b0f1f1526792737a179e73896152f85b88c2", + strip_prefix = "libloading-0.5.0", + build_file = Label("//bindgen/raze/remote:libloading-0.5.0.BUILD") + ) + + _new_http_archive( + name = "raze__log__0_4_6", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/log/log-0.4.6.crate", + type = "tar.gz", + sha256 = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6", + strip_prefix = "log-0.4.6", + build_file = Label("//bindgen/raze/remote:log-0.4.6.BUILD") + ) + + _new_http_archive( + name = "raze__memchr__1_0_2", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/memchr/memchr-1.0.2.crate", + type = "tar.gz", + sha256 = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a", + strip_prefix = "memchr-1.0.2", + build_file = Label("//bindgen/raze/remote:memchr-1.0.2.BUILD") + ) + + _new_http_archive( + name = "raze__memchr__2_1_3", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/memchr/memchr-2.1.3.crate", + type = "tar.gz", + sha256 = "e1dd4eaac298c32ce07eb6ed9242eda7d82955b9170b7d6db59b2e02cc63fcb8", + strip_prefix = "memchr-2.1.3", + build_file = Label("//bindgen/raze/remote:memchr-2.1.3.BUILD") + ) + + _new_http_archive( + name = "raze__nom__3_2_1", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/nom/nom-3.2.1.crate", + type = "tar.gz", + sha256 = "05aec50c70fd288702bcd93284a8444607f3292dbdf2a30de5ea5dcdbe72287b", + strip_prefix = "nom-3.2.1", + build_file = Label("//bindgen/raze/remote:nom-3.2.1.BUILD") + ) + + _new_http_archive( + name = "raze__peeking_take_while__0_1_2", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/peeking_take_while/peeking_take_while-0.1.2.crate", + type = "tar.gz", + sha256 = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099", + strip_prefix = "peeking_take_while-0.1.2", + build_file = Label("//bindgen/raze/remote:peeking_take_while-0.1.2.BUILD") + ) + + _new_http_archive( + name = "raze__proc_macro2__0_3_5", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/proc-macro2/proc-macro2-0.3.5.crate", + type = "tar.gz", + sha256 = "77997c53ae6edd6d187fec07ec41b207063b5ee6f33680e9fa86d405cdd313d4", + strip_prefix = "proc-macro2-0.3.5", + build_file = Label("//bindgen/raze/remote:proc-macro2-0.3.5.BUILD") + ) + + _new_http_archive( + name = "raze__quick_error__1_2_2", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/quick-error/quick-error-1.2.2.crate", + type = "tar.gz", + sha256 = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0", + strip_prefix = "quick-error-1.2.2", + build_file = Label("//bindgen/raze/remote:quick-error-1.2.2.BUILD") + ) + + _new_http_archive( + name = "raze__quote__0_5_2", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/quote/quote-0.5.2.crate", + type = "tar.gz", + sha256 = "9949cfe66888ffe1d53e6ec9d9f3b70714083854be20fd5e271b232a017401e8", + strip_prefix = "quote-0.5.2", + build_file = Label("//bindgen/raze/remote:quote-0.5.2.BUILD") + ) + + _new_http_archive( + name = "raze__redox_syscall__0_1_51", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/redox_syscall/redox_syscall-0.1.51.crate", + type = "tar.gz", + sha256 = "423e376fffca3dfa06c9e9790a9ccd282fafb3cc6e6397d01dbf64f9bacc6b85", + strip_prefix = "redox_syscall-0.1.51", + build_file = Label("//bindgen/raze/remote:redox_syscall-0.1.51.BUILD") + ) + + _new_http_archive( + name = "raze__redox_termios__0_1_1", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/redox_termios/redox_termios-0.1.1.crate", + type = "tar.gz", + sha256 = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76", + strip_prefix = "redox_termios-0.1.1", + build_file = Label("//bindgen/raze/remote:redox_termios-0.1.1.BUILD") + ) + + _new_http_archive( + name = "raze__regex__1_1_0", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/regex/regex-1.1.0.crate", + type = "tar.gz", + sha256 = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f", + strip_prefix = "regex-1.1.0", + build_file = Label("//bindgen/raze/remote:regex-1.1.0.BUILD") + ) + + _new_http_archive( + name = "raze__regex_syntax__0_6_5", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/regex-syntax/regex-syntax-0.6.5.crate", + type = "tar.gz", + sha256 = "8c2f35eedad5295fdf00a63d7d4b238135723f92b434ec06774dad15c7ab0861", + strip_prefix = "regex-syntax-0.6.5", + build_file = Label("//bindgen/raze/remote:regex-syntax-0.6.5.BUILD") + ) + + _new_http_archive( + name = "raze__strsim__0_7_0", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/strsim/strsim-0.7.0.crate", + type = "tar.gz", + sha256 = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550", + strip_prefix = "strsim-0.7.0", + build_file = Label("//bindgen/raze/remote:strsim-0.7.0.BUILD") + ) + + _new_http_archive( + name = "raze__termcolor__1_0_4", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/termcolor/termcolor-1.0.4.crate", + type = "tar.gz", + sha256 = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f", + strip_prefix = "termcolor-1.0.4", + build_file = Label("//bindgen/raze/remote:termcolor-1.0.4.BUILD") + ) + + _new_http_archive( + name = "raze__termion__1_5_1", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/termion/termion-1.5.1.crate", + type = "tar.gz", + sha256 = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096", + strip_prefix = "termion-1.5.1", + build_file = Label("//bindgen/raze/remote:termion-1.5.1.BUILD") + ) + + _new_http_archive( + name = "raze__textwrap__0_10_0", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/textwrap/textwrap-0.10.0.crate", + type = "tar.gz", + sha256 = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6", + strip_prefix = "textwrap-0.10.0", + build_file = Label("//bindgen/raze/remote:textwrap-0.10.0.BUILD") + ) + + _new_http_archive( + name = "raze__thread_local__0_3_6", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/thread_local/thread_local-0.3.6.crate", + type = "tar.gz", + sha256 = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b", + strip_prefix = "thread_local-0.3.6", + build_file = Label("//bindgen/raze/remote:thread_local-0.3.6.BUILD") + ) + + _new_http_archive( + name = "raze__ucd_util__0_1_3", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/ucd-util/ucd-util-0.1.3.crate", + type = "tar.gz", + sha256 = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86", + strip_prefix = "ucd-util-0.1.3", + build_file = Label("//bindgen/raze/remote:ucd-util-0.1.3.BUILD") + ) + + _new_http_archive( + name = "raze__unicode_width__0_1_5", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/unicode-width/unicode-width-0.1.5.crate", + type = "tar.gz", + sha256 = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526", + strip_prefix = "unicode-width-0.1.5", + build_file = Label("//bindgen/raze/remote:unicode-width-0.1.5.BUILD") + ) + + _new_http_archive( + name = "raze__unicode_xid__0_1_0", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/unicode-xid/unicode-xid-0.1.0.crate", + type = "tar.gz", + sha256 = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc", + strip_prefix = "unicode-xid-0.1.0", + build_file = Label("//bindgen/raze/remote:unicode-xid-0.1.0.BUILD") + ) + + _new_http_archive( + name = "raze__utf8_ranges__1_0_2", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/utf8-ranges/utf8-ranges-1.0.2.crate", + type = "tar.gz", + sha256 = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737", + strip_prefix = "utf8-ranges-1.0.2", + build_file = Label("//bindgen/raze/remote:utf8-ranges-1.0.2.BUILD") + ) + + _new_http_archive( + name = "raze__vec_map__0_8_1", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/vec_map/vec_map-0.8.1.crate", + type = "tar.gz", + sha256 = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a", + strip_prefix = "vec_map-0.8.1", + build_file = Label("//bindgen/raze/remote:vec_map-0.8.1.BUILD") + ) + + _new_http_archive( + name = "raze__which__1_0_5", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/which/which-1.0.5.crate", + type = "tar.gz", + sha256 = "e84a603e7e0b1ce1aa1ee2b109c7be00155ce52df5081590d1ffb93f4f515cb2", + strip_prefix = "which-1.0.5", + build_file = Label("//bindgen/raze/remote:which-1.0.5.BUILD") + ) + + _new_http_archive( + name = "raze__winapi__0_3_6", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/winapi/winapi-0.3.6.crate", + type = "tar.gz", + sha256 = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0", + strip_prefix = "winapi-0.3.6", + build_file = Label("//bindgen/raze/remote:winapi-0.3.6.BUILD") + ) + + _new_http_archive( + name = "raze__winapi_i686_pc_windows_gnu__0_4_0", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/winapi-i686-pc-windows-gnu/winapi-i686-pc-windows-gnu-0.4.0.crate", + type = "tar.gz", + sha256 = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6", + strip_prefix = "winapi-i686-pc-windows-gnu-0.4.0", + build_file = Label("//bindgen/raze/remote:winapi-i686-pc-windows-gnu-0.4.0.BUILD") + ) + + _new_http_archive( + name = "raze__winapi_util__0_1_1", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/winapi-util/winapi-util-0.1.1.crate", + type = "tar.gz", + sha256 = "afc5508759c5bf4285e61feb862b6083c8480aec864fa17a81fdec6f69b461ab", + strip_prefix = "winapi-util-0.1.1", + build_file = Label("//bindgen/raze/remote:winapi-util-0.1.1.BUILD") + ) + + _new_http_archive( + name = "raze__winapi_x86_64_pc_windows_gnu__0_4_0", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/winapi-x86_64-pc-windows-gnu/winapi-x86_64-pc-windows-gnu-0.4.0.crate", + type = "tar.gz", + sha256 = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f", + strip_prefix = "winapi-x86_64-pc-windows-gnu-0.4.0", + build_file = Label("//bindgen/raze/remote:winapi-x86_64-pc-windows-gnu-0.4.0.BUILD") + ) + + _new_http_archive( + name = "raze__wincolor__1_0_1", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/wincolor/wincolor-1.0.1.crate", + type = "tar.gz", + sha256 = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba", + strip_prefix = "wincolor-1.0.1", + build_file = Label("//bindgen/raze/remote:wincolor-1.0.1.BUILD") + ) + diff --git a/bindgen/raze/libloading.BUILD b/bindgen/raze/libloading.BUILD new file mode 100644 index 0000000000..84dee9a6cd --- /dev/null +++ b/bindgen/raze/libloading.BUILD @@ -0,0 +1,43 @@ +""" +OVERRIDDEN: +cargo-raze crate build file. + +- Libloading has a CC dep that needs to be brought in +""" + +package(default_visibility = ["//visibility:public"]) + +licenses([ + "notice", # "ISC" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", + "rust_benchmark", +) + +cc_library( + name = "global_whatever", + srcs = [ + "src/os/unix/global_static.c", + ], + copts = [ "-fPIC" ], +) + +rust_library( + name = "libloading", + srcs = glob(["**/*.rs"]), + crate_features = [ + ], + crate_root = "src/lib.rs", + crate_type = "lib", + rustc_flags = [ + "--cap-lints=allow", + ], + deps = [ + ":global_whatever", + ], +) diff --git a/bindgen/raze/remote/BUILD b/bindgen/raze/remote/BUILD new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bindgen/raze/remote/aho-corasick-0.6.9.BUILD b/bindgen/raze/remote/aho-corasick-0.6.9.BUILD new file mode 100644 index 0000000000..482324ec13 --- /dev/null +++ b/bindgen/raze/remote/aho-corasick-0.6.9.BUILD @@ -0,0 +1,66 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT" + "unencumbered", # "Unlicense" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +rust_binary( + # Prefix bin name to disambiguate from (probable) collision with lib name + # N.B.: The exact form of this is subject to change. + name = "cargo_bin_aho_corasick_dot", + crate_root = "src/main.rs", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + # Binaries get an implicit dependency on their lib + ":aho_corasick", + "@raze__memchr__2_1_3//:memchr", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.6.9", + crate_features = [ + ], +) + + +rust_library( + name = "aho_corasick", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + "@raze__memchr__2_1_3//:memchr", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.6.9", + crate_features = [ + ], +) + +# Unsupported target "bench" with type "bench" omitted +# Unsupported target "dict-search" with type "example" omitted diff --git a/bindgen/raze/remote/ansi_term-0.11.0.BUILD b/bindgen/raze/remote/ansi_term-0.11.0.BUILD new file mode 100644 index 0000000000..8aadd76a35 --- /dev/null +++ b/bindgen/raze/remote/ansi_term-0.11.0.BUILD @@ -0,0 +1,43 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + + +rust_library( + name = "ansi_term", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.11.0", + crate_features = [ + ], +) + +# Unsupported target "colours" with type "example" omitted diff --git a/bindgen/raze/remote/atty-0.2.11.BUILD b/bindgen/raze/remote/atty-0.2.11.BUILD new file mode 100644 index 0000000000..2c2fb11652 --- /dev/null +++ b/bindgen/raze/remote/atty-0.2.11.BUILD @@ -0,0 +1,44 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "atty" with type "example" omitted + +rust_library( + name = "atty", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + "@raze__libc__0_2_48//:libc", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.2.11", + crate_features = [ + ], +) + diff --git a/bindgen/raze/remote/bindgen-0.40.0.BUILD b/bindgen/raze/remote/bindgen-0.40.0.BUILD new file mode 100644 index 0000000000..22728046e1 --- /dev/null +++ b/bindgen/raze/remote/bindgen-0.40.0.BUILD @@ -0,0 +1,141 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "BSD-3-Clause" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + +rust_binary( + name = "bindgen_build_script", + srcs = glob(["**/*.rs"]), + crate_root = "build.rs", + edition = "2015", + deps = [ + ], + rustc_flags = [ + "--cap-lints=allow", + ], + crate_features = [ + "default", + "env_logger", + "log", + "logging", + ], + data = glob(["*"]), + version = "0.40.0", + visibility = ["//visibility:private"], +) + +genrule( + name = "bindgen_build_script_executor", + srcs = glob(["*", "**/*.rs"]), + outs = ["bindgen_out_dir_outputs.tar.gz"], + tools = [ + ":bindgen_build_script", + ], + local = 1, + cmd = "mkdir -p bindgen_out_dir_outputs/;" + + " (export CARGO_MANIFEST_DIR=\"$$PWD/$$(dirname $(location :Cargo.toml))\";" + # TODO(acmcarther): This needs to be revisited as part of the cross compilation story. + # See also: https://github.com/google/cargo-raze/pull/54 + + " export TARGET='x86_64-unknown-linux-gnu';" + + " export RUST_BACKTRACE=1;" + + " export CARGO_FEATURE_DEFAULT=1;" + + " export CARGO_FEATURE_ENV_LOGGER=1;" + + " export CARGO_FEATURE_LOG=1;" + + " export CARGO_FEATURE_LOGGING=1;" + + " export OUT_DIR=$$PWD/bindgen_out_dir_outputs;" + + " export BINARY_PATH=\"$$PWD/$(location :bindgen_build_script)\";" + + " export OUT_TAR=$$PWD/$@;" + + " cd $$(dirname $(location :Cargo.toml)) && $$BINARY_PATH && tar -czf $$OUT_TAR -C $$OUT_DIR .)" +) + +rust_binary( + # Prefix bin name to disambiguate from (probable) collision with lib name + # N.B.: The exact form of this is subject to change. + name = "cargo_bin_bindgen", + crate_root = "src/main.rs", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + # Binaries get an implicit dependency on their lib + ":bindgen", + "@raze__bitflags__1_0_4//:bitflags", + "@raze__cexpr__0_2_3//:cexpr", + "@raze__cfg_if__0_1_6//:cfg_if", + "@raze__clang_sys__0_23_0//:clang_sys", + "@raze__clap__2_32_0//:clap", + "@raze__env_logger__0_5_13//:env_logger", + "@raze__lazy_static__1_2_0//:lazy_static", + "@raze__log__0_4_6//:log", + "@raze__peeking_take_while__0_1_2//:peeking_take_while", + "@raze__proc_macro2__0_3_5//:proc_macro2", + "@raze__quote__0_5_2//:quote", + "@raze__regex__1_1_0//:regex", + "@raze__which__1_0_5//:which", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + out_dir_tar = ":bindgen_build_script_executor", + version = "0.40.0", + crate_features = [ + "default", + "env_logger", + "log", + "logging", + ], +) + + +rust_library( + name = "bindgen", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + "@raze__bitflags__1_0_4//:bitflags", + "@raze__cexpr__0_2_3//:cexpr", + "@raze__cfg_if__0_1_6//:cfg_if", + "@raze__clang_sys__0_23_0//:clang_sys", + "@raze__clap__2_32_0//:clap", + "@raze__env_logger__0_5_13//:env_logger", + "@raze__lazy_static__1_2_0//:lazy_static", + "@raze__log__0_4_6//:log", + "@raze__peeking_take_while__0_1_2//:peeking_take_while", + "@raze__proc_macro2__0_3_5//:proc_macro2", + "@raze__quote__0_5_2//:quote", + "@raze__regex__1_1_0//:regex", + "@raze__which__1_0_5//:which", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + out_dir_tar = ":bindgen_build_script_executor", + version = "0.40.0", + crate_features = [ + "default", + "env_logger", + "log", + "logging", + ], +) + diff --git a/bindgen/raze/remote/bitflags-1.0.4.BUILD b/bindgen/raze/remote/bitflags-1.0.4.BUILD new file mode 100644 index 0000000000..66fb9258de --- /dev/null +++ b/bindgen/raze/remote/bitflags-1.0.4.BUILD @@ -0,0 +1,43 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT,Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + + +rust_library( + name = "bitflags", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "1.0.4", + crate_features = [ + "default", + ], +) + diff --git a/bindgen/raze/remote/cc-1.0.28.BUILD b/bindgen/raze/remote/cc-1.0.28.BUILD new file mode 100644 index 0000000000..7e1370612e --- /dev/null +++ b/bindgen/raze/remote/cc-1.0.28.BUILD @@ -0,0 +1,63 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT,Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + + +rust_library( + name = "cc", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "1.0.28", + crate_features = [ + ], +) + +# Unsupported target "cc_env" with type "test" omitted +rust_binary( + # Prefix bin name to disambiguate from (probable) collision with lib name + # N.B.: The exact form of this is subject to change. + name = "cargo_bin_gcc_shim", + crate_root = "src/bin/gcc-shim.rs", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + # Binaries get an implicit dependency on their lib + ":cc", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "1.0.28", + crate_features = [ + ], +) + +# Unsupported target "test" with type "test" omitted diff --git a/bindgen/raze/remote/cexpr-0.2.3.BUILD b/bindgen/raze/remote/cexpr-0.2.3.BUILD new file mode 100644 index 0000000000..2d402c2d9e --- /dev/null +++ b/bindgen/raze/remote/cexpr-0.2.3.BUILD @@ -0,0 +1,44 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "Apache-2.0,MIT" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + + +rust_library( + name = "cexpr", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + "@raze__nom__3_2_1//:nom", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.2.3", + crate_features = [ + ], +) + +# Unsupported target "clang" with type "test" omitted diff --git a/bindgen/raze/remote/cfg-if-0.1.6.BUILD b/bindgen/raze/remote/cfg-if-0.1.6.BUILD new file mode 100644 index 0000000000..8d7e20ae76 --- /dev/null +++ b/bindgen/raze/remote/cfg-if-0.1.6.BUILD @@ -0,0 +1,43 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT,Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + + +rust_library( + name = "cfg_if", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.1.6", + crate_features = [ + ], +) + +# Unsupported target "xcrate" with type "test" omitted diff --git a/bindgen/raze/remote/clang-sys-0.23.0.BUILD b/bindgen/raze/remote/clang-sys-0.23.0.BUILD new file mode 100644 index 0000000000..01ca16cd02 --- /dev/null +++ b/bindgen/raze/remote/clang-sys-0.23.0.BUILD @@ -0,0 +1,57 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "build-script-build" with type "custom-build" omitted + +rust_library( + name = "clang_sys", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + "@raze__glob__0_2_11//:glob", + "@raze__libc__0_2_48//:libc", + "@raze__libloading__0_5_0//:libloading", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.23.0", + crate_features = [ + "clang_6_0", + "gte_clang_3_6", + "gte_clang_3_7", + "gte_clang_3_8", + "gte_clang_3_9", + "gte_clang_4_0", + "gte_clang_5_0", + "gte_clang_6_0", + "libloading", + "runtime", + ], +) + +# Unsupported target "lib" with type "test" omitted diff --git a/bindgen/raze/remote/clap-2.32.0.BUILD b/bindgen/raze/remote/clap-2.32.0.BUILD new file mode 100644 index 0000000000..5585d7847e --- /dev/null +++ b/bindgen/raze/remote/clap-2.32.0.BUILD @@ -0,0 +1,56 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + + +rust_library( + name = "clap", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + "@raze__ansi_term__0_11_0//:ansi_term", + "@raze__atty__0_2_11//:atty", + "@raze__bitflags__1_0_4//:bitflags", + "@raze__strsim__0_7_0//:strsim", + "@raze__textwrap__0_10_0//:textwrap", + "@raze__unicode_width__0_1_5//:unicode_width", + "@raze__vec_map__0_8_1//:vec_map", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "2.32.0", + crate_features = [ + "ansi_term", + "atty", + "color", + "default", + "strsim", + "suggestions", + "vec_map", + ], +) + diff --git a/bindgen/raze/remote/env_logger-0.5.13.BUILD b/bindgen/raze/remote/env_logger-0.5.13.BUILD new file mode 100644 index 0000000000..253e243993 --- /dev/null +++ b/bindgen/raze/remote/env_logger-0.5.13.BUILD @@ -0,0 +1,56 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT,Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "custom_default_format" with type "example" omitted +# Unsupported target "custom_format" with type "example" omitted +# Unsupported target "custom_logger" with type "example" omitted +# Unsupported target "default" with type "example" omitted +# Unsupported target "direct_logger" with type "example" omitted + +rust_library( + name = "env_logger", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + "@raze__atty__0_2_11//:atty", + "@raze__humantime__1_2_0//:humantime", + "@raze__log__0_4_6//:log", + "@raze__regex__1_1_0//:regex", + "@raze__termcolor__1_0_4//:termcolor", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.5.13", + crate_features = [ + "default", + "regex", + ], +) + +# Unsupported target "log-in-log" with type "test" omitted +# Unsupported target "regexp_filter" with type "test" omitted diff --git a/bindgen/raze/remote/glob-0.2.11.BUILD b/bindgen/raze/remote/glob-0.2.11.BUILD new file mode 100644 index 0000000000..e1980c319d --- /dev/null +++ b/bindgen/raze/remote/glob-0.2.11.BUILD @@ -0,0 +1,43 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT,Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + + +rust_library( + name = "glob", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.2.11", + crate_features = [ + ], +) + +# Unsupported target "glob-std" with type "test" omitted diff --git a/bindgen/raze/remote/humantime-1.2.0.BUILD b/bindgen/raze/remote/humantime-1.2.0.BUILD new file mode 100644 index 0000000000..c00bdebc15 --- /dev/null +++ b/bindgen/raze/remote/humantime-1.2.0.BUILD @@ -0,0 +1,45 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT,Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "datetime_format" with type "bench" omitted +# Unsupported target "datetime_parse" with type "bench" omitted + +rust_library( + name = "humantime", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + "@raze__quick_error__1_2_2//:quick_error", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "1.2.0", + crate_features = [ + ], +) + diff --git a/bindgen/raze/remote/lazy_static-1.2.0.BUILD b/bindgen/raze/remote/lazy_static-1.2.0.BUILD new file mode 100644 index 0000000000..2bfb3e0ef2 --- /dev/null +++ b/bindgen/raze/remote/lazy_static-1.2.0.BUILD @@ -0,0 +1,44 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT,Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + + +rust_library( + name = "lazy_static", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "1.2.0", + crate_features = [ + ], +) + +# Unsupported target "no_std" with type "test" omitted +# Unsupported target "test" with type "test" omitted diff --git a/bindgen/raze/remote/libc-0.2.48.BUILD b/bindgen/raze/remote/libc-0.2.48.BUILD new file mode 100644 index 0000000000..31bd9e8ab1 --- /dev/null +++ b/bindgen/raze/remote/libc-0.2.48.BUILD @@ -0,0 +1,45 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "restricted", # "MIT OR Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "build-script-build" with type "custom-build" omitted + +rust_library( + name = "libc", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.2.48", + crate_features = [ + "default", + "use_std", + ], +) + diff --git a/bindgen/raze/remote/libloading-0.5.0.BUILD b/bindgen/raze/remote/libloading-0.5.0.BUILD new file mode 100644 index 0000000000..ee505fe29c --- /dev/null +++ b/bindgen/raze/remote/libloading-0.5.0.BUILD @@ -0,0 +1,46 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "ISC" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "build-script-build" with type "custom-build" omitted +# Unsupported target "functions" with type "test" omitted + +rust_library( + name = "libloading", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.5.0", + crate_features = [ + ], +) + +# Unsupported target "markers" with type "test" omitted +# Unsupported target "windows" with type "test" omitted diff --git a/bindgen/raze/remote/log-0.4.6.BUILD b/bindgen/raze/remote/log-0.4.6.BUILD new file mode 100644 index 0000000000..4673fea1b5 --- /dev/null +++ b/bindgen/raze/remote/log-0.4.6.BUILD @@ -0,0 +1,45 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT,Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "filters" with type "test" omitted + +rust_library( + name = "log", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + "@raze__cfg_if__0_1_6//:cfg_if", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.4.6", + crate_features = [ + "std", + ], +) + diff --git a/bindgen/raze/remote/memchr-1.0.2.BUILD b/bindgen/raze/remote/memchr-1.0.2.BUILD new file mode 100644 index 0000000000..a895f2593d --- /dev/null +++ b/bindgen/raze/remote/memchr-1.0.2.BUILD @@ -0,0 +1,47 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT" + "unencumbered", # "Unlicense" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "bench" with type "bench" omitted + +rust_library( + name = "memchr", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + "@raze__libc__0_2_48//:libc", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "1.0.2", + crate_features = [ + "libc", + "use_std", + ], +) + diff --git a/bindgen/raze/remote/memchr-2.1.3.BUILD b/bindgen/raze/remote/memchr-2.1.3.BUILD new file mode 100644 index 0000000000..ff1a025013 --- /dev/null +++ b/bindgen/raze/remote/memchr-2.1.3.BUILD @@ -0,0 +1,49 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT" + "unencumbered", # "Unlicense" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "build-script-build" with type "custom-build" omitted + +rust_library( + name = "memchr", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + "@raze__cfg_if__0_1_6//:cfg_if", + "@raze__libc__0_2_48//:libc", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "2.1.3", + crate_features = [ + "default", + "libc", + "use_std", + ], +) + diff --git a/bindgen/raze/remote/nom-3.2.1.BUILD b/bindgen/raze/remote/nom-3.2.1.BUILD new file mode 100644 index 0000000000..9aca6ca801 --- /dev/null +++ b/bindgen/raze/remote/nom-3.2.1.BUILD @@ -0,0 +1,64 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "arithmetic" with type "test" omitted +# Unsupported target "arithmetic_ast" with type "test" omitted +# Unsupported target "blockbuf-arithmetic" with type "test" omitted +# Unsupported target "cross_function_backtracking" with type "test" omitted +# Unsupported target "float" with type "test" omitted +# Unsupported target "ini" with type "test" omitted +# Unsupported target "ini_str" with type "test" omitted +# Unsupported target "issues" with type "test" omitted +# Unsupported target "json" with type "test" omitted +# Unsupported target "mp4" with type "test" omitted +# Unsupported target "multiline" with type "test" omitted +# Unsupported target "named_args" with type "test" omitted + +rust_library( + name = "nom", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + "@raze__memchr__1_0_2//:memchr", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "3.2.1", + crate_features = [ + "default", + "memchr", + "std", + "stream", + "verbose-errors", + ], +) + +# Unsupported target "omnom" with type "test" omitted +# Unsupported target "overflow" with type "test" omitted +# Unsupported target "reborrow_fold" with type "test" omitted +# Unsupported target "test1" with type "test" omitted diff --git a/bindgen/raze/remote/peeking_take_while-0.1.2.BUILD b/bindgen/raze/remote/peeking_take_while-0.1.2.BUILD new file mode 100644 index 0000000000..27e8693913 --- /dev/null +++ b/bindgen/raze/remote/peeking_take_while-0.1.2.BUILD @@ -0,0 +1,42 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "Apache-2.0,MIT" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + + +rust_library( + name = "peeking_take_while", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.1.2", + crate_features = [ + ], +) + diff --git a/bindgen/raze/remote/proc-macro2-0.3.5.BUILD b/bindgen/raze/remote/proc-macro2-0.3.5.BUILD new file mode 100644 index 0000000000..92a97b9b74 --- /dev/null +++ b/bindgen/raze/remote/proc-macro2-0.3.5.BUILD @@ -0,0 +1,44 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT,Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + + +rust_library( + name = "proc_macro2", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + "@raze__unicode_xid__0_1_0//:unicode_xid", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.3.5", + crate_features = [ + ], +) + +# Unsupported target "test" with type "test" omitted diff --git a/bindgen/raze/remote/quick-error-1.2.2.BUILD b/bindgen/raze/remote/quick-error-1.2.2.BUILD new file mode 100644 index 0000000000..c51de2d073 --- /dev/null +++ b/bindgen/raze/remote/quick-error-1.2.2.BUILD @@ -0,0 +1,43 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT,Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "context" with type "example" omitted + +rust_library( + name = "quick_error", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "1.2.2", + crate_features = [ + ], +) + diff --git a/bindgen/raze/remote/quote-0.5.2.BUILD b/bindgen/raze/remote/quote-0.5.2.BUILD new file mode 100644 index 0000000000..508c1dfa16 --- /dev/null +++ b/bindgen/raze/remote/quote-0.5.2.BUILD @@ -0,0 +1,44 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT,Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + + +rust_library( + name = "quote", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + "@raze__proc_macro2__0_3_5//:proc_macro2", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.5.2", + crate_features = [ + ], +) + +# Unsupported target "test" with type "test" omitted diff --git a/bindgen/raze/remote/redox_syscall-0.1.51.BUILD b/bindgen/raze/remote/redox_syscall-0.1.51.BUILD new file mode 100644 index 0000000000..8648afb507 --- /dev/null +++ b/bindgen/raze/remote/redox_syscall-0.1.51.BUILD @@ -0,0 +1,46 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +alias( + name = "redox_syscall", + actual = ":syscall", +) + +rust_library( + name = "syscall", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.1.51", + crate_features = [ + ], +) + diff --git a/bindgen/raze/remote/redox_termios-0.1.1.BUILD b/bindgen/raze/remote/redox_termios-0.1.1.BUILD new file mode 100644 index 0000000000..6173808779 --- /dev/null +++ b/bindgen/raze/remote/redox_termios-0.1.1.BUILD @@ -0,0 +1,43 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + + +rust_library( + name = "redox_termios", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + "@raze__redox_syscall__0_1_51//:redox_syscall", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.1.1", + crate_features = [ + ], +) + diff --git a/bindgen/raze/remote/regex-1.1.0.BUILD b/bindgen/raze/remote/regex-1.1.0.BUILD new file mode 100644 index 0000000000..70318bbddf --- /dev/null +++ b/bindgen/raze/remote/regex-1.1.0.BUILD @@ -0,0 +1,65 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT,Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "backtrack" with type "test" omitted +# Unsupported target "backtrack-bytes" with type "test" omitted +# Unsupported target "backtrack-utf8bytes" with type "test" omitted +# Unsupported target "build-script-build" with type "custom-build" omitted +# Unsupported target "crates-regex" with type "test" omitted +# Unsupported target "default" with type "test" omitted +# Unsupported target "default-bytes" with type "test" omitted +# Unsupported target "nfa" with type "test" omitted +# Unsupported target "nfa-bytes" with type "test" omitted +# Unsupported target "nfa-utf8bytes" with type "test" omitted + +rust_library( + name = "regex", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + "@raze__aho_corasick__0_6_9//:aho_corasick", + "@raze__memchr__2_1_3//:memchr", + "@raze__regex_syntax__0_6_5//:regex_syntax", + "@raze__thread_local__0_3_6//:thread_local", + "@raze__utf8_ranges__1_0_2//:utf8_ranges", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "1.1.0", + crate_features = [ + "default", + "use_std", + ], +) + +# Unsupported target "shootout-regex-dna" with type "example" omitted +# Unsupported target "shootout-regex-dna-bytes" with type "example" omitted +# Unsupported target "shootout-regex-dna-cheat" with type "example" omitted +# Unsupported target "shootout-regex-dna-replace" with type "example" omitted +# Unsupported target "shootout-regex-dna-single" with type "example" omitted +# Unsupported target "shootout-regex-dna-single-cheat" with type "example" omitted diff --git a/bindgen/raze/remote/regex-syntax-0.6.5.BUILD b/bindgen/raze/remote/regex-syntax-0.6.5.BUILD new file mode 100644 index 0000000000..5f29f8c5b1 --- /dev/null +++ b/bindgen/raze/remote/regex-syntax-0.6.5.BUILD @@ -0,0 +1,44 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT,Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "bench" with type "bench" omitted + +rust_library( + name = "regex_syntax", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + "@raze__ucd_util__0_1_3//:ucd_util", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.6.5", + crate_features = [ + ], +) + diff --git a/bindgen/raze/remote/strsim-0.7.0.BUILD b/bindgen/raze/remote/strsim-0.7.0.BUILD new file mode 100644 index 0000000000..a429808f4b --- /dev/null +++ b/bindgen/raze/remote/strsim-0.7.0.BUILD @@ -0,0 +1,43 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "lib" with type "test" omitted + +rust_library( + name = "strsim", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.7.0", + crate_features = [ + ], +) + diff --git a/bindgen/raze/remote/termcolor-1.0.4.BUILD b/bindgen/raze/remote/termcolor-1.0.4.BUILD new file mode 100644 index 0000000000..ebdf3879a9 --- /dev/null +++ b/bindgen/raze/remote/termcolor-1.0.4.BUILD @@ -0,0 +1,42 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "restricted", # "Unlicense OR MIT" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + + +rust_library( + name = "termcolor", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "1.0.4", + crate_features = [ + ], +) + diff --git a/bindgen/raze/remote/termion-1.5.1.BUILD b/bindgen/raze/remote/termion-1.5.1.BUILD new file mode 100644 index 0000000000..6164736d7f --- /dev/null +++ b/bindgen/raze/remote/termion-1.5.1.BUILD @@ -0,0 +1,59 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "alternate_screen" with type "example" omitted +# Unsupported target "alternate_screen_raw" with type "example" omitted +# Unsupported target "async" with type "example" omitted +# Unsupported target "click" with type "example" omitted +# Unsupported target "color" with type "example" omitted +# Unsupported target "commie" with type "example" omitted +# Unsupported target "detect_color" with type "example" omitted +# Unsupported target "is_tty" with type "example" omitted +# Unsupported target "keys" with type "example" omitted +# Unsupported target "mouse" with type "example" omitted +# Unsupported target "rainbow" with type "example" omitted +# Unsupported target "read" with type "example" omitted +# Unsupported target "rustc_fun" with type "example" omitted +# Unsupported target "simple" with type "example" omitted +# Unsupported target "size" with type "example" omitted + +rust_library( + name = "termion", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + "@raze__libc__0_2_48//:libc", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "1.5.1", + crate_features = [ + ], +) + +# Unsupported target "truecolor" with type "example" omitted diff --git a/bindgen/raze/remote/textwrap-0.10.0.BUILD b/bindgen/raze/remote/textwrap-0.10.0.BUILD new file mode 100644 index 0000000000..777f38550b --- /dev/null +++ b/bindgen/raze/remote/textwrap-0.10.0.BUILD @@ -0,0 +1,47 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "layout" with type "example" omitted +# Unsupported target "linear" with type "bench" omitted +# Unsupported target "termwidth" with type "example" omitted + +rust_library( + name = "textwrap", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + "@raze__unicode_width__0_1_5//:unicode_width", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.10.0", + crate_features = [ + ], +) + +# Unsupported target "version-numbers" with type "test" omitted diff --git a/bindgen/raze/remote/thread_local-0.3.6.BUILD b/bindgen/raze/remote/thread_local-0.3.6.BUILD new file mode 100644 index 0000000000..bc76676167 --- /dev/null +++ b/bindgen/raze/remote/thread_local-0.3.6.BUILD @@ -0,0 +1,44 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "Apache-2.0,MIT" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "thread_local" with type "bench" omitted + +rust_library( + name = "thread_local", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + "@raze__lazy_static__1_2_0//:lazy_static", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.3.6", + crate_features = [ + ], +) + diff --git a/bindgen/raze/remote/ucd-util-0.1.3.BUILD b/bindgen/raze/remote/ucd-util-0.1.3.BUILD new file mode 100644 index 0000000000..6f8688e407 --- /dev/null +++ b/bindgen/raze/remote/ucd-util-0.1.3.BUILD @@ -0,0 +1,42 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT,Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + + +rust_library( + name = "ucd_util", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.1.3", + crate_features = [ + ], +) + diff --git a/bindgen/raze/remote/unicode-width-0.1.5.BUILD b/bindgen/raze/remote/unicode-width-0.1.5.BUILD new file mode 100644 index 0000000000..1ab5a8a3e6 --- /dev/null +++ b/bindgen/raze/remote/unicode-width-0.1.5.BUILD @@ -0,0 +1,43 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT,Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + + +rust_library( + name = "unicode_width", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.1.5", + crate_features = [ + "default", + ], +) + diff --git a/bindgen/raze/remote/unicode-xid-0.1.0.BUILD b/bindgen/raze/remote/unicode-xid-0.1.0.BUILD new file mode 100644 index 0000000000..511fcf8c82 --- /dev/null +++ b/bindgen/raze/remote/unicode-xid-0.1.0.BUILD @@ -0,0 +1,43 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT,Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + + +rust_library( + name = "unicode_xid", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.1.0", + crate_features = [ + "default", + ], +) + diff --git a/bindgen/raze/remote/utf8-ranges-1.0.2.BUILD b/bindgen/raze/remote/utf8-ranges-1.0.2.BUILD new file mode 100644 index 0000000000..c2993e17ea --- /dev/null +++ b/bindgen/raze/remote/utf8-ranges-1.0.2.BUILD @@ -0,0 +1,44 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT" + "unencumbered", # "Unlicense" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "bench" with type "bench" omitted + +rust_library( + name = "utf8_ranges", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "1.0.2", + crate_features = [ + ], +) + diff --git a/bindgen/raze/remote/vec_map-0.8.1.BUILD b/bindgen/raze/remote/vec_map-0.8.1.BUILD new file mode 100644 index 0000000000..4309bea127 --- /dev/null +++ b/bindgen/raze/remote/vec_map-0.8.1.BUILD @@ -0,0 +1,42 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT,Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + + +rust_library( + name = "vec_map", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.8.1", + crate_features = [ + ], +) + diff --git a/bindgen/raze/remote/which-1.0.5.BUILD b/bindgen/raze/remote/which-1.0.5.BUILD new file mode 100644 index 0000000000..cc92293b83 --- /dev/null +++ b/bindgen/raze/remote/which-1.0.5.BUILD @@ -0,0 +1,43 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + + +rust_library( + name = "which", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + "@raze__libc__0_2_48//:libc", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "1.0.5", + crate_features = [ + ], +) + diff --git a/bindgen/raze/remote/winapi-0.3.6.BUILD b/bindgen/raze/remote/winapi-0.3.6.BUILD new file mode 100644 index 0000000000..57928ac2ce --- /dev/null +++ b/bindgen/raze/remote/winapi-0.3.6.BUILD @@ -0,0 +1,54 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT,Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "build-script-build" with type "custom-build" omitted + +rust_library( + name = "winapi", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.3.6", + crate_features = [ + "consoleapi", + "errhandlingapi", + "fileapi", + "libloaderapi", + "minwinbase", + "minwindef", + "processenv", + "std", + "winbase", + "wincon", + "winerror", + ], +) + diff --git a/bindgen/raze/remote/winapi-i686-pc-windows-gnu-0.4.0.BUILD b/bindgen/raze/remote/winapi-i686-pc-windows-gnu-0.4.0.BUILD new file mode 100644 index 0000000000..11e2028209 --- /dev/null +++ b/bindgen/raze/remote/winapi-i686-pc-windows-gnu-0.4.0.BUILD @@ -0,0 +1,43 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT,Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "build-script-build" with type "custom-build" omitted + +rust_library( + name = "winapi_i686_pc_windows_gnu", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.4.0", + crate_features = [ + ], +) + diff --git a/bindgen/raze/remote/winapi-util-0.1.1.BUILD b/bindgen/raze/remote/winapi-util-0.1.1.BUILD new file mode 100644 index 0000000000..1bfd949402 --- /dev/null +++ b/bindgen/raze/remote/winapi-util-0.1.1.BUILD @@ -0,0 +1,43 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT" + "unencumbered", # "Unlicense" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + + +rust_library( + name = "winapi_util", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.1.1", + crate_features = [ + ], +) + diff --git a/bindgen/raze/remote/winapi-x86_64-pc-windows-gnu-0.4.0.BUILD b/bindgen/raze/remote/winapi-x86_64-pc-windows-gnu-0.4.0.BUILD new file mode 100644 index 0000000000..cba7ac0bca --- /dev/null +++ b/bindgen/raze/remote/winapi-x86_64-pc-windows-gnu-0.4.0.BUILD @@ -0,0 +1,43 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT,Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "build-script-build" with type "custom-build" omitted + +rust_library( + name = "winapi_x86_64_pc_windows_gnu", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.4.0", + crate_features = [ + ], +) + diff --git a/bindgen/raze/remote/wincolor-1.0.1.BUILD b/bindgen/raze/remote/wincolor-1.0.1.BUILD new file mode 100644 index 0000000000..edcc7e63cd --- /dev/null +++ b/bindgen/raze/remote/wincolor-1.0.1.BUILD @@ -0,0 +1,45 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bindgen/raze", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT" + "unencumbered", # "Unlicense" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + + +rust_library( + name = "wincolor", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + "@raze__winapi__0_3_6//:winapi", + "@raze__winapi_util__0_1_1//:winapi_util", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "1.0.1", + crate_features = [ + ], +) + diff --git a/bindgen/repositories.bzl b/bindgen/repositories.bzl index 5f0b996ccc..ee985be195 100644 --- a/bindgen/repositories.bzl +++ b/bindgen/repositories.bzl @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# load("//bindgen/raze:crates.bzl", _cargo_repositories = "raze_fetch_remote_crates") +load("//bindgen/raze:crates.bzl", "raze_fetch_remote_crates") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def maybe(workspace_rule, **kwargs): @@ -55,6 +55,7 @@ cc_library( # TODO(marco): # 1. Vendor bindgen with raze... # 2. Make rustfmt optional + raze_fetch_remote_crates() maybe( native.new_local_repository, name = "local_cargo", From 40e5d52abfb33e956c4bab468fa863e1f4ead40e Mon Sep 17 00:00:00 2001 From: Marco Farrugia Date: Sun, 27 Jan 2019 15:23:18 -0500 Subject: [PATCH 06/30] Use raze (with hacks) for getting the bindgen binary. genrule and actions don't seem to be able to call 'tar' anymore, on bazel 21 installed with nix, on ubuntu 18.04 ... might need to turn the build script genrules into a rule --- bindgen/BUILD | 2 +- bindgen/raze/Cargo.toml | 10 +++++----- bindgen/raze/crates.bzl | 2 +- bindgen/raze/remote/bindgen-0.40.0.BUILD | 3 ++- bindgen/repositories.bzl | 6 ------ rust/private/rustc.bzl | 7 +++++-- 6 files changed, 14 insertions(+), 16 deletions(-) diff --git a/bindgen/BUILD b/bindgen/BUILD index db60963f03..9d0164626a 100644 --- a/bindgen/BUILD +++ b/bindgen/BUILD @@ -6,7 +6,7 @@ toolchain_type(name = "bindgen_toolchain") rust_bindgen_toolchain( name = "example-bindgen-toolchain-impl", - bindgen = "@local_cargo//:bindgen", + bindgen = "//bindgen/raze:cargo_bin_bindgen", clang = "@clang//:clang", libclang = "@clang//:libclang.so", libstdcxx = "@local_linux//:libstdc++", diff --git a/bindgen/raze/Cargo.toml b/bindgen/raze/Cargo.toml index a0ecc8a3ca..cbf38a6552 100644 --- a/bindgen/raze/Cargo.toml +++ b/bindgen/raze/Cargo.toml @@ -3,17 +3,17 @@ genmode = "Remote" workspace_path = "//bindgen/raze" [dependencies] -# TODO: 47 requires changes +# TODO: Using "0.47.0" requires yet more overrides for building clang-sys '0.27.0'. bindgen = "0.40.0" [raze.crates.bindgen.'0.40.0'] gen_buildrs = true extra_aliased_targets = ["cargo_bin_bindgen"] -[raze.crates.clang-sys.'0.23.0'] -# gen_buildrs = true - -# TODO: https://github.com/google/cargo-raze/issues/58 +# TODO: Un-patch crates.bzl +# See https://github.com/google/cargo-raze/issues/58 +# [raze.crates.libloading.'0.5.0'] +# custom_build_file_path = "//bindgen/raze:libloading.BUILD" [package] name = "fake_lib" diff --git a/bindgen/raze/crates.bzl b/bindgen/raze/crates.bzl index 4e0de7bdb9..935229e1ad 100644 --- a/bindgen/raze/crates.bzl +++ b/bindgen/raze/crates.bzl @@ -157,7 +157,7 @@ def raze_fetch_remote_crates(): type = "tar.gz", sha256 = "9c3ad660d7cb8c5822cd83d10897b0f1f1526792737a179e73896152f85b88c2", strip_prefix = "libloading-0.5.0", - build_file = Label("//bindgen/raze/remote:libloading-0.5.0.BUILD") + build_file = Label("//bindgen/raze:libloading.BUILD") ) _new_http_archive( diff --git a/bindgen/raze/remote/bindgen-0.40.0.BUILD b/bindgen/raze/remote/bindgen-0.40.0.BUILD index 22728046e1..cad1b4383d 100644 --- a/bindgen/raze/remote/bindgen-0.40.0.BUILD +++ b/bindgen/raze/remote/bindgen-0.40.0.BUILD @@ -64,7 +64,8 @@ genrule( + " export OUT_DIR=$$PWD/bindgen_out_dir_outputs;" + " export BINARY_PATH=\"$$PWD/$(location :bindgen_build_script)\";" + " export OUT_TAR=$$PWD/$@;" - + " cd $$(dirname $(location :Cargo.toml)) && $$BINARY_PATH && tar -czf $$OUT_TAR -C $$OUT_DIR .)" + + " export PATH=$$PATH:/bin/;" + + " cd $$(dirname $(location :Cargo.toml)) && $$BINARY_PATH && /bin/tar -czf $$OUT_TAR -C $$OUT_DIR .)" ) rust_binary( diff --git a/bindgen/repositories.bzl b/bindgen/repositories.bzl index ee985be195..0fafeee26b 100644 --- a/bindgen/repositories.bzl +++ b/bindgen/repositories.bzl @@ -53,7 +53,6 @@ cc_library( ) # TODO(marco): - # 1. Vendor bindgen with raze... # 2. Make rustfmt optional raze_fetch_remote_crates() maybe( @@ -63,11 +62,6 @@ cc_library( build_file_content = """ package(default_visibility = ["//visibility:public"]) -sh_binary( - name = "bindgen", - srcs = ["bin/bindgen"], -) - sh_binary( name = "rustfmt", srcs = ["bin/rustfmt"], diff --git a/rust/private/rustc.bzl b/rust/private/rustc.bzl index 028015d992..35ca622a91 100644 --- a/rust/private/rustc.bzl +++ b/rust/private/rustc.bzl @@ -258,7 +258,10 @@ def rustc_compile_action( package_dir = ctx.build_file_path[:ctx.build_file_path.rfind("/")] manifest_dir_env = "CARGO_MANIFEST_DIR=$(pwd)/{} ".format(package_dir) command = '{}{}{} "$@" --remap-path-prefix="$(pwd)"=__bazel_redacted_pwd'.format( - manifest_dir_env, out_dir_env, toolchain.rustc.path) + manifest_dir_env, + out_dir_env, + toolchain.rustc.path, + ) ctx.actions.run_shell( command = command, @@ -297,7 +300,7 @@ def _create_out_dir_action(ctx): out_dir = ctx.actions.declare_directory(ctx.label.name + ".out_dir") ctx.actions.run_shell( # TODO: Remove system tar usage - command = "rm -fr {dir} && mkdir {dir} && tar -xzf {tar} -C {dir}".format(tar = tar_file.path, dir = out_dir.path), + command = "rm -fr {dir} && mkdir {dir} && env PATH=$PATH:/bin tar -xzf {tar} -C {dir}".format(tar = tar_file.path, dir = out_dir.path), inputs = [tar_file], outputs = [out_dir], use_default_shell_env = True, # Sets PATH for tar and gzip (tar's dependency) From 7209c283165ddcbb548aa9c9d7fc395605a64129 Mon Sep 17 00:00:00 2001 From: Marco Farrugia Date: Sun, 27 Jan 2019 15:23:18 -0500 Subject: [PATCH 07/30] Make rustfmt optional and tidy it all up. --- bindgen/BUILD | 1 - bindgen/bindgen.bzl | 19 +++++++++++------ bindgen/local_linux.BUILD | 8 +++++++ bindgen/repositories.bzl | 45 ++++++++------------------------------- 4 files changed, 29 insertions(+), 44 deletions(-) create mode 100644 bindgen/local_linux.BUILD diff --git a/bindgen/BUILD b/bindgen/BUILD index 9d0164626a..6df952df7c 100644 --- a/bindgen/BUILD +++ b/bindgen/BUILD @@ -10,7 +10,6 @@ rust_bindgen_toolchain( clang = "@clang//:clang", libclang = "@clang//:libclang.so", libstdcxx = "@local_linux//:libstdc++", - rustfmt = "@local_cargo//:rustfmt", ) toolchain( diff --git a/bindgen/bindgen.bzl b/bindgen/bindgen.bzl index 6360ea3da5..110a1b50dc 100644 --- a/bindgen/bindgen.bzl +++ b/bindgen/bindgen.bzl @@ -54,6 +54,7 @@ rust_bindgen_toolchain = rule( "rustfmt": attr.label( executable = True, cfg = "host", + mandatory = False, ), }, ) @@ -89,7 +90,10 @@ def _rust_bindgen(ctx): [f.dirname for f in cc_lib.cc.transitive_headers] ) - unformatted = ctx.actions.declare_file(output.basename + ".unformatted") + if rustfmt: + unformatted = ctx.actions.declare_file(output.basename + ".unformatted") + else: + unformatted = output args = ctx.actions.args() args.add_all(bindgen_args) @@ -121,12 +125,13 @@ def _rust_bindgen(ctx): tools=[clang], ) - ctx.actions.run_shell( - inputs=depset([rustfmt, unformatted]), - outputs=[output], - command="{} --emit stdout --quiet {} > {}".format(rustfmt.path, unformatted.path, output.path), - tools=[rustfmt], - ) + if rustfmt: + ctx.actions.run_shell( + inputs=depset([rustfmt, unformatted]), + outputs=[output], + command="{} --emit stdout --quiet {} > {}".format(rustfmt.path, unformatted.path, output.path), + tools=[rustfmt], + ) rust_bindgen = rule( _rust_bindgen, diff --git a/bindgen/local_linux.BUILD b/bindgen/local_linux.BUILD new file mode 100644 index 0000000000..7ec53700b3 --- /dev/null +++ b/bindgen/local_linux.BUILD @@ -0,0 +1,8 @@ +package(default_visibility = ["//visibility:public"]) + +cc_library( + name = "libstdc++", + srcs = [ + "libstdc++.so.6", + ], +) \ No newline at end of file diff --git a/bindgen/repositories.bzl b/bindgen/repositories.bzl index 0fafeee26b..2e54ab9854 100644 --- a/bindgen/repositories.bzl +++ b/bindgen/repositories.bzl @@ -20,12 +20,16 @@ def maybe(workspace_rule, **kwargs): workspace_rule(**kwargs) def rust_bindgen_repositories(): - # nb. The bindgen rule should work on any platform. + """Declare dependencies needed for bindgen.""" + + # nb. The bindgen rule itself should work on any platform. _linux_rust_bindgen_repositories() -def _linux_rust_bindgen_repositories(): - """Declare dependencies needed for bindgen.""" + raze_fetch_remote_crates() + + native.register_toolchains("@io_bazel_rules_rust//bindgen:example-bindgen-toolchain") +def _linux_rust_bindgen_repositories(): maybe( http_archive, name = "clang", @@ -35,41 +39,10 @@ def _linux_rust_bindgen_repositories(): build_file = "@//bindgen:clang.BUILD", ) - # TODO: We should be able to pull libstdc++ out of the cc_toolchain eventually. + # TODO: We should be able to pull libstdc++ from the cc_toolchain eventually. maybe( native.new_local_repository, name = "local_linux", path = "/usr/lib/x86_64-linux-gnu", - build_file_content = """ -package(default_visibility = ["//visibility:public"]) - -cc_library( - name = "libstdc++", - srcs = [ - "libstdc++.so.6", - ], -) -""", - ) - - # TODO(marco): - # 2. Make rustfmt optional - raze_fetch_remote_crates() - maybe( - native.new_local_repository, - name = "local_cargo", - path = "/home/marco/.cargo", - build_file_content = """ -package(default_visibility = ["//visibility:public"]) - -sh_binary( - name = "rustfmt", - srcs = ["bin/rustfmt"], -) -""", - ) - - # Register toolchains - native.register_toolchains( - "@io_bazel_rules_rust//bindgen:example-bindgen-toolchain", + build_file= "@//bindgen:local_linux.BUILD" ) From 80546088bd05c21f8d04aaaaeedb3f3c4ef6231e Mon Sep 17 00:00:00 2001 From: Marco Farrugia Date: Sun, 27 Jan 2019 15:23:18 -0500 Subject: [PATCH 08/30] add note --- bindgen/repositories.bzl | 1 + 1 file changed, 1 insertion(+) diff --git a/bindgen/repositories.bzl b/bindgen/repositories.bzl index 2e54ab9854..b6dfe6e1bd 100644 --- a/bindgen/repositories.bzl +++ b/bindgen/repositories.bzl @@ -30,6 +30,7 @@ def rust_bindgen_repositories(): native.register_toolchains("@io_bazel_rules_rust//bindgen:example-bindgen-toolchain") def _linux_rust_bindgen_repositories(): + # Releases @ http://releases.llvm.org/download.html maybe( http_archive, name = "clang", From ecb07c0315e53c0e8a19f053b889af670f99b4dc Mon Sep 17 00:00:00 2001 From: Marco Farrugia Date: Sun, 27 Jan 2019 15:23:18 -0500 Subject: [PATCH 09/30] buildifier --- bindgen/bindgen.bzl | 33 +++++++++++++++++---------------- bindgen/local_linux.BUILD | 2 +- bindgen/repositories.bzl | 2 +- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/bindgen/bindgen.bzl b/bindgen/bindgen.bzl index 110a1b50dc..7fa6b3d3c2 100644 --- a/bindgen/bindgen.bzl +++ b/bindgen/bindgen.bzl @@ -25,7 +25,7 @@ def rust_bindgen_library(name, header, cc_lib, bindgen_flags = []): rust_library( name = name, srcs = [name + "__bindgen.rs"], - deps = [cc_lib] + deps = [cc_lib], ) def _rust_bindgen_toolchain(ctx): @@ -66,6 +66,7 @@ def _rust_bindgen(ctx): rustfmt = bt.rustfmt clang = bt.clang libclang = bt.libclang + # TODO: This should not need to be explicitly provided, see below TODO. libstdcxx = bt.libstdcxx @@ -87,7 +88,7 @@ def _rust_bindgen(ctx): libclang_dir = libclang.cc.libs.to_list()[0].dirname include_directories = depset( - [f.dirname for f in cc_lib.cc.transitive_headers] + [f.dirname for f in cc_lib.cc.transitive_headers], ) if rustfmt: @@ -100,18 +101,18 @@ def _rust_bindgen(ctx): args.add(header.path) args.add("--output", unformatted.path) args.add("--") - args.add_all(include_directories, before_each="-I") + args.add_all(include_directories, before_each = "-I") args.add_all(clang_args) ctx.actions.run( - executable=bindgen, - inputs=depset( + executable = bindgen, + inputs = depset( [header], - transitive=[cc_lib.cc.transitive_headers, libclang.cc.libs, libstdcxx.cc.libs], + transitive = [cc_lib.cc.transitive_headers, libclang.cc.libs, libstdcxx.cc.libs], ), - outputs=[unformatted], - mnemonic="RustBindgen", - progress_message="Generating bindings for {}..".format(header.path), - env={ + outputs = [unformatted], + mnemonic = "RustBindgen", + progress_message = "Generating bindings for {}..".format(header.path), + env = { "RUST_BACKTRACE": "1", "CLANG_PATH": clang.path, # Bindgen loads libclang at runtime, which also needs libstdc++, so we setup LD_LIBRARY_PATH @@ -121,16 +122,16 @@ def _rust_bindgen(ctx): # have a direct dependency on libstdc++.so "LD_LIBRARY_PATH": ":".join([f.dirname for f in libstdcxx.cc.libs]), }, - arguments=[args], - tools=[clang], + arguments = [args], + tools = [clang], ) if rustfmt: ctx.actions.run_shell( - inputs=depset([rustfmt, unformatted]), - outputs=[output], - command="{} --emit stdout --quiet {} > {}".format(rustfmt.path, unformatted.path, output.path), - tools=[rustfmt], + inputs = depset([rustfmt, unformatted]), + outputs = [output], + command = "{} --emit stdout --quiet {} > {}".format(rustfmt.path, unformatted.path, output.path), + tools = [rustfmt], ) rust_bindgen = rule( diff --git a/bindgen/local_linux.BUILD b/bindgen/local_linux.BUILD index 7ec53700b3..8d3bab60ce 100644 --- a/bindgen/local_linux.BUILD +++ b/bindgen/local_linux.BUILD @@ -5,4 +5,4 @@ cc_library( srcs = [ "libstdc++.so.6", ], -) \ No newline at end of file +) diff --git a/bindgen/repositories.bzl b/bindgen/repositories.bzl index b6dfe6e1bd..57b21bcc04 100644 --- a/bindgen/repositories.bzl +++ b/bindgen/repositories.bzl @@ -45,5 +45,5 @@ def _linux_rust_bindgen_repositories(): native.new_local_repository, name = "local_linux", path = "/usr/lib/x86_64-linux-gnu", - build_file= "@//bindgen:local_linux.BUILD" + build_file = "@//bindgen:local_linux.BUILD", ) From c1baedbe82786083de312200a12e429230314d29 Mon Sep 17 00:00:00 2001 From: Marco Farrugia Date: Sun, 27 Jan 2019 15:23:18 -0500 Subject: [PATCH 10/30] Add docs and move stuff around. --- bindgen/bindgen.bzl | 98 +++++++++++++++++++++------------------------ 1 file changed, 46 insertions(+), 52 deletions(-) diff --git a/bindgen/bindgen.bzl b/bindgen/bindgen.bzl index 7fa6b3d3c2..7d42fb4336 100644 --- a/bindgen/bindgen.bzl +++ b/bindgen/bindgen.bzl @@ -15,12 +15,13 @@ load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain") load("@io_bazel_rules_rust//rust:rust.bzl", "rust_library") -def rust_bindgen_library(name, header, cc_lib, bindgen_flags = []): +def rust_bindgen_library(name, header, cc_lib, **kwargs): + """Generates a rust source file for `header`, and builds a rust_library.""" rust_bindgen( name = name + "__bindgen", header = header, cc_lib = cc_lib, - bindgen_flags = bindgen_flags, + **kwargs ) rust_library( name = name, @@ -41,48 +42,51 @@ rust_bindgen_toolchain = rule( _rust_bindgen_toolchain, attrs = { "bindgen": attr.label( - doc = "The location of a `bindgen` executable.", + doc = "The label of a `bindgen` executable.", executable = True, cfg = "host", ), - "clang": attr.label( + "rustfmt": attr.label( + doc = "The label of a `rustfmt` executable. If this is provided, generated sources will be formatted.", executable = True, cfg = "host", + mandatory = False, ), - "libclang": attr.label(), - "libstdcxx": attr.label(), - "rustfmt": attr.label( + "clang": attr.label( + doc = "The label of a `clang` executable.", executable = True, cfg = "host", - mandatory = False, + ), + "libclang": attr.label( + doc = "A cc_library that provides bindgen's runtime dependency on libclang.", + providers = ["cc"], + ), + "libstdcxx": attr.label( + doc = "A cc_library that satisfies libclang's libstdc++ dependency.", + providers = ["cc"], ), }, ) def _rust_bindgen(ctx): - bt = ctx.toolchains["@io_bazel_rules_rust//bindgen:bindgen_toolchain"] - - bindgen = bt.bindgen - rustfmt = bt.rustfmt - clang = bt.clang - libclang = bt.libclang - - # TODO: This should not need to be explicitly provided, see below TODO. - libstdcxx = bt.libstdcxx - - cc_toolchain = find_cpp_toolchain(ctx) - # nb. We can't grab the cc_library`s direct headers, so a header must be provided. cc_lib = ctx.attr.cc_lib - if not hasattr(cc_lib, "cc"): - fail("{} is not a cc_library".format(cc_lib)) header = ctx.file.header if header not in cc_lib.cc.transitive_headers: - fail("Header {} is not in {}'s transitive closure of headers.".format(ctx.attr.header, cc_lib)) + fail("Header {} is not in {}'s transitive headers.".format(ctx.attr.header, cc_lib), "header") - # rustfmt is not in the usual place, so bindgen would fail to find it + toolchain = ctx.toolchains["@io_bazel_rules_rust//bindgen:bindgen_toolchain"] + bindgen = toolchain.bindgen + rustfmt = toolchain.rustfmt + clang = toolchain.clang + libclang = toolchain.libclang + + # TODO: This should not need to be explicitly provided, see below TODO. + libstdcxx = toolchain.libstdcxx + + # rustfmt is not where bindgen expects to find it, so we format manually bindgen_args = ["--no-rustfmt-bindings"] + ctx.attr.bindgen_flags - clang_args = [] + clang_args = ctx.attr.clang_flags output = ctx.outputs.out @@ -117,9 +121,10 @@ def _rust_bindgen(ctx): "CLANG_PATH": clang.path, # Bindgen loads libclang at runtime, which also needs libstdc++, so we setup LD_LIBRARY_PATH "LIBCLANG_PATH": libclang_dir, - # TODO: If libclang were built by bazel w/ properly specified dependencies, it + # TODO: If libclang were built by bazel from source w/ properly specified dependencies, it # would have the correct rpaths and not require this nor would this rule # have a direct dependency on libstdc++.so + # This is unnecessary if the system libstdc++ suffices, which may not always be the case. "LD_LIBRARY_PATH": ":".join([f.dirname for f in libstdcxx.cc.libs]), }, arguments = [args], @@ -136,36 +141,25 @@ def _rust_bindgen(ctx): rust_bindgen = rule( _rust_bindgen, + doc = "Generates a rust source file from a cc_library and a header.", attrs = { - "header": attr.label(allow_single_file = True), - "cc_lib": attr.label(), - # An instance of cc_toolchain, used to find the standard library headers. - "_cc_toolchain": attr.label(default = Label("@bazel_tools//tools/cpp:current_cc_toolchain")), - "libstdcxx": attr.label(), - "bindgen_flags": attr.string_list(), + "header": attr.label( + doc = "The .h file to generate bindings for.", + allow_single_file = True, + ), + "cc_lib": attr.label( + doc = "The cc_library that contains the .h file. This is used to find the transitive includes.", + providers = ["cc"], + ), + "bindgen_flags": attr.string_list( + doc = "Flags to pass directly to the bindgen executable. See https://rust-lang.github.io/rust-bindgen/ for details.", + ), + "clang_flags": attr.string_list( + doc = "Flags to pass directly to the clang executable.", + ), }, - fragments = ["cpp"], outputs = {"out": "%{name}.rs"}, toolchains = [ - "@io_bazel_rules_rust//rust:toolchain", "@io_bazel_rules_rust//bindgen:bindgen_toolchain", ], ) - -""" -Generates a rust file from a cc_library and one of it's headers. - -TODO: Update docs for configuring toolchain. - -and then use it as follows: - -```python -load("@io_bazel_rules_rust//bindgen:bindgen.bzl", "rust_bindgen_library") - -rust_bindgen_library( - name = "example_ffi", - cc_lib = "//example:lib", - header = "//example:api.h", -) -``` -""" From 725501cb8b056009fd732f9dc0519bfda9a36b99 Mon Sep 17 00:00:00 2001 From: Marco Farrugia Date: Sun, 27 Jan 2019 15:23:18 -0500 Subject: [PATCH 11/30] tidy more --- bindgen/bindgen.bzl | 86 ++++++++++++++++++----------------- bindgen/raze/crates.bzl | 1 + bindgen/raze/libloading.BUILD | 8 ++-- bindgen/repositories.bzl | 2 +- 4 files changed, 50 insertions(+), 47 deletions(-) diff --git a/bindgen/bindgen.bzl b/bindgen/bindgen.bzl index 7d42fb4336..31914ade61 100644 --- a/bindgen/bindgen.bzl +++ b/bindgen/bindgen.bzl @@ -12,11 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain") load("@io_bazel_rules_rust//rust:rust.bzl", "rust_library") def rust_bindgen_library(name, header, cc_lib, **kwargs): """Generates a rust source file for `header`, and builds a rust_library.""" + rust_bindgen( name = name + "__bindgen", header = header, @@ -29,46 +29,7 @@ def rust_bindgen_library(name, header, cc_lib, **kwargs): deps = [cc_lib], ) -def _rust_bindgen_toolchain(ctx): - return platform_common.ToolchainInfo( - bindgen = ctx.executable.bindgen, - clang = ctx.executable.clang, - libclang = ctx.attr.libclang, - libstdcxx = ctx.attr.libstdcxx, - rustfmt = ctx.executable.rustfmt, - ) - -rust_bindgen_toolchain = rule( - _rust_bindgen_toolchain, - attrs = { - "bindgen": attr.label( - doc = "The label of a `bindgen` executable.", - executable = True, - cfg = "host", - ), - "rustfmt": attr.label( - doc = "The label of a `rustfmt` executable. If this is provided, generated sources will be formatted.", - executable = True, - cfg = "host", - mandatory = False, - ), - "clang": attr.label( - doc = "The label of a `clang` executable.", - executable = True, - cfg = "host", - ), - "libclang": attr.label( - doc = "A cc_library that provides bindgen's runtime dependency on libclang.", - providers = ["cc"], - ), - "libstdcxx": attr.label( - doc = "A cc_library that satisfies libclang's libstdc++ dependency.", - providers = ["cc"], - ), - }, -) - -def _rust_bindgen(ctx): +def _rust_bindgen_impl(ctx): # nb. We can't grab the cc_library`s direct headers, so a header must be provided. cc_lib = ctx.attr.cc_lib header = ctx.file.header @@ -90,6 +51,7 @@ def _rust_bindgen(ctx): output = ctx.outputs.out + # libclang should only have 1 output file libclang_dir = libclang.cc.libs.to_list()[0].dirname include_directories = depset( [f.dirname for f in cc_lib.cc.transitive_headers], @@ -140,7 +102,7 @@ def _rust_bindgen(ctx): ) rust_bindgen = rule( - _rust_bindgen, + _rust_bindgen_impl, doc = "Generates a rust source file from a cc_library and a header.", attrs = { "header": attr.label( @@ -163,3 +125,43 @@ rust_bindgen = rule( "@io_bazel_rules_rust//bindgen:bindgen_toolchain", ], ) + +def _rust_bindgen_toolchain_impl(ctx): + return platform_common.ToolchainInfo( + bindgen = ctx.executable.bindgen, + clang = ctx.executable.clang, + libclang = ctx.attr.libclang, + libstdcxx = ctx.attr.libstdcxx, + rustfmt = ctx.executable.rustfmt, + ) + +rust_bindgen_toolchain = rule( + _rust_bindgen_toolchain_impl, + doc = "The tools required for the `rust_bindgen` rule.", + attrs = { + "bindgen": attr.label( + doc = "The label of a `bindgen` executable.", + executable = True, + cfg = "host", + ), + "rustfmt": attr.label( + doc = "The label of a `rustfmt` executable. If this is provided, generated sources will be formatted.", + executable = True, + cfg = "host", + mandatory = False, + ), + "clang": attr.label( + doc = "The label of a `clang` executable.", + executable = True, + cfg = "host", + ), + "libclang": attr.label( + doc = "A cc_library that provides bindgen's runtime dependency on libclang.", + providers = ["cc"], + ), + "libstdcxx": attr.label( + doc = "A cc_library that satisfies libclang's libstdc++ dependency.", + providers = ["cc"], + ), + }, +) \ No newline at end of file diff --git a/bindgen/raze/crates.bzl b/bindgen/raze/crates.bzl index 935229e1ad..c4a11e41e8 100644 --- a/bindgen/raze/crates.bzl +++ b/bindgen/raze/crates.bzl @@ -157,6 +157,7 @@ def raze_fetch_remote_crates(): type = "tar.gz", sha256 = "9c3ad660d7cb8c5822cd83d10897b0f1f1526792737a179e73896152f85b88c2", strip_prefix = "libloading-0.5.0", + # TODO: This is a manual patch, need https://github.com/google/cargo-raze/issues/58 build_file = Label("//bindgen/raze:libloading.BUILD") ) diff --git a/bindgen/raze/libloading.BUILD b/bindgen/raze/libloading.BUILD index 84dee9a6cd..9843eacdac 100644 --- a/bindgen/raze/libloading.BUILD +++ b/bindgen/raze/libloading.BUILD @@ -2,7 +2,7 @@ OVERRIDDEN: cargo-raze crate build file. -- Libloading has a CC dep that needs to be brought in +- Libloading has a CC dep that needs to be built. """ package(default_visibility = ["//visibility:public"]) @@ -13,10 +13,10 @@ licenses([ load( "@io_bazel_rules_rust//rust:rust.bzl", - "rust_library", + "rust_benchmark", "rust_binary", + "rust_library", "rust_test", - "rust_benchmark", ) cc_library( @@ -24,7 +24,7 @@ cc_library( srcs = [ "src/os/unix/global_static.c", ], - copts = [ "-fPIC" ], + copts = ["-fPIC"], ) rust_library( diff --git a/bindgen/repositories.bzl b/bindgen/repositories.bzl index 57b21bcc04..c98ebbde8e 100644 --- a/bindgen/repositories.bzl +++ b/bindgen/repositories.bzl @@ -40,7 +40,7 @@ def _linux_rust_bindgen_repositories(): build_file = "@//bindgen:clang.BUILD", ) - # TODO: We should be able to pull libstdc++ from the cc_toolchain eventually. + # TODO: We should be able to locate libstdc++ via cc_toolchain eventually. maybe( native.new_local_repository, name = "local_linux", From 5070b0af8118cf794a3db1a808876ce126862890 Mon Sep 17 00:00:00 2001 From: Marco Farrugia Date: Sun, 27 Jan 2019 15:23:18 -0500 Subject: [PATCH 12/30] var renames --- bindgen/bindgen.bzl | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/bindgen/bindgen.bzl b/bindgen/bindgen.bzl index 31914ade61..6a57b3b0bd 100644 --- a/bindgen/bindgen.bzl +++ b/bindgen/bindgen.bzl @@ -37,9 +37,9 @@ def _rust_bindgen_impl(ctx): fail("Header {} is not in {}'s transitive headers.".format(ctx.attr.header, cc_lib), "header") toolchain = ctx.toolchains["@io_bazel_rules_rust//bindgen:bindgen_toolchain"] - bindgen = toolchain.bindgen - rustfmt = toolchain.rustfmt - clang = toolchain.clang + bindgen_bin = toolchain.bindgen + rustfmt_bin = toolchain.rustfmt + clang_bin = toolchain.clang libclang = toolchain.libclang # TODO: This should not need to be explicitly provided, see below TODO. @@ -57,30 +57,30 @@ def _rust_bindgen_impl(ctx): [f.dirname for f in cc_lib.cc.transitive_headers], ) - if rustfmt: - unformatted = ctx.actions.declare_file(output.basename + ".unformatted") + if rustfmt_bin: + unformatted_output = ctx.actions.declare_file(output.basename + ".unformatted") else: - unformatted = output + unformatted_output = output args = ctx.actions.args() args.add_all(bindgen_args) args.add(header.path) - args.add("--output", unformatted.path) + args.add("--output", unformatted_output.path) args.add("--") args.add_all(include_directories, before_each = "-I") args.add_all(clang_args) ctx.actions.run( - executable = bindgen, + executable = bindgen_bin, inputs = depset( [header], transitive = [cc_lib.cc.transitive_headers, libclang.cc.libs, libstdcxx.cc.libs], ), - outputs = [unformatted], + outputs = [unformatted_output], mnemonic = "RustBindgen", progress_message = "Generating bindings for {}..".format(header.path), env = { "RUST_BACKTRACE": "1", - "CLANG_PATH": clang.path, + "CLANG_PATH": clang_bin.path, # Bindgen loads libclang at runtime, which also needs libstdc++, so we setup LD_LIBRARY_PATH "LIBCLANG_PATH": libclang_dir, # TODO: If libclang were built by bazel from source w/ properly specified dependencies, it @@ -90,15 +90,15 @@ def _rust_bindgen_impl(ctx): "LD_LIBRARY_PATH": ":".join([f.dirname for f in libstdcxx.cc.libs]), }, arguments = [args], - tools = [clang], + tools = [clang_bin], ) - if rustfmt: + if rustfmt_bin: ctx.actions.run_shell( - inputs = depset([rustfmt, unformatted]), + inputs = depset([rustfmt_bin, unformatted_output]), outputs = [output], - command = "{} --emit stdout --quiet {} > {}".format(rustfmt.path, unformatted.path, output.path), - tools = [rustfmt], + command = "{} --emit stdout --quiet {} > {}".format(rustfmt_bin.path, unformatted_output.path, output.path), + tools = [rustfmt_bin], ) rust_bindgen = rule( From 65c10d4aa9ee2ff60cc2002bfddfad2c74f0e73c Mon Sep 17 00:00:00 2001 From: Marco Farrugia Date: Sun, 27 Jan 2019 15:52:03 -0500 Subject: [PATCH 13/30] Add ubuntu 18.04 to .bazelci --- .bazelci/presubmit.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 987d2e4675..01009ceba9 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -10,6 +10,9 @@ platforms: ubuntu1604: build_targets: *default_targets test_targets: *default_targets + ubuntu1804: + build_targets: *default_targets + test_targets: *default_targets macos: osx_targets: &osx_targets - "--" # Allows negative patterns; hack for https://github.com/bazelbuild/continuous-integration/pull/245 From 2534cd53c665af30a6522935637e70f8c978b6fa Mon Sep 17 00:00:00 2001 From: Marco Farrugia Date: Sun, 27 Jan 2019 16:03:54 -0500 Subject: [PATCH 14/30] Only run bindgen examples on ubuntu 18.04 --- .bazelci/presubmit.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 01009ceba9..aba651513b 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -1,8 +1,11 @@ --- default_targets: &default_targets +- "--" # Allows negative patterns; hack for https://github.com/bazelbuild/continuous-integration/pull/245 - "..." - "@docs//..." - "@examples//..." +# Bindgen currently only has a working toolchain for 18.04 +- "-@examples//ffi/rust_calling_c/simple/..." platforms: ubuntu1404: build_targets: *default_targets @@ -12,16 +15,20 @@ platforms: test_targets: *default_targets ubuntu1804: build_targets: *default_targets - test_targets: *default_targets + test_targets: + - "..." + - "@docs//..." + - "@examples//..." macos: osx_targets: &osx_targets - - "--" # Allows negative patterns; hack for https://github.com/bazelbuild/continuous-integration/pull/245 + - "--" - "..." - "@docs//..." - "@examples//..." # Skip tests for dylib support on osx, since we don't support it yet. - "-@examples//ffi/rust_calling_c:matrix_dylib_test" - "-@examples//ffi/rust_calling_c:matrix_dynamically_linked" + - "-@examples//ffi/rust_calling_c/simple/..." build_targets: *osx_targets test_targets: *osx_targets rbe_ubuntu1604: @@ -35,3 +42,4 @@ platforms: - "-@examples//fibonacci:fibonacci_doc_test" - "-@examples//hello_lib:hello_lib_doc_test" - "-//tools/runfiles:runfiles_doc_test" + - "-@examples//ffi/rust_calling_c/simple/..." From 4bbcb7a4e4bfbdb090dafa48793a2627fd312e60 Mon Sep 17 00:00:00 2001 From: Marco Farrugia Date: Sun, 3 Feb 2019 14:50:11 -0500 Subject: [PATCH 15/30] revert tar path change --- rust/private/rustc.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/private/rustc.bzl b/rust/private/rustc.bzl index 35ca622a91..470a85ee53 100644 --- a/rust/private/rustc.bzl +++ b/rust/private/rustc.bzl @@ -300,7 +300,7 @@ def _create_out_dir_action(ctx): out_dir = ctx.actions.declare_directory(ctx.label.name + ".out_dir") ctx.actions.run_shell( # TODO: Remove system tar usage - command = "rm -fr {dir} && mkdir {dir} && env PATH=$PATH:/bin tar -xzf {tar} -C {dir}".format(tar = tar_file.path, dir = out_dir.path), + command = "rm -fr {dir} && mkdir {dir} && tar -xzf {tar} -C {dir}".format(tar = tar_file.path, dir = out_dir.path), inputs = [tar_file], outputs = [out_dir], use_default_shell_env = True, # Sets PATH for tar and gzip (tar's dependency) From f558d5eb3c92f45f8c101f4cf64404924c82c1bd Mon Sep 17 00:00:00 2001 From: Marco Farrugia Date: Sun, 3 Feb 2019 14:50:11 -0500 Subject: [PATCH 16/30] Move override for libloading out of generated crates.bzl --- bindgen/raze/crates.bzl | 3 +-- bindgen/raze/libloading.BUILD | 19 +++++-------------- bindgen/raze/remote/bindgen-0.40.0.BUILD | 3 +-- bindgen/repositories.bzl | 12 ++++++++++++ 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/bindgen/raze/crates.bzl b/bindgen/raze/crates.bzl index c4a11e41e8..4e0de7bdb9 100644 --- a/bindgen/raze/crates.bzl +++ b/bindgen/raze/crates.bzl @@ -157,8 +157,7 @@ def raze_fetch_remote_crates(): type = "tar.gz", sha256 = "9c3ad660d7cb8c5822cd83d10897b0f1f1526792737a179e73896152f85b88c2", strip_prefix = "libloading-0.5.0", - # TODO: This is a manual patch, need https://github.com/google/cargo-raze/issues/58 - build_file = Label("//bindgen/raze:libloading.BUILD") + build_file = Label("//bindgen/raze/remote:libloading-0.5.0.BUILD") ) _new_http_archive( diff --git a/bindgen/raze/libloading.BUILD b/bindgen/raze/libloading.BUILD index 9843eacdac..7c02e573d2 100644 --- a/bindgen/raze/libloading.BUILD +++ b/bindgen/raze/libloading.BUILD @@ -5,8 +5,6 @@ cargo-raze crate build file. - Libloading has a CC dep that needs to be built. """ -package(default_visibility = ["//visibility:public"]) - licenses([ "notice", # "ISC" ]) @@ -20,24 +18,17 @@ load( ) cc_library( - name = "global_whatever", - srcs = [ - "src/os/unix/global_static.c", - ], + name = "global_static", + srcs = ["src/os/unix/global_static.c"], copts = ["-fPIC"], ) rust_library( name = "libloading", srcs = glob(["**/*.rs"]), - crate_features = [ - ], crate_root = "src/lib.rs", crate_type = "lib", - rustc_flags = [ - "--cap-lints=allow", - ], - deps = [ - ":global_whatever", - ], + rustc_flags = ["--cap-lints=allow"], + deps = [":global_static"], + visibility = ["//visibility:public"], ) diff --git a/bindgen/raze/remote/bindgen-0.40.0.BUILD b/bindgen/raze/remote/bindgen-0.40.0.BUILD index cad1b4383d..22728046e1 100644 --- a/bindgen/raze/remote/bindgen-0.40.0.BUILD +++ b/bindgen/raze/remote/bindgen-0.40.0.BUILD @@ -64,8 +64,7 @@ genrule( + " export OUT_DIR=$$PWD/bindgen_out_dir_outputs;" + " export BINARY_PATH=\"$$PWD/$(location :bindgen_build_script)\";" + " export OUT_TAR=$$PWD/$@;" - + " export PATH=$$PATH:/bin/;" - + " cd $$(dirname $(location :Cargo.toml)) && $$BINARY_PATH && /bin/tar -czf $$OUT_TAR -C $$OUT_DIR .)" + + " cd $$(dirname $(location :Cargo.toml)) && $$BINARY_PATH && tar -czf $$OUT_TAR -C $$OUT_DIR .)" ) rust_binary( diff --git a/bindgen/repositories.bzl b/bindgen/repositories.bzl index c98ebbde8e..5a8a309ca5 100644 --- a/bindgen/repositories.bzl +++ b/bindgen/repositories.bzl @@ -25,6 +25,18 @@ def rust_bindgen_repositories(): # nb. The bindgen rule itself should work on any platform. _linux_rust_bindgen_repositories() + # This overrides the BUILD file raze generates for libloading with a handwritten one. + # TODO: Tidier to implement https://github.com/google/cargo-raze/issues/58 + maybe( + http_archive, + name = "raze__libloading__0_5_0", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/libloading/libloading-0.5.0.crate", + type = "tar.gz", + sha256 = "9c3ad660d7cb8c5822cd83d10897b0f1f1526792737a179e73896152f85b88c2", + strip_prefix = "libloading-0.5.0", + # TODO: This is a manual patch, need https://github.com/google/cargo-raze/issues/58 + build_file = Label("//bindgen/raze:libloading.BUILD") + ) raze_fetch_remote_crates() native.register_toolchains("@io_bazel_rules_rust//bindgen:example-bindgen-toolchain") From 651627f1724c2dd2e8b453c210a3010e39c9b9e0 Mon Sep 17 00:00:00 2001 From: Marco Farrugia Date: Sun, 3 Feb 2019 14:50:11 -0500 Subject: [PATCH 17/30] Copyrights to 2019. --- bindgen/bindgen.bzl | 2 +- bindgen/repositories.bzl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bindgen/bindgen.bzl b/bindgen/bindgen.bzl index 6a57b3b0bd..d09116f01b 100644 --- a/bindgen/bindgen.bzl +++ b/bindgen/bindgen.bzl @@ -1,4 +1,4 @@ -# Copyright 2015 The Bazel Authors. All rights reserved. +# Copyright 2019 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/bindgen/repositories.bzl b/bindgen/repositories.bzl index 5a8a309ca5..a84505f9fd 100644 --- a/bindgen/repositories.bzl +++ b/bindgen/repositories.bzl @@ -1,4 +1,4 @@ -# Copyright 2018 The Bazel Authors. All rights reserved. +# Copyright 2019 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. From e824e0d307dd06ae4a4ec5cfa8f9ce75d6b70ef7 Mon Sep 17 00:00:00 2001 From: Marco Farrugia Date: Sun, 3 Feb 2019 14:50:11 -0500 Subject: [PATCH 18/30] Have macro forward kwargs to rust_library instead of rust_bindgen. --- bindgen/bindgen.bzl | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/bindgen/bindgen.bzl b/bindgen/bindgen.bzl index d09116f01b..5d7dc5e485 100644 --- a/bindgen/bindgen.bzl +++ b/bindgen/bindgen.bzl @@ -14,19 +14,31 @@ load("@io_bazel_rules_rust//rust:rust.bzl", "rust_library") -def rust_bindgen_library(name, header, cc_lib, **kwargs): - """Generates a rust source file for `header`, and builds a rust_library.""" +def rust_bindgen_library( + name, + header, + cc_lib, + bindgen_flags = None, + clang_flags = None, + **kwargs): + """ + Generates a rust source file for `header`, and builds a rust_library. + + `kwargs` are passed directly to the rust_library. + """ rust_bindgen( name = name + "__bindgen", header = header, cc_lib = cc_lib, - **kwargs + bindgen_flags = bindgen_flags or [], + clang_flags = clang_flags or [], ) rust_library( name = name, srcs = [name + "__bindgen.rs"], deps = [cc_lib], + **kwargs ) def _rust_bindgen_impl(ctx): @@ -164,4 +176,4 @@ rust_bindgen_toolchain = rule( providers = ["cc"], ), }, -) \ No newline at end of file +) From 45592dd2fe15af116e8e90f2f74506f292d3658c Mon Sep 17 00:00:00 2001 From: Marco Farrugia Date: Sun, 3 Feb 2019 14:50:11 -0500 Subject: [PATCH 19/30] Consolidate 'remove libstdc++ dep' todos. --- bindgen/bindgen.bzl | 11 ++++++----- bindgen/repositories.bzl | 1 - 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bindgen/bindgen.bzl b/bindgen/bindgen.bzl index 5d7dc5e485..e6007deee2 100644 --- a/bindgen/bindgen.bzl +++ b/bindgen/bindgen.bzl @@ -54,7 +54,12 @@ def _rust_bindgen_impl(ctx): clang_bin = toolchain.clang libclang = toolchain.libclang - # TODO: This should not need to be explicitly provided, see below TODO. + # TODO: This rule shouldn't need to depend on libstdc++ + # This rule requires an explicit dependency on a libstdc++ because + # 1. It is a runtime dependency of libclang.so + # 2. We cannot locate it in the cc_toolchain yet + # Depending on how libclang.so was compiled, it may try to locate its libstdc++ dependency + # in a way that makes our handling here unnecessary (eg. system /usr/lib/x86_64-linux-gnu/libstdc++.so.6) libstdcxx = toolchain.libstdcxx # rustfmt is not where bindgen expects to find it, so we format manually @@ -95,10 +100,6 @@ def _rust_bindgen_impl(ctx): "CLANG_PATH": clang_bin.path, # Bindgen loads libclang at runtime, which also needs libstdc++, so we setup LD_LIBRARY_PATH "LIBCLANG_PATH": libclang_dir, - # TODO: If libclang were built by bazel from source w/ properly specified dependencies, it - # would have the correct rpaths and not require this nor would this rule - # have a direct dependency on libstdc++.so - # This is unnecessary if the system libstdc++ suffices, which may not always be the case. "LD_LIBRARY_PATH": ":".join([f.dirname for f in libstdcxx.cc.libs]), }, arguments = [args], diff --git a/bindgen/repositories.bzl b/bindgen/repositories.bzl index a84505f9fd..0a11e6e741 100644 --- a/bindgen/repositories.bzl +++ b/bindgen/repositories.bzl @@ -52,7 +52,6 @@ def _linux_rust_bindgen_repositories(): build_file = "@//bindgen:clang.BUILD", ) - # TODO: We should be able to locate libstdc++ via cc_toolchain eventually. maybe( native.new_local_repository, name = "local_linux", From 485becc738febc9a5ec81f26cf394a040ec93734 Mon Sep 17 00:00:00 2001 From: Marco Farrugia Date: Sun, 3 Feb 2019 14:50:11 -0500 Subject: [PATCH 20/30] Rename @clang to @bindgen_clang --- bindgen/BUILD | 4 ++-- bindgen/repositories.bzl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bindgen/BUILD b/bindgen/BUILD index 6df952df7c..6d703cb69c 100644 --- a/bindgen/BUILD +++ b/bindgen/BUILD @@ -7,8 +7,8 @@ toolchain_type(name = "bindgen_toolchain") rust_bindgen_toolchain( name = "example-bindgen-toolchain-impl", bindgen = "//bindgen/raze:cargo_bin_bindgen", - clang = "@clang//:clang", - libclang = "@clang//:libclang.so", + clang = "@bindgen_clang//:clang", + libclang = "@bindgen_clang//:libclang.so", libstdcxx = "@local_linux//:libstdc++", ) diff --git a/bindgen/repositories.bzl b/bindgen/repositories.bzl index 0a11e6e741..65b305e0d6 100644 --- a/bindgen/repositories.bzl +++ b/bindgen/repositories.bzl @@ -45,7 +45,7 @@ def _linux_rust_bindgen_repositories(): # Releases @ http://releases.llvm.org/download.html maybe( http_archive, - name = "clang", + name = "bindgen_clang", urls = ["http://releases.llvm.org/7.0.1/clang+llvm-7.0.1-x86_64-linux-gnu-ubuntu-18.04.tar.xz"], strip_prefix = "clang+llvm-7.0.1-x86_64-linux-gnu-ubuntu-18.04", sha256 = "e74ce06d99ed9ce42898e22d2a966f71ae785bdf4edbded93e628d696858921a", From 25c3ca96526d24d8e548db9c0b404e0c3aa6a743 Mon Sep 17 00:00:00 2001 From: Marco Farrugia Date: Sun, 3 Feb 2019 14:50:11 -0500 Subject: [PATCH 21/30] Add more broken stubs for stardoc... --- bindgen/BUILD | 7 +++++++ bindgen/bindgen.bzl | 5 ++--- docs/BUILD | 6 +++++- docs/all.bzl | 10 ++++++++++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/bindgen/BUILD b/bindgen/BUILD index 6d703cb69c..d643955525 100644 --- a/bindgen/BUILD +++ b/bindgen/BUILD @@ -1,9 +1,16 @@ load("@io_bazel_rules_rust//bindgen:bindgen.bzl", "rust_bindgen_toolchain") +load("@bazel_skylib//:bzl_library.bzl", "bzl_library") package(default_visibility = ["//visibility:public"]) toolchain_type(name = "bindgen_toolchain") +bzl_library( + name = "rules", + srcs = glob(["**/*.bzl"]), + deps = ["@io_bazel_rules_rust//rust:rules"], +) + rust_bindgen_toolchain( name = "example-bindgen-toolchain-impl", bindgen = "//bindgen/raze:cargo_bin_bindgen", diff --git a/bindgen/bindgen.bzl b/bindgen/bindgen.bzl index e6007deee2..47b6e3d720 100644 --- a/bindgen/bindgen.bzl +++ b/bindgen/bindgen.bzl @@ -21,10 +21,9 @@ def rust_bindgen_library( bindgen_flags = None, clang_flags = None, **kwargs): - """ - Generates a rust source file for `header`, and builds a rust_library. + """Generates a rust source file for `header`, and builds a rust_library. - `kwargs` are passed directly to the rust_library. + Arguments are the same as `rust_bindgen`, and `kwargs` are passed directly to rust_library. """ rust_bindgen( diff --git a/docs/BUILD b/docs/BUILD index 9a70e5ee0e..4f94499d3f 100644 --- a/docs/BUILD +++ b/docs/BUILD @@ -17,9 +17,13 @@ stardoc( "rust_proto_toolchain", "rust_proto_library", "rust_grpc_library", + "rust_bindgen_toolchain", + "rust_bindgen", + "rust_bindgen_library", ], deps = [ - "@io_bazel_rules_rust//proto:rules", "@io_bazel_rules_rust//rust:rules", + "@io_bazel_rules_rust//proto:rules", + "@io_bazel_rules_rust//bindgen:rules", ], ) diff --git a/docs/all.bzl b/docs/all.bzl index df22002dfd..5919f27713 100644 --- a/docs/all.bzl +++ b/docs/all.bzl @@ -19,6 +19,11 @@ load("@io_bazel_rules_rust//proto:toolchain.bzl", _rust_proto_toolchain = "rust_ # _rust_library = "rust_library", # _rust_test = "rust_test", # ) +# load("@io_bazel_rules_rust//bindgen:bindgen.bzl", +# _rust_bindgen_toolchain = "rust_bindgen_toolchain", +# _rust_bindgen = "rust_bindgen", +# _rust_bindgen_library = "rust_bindgen_library", +# ) # # rust_library = _rust_library # rust_binary = _rust_binary @@ -29,6 +34,11 @@ load("@io_bazel_rules_rust//proto:toolchain.bzl", _rust_proto_toolchain = "rust_ # # rust_benchmark = _rust_benchmark # rust_proto_library = _rust_proto_library # rust_grpc_library = _rust_grpc_library +# +# rust_bindgen_toolchain = _rust_bindgen_toolchain +# # TODO: Macro documentation doesn't seem to work. +# # rust_bindgen = _rust_bindgen +# rust_bindgen_library = _rust_bindgen_library # TODO(stardoc): This aliasing isn't mentioned in the docs, but generated documentation is broken without it. rust_toolchain = _rust_toolchain From 11616c30922ac65cde6f409819f0dd4fb2e940c6 Mon Sep 17 00:00:00 2001 From: Marco Farrugia Date: Sun, 3 Feb 2019 14:50:11 -0500 Subject: [PATCH 22/30] Commit hackily generated rust_bindgen_toolchain doc ... --- docs/index.md | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/docs/index.md b/docs/index.md index e65bed66ca..a13e946675 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1248,4 +1248,76 @@ with the actual binaries and libraries. + +## rust_bindgen_toolchain +
+rust_bindgen_toolchain(name, bindgen, clang, libclang, libstdcxx, rustfmt)
+
+ +The tools required for the `rust_bindgen` rule. + +### Attributes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
name + Name; required +

+ A unique name for this target. +

+
bindgen + Label; optional +

+ The label of a `bindgen` executable. +

+
clang + Label; optional +

+ The label of a `clang` executable. +

+
libclang + Label; optional +

+ A cc_library that provides bindgen's runtime dependency on libclang. +

+
libstdcxx + Label; optional +

+ A cc_library that satisfies libclang's libstdc++ dependency. +

+
rustfmt + Label; optional +

+ The label of a `rustfmt` executable. If this is provided, generated sources will be formatted. +

+
From 243aa624cec561a0ed88c42aa96a5bf1fbb228f7 Mon Sep 17 00:00:00 2001 From: Marco Farrugia Date: Sun, 3 Feb 2019 14:50:11 -0500 Subject: [PATCH 23/30] Fix commented out lines. --- docs/all.bzl | 4 ++-- docs/index.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/all.bzl b/docs/all.bzl index 5919f27713..8e9034843a 100644 --- a/docs/all.bzl +++ b/docs/all.bzl @@ -36,9 +36,9 @@ load("@io_bazel_rules_rust//proto:toolchain.bzl", _rust_proto_toolchain = "rust_ # rust_grpc_library = _rust_grpc_library # # rust_bindgen_toolchain = _rust_bindgen_toolchain +# rust_bindgen = _rust_bindgen # # TODO: Macro documentation doesn't seem to work. -# # rust_bindgen = _rust_bindgen -# rust_bindgen_library = _rust_bindgen_library +# # rust_bindgen_library = _rust_bindgen_library # TODO(stardoc): This aliasing isn't mentioned in the docs, but generated documentation is broken without it. rust_toolchain = _rust_toolchain diff --git a/docs/index.md b/docs/index.md index a13e946675..330d779b44 100644 --- a/docs/index.md +++ b/docs/index.md @@ -53,7 +53,7 @@ load("@io_bazel_rules_rust//rust:rust.bzl", "rust_library") rust_library( name = "hello_lib", srcs = ["src/lib.rs"], -) +) ``` `hello_world/src/main.rs`: From dfe5ded0591b93aa3534c3f9bb17376b44373ad6 Mon Sep 17 00:00:00 2001 From: Marco Farrugia Date: Sun, 3 Feb 2019 14:50:11 -0500 Subject: [PATCH 24/30] Refer to ourselves as @io_bazel_rules_rust in WORKSPACE to be a little more user friendly. --- WORKSPACE | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 198a6931a4..014a709fb2 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -25,23 +25,20 @@ http_archive( ) # TODO: Move this to examples/WORKSPACE when recursive repositories are enabled. -load("//rust:repositories.bzl", "rust_repositories") - +load("@io_bazel_rules_rust//rust:repositories.bzl", "rust_repositories") rust_repositories() new_git_repository( name = "libc", - build_file = "//:libc.BUILD", + build_file = "@io_bazel_rules_rust//:libc.BUILD", remote = "https://github.com/rust-lang/libc", tag = "0.2.20", ) -load("//proto:repositories.bzl", "rust_proto_repositories") - +load("@io_bazel_rules_rust//proto:repositories.bzl", "rust_proto_repositories") rust_proto_repositories() -load("//bindgen:repositories.bzl", "rust_bindgen_repositories") - +load("@io_bazel_rules_rust//bindgen:repositories.bzl", "rust_bindgen_repositories") rust_bindgen_repositories() # Stardoc and its dependencies @@ -75,6 +72,5 @@ http_archive( ], ) -load(":workspace.bzl", "bazel_version") - +load("@io_bazel_rules_rust//:workspace.bzl", "bazel_version") bazel_version(name = "bazel_version") From 20fd05845df0e5a0b34e532927a5b65780984a18 Mon Sep 17 00:00:00 2001 From: Marco Farrugia Date: Sun, 3 Feb 2019 14:50:11 -0500 Subject: [PATCH 25/30] Add bindgen overview doc, make minor adjustments to proto docs to match. --- bindgen/README.md | 82 +++++++++++++++++++++++++++++++++++++++++++++++ proto/README.md | 28 +++++++++------- 2 files changed, 98 insertions(+), 12 deletions(-) create mode 100644 bindgen/README.md diff --git a/bindgen/README.md b/bindgen/README.md new file mode 100644 index 0000000000..0dc009ac2e --- /dev/null +++ b/bindgen/README.md @@ -0,0 +1,82 @@ +# Rust Bindgen Rules + +
+

Rules

+ +
+ +## Overview + +These rules are for using [Bindgen][bindgen] to generate [Rust][rust] bindings to C (and some C++) ilbraries. + +[rust]: http://www.rust-lang.org/ +[bindgen]: https://github.com/rust-lang/rust-bindgen + +See the [bindgen example](../examples/ffi/rust_calling_c/simple/BUILD:9) for a more complete example of use. + +### Setup + +To use the Rust bindgen rules, add the following to your `WORKSPACE` file to add the +external repositories for the Rust bindgen toolchain (in addition to the [rust rules setup](..)): + +```python +load("@io_bazel_rules_rust//bindgen:repositories.bzl", "rust_bindgen_repositories") + +rust_bindgen_repositories() +``` +This makes the default toolchain defined in @io_bazel_rules_rust available, it is defined [here](./BUILD). + +[raze]: https://github.com/google/cargo-raze + +It will load crate dependencies of bindgen that are generated using +[cargo raze][raze] inside the rules_rust +repository. However, using those dependencies might conflict with other uses +of [cargo raze][raze]. If you need to change +those dependencies, please see the [dedicated section below](#custom-deps). + +For additional information about Bazel toolchains, see [here](https://docs.bazel.build/versions/master/toolchains.html). + +## Customizing dependencies + +These rules depends on the [`bindgen`](https://crates.io/crates/bindgen) binary crate, and it +in turn depends on both a clang binary and the clang library. To obtain these dependencies, +`rust_bindgen_repositories` imports bindgen and its dependencies using BUILD files generated with +[`cargo raze`][raze], along with a tarball of clang. + +If you want to change the bindgen used, or use [`cargo raze`][raze] in a more +complex scenario (with more dependencies), you must redefine those +dependencies. + +To do this, once you've imported the needed dependencies (see our +[Cargo.toml](./raze/Cargo.toml) file to see the default dependencies), you +need to create your own toolchain. To do so you can create a BUILD +file with your [`rust_bindgen_toolchain`](../docs/index.md#rust_bindgen_toolchain) definition, for example: + +```python +load("@io_bazel_rules_rust//bindgen:bindgen.bzl", "rust_bindgen_toolchain") + +rust_bindgen_toolchain( + name = "bindgen-toolchain-impl", + bindgen = "//my/raze:cargo_bin_bindgen", + clang = "//my/clang:clang", + libclang = "//my/clang:libclang.so", + libstdcxx = "//my/cpp:libstdc++", +) + +toolchain( + name = "bindgen-toolchain", + toolchain = "bindgen-toolchain-impl", + toolchain_type = "@io_bazel_rules_rust//bindgen:bindgen_toolchain", +) +``` + +Now that you have your own toolchain, you need to register it by +inserting the following statement in your `WORKSPACE` file: + +```python +register_toolchains("//my/toolchains:bindgen-toolchain") +``` diff --git a/proto/README.md b/proto/README.md index bfef428567..3d6ec78ff4 100644 --- a/proto/README.md +++ b/proto/README.md @@ -29,35 +29,39 @@ load("@io_bazel_rules_rust//proto:repositories.bzl", "rust_proto_repositories") rust_proto_repositories() ``` +[raze]: https://github.com/google/cargo-raze + This will load crate dependencies of protobuf that are generated using -[cargo raze](https://github.com/google/cargo-raze) inside the rules_rust +[cargo raze][raze] inside the rules_rust repository. However, using those dependencies might conflict with other uses -of [cargo raze](https://github.com/google/cargo-raze). If you need to change +of [cargo raze][raze]. If you need to change those dependencies, please see the [dedicated section below](#custom-deps). +For additional information about Bazel toolchains, see [here](https://docs.bazel.build/versions/master/toolchains.html). + ## Customizing dependencies These rules depends on the [`protobuf`](https://crates.io/crates/protobuf) and the [`grpc`](https://crates.io/crates/grpc) crates in addition to the [protobuf -compiler](https://github.com/google/protobuf). To do so the -`rust_proto_repositories` import the given crates using file generated with -[`cargo raze`](https://github.com/google/cargo-raze). +compiler](https://github.com/google/protobuf). To obtain these crates, +`rust_proto_repositories` imports the given crates using BUILD files generated with +[`cargo raze`][raze]. If you want to either change the protobuf and gRPC rust compilers, or to -simply use [`cargo raze`](https://github.com/google/cargo-raze) in a more +simply use [`cargo raze`][raze] in a more complex scenario (with more dependencies), you must redefine those dependencies. To do this, once you've imported the needed dependencies (see our [Cargo.toml](raze/Cargo.toml) file to see the default dependencies), you -need to point to the correct toolchain, to do so you can create a BUILD -file with the toolchain definition, for example: +need to create your own toolchain. To do so you can create a BUILD +file with your toolchain definition, for example: ```python load("@io_bazel_rules_rust//proto:toolchain.bzl", "rust_proto_toolchain") rust_proto_toolchain( - name = "toolchain-impl", + name = "proto-toolchain-impl", # Path to the protobuf compiler. protoc = "@com_google_protobuf//:protoc", # Protobuf compiler plugin to generate rust gRPC stubs. @@ -67,8 +71,8 @@ rust_proto_toolchain( ) toolchain( - name = "toolchain", - toolchain = ":toolchain-impl", + name = "proto-toolchain", + toolchain = ":proto-toolchain-impl", toolchain_type = "@io_bazel_rules_rust//proto:toolchain", ) ``` @@ -77,7 +81,7 @@ Now that you have your own toolchain, you need to register it by inserting the following statement in your `WORKSPACE` file: ```python -register_toolchains("//package:toolchain") +register_toolchains("//my/toolchains:proto-toolchain") ``` Finally, you might want to set the `rust_deps` attribute in From 55f00758f0152fbe91870f7992ac9b95df17f4bb Mon Sep 17 00:00:00 2001 From: Marco Farrugia Date: Sun, 3 Feb 2019 15:46:35 -0500 Subject: [PATCH 26/30] Replace 'new_local_repository' for libstdc++ with something that shouldn't blow up on osx. --- bindgen/BUILD | 2 +- bindgen/repositories.bzl | 24 ++++++++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/bindgen/BUILD b/bindgen/BUILD index d643955525..c68f15b721 100644 --- a/bindgen/BUILD +++ b/bindgen/BUILD @@ -16,7 +16,7 @@ rust_bindgen_toolchain( bindgen = "//bindgen/raze:cargo_bin_bindgen", clang = "@bindgen_clang//:clang", libclang = "@bindgen_clang//:libclang.so", - libstdcxx = "@local_linux//:libstdc++", + libstdcxx = "@local_libstdcpp//:libstdc++", ) toolchain( diff --git a/bindgen/repositories.bzl b/bindgen/repositories.bzl index 65b305e0d6..69b79ab00b 100644 --- a/bindgen/repositories.bzl +++ b/bindgen/repositories.bzl @@ -25,6 +25,11 @@ def rust_bindgen_repositories(): # nb. The bindgen rule itself should work on any platform. _linux_rust_bindgen_repositories() + maybe( + _local_libstdcpp, + name = "local_libstdcpp", + ) + # This overrides the BUILD file raze generates for libloading with a handwritten one. # TODO: Tidier to implement https://github.com/google/cargo-raze/issues/58 maybe( @@ -52,9 +57,16 @@ def _linux_rust_bindgen_repositories(): build_file = "@//bindgen:clang.BUILD", ) - maybe( - native.new_local_repository, - name = "local_linux", - path = "/usr/lib/x86_64-linux-gnu", - build_file = "@//bindgen:local_linux.BUILD", - ) +def _local_libstdcpp_impl(repository_ctx): + if repository_ctx.os.name == "linux": + # Basically the same as `native.new_local_repository`, but we're not allowed to call that here.. + repository_ctx.template("BUILD.bazel", Label("@//bindgen:local_linux.BUILD")) + repository_ctx.symlink("/usr/lib/x86_64-linux-gnu/libstdc++.so.6", "libstdc++.so.6") + else: + # TODO: Support examples for other OS. + repository_ctx.file("BUILD", "") + + +_local_libstdcpp = repository_rule( + implementation = _local_libstdcpp_impl, +) \ No newline at end of file From 6c0b35b3f6b109d645933f0aff6c396ea091e507 Mon Sep 17 00:00:00 2001 From: Marco Farrugia Date: Sun, 3 Feb 2019 16:00:30 -0500 Subject: [PATCH 27/30] take 2 --- bindgen/local_linux.BUILD | 8 -------- bindgen/repositories.bzl | 29 +++++++++++++++++++++++------ 2 files changed, 23 insertions(+), 14 deletions(-) delete mode 100644 bindgen/local_linux.BUILD diff --git a/bindgen/local_linux.BUILD b/bindgen/local_linux.BUILD deleted file mode 100644 index 8d3bab60ce..0000000000 --- a/bindgen/local_linux.BUILD +++ /dev/null @@ -1,8 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -cc_library( - name = "libstdc++", - srcs = [ - "libstdc++.so.6", - ], -) diff --git a/bindgen/repositories.bzl b/bindgen/repositories.bzl index 69b79ab00b..1817783711 100644 --- a/bindgen/repositories.bzl +++ b/bindgen/repositories.bzl @@ -57,15 +57,32 @@ def _linux_rust_bindgen_repositories(): build_file = "@//bindgen:clang.BUILD", ) +LIBSTDCPP_LINUX = """ +cc_library( + name = "libstdc++", + srcs = ["libstdc++.so.6"], + visibility = ["//visibility:public"] +) +""" + +LIBSTDCPP_MAC = """ +cc_library( + name = "libstdc++", + srcs = ["libstdc++.6.dylib"], + visibility = ["//visibility:public"] +) +""" + def _local_libstdcpp_impl(repository_ctx): - if repository_ctx.os.name == "linux": - # Basically the same as `native.new_local_repository`, but we're not allowed to call that here.. - repository_ctx.template("BUILD.bazel", Label("@//bindgen:local_linux.BUILD")) + os = repository_ctx.os.name.lower() + if os == "linux": repository_ctx.symlink("/usr/lib/x86_64-linux-gnu/libstdc++.so.6", "libstdc++.so.6") + repository_ctx.file("BUILD.bazel", LIBSTDCPP_LINUX) + elif os.startswith("mac"): + repository_ctx.symlink("/usr/lib/libstdc++.6.dylib", "libstdc++.6.dylib") + repository_ctx.file("BUILD.bazel", LIBSTDCPP_MAC) else: - # TODO: Support examples for other OS. - repository_ctx.file("BUILD", "") - + fail(os + " is not supported.") _local_libstdcpp = repository_rule( implementation = _local_libstdcpp_impl, From 0e7c86eb2ab0d6a07a54363b6694b6f0dc9e705d Mon Sep 17 00:00:00 2001 From: Damien Martin-Guillerez Date: Tue, 5 Feb 2019 09:51:38 -0500 Subject: [PATCH 28/30] Apply suggestions from code review Co-Authored-By: mfarrugi --- bindgen/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bindgen/README.md b/bindgen/README.md index 0dc009ac2e..bb13f5d18d 100644 --- a/bindgen/README.md +++ b/bindgen/README.md @@ -16,7 +16,7 @@ These rules are for using [Bindgen][bindgen] to generate [Rust][rust] bindings t [rust]: http://www.rust-lang.org/ [bindgen]: https://github.com/rust-lang/rust-bindgen -See the [bindgen example](../examples/ffi/rust_calling_c/simple/BUILD:9) for a more complete example of use. +See the [bindgen example](../examples/ffi/rust_calling_c/simple/BUILD#L9) for a more complete example of use. ### Setup @@ -28,7 +28,7 @@ load("@io_bazel_rules_rust//bindgen:repositories.bzl", "rust_bindgen_repositorie rust_bindgen_repositories() ``` -This makes the default toolchain defined in @io_bazel_rules_rust available, it is defined [here](./BUILD). +This makes the default toolchain defined in [`@io_bazel_rules_rust`](./BUILD) available. [raze]: https://github.com/google/cargo-raze @@ -38,7 +38,7 @@ repository. However, using those dependencies might conflict with other uses of [cargo raze][raze]. If you need to change those dependencies, please see the [dedicated section below](#custom-deps). -For additional information about Bazel toolchains, see [here](https://docs.bazel.build/versions/master/toolchains.html). +For additional information, see the [Bazel toolchains documentation](https://docs.bazel.build/versions/master/toolchains.html). ## Customizing dependencies From f1f91e35eadff3a4f891c0e3bde0ac1da1bd42f9 Mon Sep 17 00:00:00 2001 From: Marco Farrugia Date: Tue, 5 Feb 2019 09:57:38 -0500 Subject: [PATCH 29/30] Address last review comments. --- .bazelci/presubmit.yml | 4 ++-- bindgen/bindgen.bzl | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index aba651513b..c7f2b1913a 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -21,7 +21,7 @@ platforms: - "@examples//..." macos: osx_targets: &osx_targets - - "--" + - "--" # Allows negative patterns; hack for https://github.com/bazelbuild/continuous-integration/pull/245 - "..." - "@docs//..." - "@examples//..." @@ -33,7 +33,7 @@ platforms: test_targets: *osx_targets rbe_ubuntu1604: test_targets: - - "--" + - "--" # Allows negative patterns; hack for https://github.com/bazelbuild/continuous-integration/pull/245 - "//test/..." - "@examples//..." - "-//test/conflicting_deps:conflicting_deps_test" diff --git a/bindgen/bindgen.bzl b/bindgen/bindgen.bzl index 47b6e3d720..fd267d2f6e 100644 --- a/bindgen/bindgen.bzl +++ b/bindgen/bindgen.bzl @@ -73,6 +73,7 @@ def _rust_bindgen_impl(ctx): [f.dirname for f in cc_lib.cc.transitive_headers], ) + # Vanilla usage of bindgen produces formatted output, here we do the same if we have `rustfmt` in our toolchain. if rustfmt_bin: unformatted_output = ctx.actions.declare_file(output.basename + ".unformatted") else: @@ -169,10 +170,12 @@ rust_bindgen_toolchain = rule( ), "libclang": attr.label( doc = "A cc_library that provides bindgen's runtime dependency on libclang.", + cfg = "host", providers = ["cc"], ), "libstdcxx": attr.label( doc = "A cc_library that satisfies libclang's libstdc++ dependency.", + cfg = "host", providers = ["cc"], ), }, From 22ab34a4e7325b3f89de4d2af227c39f5f08a86b Mon Sep 17 00:00:00 2001 From: Marco Farrugia Date: Tue, 5 Feb 2019 20:54:06 -0500 Subject: [PATCH 30/30] fix typo --- bindgen/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindgen/README.md b/bindgen/README.md index bb13f5d18d..79eee77f47 100644 --- a/bindgen/README.md +++ b/bindgen/README.md @@ -11,7 +11,7 @@ ## Overview -These rules are for using [Bindgen][bindgen] to generate [Rust][rust] bindings to C (and some C++) ilbraries. +These rules are for using [Bindgen][bindgen] to generate [Rust][rust] bindings to C (and some C++) libraries. [rust]: http://www.rust-lang.org/ [bindgen]: https://github.com/rust-lang/rust-bindgen