aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar David Chen <dzc@google.com>2015-08-25 12:07:29 +0000
committerGravatar Lukacs Berki <lberki@google.com>2015-08-26 07:35:02 +0000
commit734c6d26445ab2d8b28104a720bb1f107849556c (patch)
treed68306dc51a8ab53190521c7b32280b38ca8e727 /tools
parenta59fa55506cea333f31b76231d8ccf7dcb3e6bac (diff)
Update Rust rules to use Rust 1.2.0. Rename features attribute to
crate_features to fix conflict with new default features attribute. -- MOS_MIGRATED_REVID=101454678
Diffstat (limited to 'tools')
-rw-r--r--tools/build_rules/rust/README.md12
-rw-r--r--tools/build_rules/rust/rust-darwin-x86_64.BUILD2
-rw-r--r--tools/build_rules/rust/rust-linux-x86_64.BUILD2
-rw-r--r--tools/build_rules/rust/rust.WORKSPACE8
-rw-r--r--tools/build_rules/rust/rust.bzl8
-rw-r--r--tools/build_rules/rust/test/rust_rule_test.bzl66
6 files changed, 54 insertions, 44 deletions
diff --git a/tools/build_rules/rust/README.md b/tools/build_rules/rust/README.md
index 369ca5e9e4..c82179d08b 100644
--- a/tools/build_rules/rust/README.md
+++ b/tools/build_rules/rust/README.md
@@ -148,7 +148,7 @@ Hello world
<a name="reference-rust_library"></a>
### `rust_library`
-`rust_library(name, srcs, deps, data, features, rustc_flags)`
+`rust_library(name, srcs, deps, data, crate_features, rustc_flags)`
<table>
<thead>
@@ -209,7 +209,7 @@ Hello world
</td>
</tr>
<tr>
- <td><code>features</code></td>
+ <td><code>crate_features</code></td>
<td>
<code>List of strings, optional</code>
<p>List of features to enable for this crate.</p>
@@ -234,7 +234,7 @@ Hello world
<a name="reference-rust_binary"></a>
### `rust_binary`
-`rust_binary(name, srcs, deps, data, features, rustc_flags)`
+`rust_binary(name, srcs, deps, data, crate_features, rustc_flags)`
<table>
<thead>
@@ -295,7 +295,7 @@ Hello world
</td>
</tr>
<tr>
- <td><code>features</code></td>
+ <td><code>crate_features</code></td>
<td>
<code>List of strings, optional</code>
<p>List of features to enable for this crate.</p>
@@ -320,7 +320,7 @@ Hello world
<a name="reference-rust_test"></a>
### `rust_test`
-`rust_test(name, srcs, deps, data, features, rustc_flags)`
+`rust_test(name, srcs, deps, data, crate_features, rustc_flags)`
<table>
<thead>
@@ -380,7 +380,7 @@ Hello world
</td>
</tr>
<tr>
- <td><code>features</code></td>
+ <td><code>crate_features</code></td>
<td>
<code>List of strings, optional</code>
<p>List of features to enable for this crate.</p>
diff --git a/tools/build_rules/rust/rust-darwin-x86_64.BUILD b/tools/build_rules/rust/rust-darwin-x86_64.BUILD
index 2f067e135b..1e3b7c97c1 100644
--- a/tools/build_rules/rust/rust-darwin-x86_64.BUILD
+++ b/tools/build_rules/rust/rust-darwin-x86_64.BUILD
@@ -1,4 +1,4 @@
-BASE_DIR = "rust-1.1.0-x86_64-apple-darwin/"
+BASE_DIR = "rust-1.2.0-x86_64-apple-darwin/"
filegroup(
name = "rustc",
diff --git a/tools/build_rules/rust/rust-linux-x86_64.BUILD b/tools/build_rules/rust/rust-linux-x86_64.BUILD
index 2ec77289a3..27559106fd 100644
--- a/tools/build_rules/rust/rust-linux-x86_64.BUILD
+++ b/tools/build_rules/rust/rust-linux-x86_64.BUILD
@@ -1,4 +1,4 @@
-BASE_DIR = "rust-1.1.0-x86_64-unknown-linux-gnu/"
+BASE_DIR = "rust-1.2.0-x86_64-unknown-linux-gnu/"
filegroup(
name = "rustc",
diff --git a/tools/build_rules/rust/rust.WORKSPACE b/tools/build_rules/rust/rust.WORKSPACE
index 3b307d264a..4086ce80be 100644
--- a/tools/build_rules/rust/rust.WORKSPACE
+++ b/tools/build_rules/rust/rust.WORKSPACE
@@ -1,13 +1,13 @@
new_http_archive(
name = "rust-linux-x86_64",
- url = "https://static.rust-lang.org/dist/rust-1.1.0-x86_64-unknown-linux-gnu.tar.gz",
- sha256 = "5a8b1c4bb254a698a69cd05734909a3933567be6996422ff53f947fd115372e6",
+ url = "https://static.rust-lang.org/dist/rust-1.2.0-x86_64-unknown-linux-gnu.tar.gz",
+ sha256 = "2311420052e06b3e698ce892924ec40890a8ff0499902e7fc5350733187a1531",
build_file = "tools/build_rules/rust/rust-linux-x86_64.BUILD",
)
new_http_archive(
name = "rust-darwin-x86_64",
- url = "https://static.rust-lang.org/dist/rust-1.1.0-x86_64-apple-darwin.tar.gz",
- sha256 = "ac802916da3f9c431377c00b864a517bc356859495b7a8a123ce2c532ee8fa83",
+ url = "https://static.rust-lang.org/dist/rust-1.2.0-x86_64-apple-darwin.tar.gz",
+ sha256 = "0d471e672fac5a450ae5507b335fda2efc0b22ea9fb7f215c6a9c466dafa2661",
build_file = "tools/build_rules/rust/rust-darwin-x86_64.BUILD",
)
diff --git a/tools/build_rules/rust/rust.bzl b/tools/build_rules/rust/rust.bzl
index 5913f8a3f2..149f41536f 100644
--- a/tools/build_rules/rust/rust.bzl
+++ b/tools/build_rules/rust/rust.bzl
@@ -13,7 +13,7 @@
# limitations under the License.
RUST_FILETYPE = FileType([".rs"])
-C_LIB_FILETYPE = FileType([".a"])
+A_FILETYPE = FileType([".a"])
def _relative(src_path, dest_path):
"""
@@ -78,7 +78,7 @@ def _setup_deps(deps, name, working_dir):
# If this rule depends on a cc_library
if hasattr(dep, "cc"):
- native_libs = C_LIB_FILETYPE.filter(dep.cc.libs)
+ native_libs = A_FILETYPE.filter(dep.cc.libs)
libs += native_libs
transitive_libs += native_libs
symlinked_libs += native_libs
@@ -135,7 +135,7 @@ def _build_rustc_command(ctx, crate_type, src, output_dir, depinfo,
ar = "/usr/bin/ar"
# Construct features flags
- features_flags = _get_features_flags(ctx.attr.features)
+ features_flags = _get_features_flags(ctx.attr.crate_features)
return " ".join([
"set -e;",
@@ -261,7 +261,7 @@ _rust_common_attrs = {
"srcs": attr.label_list(allow_files = RUST_FILETYPE),
"data": attr.label_list(allow_files = True, cfg = DATA_CFG),
"deps": attr.label_list(),
- "features": attr.string_list(),
+ "crate_features": attr.string_list(),
"rustc_flags": attr.string_list(),
"_rustc": attr.label(
default = Label("//tools/build_rules/rust:rustc"),
diff --git a/tools/build_rules/rust/test/rust_rule_test.bzl b/tools/build_rules/rust/test/rust_rule_test.bzl
index e9f957e0fb..799958bfe7 100644
--- a/tools/build_rules/rust/test/rust_rule_test.bzl
+++ b/tools/build_rules/rust/test/rust_rule_test.bzl
@@ -1,5 +1,3 @@
-"""Tests for rust rules."""
-#
# Copyright 2015 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,46 +12,58 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-load("/third_party/bazel/tools/build_rules/rust/rust",
- "rust_library", "rust_binary", "rust_test")
-load("/third_party/bazel/tools/build_rules/test_rules",
- "success_target",
- "successful_test",
- "failure_target",
- "failed_test",
- "assert_",
- "strip_prefix",
- "expectation_description",
- "check_results",
- "load_results",
- "analysis_results",
- "rule_test",
- "file_test")
+"""Tests for rust rules."""
+
+load(
+ "/tools/build_rules/rust/rust",
+ "rust_library",
+ "rust_binary",
+ "rust_test",
+)
+load(
+ "/tools/build_rules/test_rules",
+ "success_target",
+ "successful_test",
+ "failure_target",
+ "failed_test",
+ "assert_",
+ "strip_prefix",
+ "expectation_description",
+ "check_results",
+ "load_results",
+ "analysis_results",
+ "rule_test",
+ "file_test",
+)
def _rust_library_test(package):
rule_test(
- name="hello_lib_rule_test",
- generates=["libhello_lib.rlib"],
- provides={
+ name ="hello_lib_rule_test",
+ generates = ["libhello_lib.rlib"],
+ provides = {
"rust_lib": "/libhello_lib.rlib$",
- "transitive_libs": "^\\[\\]$"},
- rule=package + "/hello_lib:hello_lib")
+ "transitive_libs": "^\\[\\]$"
+ },
+ rule = package + "/hello_lib:hello_lib",
+ )
def _rust_binary_test(package):
rule_test(
- name="hello_world_rule_test",
- generates=["hello_world"],
- rule=package + "/hello_world:hello_world")
+ name = "hello_world_rule_test",
+ generates = ["hello_world"],
+ rule = package + "/hello_world:hello_world",
+ )
def _rust_test_test(package):
"""Issue rule tests for rust_test."""
rule_test(
- name="greeting_rule_test",
- generates=["greeting"],
- rule=package + "/hello_lib:greeting")
+ name = "greeting_rule_test",
+ generates = ["greeting"],
+ rule = package + "/hello_lib:greeting",
+ )
def rust_rule_test(package):