mirror of https://github.com/rwf2/Rocket.git
Update 'version_check' to 0.9.
This commit is contained in:
parent
be829bd891
commit
2d4eec8f7e
|
@ -23,7 +23,7 @@ quote = "0.6"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
yansi = "0.5"
|
yansi = "0.5"
|
||||||
version_check = "0.1.3"
|
version_check = "0.9.1"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
compiletest_rs = { version = "0.3", features = ["stable"] }
|
compiletest_rs = { version = "0.3", features = ["stable"] }
|
||||||
|
|
|
@ -1,55 +1,40 @@
|
||||||
//! This tiny build script ensures that rocket is not compiled with an
|
//! Ensures Rocket isn't compiled with an incompatible version of Rust.
|
||||||
//! incompatible version of rust.
|
|
||||||
|
|
||||||
extern crate yansi;
|
extern crate yansi;
|
||||||
extern crate version_check;
|
extern crate version_check;
|
||||||
|
|
||||||
use yansi::Color::{Red, Yellow, Blue};
|
use yansi::{Paint, Color::{Red, Yellow, Blue}};
|
||||||
use version_check::{supports_features, is_min_version, is_min_date};
|
|
||||||
|
|
||||||
// Specifies the minimum nightly version needed to compile Rocket.
|
// Specifies the minimum nightly version needed to compile Rocket.
|
||||||
const MIN_DATE: &'static str = "2018-10-05";
|
const MIN_DATE: &'static str = "2018-10-05";
|
||||||
const MIN_VERSION: &'static str = "1.31.0-nightly";
|
const MIN_VERSION: &'static str = "1.31.0-nightly";
|
||||||
|
|
||||||
|
macro_rules! err {
|
||||||
|
($version:expr, $date:expr, $msg:expr) => (
|
||||||
|
eprintln!("{} {}", Red.paint("Error:").bold(), Paint::new($msg).bold());
|
||||||
|
eprintln!("Installed version: {}", Yellow.paint(format!("{} ({})", $version, $date)));
|
||||||
|
eprintln!("Minimum required: {}", Yellow.paint(format!("{} ({})", MIN_VERSION, MIN_DATE)));
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let ok_channel = supports_features();
|
if let Some((version, channel, date)) = version_check::triple() {
|
||||||
let ok_version = is_min_version(MIN_VERSION);
|
if !channel.supports_features() {
|
||||||
let ok_date = is_min_date(MIN_DATE);
|
err!(version, date, "Rocket requires a 'dev' or 'nightly' version of rustc.");
|
||||||
let triple = (ok_channel, ok_version, ok_date);
|
|
||||||
|
|
||||||
let print_version_err = |version: &str, date: &str| {
|
eprint!("{}", Blue.paint("See the getting started guide ("));
|
||||||
eprintln!("{} {}. {} {}.",
|
eprint!("https://rocket.rs/v0.5/guide/getting-started/");
|
||||||
"Installed version is:",
|
eprintln!("{}", Blue.paint(") for more information."));
|
||||||
Yellow.paint(format!("{} ({})", version, date)),
|
|
||||||
"Minimum required:",
|
|
||||||
Yellow.paint(format!("{} ({})", MIN_VERSION, MIN_DATE)));
|
|
||||||
};
|
|
||||||
|
|
||||||
if let (Some(ok_channel), Some((ok_version, version)), Some((ok_date, date))) = triple {
|
|
||||||
if !ok_channel {
|
|
||||||
eprintln!("{} {}",
|
|
||||||
Red.paint("Error:").bold(),
|
|
||||||
"Rocket requires a nightly or dev version of Rust.");
|
|
||||||
print_version_err(&*version, &*date);
|
|
||||||
eprintln!("{}{}{}",
|
|
||||||
Blue.paint("See the getting started guide ("),
|
|
||||||
"https://rocket.rs/v0.4/guide/getting-started/",
|
|
||||||
Blue.paint(") for more information."));
|
|
||||||
panic!("Aborting compilation due to incompatible compiler.")
|
panic!("Aborting compilation due to incompatible compiler.")
|
||||||
}
|
}
|
||||||
|
|
||||||
if !ok_version || !ok_date {
|
if !version.at_least(MIN_VERSION) || !date.at_least(MIN_DATE) {
|
||||||
eprintln!("{} {}",
|
err!(version, date, "Rocket requires a more recent version of rustc.");
|
||||||
Red.paint("Error:").bold(),
|
|
||||||
"Rocket requires a more recent version of rustc.");
|
|
||||||
eprintln!("{}{}{}",
|
|
||||||
Blue.paint("Use `"), "rustup update",
|
|
||||||
Blue.paint("` or your preferred method to update Rust."));
|
|
||||||
print_version_err(&*version, &*date);
|
|
||||||
panic!("Aborting compilation due to incompatible compiler.")
|
panic!("Aborting compilation due to incompatible compiler.")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
println!("cargo:warning={}", "Rocket was unable to check rustc compatibility.");
|
println!("cargo:warning={}", "Rocket was unable to check rustc compiler compatibility.");
|
||||||
println!("cargo:warning={}", "Build may fail due to incompatible rustc version.");
|
println!("cargo:warning={}", "Build may fail due to incompatible rustc version.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ devise = "0.2"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
yansi = "0.5"
|
yansi = "0.5"
|
||||||
version_check = "0.1.3"
|
version_check = "0.9.1"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
rocket = { version = "0.4.1", path = "../lib" }
|
rocket = { version = "0.4.1", path = "../lib" }
|
||||||
|
|
|
@ -1,55 +1,40 @@
|
||||||
//! This tiny build script ensures that rocket is not compiled with an
|
//! Ensures Rocket isn't compiled with an incompatible version of Rust.
|
||||||
//! incompatible version of rust.
|
|
||||||
|
|
||||||
extern crate yansi;
|
extern crate yansi;
|
||||||
extern crate version_check;
|
extern crate version_check;
|
||||||
|
|
||||||
use yansi::Color::{Red, Yellow, Blue};
|
use yansi::{Paint, Color::{Red, Yellow, Blue}};
|
||||||
use version_check::{supports_features, is_min_version, is_min_date};
|
|
||||||
|
|
||||||
// Specifies the minimum nightly version needed to compile Rocket.
|
// Specifies the minimum nightly version needed to compile Rocket.
|
||||||
const MIN_DATE: &'static str = "2019-01-13";
|
const MIN_DATE: &'static str = "2019-01-13";
|
||||||
const MIN_VERSION: &'static str = "1.33.0-nightly";
|
const MIN_VERSION: &'static str = "1.33.0-nightly";
|
||||||
|
|
||||||
|
macro_rules! err {
|
||||||
|
($version:expr, $date:expr, $msg:expr) => (
|
||||||
|
eprintln!("{} {}", Red.paint("Error:").bold(), Paint::new($msg).bold());
|
||||||
|
eprintln!("Installed version: {}", Yellow.paint(format!("{} ({})", $version, $date)));
|
||||||
|
eprintln!("Minimum required: {}", Yellow.paint(format!("{} ({})", MIN_VERSION, MIN_DATE)));
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let ok_channel = supports_features();
|
if let Some((version, channel, date)) = version_check::triple() {
|
||||||
let ok_version = is_min_version(MIN_VERSION);
|
if !channel.supports_features() {
|
||||||
let ok_date = is_min_date(MIN_DATE);
|
err!(version, date, "Rocket (codegen) requires a 'dev' or 'nightly' version of rustc.");
|
||||||
let triple = (ok_channel, ok_version, ok_date);
|
|
||||||
|
|
||||||
let print_version_err = |version: &str, date: &str| {
|
eprint!("{}", Blue.paint("See the getting started guide ("));
|
||||||
eprintln!("{} {}. {} {}.",
|
eprint!("https://rocket.rs/v0.5/guide/getting-started/");
|
||||||
"Installed version is:",
|
eprintln!("{}", Blue.paint(") for more information."));
|
||||||
Yellow.paint(format!("{} ({})", version, date)),
|
|
||||||
"Minimum required:",
|
|
||||||
Yellow.paint(format!("{} ({})", MIN_VERSION, MIN_DATE)));
|
|
||||||
};
|
|
||||||
|
|
||||||
if let (Some(ok_channel), Some((ok_version, version)), Some((ok_date, date))) = triple {
|
|
||||||
if !ok_channel {
|
|
||||||
eprintln!("{} {}",
|
|
||||||
Red.paint("Error:").bold(),
|
|
||||||
"Rocket requires a nightly or dev version of Rust.");
|
|
||||||
print_version_err(&*version, &*date);
|
|
||||||
eprintln!("{}{}{}",
|
|
||||||
Blue.paint("See the getting started guide ("),
|
|
||||||
"https://rocket.rs/v0.4/guide/getting-started/",
|
|
||||||
Blue.paint(") for more information."));
|
|
||||||
panic!("Aborting compilation due to incompatible compiler.")
|
panic!("Aborting compilation due to incompatible compiler.")
|
||||||
}
|
}
|
||||||
|
|
||||||
if !ok_version || !ok_date {
|
if !version.at_least(MIN_VERSION) || !date.at_least(MIN_DATE) {
|
||||||
eprintln!("{} {}",
|
err!(version, date, "Rocket (codegen) requires a more recent version of rustc.");
|
||||||
Red.paint("Error:").bold(),
|
|
||||||
"Rocket requires a more recent version of rustc.");
|
|
||||||
eprintln!("{}{}{}",
|
|
||||||
Blue.paint("Use `"), "rustup update",
|
|
||||||
Blue.paint("` or your preferred method to update Rust."));
|
|
||||||
print_version_err(&*version, &*date);
|
|
||||||
panic!("Aborting compilation due to incompatible compiler.")
|
panic!("Aborting compilation due to incompatible compiler.")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
println!("cargo:warning={}", "Rocket was unable to check rustc compatibility.");
|
println!("cargo:warning={}", "Rocket was unable to check rustc compiler compatibility.");
|
||||||
println!("cargo:warning={}", "Build may fail due to incompatible rustc version.");
|
println!("cargo:warning={}", "Build may fail due to incompatible rustc version.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ atty = "0.2"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
yansi = "0.5"
|
yansi = "0.5"
|
||||||
version_check = "0.1.3"
|
version_check = "0.9.1"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
# TODO: Find a way to not depend on this.
|
# TODO: Find a way to not depend on this.
|
||||||
|
|
|
@ -1,55 +1,40 @@
|
||||||
//! This tiny build script ensures that rocket is not compiled with an
|
//! Ensures Rocket isn't compiled with an incompatible version of Rust.
|
||||||
//! incompatible version of rust.
|
|
||||||
|
|
||||||
extern crate yansi;
|
extern crate yansi;
|
||||||
extern crate version_check;
|
extern crate version_check;
|
||||||
|
|
||||||
use yansi::Color::{Red, Yellow, Blue};
|
use yansi::{Paint, Color::{Red, Yellow, Blue}};
|
||||||
use version_check::{supports_features, is_min_version, is_min_date};
|
|
||||||
|
|
||||||
// Specifies the minimum nightly version needed to compile Rocket.
|
// Specifies the minimum nightly version needed to compile Rocket.
|
||||||
const MIN_DATE: &'static str = "2019-04-05";
|
const MIN_DATE: &'static str = "2019-04-05";
|
||||||
const MIN_VERSION: &'static str = "1.35.0-nightly";
|
const MIN_VERSION: &'static str = "1.35.0-nightly";
|
||||||
|
|
||||||
|
macro_rules! err {
|
||||||
|
($version:expr, $date:expr, $msg:expr) => (
|
||||||
|
eprintln!("{} {}", Red.paint("Error:").bold(), Paint::new($msg).bold());
|
||||||
|
eprintln!("Installed version: {}", Yellow.paint(format!("{} ({})", $version, $date)));
|
||||||
|
eprintln!("Minimum required: {}", Yellow.paint(format!("{} ({})", MIN_VERSION, MIN_DATE)));
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let ok_channel = supports_features();
|
if let Some((version, channel, date)) = version_check::triple() {
|
||||||
let ok_version = is_min_version(MIN_VERSION);
|
if !channel.supports_features() {
|
||||||
let ok_date = is_min_date(MIN_DATE);
|
err!(version, date, "Rocket (core) requires a 'dev' or 'nightly' version of rustc.");
|
||||||
let triple = (ok_channel, ok_version, ok_date);
|
|
||||||
|
|
||||||
let print_version_err = |version: &str, date: &str| {
|
eprint!("{}", Blue.paint("See the getting started guide ("));
|
||||||
eprintln!("{} {}. {} {}.",
|
eprint!("https://rocket.rs/v0.5/guide/getting-started/");
|
||||||
"Installed version is:",
|
eprintln!("{}", Blue.paint(") for more information."));
|
||||||
Yellow.paint(format!("{} ({})", version, date)),
|
|
||||||
"Minimum required:",
|
|
||||||
Yellow.paint(format!("{} ({})", MIN_VERSION, MIN_DATE)));
|
|
||||||
};
|
|
||||||
|
|
||||||
if let (Some(ok_channel), Some((ok_version, version)), Some((ok_date, date))) = triple {
|
|
||||||
if !ok_channel {
|
|
||||||
eprintln!("{} {}",
|
|
||||||
Red.paint("Error:").bold(),
|
|
||||||
"Rocket requires a nightly or dev version of Rust.");
|
|
||||||
print_version_err(&*version, &*date);
|
|
||||||
eprintln!("{}{}{}",
|
|
||||||
Blue.paint("See the getting started guide ("),
|
|
||||||
"https://rocket.rs/v0.4/guide/getting-started/",
|
|
||||||
Blue.paint(") for more information."));
|
|
||||||
panic!("Aborting compilation due to incompatible compiler.")
|
panic!("Aborting compilation due to incompatible compiler.")
|
||||||
}
|
}
|
||||||
|
|
||||||
if !ok_version || !ok_date {
|
if !version.at_least(MIN_VERSION) || !date.at_least(MIN_DATE) {
|
||||||
eprintln!("{} {}",
|
err!(version, date, "Rocket (core) requires a more recent version of rustc.");
|
||||||
Red.paint("Error:").bold(),
|
|
||||||
"Rocket requires a more recent version of rustc.");
|
|
||||||
eprintln!("{}{}{}",
|
|
||||||
Blue.paint("Use `"), "rustup update",
|
|
||||||
Blue.paint("` or your preferred method to update Rust."));
|
|
||||||
print_version_err(&*version, &*date);
|
|
||||||
panic!("Aborting compilation due to incompatible compiler.")
|
panic!("Aborting compilation due to incompatible compiler.")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
println!("cargo:warning={}", "Rocket was unable to check rustc compatibility.");
|
println!("cargo:warning={}", "Rocket was unable to check rustc compiler compatibility.");
|
||||||
println!("cargo:warning={}", "Build may fail due to incompatible rustc version.");
|
println!("cargo:warning={}", "Build may fail due to incompatible rustc version.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue