diff --git a/.circleci/config.yml b/.circleci/config.yml index 20bf8fb7..cbc34648 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -30,7 +30,7 @@ commands: jobs: rust: docker: - - image: circleci/rust:buster + - image: circleci/rust:1.37.0-buster steps: - checkout - restore_cache: @@ -56,9 +56,8 @@ jobs: # https://github.com/mruby/mruby/blob/master/doc/guides/compile.md#prerequisites name: Install mruby Build Dependencies command: | - sudo apt-get install -y bison gperf + sudo apt-get install -y bison bison --version - gperf --version - run: # needed for cc crate in build.rs name: Install mruby-sys Build Dependencies diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bb1f5c53..8643f95c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,8 +29,8 @@ dependencies, which are orchestrated by [Yarn](https://yarnpkg.com/). ### Rust Toolchain -The Artichoke Playground depends on nightly Rust and several compiler plugins -for linting and formatting. The specific version of Rust Artichoke requires is +The Artichoke Playground depends on stable Rust and several compiler plugins for +linting and formatting. The specific version of Rust Artichoke requires is specified in the [toolchain file](/rust-toolchain) #### Installation @@ -179,11 +179,12 @@ Merges will be blocked by CI if there are lint errors. ### Rust Toolchain -Because rustfmt, clippy, and the language server sometimes break on nightly, th -Artichoke Playground pegs a specific date archive of nightly. If you want to -update the pegged nightly version, choose one that has -[passing builds for rustfmt, clippy, and rls](https://rust-lang-nursery.github.io/rust-toolstate/); -otherwise, the build will fail on [CI](/.circleci/config.yml). +The rust-toolchain can be bumped to the latest stable compiler by editing the +[`rust-toolchain`](/rust-toolchain) file. This file is automatically picked up +by local builds and CI. + +When updating the Rust toolchain, please also bump the build container base +image in [`.circleci/config.yml`](/.circleci/config.yml). ### Rust Crates diff --git a/playground/src/main.rs b/playground/src/main.rs index 6a211b65..b52ac0f8 100644 --- a/playground/src/main.rs +++ b/playground/src/main.rs @@ -1,7 +1,6 @@ #![deny(warnings, intra_doc_link_resolution_failure)] #![deny(clippy::all, clippy::pedantic)] #![allow(clippy::cast_possible_truncation, clippy::cast_lossless)] -#![feature(link_args)] use artichoke_backend::eval::{Context, Eval}; use artichoke_backend::Artichoke; @@ -116,14 +115,4 @@ pub fn artichoke_eval(state: u32, ptr: u32) -> u32 { s } -#[cfg(link_args = r#" - -s WASM=1 - -s ASSERTIONS=1 - -s ENVIRONMENT='web' - -s EXPORTED_FUNCTIONS=["_artichoke_web_repl_init","_artichoke_string_new","_artichoke_string_free","_artichoke_string_getlen","_artichoke_string_getch","_artichoke_string_putch","_artichoke_eval"] - -s EXTRA_EXPORTED_RUNTIME_METHODS=["ccall","cwrap"] -"#)] -#[allow(unused_attributes)] -extern "C" {} - fn main() {} diff --git a/rust-toolchain b/rust-toolchain index b7838311..bf50e910 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2019-07-08 +1.37.0 diff --git a/scripts/activate-wasm-build-env.sh b/scripts/activate-wasm-build-env.sh index f0a2f82c..5184d946 100644 --- a/scripts/activate-wasm-build-env.sh +++ b/scripts/activate-wasm-build-env.sh @@ -1,5 +1,23 @@ #!/usr/bin/env bash +link_args=( + -s "NO_EXIT_RUNTIME=1" + -s "WASM=1" + -s "ASSERTIONS=1" + -s "ENVIRONMENT=web" + -s 'EXPORTED_FUNCTIONS=["_artichoke_web_repl_init","_artichoke_string_new","_artichoke_string_free","_artichoke_string_getlen","_artichoke_string_getch","_artichoke_string_putch","_artichoke_eval"]' + -s 'EXTRA_EXPORTED_RUNTIME_METHODS=["ccall","cwrap"]' +) + +declare -a rustc_linker_flags +for flag in "${link_args[@]}"; do + rustc_linker_flags+=("-C") + rustc_linker_flags+=("link-arg=$flag") +done + +RUSTFLAGS="${rustc_linker_flags[*]}" +export RUSTFLAGS + ensure_emsdk() { # shellcheck disable=SC2091 if [ ! -f "target/emsdk/emsdk" ]; then