Skip to content

Commit

Permalink
Update documentation for custom target dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed Nov 22, 2019
1 parent 579174c commit 285dc31
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
12 changes: 4 additions & 8 deletions src/doc/src/reference/specifying-dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -483,20 +483,16 @@ winhttp = "0.4.0"
openssl = "1.0.1"
```

If you’re using a custom target specification, quote the full path and file
name:
If you’re using a custom target specification (such as `--target
foo/bar.json`), use the base filename without the `.json` extension:

```toml
[target."x86_64/windows.json".dependencies]
[target.bar.dependencies]
winhttp = "0.4.0"

[target."i686/linux.json".dependencies]
[target.my-special-i686-platform.dependencies]
openssl = "1.0.1"
native = { path = "native/i686" }

[target."x86_64/linux.json".dependencies]
openssl = "1.0.1"
native = { path = "native/x86_64" }
```

### Development dependencies
Expand Down
19 changes: 18 additions & 1 deletion tests/build-std/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,24 @@ fn basic() {
#[cargo_test(build_std)]
fn cross_custom() {
let p = project()
.file("src/lib.rs", "#![no_std] pub fn f() {}")
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.1.0"
edition = "2018"
[target.custom-target.dependencies]
dep = { path = "dep" }
"#,
)
.file(
"src/lib.rs",
"#![no_std] pub fn f() -> u32 { dep::answer() }",
)
.file("dep/Cargo.toml", &basic_manifest("dep", "0.1.0"))
.file("dep/src/lib.rs", "#![no_std] pub fn answer() -> u32 { 42 }")
.file(
"custom-target.json",
r#"
Expand Down

0 comments on commit 285dc31

Please sign in to comment.