Skip to content

Commit

Permalink
Merge pull request #23 from artichoke/stable-rust
Browse files Browse the repository at this point in the history
Build playground with stable Rust 1.37.0
  • Loading branch information
lopopolo authored Oct 12, 2019
2 parents 789f2af + c652ded commit a9b72c0
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 22 deletions.
5 changes: 2 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ commands:
jobs:
rust:
docker:
- image: circleci/rust:buster
- image: circleci/rust:1.37.0-buster
steps:
- checkout
- restore_cache:
Expand All @@ -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
Expand Down
15 changes: 8 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
11 changes: 0 additions & 11 deletions playground/src/main.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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() {}
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2019-07-08
1.37.0
18 changes: 18 additions & 0 deletions scripts/activate-wasm-build-env.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit a9b72c0

Please sign in to comment.