forked from FuelLabs/sway
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add build instructions to readme (FuelLabs#282)
* Add CI badge. * Add community badge. * Update readme. * Fix typo. * Fix typo. * Install to Cargo bin. * Heading.
- Loading branch information
Showing
1 changed file
with
46 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,54 @@ | ||
# Sway | ||
|
||
[![Compile and Test](https://github.com/FuelLabs/sway/actions/workflows/cargo_test.yml/badge.svg)](https://github.com/FuelLabs/sway/actions/workflows/cargo_test.yml) | ||
[![Community](https://img.shields.io/badge/chat%20on-discord-orange?&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/xfpK4Pe) | ||
|
||
Sway is a language developed for the Fuel blockchain. It is heavily inspired by Rust and aims to bring modern language development and performance to the blockchain ecosystem. | ||
|
||
## Running the Compiler | ||
## Documentation | ||
|
||
For user documentation, see the Sway Book: <https://fuellabs.github.io/sway/latest/>. | ||
|
||
## Building from Source | ||
|
||
To run the compiler from this directory: | ||
### Dependencies | ||
|
||
```sh | ||
cargo run --bin forc -- -p <path_to_project> | ||
cargo run --bin forc -- build -p example_project/fuel_project | ||
Sway is built in Rust. To begin, install the Rust toolchain following instructions at <https://www.rust-lang.org/tools/install>. Then configure your Rust toolchain to use Rust `stable`: | ||
|
||
```console | ||
rustup default stable | ||
``` | ||
|
||
If not already done, add the Cargo bin directory to your `PATH` by adding the following line to `~/.profile` and restarting the shell session. | ||
|
||
```console | ||
export PATH="${HOME}/.cargo/bin:${PATH}" | ||
``` | ||
|
||
To ensure access to all dependent repositories, [create](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) and [add](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account) SSH keys to your GitHub account. | ||
|
||
### Building Sway | ||
|
||
Clone the repository and build the Sway toolchain: | ||
|
||
```console | ||
git clone [email protected]:FuelLabs/sway.git | ||
cd sway | ||
cargo build | ||
``` | ||
|
||
Confirm the Sway toolchain built successfully: | ||
|
||
```console | ||
cargo run --bin forc -- --help | ||
# or | ||
./target/debug/forc --help | ||
``` | ||
|
||
To run `forc` from any directory, install `forc` to your local Cargo bin directory: | ||
|
||
```console | ||
cargo install --path forc | ||
# Also install sway-server if using the IDE plugin | ||
cargo install --path sway-server | ||
``` |