Factor out common symlink check build script

This commit is contained in:
David Tolnay 2020-10-11 02:34:08 -07:00
parent 362c9f92b0
commit 65b66f2091
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
5 changed files with 33 additions and 116 deletions

View File

@ -1,29 +1 @@
use std::io::{self, Write};
use std::path::Path;
use std::process;
const NOSYMLINK: &str = "
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When building `cxx` from a git clone, git's symlink support needs
to be enabled on platforms that have it off by default (Windows).
Either use:
$ git config --global core.symlinks true
prior to cloning, or else use:
$ git clone -c core.symlinks=true ...
for the clone.
Symlinks are only required for local development, not for building
`cxx` as a (possibly transitive) dependency from crates.io.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
";
fn main() {
if !Path::new("src/syntax/mod.rs").exists() {
let _ = io::stderr().lock().write_all(NOSYMLINK.as_bytes());
process::exit(1);
}
}
include!("../../tools/cargo/build.rs");

View File

@ -1,29 +1 @@
use std::io::{self, Write};
use std::path::Path;
use std::process;
const NOSYMLINK: &str = "
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When building `cxx` from a git clone, git's symlink support needs
to be enabled on platforms that have it off by default (Windows).
Either use:
$ git config --global core.symlinks true
prior to cloning, or else use:
$ git clone -c core.symlinks=true ...
for the clone.
Symlinks are only required for local development, not for building
`cxx` as a (possibly transitive) dependency from crates.io.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
";
fn main() {
if !Path::new("src/syntax/mod.rs").exists() {
let _ = io::stderr().lock().write_all(NOSYMLINK.as_bytes());
process::exit(1);
}
}
include!("../../tools/cargo/build.rs");

View File

@ -1,29 +1 @@
use std::io::{self, Write};
use std::path::Path;
use std::process;
const NOSYMLINK: &str = "
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When building `cxx` from a git clone, git's symlink support needs
to be enabled on platforms that have it off by default (Windows).
Either use:
$ git config --global core.symlinks true
prior to cloning, or else use:
$ git clone -c core.symlinks=true ...
for the clone.
Symlinks are only required for local development, not for building
`cxx` as a (possibly transitive) dependency from crates.io.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
";
fn main() {
if !Path::new("src/syntax/mod.rs").exists() {
let _ = io::stderr().lock().write_all(NOSYMLINK.as_bytes());
process::exit(1);
}
}
include!("../../tools/cargo/build.rs");

View File

@ -1,29 +1 @@
use std::io::{self, Write};
use std::path::Path;
use std::process;
const NOSYMLINK: &str = "
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When building `cxx` from a git clone, git's symlink support needs
to be enabled on platforms that have it off by default (Windows).
Either use:
$ git config --global core.symlinks true
prior to cloning, or else use:
$ git clone -c core.symlinks=true ...
for the clone.
Symlinks are only required for local development, not for building
`cxx` as a (possibly transitive) dependency from crates.io.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
";
fn main() {
if !Path::new("src/syntax/mod.rs").exists() {
let _ = io::stderr().lock().write_all(NOSYMLINK.as_bytes());
process::exit(1);
}
}
include!("../tools/cargo/build.rs");

29
tools/cargo/build.rs Normal file
View File

@ -0,0 +1,29 @@
use std::io::{self, Write};
use std::path::Path;
use std::process;
const NOSYMLINK: &str = "
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When building `cxx` from a git clone, git's symlink support needs
to be enabled on platforms that have it off by default (Windows).
Either use:
$ git config --global core.symlinks true
prior to cloning, or else use:
$ git clone -c core.symlinks=true ...
for the clone.
Symlinks are only required for local development, not for building
`cxx` as a (possibly transitive) dependency from crates.io.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
";
fn main() {
if !Path::new("src/syntax/mod.rs").exists() {
let _ = io::stderr().lock().write_all(NOSYMLINK.as_bytes());
process::exit(1);
}
}