aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.cargo/config23
-rw-r--r--Cargo.lock26
-rw-r--r--Cargo.toml2
-rw-r--r--README.md4
-rw-r--r--docs/dev/architecture.md14
-rw-r--r--docs/user/README.md6
-rw-r--r--xtask/Cargo.toml (renamed from crates/ra_tools/Cargo.toml)2
-rw-r--r--xtask/src/bin/pre-commit.rs (renamed from crates/ra_tools/src/bin/pre-commit.rs)0
-rw-r--r--xtask/src/boilerplate_gen.rs (renamed from crates/ra_tools/src/boilerplate_gen.rs)0
-rw-r--r--xtask/src/help.rs (renamed from crates/ra_tools/src/help.rs)10
-rw-r--r--xtask/src/lib.rs (renamed from crates/ra_tools/src/lib.rs)2
-rw-r--r--xtask/src/main.rs (renamed from crates/ra_tools/src/main.rs)10
-rw-r--r--xtask/tests/cli.rs (renamed from crates/ra_tools/tests/cli.rs)0
-rw-r--r--xtask/tests/docs.rs (renamed from crates/ra_tools/tests/docs.rs)0
-rw-r--r--xtask/tests/main.rs (renamed from crates/ra_tools/tests/main.rs)0
15 files changed, 37 insertions, 62 deletions
diff --git a/.cargo/config b/.cargo/config
index 92a3acfd0..67d0d1885 100644
--- a/.cargo/config
+++ b/.cargo/config
@@ -1,23 +1,4 @@
1[alias] 1[alias]
2# Automatically generates the ast and syntax kinds files 2xtask = "run --package xtask --bin xtask --"
3gen-syntax = "run --package ra_tools --bin ra_tools -- gen-syntax"
4 3
5# Extracts the tests from 4install-ra = "run --package xtask -- install" # for backwards compat
6gen-tests = "run --package ra_tools --bin ra_tools -- gen-tests"
7
8# Installs the visual studio code extension
9install-ra = "run --package ra_tools --bin ra_tools -- install-ra"
10install-code = "run --package ra_tools --bin ra_tools -- install-ra" # just an alias
11
12# Formats the full repository or installs the git hook to do it automatically.
13format = "run --package ra_tools --bin ra_tools -- format"
14format-hook = "run --package ra_tools --bin ra_tools -- format-hook"
15
16# Run clippy
17lint = "run --package ra_tools --bin ra_tools -- lint"
18
19# Runs the fuzzing test suite (currently only parser)
20fuzz-tests = "run --package ra_tools --bin ra_tools -- fuzz-tests"
21
22# Parse a file. This should be piped the file contents
23parse = "run --package ra_cli -- parse"
diff --git a/Cargo.lock b/Cargo.lock
index 9a048e67e..d2fe8e216 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1140,19 +1140,6 @@ dependencies = [
1140] 1140]
1141 1141
1142[[package]] 1142[[package]]
1143name = "ra_tools"
1144version = "0.1.0"
1145dependencies = [
1146 "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
1147 "pico-args 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
1148 "proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
1149 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
1150 "ron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
1151 "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
1152 "walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
1153]
1154
1155[[package]]
1156name = "ra_tt" 1143name = "ra_tt"
1157version = "0.1.0" 1144version = "0.1.0"
1158dependencies = [ 1145dependencies = [
@@ -1785,6 +1772,19 @@ dependencies = [
1785] 1772]
1786 1773
1787[[package]] 1774[[package]]
1775name = "xtask"
1776version = "0.1.0"
1777dependencies = [
1778 "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
1779 "pico-args 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
1780 "proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
1781 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
1782 "ron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
1783 "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
1784 "walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
1785]
1786
1787[[package]]
1788name = "yaml-rust" 1788name = "yaml-rust"
1789version = "0.4.3" 1789version = "0.4.3"
1790source = "registry+https://github.com/rust-lang/crates.io-index" 1790source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/Cargo.toml b/Cargo.toml
index 6ec176cf7..e8f6c4267 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,5 +1,5 @@
1[workspace] 1[workspace]
2members = [ "crates/*" ] 2members = [ "crates/*", "xtask/", "website/website-gen" ]
3 3
4[profile.dev] 4[profile.dev]
5debug = 1 # only line info 5debug = 1 # only line info
diff --git a/README.md b/README.md
index 55d91a70a..f5ee4263d 100644
--- a/README.md
+++ b/README.md
@@ -33,10 +33,10 @@ To quickly install rust-analyzer with VS Code extension with standard setup
33$ git clone https://github.com/rust-analyzer/rust-analyzer && cd rust-analyzer 33$ git clone https://github.com/rust-analyzer/rust-analyzer && cd rust-analyzer
34 34
35# install both the language server and VS Code extension 35# install both the language server and VS Code extension
36$ cargo install-ra 36$ cargo xtask install
37 37
38# alternatively, install only the server. Binary name is `ra_lsp_server`. 38# alternatively, install only the server. Binary name is `ra_lsp_server`.
39$ cargo install-ra --server 39$ cargo xtask install --server
40``` 40```
41 41
42For non-standard setup of VS Code and other editors, see [./docs/user](./docs/user). 42For non-standard setup of VS Code and other editors, see [./docs/user](./docs/user).
diff --git a/docs/dev/architecture.md b/docs/dev/architecture.md
index 1ffabc6ef..28f2a37e5 100644
--- a/docs/dev/architecture.md
+++ b/docs/dev/architecture.md
@@ -45,21 +45,15 @@ can be quickly updated for small modifications.
45Some of the components of this repository are generated through automatic 45Some of the components of this repository are generated through automatic
46processes. These are outlined below: 46processes. These are outlined below:
47 47
48- `gen-syntax`: The kinds of tokens that are reused in several places, so a generator 48- `cargo xtask codegen`: The kinds of tokens that are reused in several places, so a generator
49 is used. We use tera templates to generate the files listed below, based on 49 is used. We use `quote!` macro to generate the files listed below, based on
50 the grammar described in [grammar.ron]: 50 the grammar described in [grammar.ron]:
51 - [ast/generated.rs][ast generated] in `ra_syntax` based on 51 - [ast/generated.rs][ast generated]
52 [ast/generated.tera.rs][ast source] 52 - [syntax_kind/generated.rs][syntax_kind generated]
53 - [syntax_kind/generated.rs][syntax_kind generated] in `ra_syntax` based on
54 [syntax_kind/generated.tera.rs][syntax_kind source]
55 53
56[tera]: https://tera.netlify.com/
57[grammar.ron]: ../../crates/ra_syntax/src/grammar.ron 54[grammar.ron]: ../../crates/ra_syntax/src/grammar.ron
58[ast generated]: ../../crates/ra_syntax/src/ast/generated.rs 55[ast generated]: ../../crates/ra_syntax/src/ast/generated.rs
59[ast source]: ../../crates/ra_syntax/src/ast/generated.rs.tera
60[syntax_kind generated]: ../../crates/ra_parser/src/syntax_kind/generated.rs 56[syntax_kind generated]: ../../crates/ra_parser/src/syntax_kind/generated.rs
61[syntax_kind source]: ../../crates/ra_parser/src/syntax_kind/generated.rs.tera
62
63 57
64## Code Walk-Through 58## Code Walk-Through
65 59
diff --git a/docs/user/README.md b/docs/user/README.md
index 5b7502132..f45c0d7d1 100644
--- a/docs/user/README.md
+++ b/docs/user/README.md
@@ -1,6 +1,6 @@
1The main interface to rust-analyzer is the 1The main interface to rust-analyzer is the
2[LSP](https://microsoft.github.io/language-server-protocol/) implementation. To 2[LSP](https://microsoft.github.io/language-server-protocol/) implementation. To
3install lsp server, use `cargo install-ra --server`, which is a shorthand for `cargo 3install lsp server, use `cargo xtask install --server`, which is a shorthand for `cargo
4install --package ra_lsp_server`. The binary is named `ra_lsp_server`, you 4install --package ra_lsp_server`. The binary is named `ra_lsp_server`, you
5should be able to use it with any LSP-compatible editor. We use custom 5should be able to use it with any LSP-compatible editor. We use custom
6extensions to LSP, so special client-side support is required to take full 6extensions to LSP, so special client-side support is required to take full
@@ -33,7 +33,7 @@ following commands:
33``` 33```
34$ git clone https://github.com/rust-analyzer/rust-analyzer.git --depth 1 34$ git clone https://github.com/rust-analyzer/rust-analyzer.git --depth 1
35$ cd rust-analyzer 35$ cd rust-analyzer
36$ cargo install-ra 36$ cargo xtask install
37``` 37```
38 38
39The automatic installation is expected to *just work* for common cases, if it 39The automatic installation is expected to *just work* for common cases, if it
@@ -58,7 +58,7 @@ Beyond basic LSP features, there are some extension commands which you can
58invoke via <kbd>Ctrl+Shift+P</kbd> or bind to a shortcut. See [./features.md](./features.md) 58invoke via <kbd>Ctrl+Shift+P</kbd> or bind to a shortcut. See [./features.md](./features.md)
59for details. 59for details.
60 60
61For updates, pull the latest changes from the master branch, run `cargo install-ra` again, and **restart** VS Code instance. 61For updates, pull the latest changes from the master branch, run `cargo xtask install` again, and **restart** VS Code instance.
62See [microsoft/vscode#72308](https://github.com/microsoft/vscode/issues/72308) for why a full restart is needed. 62See [microsoft/vscode#72308](https://github.com/microsoft/vscode/issues/72308) for why a full restart is needed.
63 63
64### Settings 64### Settings
diff --git a/crates/ra_tools/Cargo.toml b/xtask/Cargo.toml
index 9cceacee3..4fc1c744b 100644
--- a/crates/ra_tools/Cargo.toml
+++ b/xtask/Cargo.toml
@@ -1,6 +1,6 @@
1[package] 1[package]
2edition = "2018" 2edition = "2018"
3name = "ra_tools" 3name = "xtask"
4version = "0.1.0" 4version = "0.1.0"
5authors = ["rust-analyzer developers"] 5authors = ["rust-analyzer developers"]
6publish = false 6publish = false
diff --git a/crates/ra_tools/src/bin/pre-commit.rs b/xtask/src/bin/pre-commit.rs
index 16bbf9cb2..16bbf9cb2 100644
--- a/crates/ra_tools/src/bin/pre-commit.rs
+++ b/xtask/src/bin/pre-commit.rs
diff --git a/crates/ra_tools/src/boilerplate_gen.rs b/xtask/src/boilerplate_gen.rs
index 39f1cae66..39f1cae66 100644
--- a/crates/ra_tools/src/boilerplate_gen.rs
+++ b/xtask/src/boilerplate_gen.rs
diff --git a/crates/ra_tools/src/help.rs b/xtask/src/help.rs
index 72dfabacd..4c6bf6b53 100644
--- a/crates/ra_tools/src/help.rs
+++ b/xtask/src/help.rs
@@ -12,15 +12,15 @@ SUBCOMMANDS:
12 format 12 format
13 format-hook 13 format-hook
14 fuzz-tests 14 fuzz-tests
15 gen-syntax 15 codegen
16 gen-tests 16 gen-tests
17 install-ra 17 install
18 lint"; 18 lint";
19 19
20pub const INSTALL_RA_HELP: &str = "ra_tools-install-ra 20pub const INSTALL_HELP: &str = "ra_tools-install
21 21
22USAGE: 22USAGE:
23 ra_tools.exe install-ra [FLAGS] 23 ra_tools.exe install [FLAGS]
24 24
25FLAGS: 25FLAGS:
26 --client-code 26 --client-code
@@ -43,5 +43,5 @@ FLAGS:
43 43
44pub const INSTALL_RA_CONFLICT: &str = 44pub const INSTALL_RA_CONFLICT: &str =
45 "error: The argument `--server` cannot be used with `--client-code` 45 "error: The argument `--server` cannot be used with `--client-code`
46 46
47For more information try --help"; 47For more information try --help";
diff --git a/crates/ra_tools/src/lib.rs b/xtask/src/lib.rs
index aa993a38a..761592e85 100644
--- a/crates/ra_tools/src/lib.rs
+++ b/xtask/src/lib.rs
@@ -78,7 +78,7 @@ pub fn collect_tests(s: &str) -> Vec<(usize, Test)> {
78} 78}
79 79
80pub fn project_root() -> PathBuf { 80pub fn project_root() -> PathBuf {
81 Path::new(&env!("CARGO_MANIFEST_DIR")).ancestors().nth(2).unwrap().to_path_buf() 81 Path::new(&env!("CARGO_MANIFEST_DIR")).ancestors().nth(1).unwrap().to_path_buf()
82} 82}
83 83
84pub struct Cmd<'a> { 84pub struct Cmd<'a> {
diff --git a/crates/ra_tools/src/main.rs b/xtask/src/main.rs
index 161871ccf..623058436 100644
--- a/crates/ra_tools/src/main.rs
+++ b/xtask/src/main.rs
@@ -5,11 +5,11 @@ mod help;
5use core::fmt::Write; 5use core::fmt::Write;
6use core::str; 6use core::str;
7use pico_args::Arguments; 7use pico_args::Arguments;
8use ra_tools::{ 8use std::{env, path::PathBuf};
9use xtask::{
9 gen_tests, generate_boilerplate, install_format_hook, run, run_clippy, run_fuzzer, run_rustfmt, 10 gen_tests, generate_boilerplate, install_format_hook, run, run_clippy, run_fuzzer, run_rustfmt,
10 Cmd, Overwrite, Result, 11 Cmd, Overwrite, Result,
11}; 12};
12use std::{env, path::PathBuf};
13 13
14struct InstallOpt { 14struct InstallOpt {
15 client: Option<ClientOpt>, 15 client: Option<ClientOpt>,
@@ -35,9 +35,9 @@ fn main() -> Result<()> {
35 let mut matches = Arguments::from_vec(std::env::args_os().skip(2).collect()); 35 let mut matches = Arguments::from_vec(std::env::args_os().skip(2).collect());
36 let subcommand = &*subcommand.to_string_lossy(); 36 let subcommand = &*subcommand.to_string_lossy();
37 match subcommand { 37 match subcommand {
38 "install-ra" | "install-code" => { 38 "install" => {
39 if matches.contains(["-h", "--help"]) { 39 if matches.contains(["-h", "--help"]) {
40 eprintln!("{}", help::INSTALL_RA_HELP); 40 eprintln!("{}", help::INSTALL_HELP);
41 return Ok(()); 41 return Ok(());
42 } 42 }
43 let server = matches.contains("--server"); 43 let server = matches.contains("--server");
@@ -61,7 +61,7 @@ fn main() -> Result<()> {
61 } 61 }
62 gen_tests(Overwrite)? 62 gen_tests(Overwrite)?
63 } 63 }
64 "gen-syntax" => { 64 "codegen" => {
65 if matches.contains(["-h", "--help"]) { 65 if matches.contains(["-h", "--help"]) {
66 help::print_no_param_subcommand_help(&subcommand); 66 help::print_no_param_subcommand_help(&subcommand);
67 return Ok(()); 67 return Ok(());
diff --git a/crates/ra_tools/tests/cli.rs b/xtask/tests/cli.rs
index 609fd4d8b..609fd4d8b 100644
--- a/crates/ra_tools/tests/cli.rs
+++ b/xtask/tests/cli.rs
diff --git a/crates/ra_tools/tests/docs.rs b/xtask/tests/docs.rs
index ea3330175..ea3330175 100644
--- a/crates/ra_tools/tests/docs.rs
+++ b/xtask/tests/docs.rs
diff --git a/crates/ra_tools/tests/main.rs b/xtask/tests/main.rs
index 56d1318d6..56d1318d6 100644
--- a/crates/ra_tools/tests/main.rs
+++ b/xtask/tests/main.rs