Skip to content

Commit

Permalink
Add instructions on how to install ELP from source
Browse files Browse the repository at this point in the history
Summary:
* Port and expand the instructions from the CONTRIBUTING file
* Point the CONTRIBUTING file to the new instructions

Reviewed By: alanz

Differential Revision: D53916555

fbshipit-source-id: 3098892ee7fadadece4b54890b234b7db59d14ff
  • Loading branch information
robertoaloi authored and facebook-github-bot committed Feb 19, 2024
1 parent 1e0720a commit 5276f03
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 41 deletions.
33 changes: 1 addition & 32 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,7 @@ requests as described below.

The gold standard is the current config in [ci.yml](.github/workflows/ci.yml).

A summary of these is

Check out [eqwalizer](https://github.com/WhatsApp/eqwalizer/) next to erlang-language-platform (this repo).

Install [sbt](https://www.scala-sbt.org/), and java >= 11

```sh
cd $PATH_TO_REPO/eqwalizer/eqwalizer
sbt assembly
```

It gives a path to the file

```sh
export ELP_EQWALIZER_PATH=<the path>
```

e.g. on a particular machine this would be

```sh
export ELP_EQWALIZER_PATH=/home/alanz/mysrc/github/WhatsApp/eqwalizer/eqwalizer/target/scala-2.13/eqwalizer.jar
```

Then use `cargo build` as usual from this repository.

Note: if you set `ELP_EQWALIZER_PATH` in your shell profile, it will be used by rust_analyzer in your IDE too.

An alternative way to build is

```sh
ELP_EQWALIZER_PATH=../../../eqwalizer/eqwalizer/target/scala-2.13/eqwalizer.jar cargo build
```
You can find detailed instructions on how to compile ELP from source [here](./website/docs/get-started/install.md).

## Pull Requests

Expand Down
80 changes: 71 additions & 9 deletions website/docs/get-started/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,40 @@ sidebar_position: 2

# Install ELP

The easiest way to install to ELP is [from binary](#from-binary). It is also possible to compile it [from source](#from-source).
The easiest way to install to ELP is [from binary](#from-binary). It is also
possible to compile it [from source](#from-source).

## From Binary

Visit our [releases](https://github.com/WhatsApp/erlang-language-platform/releases) page and download the `elp` tarball for the latest releases.
Visit our
[releases](https://github.com/WhatsApp/erlang-language-platform/releases) page
and download the `elp` tarball for the latest releases.

Packages are available in the _Assets_ section below each release. Each tarball name has the format:
Packages are available in the _Assets_ section below each release. Each tarball
name has the format:

```
elp-[OS]-[ARCH]-[c]-otp-[OTP_VERSION].tar.gz
```

Pick the appropriate version according to your Operating System (OS), Architecture (ARCH) and Erlang/OTP version (OTP_VERSION). For example, for my Darwin MacBook Pro where I have installed Erlang/OTP 25, I will pick:
Pick the appropriate version according to your Operating System (OS),
Architecture (ARCH) and Erlang/OTP version (OTP_VERSION). For example, for my
Darwin MacBook Pro where I have installed Erlang/OTP 25, I will pick:

```
elp-macos-x86_64-apple-darwin-otp-25.3.tar.gz
```

:::tip

Unsure about your architecture? Try the `uname -a` command.
Unsure about your Erlang/OTP version? Try `erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell`
Unsure about your architecture? Try the `uname -a` command. Unsure about your
Erlang/OTP version? Try
`erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell`

:::

Untar the package and place the `elp` binary in a place visible by your `PATH``. For example:
Untar the package and place the `elp` binary in a place visible by your `PATH``.
For example:

```
cd ~/Downloads
Expand All @@ -38,8 +46,62 @@ mv elp ~/bin
export PATH=$PATH:~/bin
```

Follow [these steps](cli.md#verify-elp-is-correctly-installed) to verify ELP is correctly installed.
Follow [these steps](cli.md#verify-elp-is-correctly-installed) to verify ELP is
correctly installed.

## From Source

TBD.
### Prerequisites

To be able to compile ELP from source, you need a copy of the
[eqWAlizer](https://github.com/WhatsApp/eqwalizer) typechecker for Erlang.

Clone the eqWAlizer repository:

```
git clone https://github.com/WhatsApp/eqwalizer.git
```

Enter the `eqwalizer` repository and build it. Notice the double `eqwalizer` in
the `pushd` command.

```
pushd eqwalizer/eqwalizer
sbt assembly
popd
```

Get the path of the produced `eqwalizer.jar` file:

```
find . -name eqwalizer.jar | readlink -f
```

Point the `ELP_EQWALIZER_PATH` environment variable to the path returned above:

```
export ELP_EQWALIZER_PATH=/path/to/eqwalizer.jar
```

### Compile ELP

Clone the ELP repository:

```
git clone https://github.com/WhatsApp/erlang-language-platform.git
```

Enter the ELP repo and compile it:

```
cd erlang-language-platform
cargo build --release
```

The produced executable will be available in: `target/release/elp`, so ensure it is included in your `PATH`. E.g.:

```
mkdir -p ~/bin
mv target/releases/elp ~/bin
export PATH=$PATH:~/bin
```

0 comments on commit 5276f03

Please sign in to comment.