Enable compilation with stable Rust.

To the Rust teams, Rust's contributors, Rocket's contributors, the
entire Rust and Rocket communities, my colleagues at Stanford and
beyond, and Jeb: thank you all. Sincerely.

To the next ~4 years of Rocket!

Closes #19.
This commit is contained in:
Sergio Benitez 2020-07-17 07:36:38 -07:00
parent b47d1b8f0f
commit 56a6172625
7 changed files with 38 additions and 127 deletions

View File

@ -1,4 +1,4 @@
name: Test
name: CI
on: [push, pull_request]
@ -7,28 +7,39 @@ env:
jobs:
test:
name: "${{ matrix.os.name }} ${{ matrix.test.name }}"
name: "${{ matrix.os.name }} ${{ matrix.test.name }} (${{ matrix.toolchain }})"
strategy:
fail-fast: false
matrix:
os:
- name: Linux
distro: ubuntu-latest
- name: Windows
distro: windows-latest
- name: macOS
distro: macOS-latest
toolchain:
- nightly
- { name: Linux, distro: ubuntu-latest }
- { name: Windows, distro: windows-latest }
- { name: macOS, distro: macOS-latest }
test:
- name: Debug
flag:
- name: Release
flag: "--release"
- name: Core
flag: "--core"
- name: Contrib
flag: "--contrib"
- { name: Debug, flag: }
- { name: Contrib, flag: "--contrib" }
toolchain: [stable]
allow-failures: [false]
include:
- toolchain: stable
os: { name: Linux, distro: ubuntu-latest }
test: { name: Core, flag: "--core" }
allow-failures: false
- toolchain: stable
os: { name: Linux, distro: ubuntu-latest }
test: { name: Release, flag: "--release" }
allow-failures: false
- toolchain: nightly
os: { name: Linux, distro: ubuntu-latest }
test: { name: Debug, flag: }
allow-failures: true
- toolchain: nightly
os: { name: Linux, distro: ubuntu-latest }
test: { name: Contrib, flag: "--contrib" }
allow-failures: true
continue-on-error: ${{ matrix.allow-failures }}
runs-on: ${{ matrix.os.distro }}

View File

@ -1,6 +1,6 @@
# Rocket
[![Build Status](https://github.com/SergioBenitez/Rocket/workflows/Test/badge.svg)](https://github.com/SergioBenitez/Rocket/actions)
[![Build Status](https://github.com/SergioBenitez/Rocket/workflows/CI/badge.svg)](https://github.com/SergioBenitez/Rocket/actions)
[![Rocket Homepage](https://img.shields.io/badge/web-rocket.rs-red.svg?style=flat&label=https&colorB=d33847)](https://rocket.rs)
[![Current Crates.io Version](https://img.shields.io/crates/v/rocket.svg)](https://crates.io/crates/rocket)
[![Matrix: #rocket:mozilla.org](https://img.shields.io/badge/style-%23rocket:mozilla.org-blue.svg?style=flat&label=[m])](https://chat.mozilla.org/#/room/#rocket:mozilla.org)

View File

@ -9,7 +9,6 @@ repository = "https://github.com/SergioBenitez/Rocket"
readme = "../../README.md"
keywords = ["rocket", "contrib", "code", "generation", "proc-macro"]
license = "MIT OR Apache-2.0"
build = "build.rs"
edition = "2018"
[features]
@ -22,10 +21,6 @@ proc-macro = true
quote = "1.0"
devise = { git = "https://github.com/SergioBenitez/Devise.git", rev = "1e42a2691" }
[build-dependencies]
yansi = "0.5"
version_check = "0.9.1"
[dev-dependencies]
rocket = { version = "0.5.0-dev", path = "../../core/lib" }
rocket_contrib = { version = "0.5.0-dev", path = "../lib", features = ["diesel_sqlite_pool"] }

View File

@ -1,40 +0,0 @@
//! Ensures Rocket isn't compiled with an incompatible version of Rust.
extern crate yansi;
extern crate version_check;
use yansi::{Paint, Color::{Red, Yellow, Blue}};
// Specifies the minimum nightly version needed to compile Rocket.
const MIN_DATE: &'static str = "2020-05-20";
const MIN_VERSION: &'static str = "1.45.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() {
if let Some((version, channel, date)) = version_check::triple() {
if !channel.supports_features() {
err!(version, date, "Rocket requires a 'dev' or 'nightly' version of rustc.");
eprint!("{}", Blue.paint("See the getting started guide ("));
eprint!("https://rocket.rs/v0.5/guide/getting-started/");
eprintln!("{}", Blue.paint(") for more information."));
panic!("Aborting compilation due to incompatible compiler.")
}
if !version.at_least(MIN_VERSION) || !date.at_least(MIN_DATE) {
err!(version, date, "Rocket requires a more recent version of rustc.");
panic!("Aborting compilation due to incompatible compiler.")
}
} else {
println!("cargo:warning={}", "Rocket was unable to check rustc compiler compatibility.");
println!("cargo:warning={}", "Build may fail due to incompatible rustc version.");
}
}

View File

@ -9,7 +9,6 @@ repository = "https://github.com/SergioBenitez/Rocket"
readme = "../../README.md"
keywords = ["rocket", "web", "framework", "code", "generation"]
license = "MIT OR Apache-2.0"
build = "build.rs"
edition = "2018"
[lib]
@ -22,10 +21,6 @@ rocket_http = { version = "0.5.0-dev", path = "../http/" }
devise = { git = "https://github.com/SergioBenitez/Devise.git", rev = "1e42a2691" }
glob = "0.3"
[build-dependencies]
yansi = "0.5"
version_check = "0.9.1"
[dev-dependencies]
rocket = { version = "0.5.0-dev", path = "../lib" }
version_check = "0.9"

View File

@ -1,37 +0,0 @@
//! Ensures Rocket isn't compiled with an incompatible version of Rust.
use yansi::{Paint, Color::{Red, Yellow, Blue}};
// Specifies the minimum nightly version needed to compile Rocket.
const MIN_DATE: &'static str = "2020-05-20";
const MIN_VERSION: &'static str = "1.45.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() {
if let Some((version, channel, date)) = version_check::triple() {
if !channel.supports_features() {
err!(version, date, "Rocket (codegen) requires a 'dev' or 'nightly' version of rustc.");
eprint!("{}", Blue.paint("See the getting started guide ("));
eprint!("https://rocket.rs/v0.5/guide/getting-started/");
eprintln!("{}", Blue.paint(") for more information."));
panic!("Aborting compilation due to incompatible compiler.")
}
if !version.at_least(MIN_VERSION) || !date.at_least(MIN_DATE) {
err!(version, date, "Rocket (codegen) requires a more recent version of rustc.");
panic!("Aborting compilation due to incompatible compiler.")
}
} else {
println!("cargo:warning={}", "Rocket was unable to check rustc compiler compatibility.");
println!("cargo:warning={}", "Build may fail due to incompatible rustc version.");
}
}

View File

@ -1,34 +1,21 @@
//! Ensures Rocket isn't compiled with an incompatible version of Rust.
use yansi::{Paint, Color::{Red, Yellow, Blue}};
use yansi::{Paint, Color::{Red, Yellow}};
// Specifies the minimum nightly version needed to compile Rocket.
const MIN_DATE: &'static str = "2020-05-20";
const MIN_VERSION: &'static str = "1.45.0-nightly";
const MIN_VERSION: &'static str = "1.45.0";
macro_rules! err {
($version:expr, $date:expr, $msg:expr) => (
($version: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)));
eprintln!("Installed version: {}", Yellow.paint(format!("{}", $version)));
eprintln!("Minimum required: {}", Yellow.paint(format!("{}", MIN_VERSION)));
)
}
fn main() {
if let Some((version, channel, date)) = version_check::triple() {
if !channel.supports_features() {
err!(version, date, "Rocket (core) requires a 'dev' or 'nightly' version of rustc.");
eprint!("{}", Blue.paint("See the getting started guide ("));
eprint!("https://rocket.rs/v0.5/guide/getting-started/");
eprintln!("{}", Blue.paint(") for more information."));
panic!("Aborting compilation due to incompatible compiler.")
}
if !version.at_least(MIN_VERSION) || !date.at_least(MIN_DATE) {
err!(version, date, "Rocket (core) requires a more recent version of rustc.");
if let Some(version) = version_check::Version::read() {
if !version.at_least(MIN_VERSION) {
err!(version, "Rocket requires a more recent version of rustc.");
panic!("Aborting compilation due to incompatible compiler.")
}
} else {