mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
Add kind/platform info to cargo metadata
This commit is contained in:
parent
5da4b4d479
commit
a7faecc34f
@ -1,9 +1,9 @@
|
|||||||
use crate::core::compiler::{CompileKind, CompileTarget, TargetInfo};
|
use crate::core::compiler::{CompileKind, CompileTarget, TargetInfo};
|
||||||
use crate::core::resolver::{Resolve, ResolveOpts};
|
use crate::core::resolver::{Resolve, ResolveOpts};
|
||||||
use crate::core::{Package, PackageId, Workspace};
|
use crate::core::{dependency, Dependency, Package, PackageId, Workspace};
|
||||||
use crate::ops::{self, Packages};
|
use crate::ops::{self, Packages};
|
||||||
use crate::util::CargoResult;
|
use crate::util::CargoResult;
|
||||||
|
use cargo_platform::Platform;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
@ -85,6 +85,22 @@ struct MetadataResolveNode {
|
|||||||
struct Dep {
|
struct Dep {
|
||||||
name: String,
|
name: String,
|
||||||
pkg: PackageId,
|
pkg: PackageId,
|
||||||
|
dep_kinds: Vec<DepKindInfo>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize)]
|
||||||
|
struct DepKindInfo {
|
||||||
|
kind: dependency::Kind,
|
||||||
|
target: Option<Platform>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<&Dependency> for DepKindInfo {
|
||||||
|
fn from(dep: &Dependency) -> DepKindInfo {
|
||||||
|
DepKindInfo {
|
||||||
|
kind: dep.kind(),
|
||||||
|
target: dep.platform().cloned(),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Builds the resolve graph as it will be displayed to the user.
|
/// Builds the resolve graph as it will be displayed to the user.
|
||||||
@ -167,12 +183,16 @@ fn build_resolve_graph_r(
|
|||||||
}),
|
}),
|
||||||
None => true,
|
None => true,
|
||||||
})
|
})
|
||||||
.filter_map(|(dep_id, _deps)| {
|
.filter_map(|(dep_id, deps)| {
|
||||||
package_map
|
package_map
|
||||||
.get(&dep_id)
|
.get(&dep_id)
|
||||||
.and_then(|pkg| pkg.targets().iter().find(|t| t.is_lib()))
|
.and_then(|pkg| pkg.targets().iter().find(|t| t.is_lib()))
|
||||||
.and_then(|lib_target| resolve.extern_crate_name(pkg_id, dep_id, lib_target).ok())
|
.and_then(|lib_target| resolve.extern_crate_name(pkg_id, dep_id, lib_target).ok())
|
||||||
.map(|name| Dep { name, pkg: dep_id })
|
.map(|name| Dep {
|
||||||
|
name,
|
||||||
|
pkg: dep_id,
|
||||||
|
dep_kinds: deps.iter().map(DepKindInfo::from).collect(),
|
||||||
|
})
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
let dumb_deps: Vec<PackageId> = deps.iter().map(|dep| dep.pkg).collect();
|
let dumb_deps: Vec<PackageId> = deps.iter().map(|dep| dep.pkg).collect();
|
||||||
|
@ -201,6 +201,10 @@ The output has the following format:
|
|||||||
],
|
],
|
||||||
/* The resolved dependency graph, with the concrete versions and features
|
/* The resolved dependency graph, with the concrete versions and features
|
||||||
selected. The set depends on the enabled features.
|
selected. The set depends on the enabled features.
|
||||||
|
|
||||||
|
All platform-specific dependencies are listed regardless of the current
|
||||||
|
target.
|
||||||
|
|
||||||
This is null if --no-deps is specified.
|
This is null if --no-deps is specified.
|
||||||
By default, this includes all dependencies for all target platforms.
|
By default, this includes all dependencies for all target platforms.
|
||||||
The `--filter-platform` flag may be used to narrow to a specific
|
The `--filter-platform` flag may be used to narrow to a specific
|
||||||
@ -230,7 +234,20 @@ The output has the following format:
|
|||||||
*/
|
*/
|
||||||
"name": "bitflags",
|
"name": "bitflags",
|
||||||
/* The Package ID of the dependency. */
|
/* The Package ID of the dependency. */
|
||||||
"pkg": "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)"
|
"pkg": "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
/* Array of dependency kinds. Added in Cargo 1.38. */
|
||||||
|
"dep_kinds": [
|
||||||
|
{
|
||||||
|
/* The dependency kind.
|
||||||
|
"dev", "build", or null for a normal dependency.
|
||||||
|
*/
|
||||||
|
"kind": null,
|
||||||
|
/* The target platform for the dependency.
|
||||||
|
null if not a target dependency.
|
||||||
|
*/
|
||||||
|
"target": "cfg(windows)"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
/* Array of features enabled on this package. */
|
/* Array of features enabled on this package. */
|
||||||
|
@ -208,6 +208,10 @@ for a Rust API for reading the metadata.</p>
|
|||||||
],
|
],
|
||||||
/* The resolved dependency graph, with the concrete versions and features
|
/* The resolved dependency graph, with the concrete versions and features
|
||||||
selected. The set depends on the enabled features.
|
selected. The set depends on the enabled features.
|
||||||
|
|
||||||
|
All platform-specific dependencies are listed regardless of the current
|
||||||
|
target.
|
||||||
|
|
||||||
This is null if --no-deps is specified.
|
This is null if --no-deps is specified.
|
||||||
By default, this includes all dependencies for all target platforms.
|
By default, this includes all dependencies for all target platforms.
|
||||||
The `--filter-platform` flag may be used to narrow to a specific
|
The `--filter-platform` flag may be used to narrow to a specific
|
||||||
@ -237,7 +241,20 @@ for a Rust API for reading the metadata.</p>
|
|||||||
*/
|
*/
|
||||||
"name": "bitflags",
|
"name": "bitflags",
|
||||||
/* The Package ID of the dependency. */
|
/* The Package ID of the dependency. */
|
||||||
"pkg": "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)"
|
"pkg": "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
/* Array of dependency kinds. Added in Cargo 1.38. */
|
||||||
|
"dep_kinds": [
|
||||||
|
{
|
||||||
|
/* The dependency kind.
|
||||||
|
"dev", "build", or null for a normal dependency.
|
||||||
|
*/
|
||||||
|
"kind": null,
|
||||||
|
/* The target platform for the dependency.
|
||||||
|
null if not a target dependency.
|
||||||
|
*/
|
||||||
|
"target": "cfg(windows)"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
/* Array of features enabled on this package. */
|
/* Array of features enabled on this package. */
|
||||||
|
@ -222,6 +222,10 @@ The output has the following format:
|
|||||||
],
|
],
|
||||||
/* The resolved dependency graph, with the concrete versions and features
|
/* The resolved dependency graph, with the concrete versions and features
|
||||||
selected. The set depends on the enabled features.
|
selected. The set depends on the enabled features.
|
||||||
|
|
||||||
|
All platform\-specific dependencies are listed regardless of the current
|
||||||
|
target.
|
||||||
|
|
||||||
This is null if \-\-no\-deps is specified.
|
This is null if \-\-no\-deps is specified.
|
||||||
By default, this includes all dependencies for all target platforms.
|
By default, this includes all dependencies for all target platforms.
|
||||||
The `\-\-filter\-platform` flag may be used to narrow to a specific
|
The `\-\-filter\-platform` flag may be used to narrow to a specific
|
||||||
@ -251,7 +255,20 @@ The output has the following format:
|
|||||||
*/
|
*/
|
||||||
"name": "bitflags",
|
"name": "bitflags",
|
||||||
/* The Package ID of the dependency. */
|
/* The Package ID of the dependency. */
|
||||||
"pkg": "bitflags 1.0.4 (registry+https://github.com/rust\-lang/crates.io\-index)"
|
"pkg": "bitflags 1.0.4 (registry+https://github.com/rust\-lang/crates.io\-index)",
|
||||||
|
/* Array of dependency kinds. Added in Cargo 1.38. */
|
||||||
|
"dep_kinds": [
|
||||||
|
{
|
||||||
|
/* The dependency kind.
|
||||||
|
"dev", "build", or null for a normal dependency.
|
||||||
|
*/
|
||||||
|
"kind": null,
|
||||||
|
/* The target platform for the dependency.
|
||||||
|
null if not a target dependency.
|
||||||
|
*/
|
||||||
|
"target": "cfg(windows)"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
/* Array of features enabled on this package. */
|
/* Array of features enabled on this package. */
|
||||||
|
@ -486,10 +486,22 @@ fn cargo_metadata_with_deps_and_version() {
|
|||||||
],
|
],
|
||||||
"deps": [
|
"deps": [
|
||||||
{
|
{
|
||||||
|
"dep_kinds": [
|
||||||
|
{
|
||||||
|
"kind": null,
|
||||||
|
"target": null
|
||||||
|
}
|
||||||
|
],
|
||||||
"name": "bar",
|
"name": "bar",
|
||||||
"pkg": "bar 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)"
|
"pkg": "bar 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"dep_kinds": [
|
||||||
|
{
|
||||||
|
"kind": "dev",
|
||||||
|
"target": null
|
||||||
|
}
|
||||||
|
],
|
||||||
"name": "foobar",
|
"name": "foobar",
|
||||||
"pkg": "foobar 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)"
|
"pkg": "foobar 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)"
|
||||||
}
|
}
|
||||||
@ -503,6 +515,12 @@ fn cargo_metadata_with_deps_and_version() {
|
|||||||
],
|
],
|
||||||
"deps": [
|
"deps": [
|
||||||
{
|
{
|
||||||
|
"dep_kinds": [
|
||||||
|
{
|
||||||
|
"kind": null,
|
||||||
|
"target": null
|
||||||
|
}
|
||||||
|
],
|
||||||
"name": "baz",
|
"name": "baz",
|
||||||
"pkg": "baz 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)"
|
"pkg": "baz 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)"
|
||||||
}
|
}
|
||||||
@ -1660,10 +1678,22 @@ fn rename_dependency() {
|
|||||||
],
|
],
|
||||||
"deps": [
|
"deps": [
|
||||||
{
|
{
|
||||||
|
"dep_kinds": [
|
||||||
|
{
|
||||||
|
"kind": null,
|
||||||
|
"target": null
|
||||||
|
}
|
||||||
|
],
|
||||||
"name": "bar",
|
"name": "bar",
|
||||||
"pkg": "bar 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)"
|
"pkg": "bar 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"dep_kinds": [
|
||||||
|
{
|
||||||
|
"kind": null,
|
||||||
|
"target": null
|
||||||
|
}
|
||||||
|
],
|
||||||
"name": "baz",
|
"name": "baz",
|
||||||
"pkg": "bar 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)"
|
"pkg": "bar 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)"
|
||||||
}
|
}
|
||||||
@ -2102,7 +2132,7 @@ fn filter_platform() {
|
|||||||
"optional": false,
|
"optional": false,
|
||||||
"uses_default_features": true,
|
"uses_default_features": true,
|
||||||
"features": [],
|
"features": [],
|
||||||
"target": "$ALT",
|
"target": "$ALT_TRIPLE",
|
||||||
"registry": null
|
"registry": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -2114,7 +2144,7 @@ fn filter_platform() {
|
|||||||
"optional": false,
|
"optional": false,
|
||||||
"uses_default_features": true,
|
"uses_default_features": true,
|
||||||
"features": [],
|
"features": [],
|
||||||
"target": "$HOST",
|
"target": "$HOST_TRIPLE",
|
||||||
"registry": null
|
"registry": null
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -2145,8 +2175,8 @@ fn filter_platform() {
|
|||||||
"links": null
|
"links": null
|
||||||
}
|
}
|
||||||
"#
|
"#
|
||||||
.replace("$ALT", &alternate())
|
.replace("$ALT_TRIPLE", &alternate())
|
||||||
.replace("$HOST", &rustc_host());
|
.replace("$HOST_TRIPLE", &rustc_host());
|
||||||
|
|
||||||
// Normal metadata, no filtering, returns *everything*.
|
// Normal metadata, no filtering, returns *everything*.
|
||||||
p.cargo("metadata")
|
p.cargo("metadata")
|
||||||
@ -2188,19 +2218,43 @@ fn filter_platform() {
|
|||||||
"deps": [
|
"deps": [
|
||||||
{
|
{
|
||||||
"name": "alt_dep",
|
"name": "alt_dep",
|
||||||
"pkg": "alt-dep 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)"
|
"pkg": "alt-dep 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"dep_kinds": [
|
||||||
|
{
|
||||||
|
"kind": null,
|
||||||
|
"target": "$ALT_TRIPLE"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "cfg_dep",
|
"name": "cfg_dep",
|
||||||
"pkg": "cfg-dep 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)"
|
"pkg": "cfg-dep 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"dep_kinds": [
|
||||||
|
{
|
||||||
|
"kind": null,
|
||||||
|
"target": "cfg(foobar)"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "host_dep",
|
"name": "host_dep",
|
||||||
"pkg": "host-dep 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)"
|
"pkg": "host-dep 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"dep_kinds": [
|
||||||
|
{
|
||||||
|
"kind": null,
|
||||||
|
"target": "$HOST_TRIPLE"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "normal_dep",
|
"name": "normal_dep",
|
||||||
"pkg": "normal-dep 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)"
|
"pkg": "normal-dep 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"dep_kinds": [
|
||||||
|
{
|
||||||
|
"kind": null,
|
||||||
|
"target": null
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"features": []
|
"features": []
|
||||||
@ -2225,6 +2279,8 @@ fn filter_platform() {
|
|||||||
"workspace_root": "[..]/foo"
|
"workspace_root": "[..]/foo"
|
||||||
}
|
}
|
||||||
"#
|
"#
|
||||||
|
.replace("$ALT_TRIPLE", &alternate())
|
||||||
|
.replace("$HOST_TRIPLE", &rustc_host())
|
||||||
.replace("$ALT_DEP", alt_dep)
|
.replace("$ALT_DEP", alt_dep)
|
||||||
.replace("$CFG_DEP", cfg_dep)
|
.replace("$CFG_DEP", cfg_dep)
|
||||||
.replace("$HOST_DEP", host_dep)
|
.replace("$HOST_DEP", host_dep)
|
||||||
@ -2262,11 +2318,23 @@ fn filter_platform() {
|
|||||||
"deps": [
|
"deps": [
|
||||||
{
|
{
|
||||||
"name": "alt_dep",
|
"name": "alt_dep",
|
||||||
"pkg": "alt-dep 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)"
|
"pkg": "alt-dep 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"dep_kinds": [
|
||||||
|
{
|
||||||
|
"kind": null,
|
||||||
|
"target": "$ALT_TRIPLE"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "normal_dep",
|
"name": "normal_dep",
|
||||||
"pkg": "normal-dep 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)"
|
"pkg": "normal-dep 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"dep_kinds": [
|
||||||
|
{
|
||||||
|
"kind": null,
|
||||||
|
"target": null
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"features": []
|
"features": []
|
||||||
@ -2285,6 +2353,7 @@ fn filter_platform() {
|
|||||||
"workspace_root": "[..]foo"
|
"workspace_root": "[..]foo"
|
||||||
}
|
}
|
||||||
"#
|
"#
|
||||||
|
.replace("$ALT_TRIPLE", &alternate())
|
||||||
.replace("$ALT_DEP", alt_dep)
|
.replace("$ALT_DEP", alt_dep)
|
||||||
.replace("$NORMAL_DEP", normal_dep)
|
.replace("$NORMAL_DEP", normal_dep)
|
||||||
.replace("$FOO", &foo),
|
.replace("$FOO", &foo),
|
||||||
@ -2314,11 +2383,23 @@ fn filter_platform() {
|
|||||||
"deps": [
|
"deps": [
|
||||||
{
|
{
|
||||||
"name": "host_dep",
|
"name": "host_dep",
|
||||||
"pkg": "host-dep 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)"
|
"pkg": "host-dep 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"dep_kinds": [
|
||||||
|
{
|
||||||
|
"kind": null,
|
||||||
|
"target": "$HOST_TRIPLE"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "normal_dep",
|
"name": "normal_dep",
|
||||||
"pkg": "normal-dep 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)"
|
"pkg": "normal-dep 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"dep_kinds": [
|
||||||
|
{
|
||||||
|
"kind": null,
|
||||||
|
"target": null
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"features": []
|
"features": []
|
||||||
@ -2343,6 +2424,7 @@ fn filter_platform() {
|
|||||||
"workspace_root": "[..]foo"
|
"workspace_root": "[..]foo"
|
||||||
}
|
}
|
||||||
"#
|
"#
|
||||||
|
.replace("$HOST_TRIPLE", &rustc_host())
|
||||||
.replace("$HOST_DEP", host_dep)
|
.replace("$HOST_DEP", host_dep)
|
||||||
.replace("$NORMAL_DEP", normal_dep)
|
.replace("$NORMAL_DEP", normal_dep)
|
||||||
.replace("$FOO", &foo),
|
.replace("$FOO", &foo),
|
||||||
@ -2381,15 +2463,33 @@ fn filter_platform() {
|
|||||||
"deps": [
|
"deps": [
|
||||||
{
|
{
|
||||||
"name": "cfg_dep",
|
"name": "cfg_dep",
|
||||||
"pkg": "cfg-dep 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)"
|
"pkg": "cfg-dep 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"dep_kinds": [
|
||||||
|
{
|
||||||
|
"kind": null,
|
||||||
|
"target": "cfg(foobar)"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "host_dep",
|
"name": "host_dep",
|
||||||
"pkg": "host-dep 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)"
|
"pkg": "host-dep 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"dep_kinds": [
|
||||||
|
{
|
||||||
|
"kind": null,
|
||||||
|
"target": "$HOST_TRIPLE"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "normal_dep",
|
"name": "normal_dep",
|
||||||
"pkg": "normal-dep 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)"
|
"pkg": "normal-dep 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"dep_kinds": [
|
||||||
|
{
|
||||||
|
"kind": null,
|
||||||
|
"target": null
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"features": []
|
"features": []
|
||||||
@ -2414,6 +2514,7 @@ fn filter_platform() {
|
|||||||
"workspace_root": "[..]/foo"
|
"workspace_root": "[..]/foo"
|
||||||
}
|
}
|
||||||
"#
|
"#
|
||||||
|
.replace("$HOST_TRIPLE", &rustc_host())
|
||||||
.replace("$CFG_DEP", cfg_dep)
|
.replace("$CFG_DEP", cfg_dep)
|
||||||
.replace("$HOST_DEP", host_dep)
|
.replace("$HOST_DEP", host_dep)
|
||||||
.replace("$NORMAL_DEP", normal_dep)
|
.replace("$NORMAL_DEP", normal_dep)
|
||||||
@ -2421,3 +2522,102 @@ fn filter_platform() {
|
|||||||
)
|
)
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cargo_test]
|
||||||
|
fn dep_kinds() {
|
||||||
|
Package::new("bar", "0.1.0").publish();
|
||||||
|
Package::new("winapi", "0.1.0").publish();
|
||||||
|
|
||||||
|
let p = project()
|
||||||
|
.file(
|
||||||
|
"Cargo.toml",
|
||||||
|
r#"
|
||||||
|
[package]
|
||||||
|
name = "foo"
|
||||||
|
version = "0.1.0"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
bar = "0.1"
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
bar = "0.1"
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
bar = "0.1"
|
||||||
|
|
||||||
|
[target.'cfg(windows)'.dependencies]
|
||||||
|
winapi = "0.1"
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
.file("src/lib.rs", "")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
p.cargo("metadata")
|
||||||
|
.with_json(
|
||||||
|
r#"
|
||||||
|
{
|
||||||
|
"packages": "{...}",
|
||||||
|
"workspace_members": "{...}",
|
||||||
|
"target_directory": "{...}",
|
||||||
|
"version": 1,
|
||||||
|
"workspace_root": "{...}",
|
||||||
|
"resolve": {
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"id": "bar 0.1.0 [..]",
|
||||||
|
"dependencies": [],
|
||||||
|
"deps": [],
|
||||||
|
"features": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "foo 0.1.0 [..]",
|
||||||
|
"dependencies": [
|
||||||
|
"bar 0.1.0 [..]",
|
||||||
|
"winapi 0.1.0 [..]"
|
||||||
|
],
|
||||||
|
"deps": [
|
||||||
|
{
|
||||||
|
"name": "bar",
|
||||||
|
"pkg": "bar 0.1.0 [..]",
|
||||||
|
"dep_kinds": [
|
||||||
|
{
|
||||||
|
"kind": null,
|
||||||
|
"target": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "dev",
|
||||||
|
"target": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "build",
|
||||||
|
"target": null
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "winapi",
|
||||||
|
"pkg": "winapi 0.1.0 [..]",
|
||||||
|
"dep_kinds": [
|
||||||
|
{
|
||||||
|
"kind": null,
|
||||||
|
"target": "cfg(windows)"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"features": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "winapi 0.1.0 [..]",
|
||||||
|
"dependencies": [],
|
||||||
|
"deps": [],
|
||||||
|
"features": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"root": "foo 0.1.0 [..]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
@ -525,6 +525,12 @@ fn update_precise_first_run() {
|
|||||||
],
|
],
|
||||||
"deps": [
|
"deps": [
|
||||||
{
|
{
|
||||||
|
"dep_kinds": [
|
||||||
|
{
|
||||||
|
"kind": null,
|
||||||
|
"target": null
|
||||||
|
}
|
||||||
|
],
|
||||||
"name": "serde",
|
"name": "serde",
|
||||||
"pkg": "serde 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)"
|
"pkg": "serde 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user