Skip to content

Commit

Permalink
Enable compilation with stable Rust.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
SergioBenitez committed Jul 21, 2020
1 parent b47d1b8 commit 56a6172
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 127 deletions.
47 changes: 29 additions & 18 deletions .github/workflows/test.yml β†’ .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test
name: CI

on: [push, pull_request]

Expand All @@ -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 }}

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
5 changes: 0 additions & 5 deletions contrib/codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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"] }
Expand Down
40 changes: 0 additions & 40 deletions contrib/codegen/build.rs

This file was deleted.

5 changes: 0 additions & 5 deletions core/codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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"
Expand Down
37 changes: 0 additions & 37 deletions core/codegen/build.rs

This file was deleted.

29 changes: 8 additions & 21 deletions core/lib/build.rs
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down

7 comments on commit 56a6172

@patchin
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woot!

@macpp
Copy link

@macpp macpp commented on 56a6172 Jul 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@EstebanBorai
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰
I will update right now!
thanks!

@nicolaiunrein
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome!

@admwrd
Copy link

@admwrd admwrd commented on 56a6172 Jul 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, Sergio, Jeb, and all of the other people who have contributed to Rocket being the awesome and fun framework that it is!

@Rustin170506
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

@kiyoakii
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! πŸŽ‰πŸŽ‰

Please sign in to comment.