Skip to content

[rust-1.16.0] Backport #3668 to rust-1.16.0 #3826

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,36 +61,36 @@ matrix:
IMAGE=cross
- env: TARGET=mips64-unknown-linux-gnuabi64
IMAGE=cross
rust: beta
rust: beta-2017-03-03
- env: TARGET=mips64el-unknown-linux-gnuabi64
IMAGE=cross
rust: beta
rust: beta-2017-03-03
- env: TARGET=s390x-unknown-linux-gnu
IMAGE=cross
rust: beta
rust: beta-2017-03-03
- env: TARGET=powerpc-unknown-linux-gnu
IMAGE=cross
rust: beta
rust: beta-2017-03-03
- env: TARGET=powerpc64-unknown-linux-gnu
IMAGE=cross
rust: beta
rust: beta-2017-03-03
- env: TARGET=powerpc64le-unknown-linux-gnu
IMAGE=cross
rust: beta
rust: beta-2017-03-03

# beta/nightly builds
- env: TARGET=x86_64-unknown-linux-gnu
ALT=i686-unknown-linux-gnu
IMAGE=dist
MAKE_TARGETS="test distcheck doc install uninstall"
DEPLOY=0
rust: beta
rust: beta-2017-03-03
- env: TARGET=x86_64-unknown-linux-gnu
ALT=i686-unknown-linux-gnu
IMAGE=dist
MAKE_TARGETS="test distcheck doc install uninstall"
DEPLOY=0
rust: nightly
rust: nightly-2017-03-03

exclude:
- rust: stable
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ install:

# FIXME(#3394) use master rustup
- curl -sSfO https://static.rust-lang.org/rustup/archive/0.6.5/x86_64-pc-windows-msvc/rustup-init.exe
- rustup-init.exe -y --default-host x86_64-pc-windows-msvc --default-toolchain nightly
- rustup-init.exe -y --default-host x86_64-pc-windows-msvc --default-toolchain nightly-2017-03-03
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
- if NOT "%TARGET%" == "x86_64-pc-windows-msvc" rustup target add %TARGET%
- if defined OTHER_TARGET rustup target add %OTHER_TARGET%
Expand Down
41 changes: 29 additions & 12 deletions src/cargo/core/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,19 +112,34 @@ pub enum TargetKind {
CustomBuild,
}

impl Encodable for TargetKind {
fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
impl TargetKind {
/// Returns a vector of crate types as specified in a manifest with one difference.
/// For ExampleLib it returns "example" instead of crate types
pub fn kinds(&self) -> Vec<&str> {
use self::TargetKind::*;
match *self {
TargetKind::Lib(ref kinds) |
TargetKind::ExampleLib(ref kinds) => {
Lib(ref kinds) => kinds.iter().map(LibKind::crate_type).collect(),
Bin => vec!["bin"],
ExampleBin | ExampleLib(_) => vec!["example"],
Test => vec!["test"],
CustomBuild => vec!["custom-build"],
Bench => vec!["bench"]
}
}

/// Returns a vector of crate types as specified in a manifest
pub fn crate_types(&self) -> Vec<&str> {
use self::TargetKind::*;
match *self {
Lib(ref kinds) | ExampleLib(ref kinds) => {
kinds.iter().map(LibKind::crate_type).collect()
}
TargetKind::Bin => vec!["bin"],
TargetKind::ExampleBin => vec!["example"],
TargetKind::Test => vec!["test"],
TargetKind::CustomBuild => vec!["custom-build"],
TargetKind::Bench => vec!["bench"],
}.encode(s)
Bin => vec!["bin"],
ExampleBin => vec!["example"],
Test => vec!["test"],
CustomBuild => vec!["custom-build"],
Bench => vec!["bench"]
}
}
}

Expand Down Expand Up @@ -195,15 +210,17 @@ pub struct Target {

#[derive(RustcEncodable)]
struct SerializedTarget<'a> {
kind: &'a TargetKind,
kind: Vec<&'a str>,
crate_types: Vec<&'a str>,
name: &'a str,
src_path: &'a str,
}

impl Encodable for Target {
fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
SerializedTarget {
kind: &self.kind,
kind: self.kind.kinds(),
crate_types: self.kind.crate_types(),
name: &self.name,
src_path: &self.src_path.display().to_string(),
}.encode(s)
Expand Down
42 changes: 36 additions & 6 deletions tests/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2510,7 +2510,12 @@ fn compiler_json_error_format() {
{
"reason":"compiler-message",
"package_id":"bar 0.5.0 ([..])",
"target":{"kind":["lib"],"name":"bar","src_path":"[..]lib.rs"},
"target":{
"kind":["lib"],
"crate_types":["lib"],
"name":"bar",
"src_path":"[..]lib.rs"
},
"message":"{...}"
}

Expand All @@ -2524,21 +2529,36 @@ fn compiler_json_error_format() {
},
"features": [],
"package_id":"bar 0.5.0 ([..])",
"target":{"kind":["lib"],"name":"bar","src_path":"[..]lib.rs"},
"target":{
"kind":["lib"],
"crate_types":["lib"],
"name":"bar",
"src_path":"[..]lib.rs"
},
"filenames":["[..].rlib"]
}

{
"reason":"compiler-message",
"package_id":"foo 0.5.0 ([..])",
"target":{"kind":["bin"],"name":"foo","src_path":"[..]main.rs"},
"target":{
"kind":["bin"],
"crate_types":["bin"],
"name":"foo",
"src_path":"[..]main.rs"
},
"message":"{...}"
}

{
"reason":"compiler-artifact",
"package_id":"foo 0.5.0 ([..])",
"target":{"kind":["bin"],"name":"foo","src_path":"[..]main.rs"},
"target":{
"kind":["bin"],
"crate_types":["bin"],
"name":"foo",
"src_path":"[..]main.rs"
},
"profile": {
"debug_assertions": true,
"debuginfo": 2,
Expand Down Expand Up @@ -2580,14 +2600,24 @@ fn message_format_json_forward_stderr() {
{
"reason":"compiler-message",
"package_id":"foo 0.5.0 ([..])",
"target":{"kind":["bin"],"name":"foo","src_path":"[..]"},
"target":{
"kind":["bin"],
"crate_types":["bin"],
"name":"foo",
"src_path":"[..]"
},
"message":"{...}"
}

{
"reason":"compiler-artifact",
"package_id":"foo 0.5.0 ([..])",
"target":{"kind":["bin"],"name":"foo","src_path":"[..]"},
"target":{
"kind":["bin"],
"crate_types":["bin"],
"name":"foo",
"src_path":"[..]"
},
"profile":{
"debug_assertions":true,
"debuginfo":2,
Expand Down
Loading