Skip to content

Commit

Permalink
[move-ide] Move analyzer versioning (#17929)
Browse files Browse the repository at this point in the history
## Description 

We would like to use the same versioning scheme we use for Sui binaries
(particularly for `sui` binary) for the `move-analyzer` as well.

Both `sui` and `move-analyzer` binaries "bundle" the move compiler and
being able to tell which version you are using is very useful (and
really necessary to avoid discrepancies in the compilation process
between the IDE and CLI).

It's apparently not possible to have to `move-analyzer` binaries in the
repo (one in `crates` and one in `external-crates`) so I renamed the one
in `external-crates` as it's the one in `crates` that is intended to be
externally used from now on.

## Test plan 

All existing tests must pass
  • Loading branch information
awelc authored May 28, 2024
1 parent daa3383 commit 6129324
Show file tree
Hide file tree
Showing 10 changed files with 493 additions and 380 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ jobs:
shell: bash
run: |
[ -f ~/.cargo/env ] && source ~/.cargo/env ; cargo build --release && cargo build --profile=dev --bin sui
cd external-crates/move && cargo build -p move-analyzer --release
- name: Rename binaries for ${{ matrix.os }}
if: ${{ env.s3_archive_exist == '' }}
Expand All @@ -156,7 +155,6 @@ jobs:
done
mv ./target/debug/sui${{ env.extention }} ${{ env.TMP_BUILD_DIR }}/sui-debug${{ env.extention }}
mv ./external-crates/move/target/release/move-analyzer${{ env.extention }} ${{ env.TMP_BUILD_DIR }}/move-analyzer${{ env.extention }}
tar -cvzf ./tmp/sui-${{ env.sui_tag }}-${{ env.os_type }}.tgz -C ${{ env.TMP_BUILD_DIR }} .
[[ ${{ env.sui_tag }} == *"testnet"* ]] && aws s3 cp ./tmp/sui-${{ env.sui_tag }}-${{ env.os_type }}.tgz s3://sui-releases/releases/sui-${{ env.sui_tag }}-${{ env.os_type }}.tgz || true
Expand Down
131 changes: 98 additions & 33 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ members = [
"crates/sui-metric-checker",
"crates/sui-move",
"crates/sui-move-build",
"crates/sui-move-lsp",
"crates/sui-network",
"crates/sui-node",
"crates/sui-open-rpc",
Expand Down Expand Up @@ -563,6 +564,7 @@ move-stackless-bytecode = { path = "external-crates/move/crates/move-stackless-b
move-symbol-pool = { path = "external-crates/move/crates/move-symbol-pool" }
move-abstract-interpreter = { path = "external-crates/move/crates/move-abstract-interpreter" }
move-abstract-stack = { path = "external-crates/move/crates/move-abstract-stack" }
move-analyzer = { path = "external-crates/move/crates/move-analyzer" }

fastcrypto = { git = "https://github.com/MystenLabs/fastcrypto", rev = "c101a5176799db3eb9c801b844e7add92153d291" }
fastcrypto-tbls = { git = "https://github.com/MystenLabs/fastcrypto", rev = "c101a5176799db3eb9c801b844e7add92153d291" }
Expand Down Expand Up @@ -622,6 +624,7 @@ sui-macros = { path = "crates/sui-macros" }
sui-metric-checker = { path = "crates/sui-metric-checker" }
sui-move = { path = "crates/sui-move" }
sui-move-build = { path = "crates/sui-move-build" }
sui-move-lsp = { path = "crates/sui-move-lsp" }
sui-network = { path = "crates/sui-network" }
sui-node = { path = "crates/sui-node" }
sui-open-rpc = { path = "crates/sui-open-rpc" }
Expand Down
3 changes: 2 additions & 1 deletion binary-build-list.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"sui-data-ingestion",
"sui-bridge",
"sui-bridge-cli",
"sui-graphql-rpc"
"sui-graphql-rpc",
"move-analyzer"
],
"internal_binaries": [
"stress",
Expand Down
15 changes: 15 additions & 0 deletions crates/sui-move-lsp/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "sui-move-lsp"
version.workspace = true
authors = ["Mysten Labs <[email protected]>"]
license = "Apache-2.0"
publish = false
edition = "2021"

[dependencies]
clap = { version = "4.1.4", features = ["derive"] }
tokio = { workspace = true, features = ["full"] }

bin-version.workspace = true
move-analyzer.workspace = true

22 changes: 22 additions & 0 deletions crates/sui-move-lsp/src/bin/move-analyzer.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

use clap::*;
use move_analyzer::analyzer;

// Define the `GIT_REVISION` and `VERSION` consts
bin_version::bin_version!();

#[derive(Parser)]
#[clap(
name = env!("CARGO_BIN_NAME"),
rename_all = "kebab-case",
author,
version = VERSION,
)]
struct App {}

fn main() {
App::parse();
analyzer::run();
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ This can be done in two steps:
as prerequisites for Sui installation - for Linux, macOS and Windows these prerequisites and
their installation instructions can be found
[here](https://docs.sui.io/guides/developer/getting-started/sui-install#additional-prerequisites-by-operating-system)
2. Invoke `cargo install --git https://github.com/MystenLabs/sui move-analyzer` to install the
2. Invoke `cargo install --git https://github.com/MystenLabs/sui sui-move-lsp` to install the
`move-analyzer` language server in your Cargo binary directory, which is typically located
in the `~/.cargo/bin` (macOS/Linux) or `C:\Users\USER\.cargo\bin` (Windows) directory.
3. Copy the move-analyzer binary to `~/.sui/bin` (macOS/Linux) or `C:\Users\USER\.sui\bin`
Expand Down
Loading

0 comments on commit 6129324

Please sign in to comment.