Skip to content

Commit

Permalink
Add //rust/private/BUILD (therefore create a package there)
Browse files Browse the repository at this point in the history
  • Loading branch information
hlopko committed Feb 3, 2021
1 parent e66bb69 commit 454860a
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 1 deletion.
1 change: 1 addition & 0 deletions bindgen/bindgen.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

# buildifier: disable=module-docstring
load("//rust:rust.bzl", "rust_library")
load("//rust/private:utils.bzl", "find_toolchain", "get_libs_for_static_executable")

# buildifier: disable=bzl-visibility
load("//rust/private:utils.bzl", "find_toolchain", "get_libs_for_static_executable")
Expand Down
3 changes: 3 additions & 0 deletions cargo/cargo_build_script.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "C_COMPILE_ACTION_NAME")
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain")
load("//rust:rust.bzl", "rust_binary")
load("//rust/private:rust.bzl", "name_to_crate_name")
load("//rust/private:rustc.bzl", "BuildInfo", "DepInfo", "get_cc_toolchain", "get_compilation_mode_opts", "get_linker_and_args")
load("//rust/private:utils.bzl", "expand_locations", "find_toolchain")

# buildifier: disable=bzl-visibility
load("//rust/private:rust.bzl", "name_to_crate_name")
Expand Down
1 change: 0 additions & 1 deletion rust/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ toolchain_type(

bzl_library(
name = "rules",
srcs = glob(["**/*.bzl"]),
deps = [
"//rust/platform:rules",
"//rust/private:rules",
Expand Down
2 changes: 2 additions & 0 deletions rust/private/rustdoc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("//rust:rust_common.bzl", "CrateInfo")

# buildifier: disable=module-docstring
load("//rust/private:common.bzl", "rust_common")
load("//rust/private:rustc.bzl", "DepInfo", "add_crate_link_flags", "add_edition_flags")
Expand Down
2 changes: 2 additions & 0 deletions rust/private/rustdoc_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("//rust:rust_common.bzl", "CrateInfo")

# buildifier: disable=module-docstring
load("//rust/private:common.bzl", "rust_common")
load("//rust/private:rustc.bzl", "DepInfo")
Expand Down
32 changes: 32 additions & 0 deletions rust/rust_common.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# 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.

"""Module with Rust definitions required to write custom Rust rules."""

CrateInfo = provider(
doc = "A provider containing general Crate information.",
fields = {
"aliases": "Dict[Label, String]: Renamed and aliased crates",
"deps": "List[Provider]: This crate's (rust or cc) dependencies' providers.",
"edition": "str: The edition of this crate.",
"is_test": "bool: If the crate is being compiled in a test context",
"name": "str: The name of this crate.",
"output": "File: The output File that will be produced, depends on crate type.",
"proc_macro_deps": "List[CrateInfo]: This crate's rust proc_macro dependencies' providers.",
"root": "File: The source File entrypoint to this crate, eg. lib.rs",
"rustc_env": "Dict[String, String]: Additional `\"key\": \"value\"` environment variables to set for rustc.",
"srcs": "List[File]: All source Files that are part of the crate.",
"type": "str: The type of this crate. eg. lib or bin",
},
)

0 comments on commit 454860a

Please sign in to comment.