Skip to content

Commit c6f5d77

Browse files
authored
Merge pull request #295 from dtolnay/detect
Detect when symlink not enabled
2 parents 3257446 + d4b1cee commit c6f5d77

File tree

8 files changed

+120
-1
lines changed

8 files changed

+120
-1
lines changed

gen/build/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ edition = "2018"
66
license = "MIT OR Apache-2.0"
77
description = "C++ code generator for integrating `cxx` crate into a Cargo build."
88
repository = "https://github.com/dtolnay/cxx"
9+
exclude = ["build.rs"]
910
keywords = ["ffi"]
1011
categories = ["development-tools::ffi"]
1112

gen/build/build.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
use std::io::{self, Write};
2+
use std::path::Path;
3+
use std::process;
4+
5+
const NOSYMLINK: &str = "
6+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7+
When building `cxx` from a git clone, git's symlink support needs
8+
to be enabled on platforms that have it off by default (Windows).
9+
Either use:
10+
11+
$ git config --global core.symlinks true
12+
13+
prior to cloning, or else use:
14+
15+
$ git clone -c core.symlinks=true ...
16+
17+
for the clone.
18+
19+
Symlinks are only required for local development, not for building
20+
`cxx` as a (possibly transitive) dependency from crates.io.
21+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22+
";
23+
24+
fn main() {
25+
if !Path::new("src/syntax/mod.rs").exists() {
26+
let _ = io::stderr().lock().write_all(NOSYMLINK.as_bytes());
27+
process::exit(1);
28+
}
29+
}

gen/cmd/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ edition = "2018"
66
license = "MIT OR Apache-2.0"
77
description = "C++ code generator for integrating `cxx` crate into a non-Cargo build."
88
repository = "https://github.com/dtolnay/cxx"
9+
exclude = ["build.rs"]
910
keywords = ["ffi"]
1011
categories = ["development-tools::ffi"]
1112

gen/cmd/build.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
use std::io::{self, Write};
2+
use std::path::Path;
3+
use std::process;
4+
5+
const NOSYMLINK: &str = "
6+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7+
When building `cxx` from a git clone, git's symlink support needs
8+
to be enabled on platforms that have it off by default (Windows).
9+
Either use:
10+
11+
$ git config --global core.symlinks true
12+
13+
prior to cloning, or else use:
14+
15+
$ git clone -c core.symlinks=true ...
16+
17+
for the clone.
18+
19+
Symlinks are only required for local development, not for building
20+
`cxx` as a (possibly transitive) dependency from crates.io.
21+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22+
";
23+
24+
fn main() {
25+
if !Path::new("src/syntax/mod.rs").exists() {
26+
let _ = io::stderr().lock().write_all(NOSYMLINK.as_bytes());
27+
process::exit(1);
28+
}
29+
}

gen/lib/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ edition = "2018"
66
license = "MIT OR Apache-2.0"
77
description = "C++ code generator for integrating `cxx` crate into higher level tools."
88
repository = "https://github.com/dtolnay/cxx"
9+
exclude = ["build.rs"]
910
keywords = ["ffi"]
1011
categories = ["development-tools::ffi"]
1112

gen/lib/build.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
use std::io::{self, Write};
2+
use std::path::Path;
3+
use std::process;
4+
5+
const NOSYMLINK: &str = "
6+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7+
When building `cxx` from a git clone, git's symlink support needs
8+
to be enabled on platforms that have it off by default (Windows).
9+
Either use:
10+
11+
$ git config --global core.symlinks true
12+
13+
prior to cloning, or else use:
14+
15+
$ git clone -c core.symlinks=true ...
16+
17+
for the clone.
18+
19+
Symlinks are only required for local development, not for building
20+
`cxx` as a (possibly transitive) dependency from crates.io.
21+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22+
";
23+
24+
fn main() {
25+
if !Path::new("src/syntax/mod.rs").exists() {
26+
let _ = io::stderr().lock().write_all(NOSYMLINK.as_bytes());
27+
process::exit(1);
28+
}
29+
}

macro/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ edition = "2018"
66
license = "MIT OR Apache-2.0"
77
description = "Implementation detail of the `cxx` crate."
88
repository = "https://github.com/dtolnay/cxx"
9-
exclude = ["README.md"]
9+
exclude = ["build.rs", "README.md"]
1010
keywords = ["ffi"]
1111
categories = ["development-tools::ffi"]
1212

macro/build.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
use std::io::{self, Write};
2+
use std::path::Path;
3+
use std::process;
4+
5+
const NOSYMLINK: &str = "
6+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7+
When building `cxx` from a git clone, git's symlink support needs
8+
to be enabled on platforms that have it off by default (Windows).
9+
Either use:
10+
11+
$ git config --global core.symlinks true
12+
13+
prior to cloning, or else use:
14+
15+
$ git clone -c core.symlinks=true ...
16+
17+
for the clone.
18+
19+
Symlinks are only required for local development, not for building
20+
`cxx` as a (possibly transitive) dependency from crates.io.
21+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22+
";
23+
24+
fn main() {
25+
if !Path::new("src/syntax/mod.rs").exists() {
26+
let _ = io::stderr().lock().write_all(NOSYMLINK.as_bytes());
27+
process::exit(1);
28+
}
29+
}

0 commit comments

Comments
 (0)