From 86601847a216efbc68fb2c38e892051531c6557d Mon Sep 17 00:00:00 2001 From: Mark Date: Sat, 12 May 2018 19:25:52 +0200 Subject: [PATCH 1/3] Instructions to install Rust, get mango, and test #53 --- README.rst | 55 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index 126002a7..50173634 100644 --- a/README.rst +++ b/README.rst @@ -16,11 +16,56 @@ There are dozens of pages of design notes, but the plan still lacks coherence, s How to use ------------------------------- -The compiler is written in Rust for WebAssembly. You can run it using: +The compiler is not complete yet and cannot be used for real code. - rustup toolchain install nightly - cargo install cargo-wasm - cargo wasm build +But if you want to play with it, or even help to complete it, here is how! -This compiles to native code, with WebAssembly to be added later (#34). +These instructions were tested on Ubuntu 18.4 (using Bash). It should also work on other platforms, if you 'translate' the commands. +* Get the code with (something like). + +.. code:: bash + + git clone https://github.com/mangolang/compiler.git mango + cd mango # choose the directory that you downloaded the code to + # After this, I'll assume $PWD is the location of `mango`. + +* The compiler is written in Rust. If you don't have `rustup` yet, install it with instructions `on this page`_. Then + +.. code:: bash + + rustup toolchain install nightly + rustup override set nightly # make sure you are in the mango directory + +* We need a few packages: + +.. code:: bash + + rustup component add rustfmt-preview + + +* There are git commit hooks that you can use. They test that code is formatted well and compiles and commit messages are correctly formatted. You don't have to use them if you ensure these things yourself. If you want to use them: + +.. code:: bash + + git config core.hooksPath $PWD/dev/hooks/ + # on git versions older than 2.9, use (from mango directory): + rm -rf .git/hooks + ln -s $PWD/dev/hooks/ .git/hooks + chmod u+x .git/hooks + +* To format and test the code, run + +.. code:: bash + + cargo +nightly fmt + cargo test --all + +* You're now ready to make changes! If you want to help, you're very welcome! Have a glance at CONTRIBUTING.rst_ if you have a minute. + +* For IDEs, Rust support isn't on the level of e.g. Java yet, but JetBrain's CLion_ with `Rust plugin`_ is not bad if you have a license. + +.. _CLion: https://www.jetbrains.com/clion/ +.. _`Rust plugin`: https://intellij-rust.github.io/ +.. _`on this page`: https://www.rust-lang.org/en-US/install.html +.. _CONTRIBUTING.rst: From 371725820ef598f8f48fd0bf0f4e16b1abb74db3 Mon Sep 17 00:00:00 2001 From: Mark Date: Sat, 12 May 2018 19:26:52 +0200 Subject: [PATCH 2/3] Fix for the commit message validation #21 --- dev/hooks/utils/message_validation.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dev/hooks/utils/message_validation.py b/dev/hooks/utils/message_validation.py index 88cba7cd..73404468 100644 --- a/dev/hooks/utils/message_validation.py +++ b/dev/hooks/utils/message_validation.py @@ -24,6 +24,8 @@ def __init__(self, msg): def validate_title(title): + if not title: + raise ValidationError('Commit message should have at least one line (the title), with any hash(#) appearing at the end') if title[0] in string.ascii_lowercase: raise ValidationError('Commit message title should start with a capital letter') if title[-1] == '.': From a90f2f2c64b67d7fa34499ab4c027195ddbe95ce Mon Sep 17 00:00:00 2001 From: Mark Date: Sat, 12 May 2018 21:38:02 +0200 Subject: [PATCH 3/3] Add instructions for building wasm version of compiler #47 --- README.rst | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 50173634..2c822695 100644 --- a/README.rst +++ b/README.rst @@ -22,6 +22,8 @@ But if you want to play with it, or even help to complete it, here is how! These instructions were tested on Ubuntu 18.4 (using Bash). It should also work on other platforms, if you 'translate' the commands. +* You will need `pkg-config`, `libssl-dev`, `git` and some way to run commands. Python is optional. + * Get the code with (something like). .. code:: bash @@ -36,13 +38,14 @@ These instructions were tested on Ubuntu 18.4 (using Bash). It should also work rustup toolchain install nightly rustup override set nightly # make sure you are in the mango directory + rustup target add wasm32-unknown-emscripten # emscritem for now * We need a few packages: .. code:: bash rustup component add rustfmt-preview - + cargo install cargo-web * There are git commit hooks that you can use. They test that code is formatted well and compiles and commit messages are correctly formatted. You don't have to use them if you ensure these things yourself. If you want to use them: @@ -54,12 +57,20 @@ These instructions were tested on Ubuntu 18.4 (using Bash). It should also work ln -s $PWD/dev/hooks/ .git/hooks chmod u+x .git/hooks -* To format and test the code, run +* The first build will be slow due to downloading and compiling dependencies. To format the code, test it, and launch the command line interface: .. code:: bash cargo +nightly fmt cargo test --all + cargo run --bin mango-cli + +* To deploy the web version in release mode: + +.. code:: bash + + cargo web deploy --release + # then open target/deploy/index.html in a browser * You're now ready to make changes! If you want to help, you're very welcome! Have a glance at CONTRIBUTING.rst_ if you have a minute. @@ -68,4 +79,4 @@ These instructions were tested on Ubuntu 18.4 (using Bash). It should also work .. _CLion: https://www.jetbrains.com/clion/ .. _`Rust plugin`: https://intellij-rust.github.io/ .. _`on this page`: https://www.rust-lang.org/en-US/install.html -.. _CONTRIBUTING.rst: +.. _CONTRIBUTING.rst: https://github.com/mangolang/compiler/blob/dev/CONTRIBUTING.rst