diff --git a/.cargo/config b/.cargo/config
index 92a3acfd0b..67d0d1885c 100644
--- a/.cargo/config
+++ b/.cargo/config
@@ -1,23 +1,4 @@
[alias]
-# Automatically generates the ast and syntax kinds files
-gen-syntax = "run --package ra_tools --bin ra_tools -- gen-syntax"
+xtask = "run --package xtask --bin xtask --"
-# Extracts the tests from
-gen-tests = "run --package ra_tools --bin ra_tools -- gen-tests"
-
-# Installs the visual studio code extension
-install-ra = "run --package ra_tools --bin ra_tools -- install-ra"
-install-code = "run --package ra_tools --bin ra_tools -- install-ra" # just an alias
-
-# Formats the full repository or installs the git hook to do it automatically.
-format = "run --package ra_tools --bin ra_tools -- format"
-format-hook = "run --package ra_tools --bin ra_tools -- format-hook"
-
-# Run clippy
-lint = "run --package ra_tools --bin ra_tools -- lint"
-
-# Runs the fuzzing test suite (currently only parser)
-fuzz-tests = "run --package ra_tools --bin ra_tools -- fuzz-tests"
-
-# Parse a file. This should be piped the file contents
-parse = "run --package ra_cli -- parse"
+install-ra = "run --package xtask -- install" # for backwards compat
diff --git a/Cargo.lock b/Cargo.lock
index 9a048e67ed..d2fe8e2162 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1139,19 +1139,6 @@ dependencies = [
"text_unit 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
-[[package]]
-name = "ra_tools"
-version = "0.1.0"
-dependencies = [
- "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "pico-args 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "ron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
- "walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
[[package]]
name = "ra_tt"
version = "0.1.0"
@@ -1784,6 +1771,19 @@ dependencies = [
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
+[[package]]
+name = "xtask"
+version = "0.1.0"
+dependencies = [
+ "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pico-args 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "ron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
+ "walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
[[package]]
name = "yaml-rust"
version = "0.4.3"
diff --git a/Cargo.toml b/Cargo.toml
index 6ec176cf70..e8f6c4267b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,5 +1,5 @@
[workspace]
-members = [ "crates/*" ]
+members = [ "crates/*", "xtask/", "website/website-gen" ]
[profile.dev]
debug = 1 # only line info
diff --git a/README.md b/README.md
index 55d91a70a1..f5ee4263da 100644
--- a/README.md
+++ b/README.md
@@ -33,10 +33,10 @@ To quickly install rust-analyzer with VS Code extension with standard setup
$ git clone https://github.com/rust-analyzer/rust-analyzer && cd rust-analyzer
# install both the language server and VS Code extension
-$ cargo install-ra
+$ cargo xtask install
# alternatively, install only the server. Binary name is `ra_lsp_server`.
-$ cargo install-ra --server
+$ cargo xtask install --server
```
For 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 1ffabc6efb..28f2a37e5f 100644
--- a/docs/dev/architecture.md
+++ b/docs/dev/architecture.md
@@ -45,21 +45,15 @@ can be quickly updated for small modifications.
Some of the components of this repository are generated through automatic
processes. These are outlined below:
-- `gen-syntax`: The kinds of tokens that are reused in several places, so a generator
- is used. We use tera templates to generate the files listed below, based on
+- `cargo xtask codegen`: The kinds of tokens that are reused in several places, so a generator
+ is used. We use `quote!` macro to generate the files listed below, based on
the grammar described in [grammar.ron]:
- - [ast/generated.rs][ast generated] in `ra_syntax` based on
- [ast/generated.tera.rs][ast source]
- - [syntax_kind/generated.rs][syntax_kind generated] in `ra_syntax` based on
- [syntax_kind/generated.tera.rs][syntax_kind source]
+ - [ast/generated.rs][ast generated]
+ - [syntax_kind/generated.rs][syntax_kind generated]
-[tera]: https://tera.netlify.com/
[grammar.ron]: ../../crates/ra_syntax/src/grammar.ron
[ast generated]: ../../crates/ra_syntax/src/ast/generated.rs
-[ast source]: ../../crates/ra_syntax/src/ast/generated.rs.tera
[syntax_kind generated]: ../../crates/ra_parser/src/syntax_kind/generated.rs
-[syntax_kind source]: ../../crates/ra_parser/src/syntax_kind/generated.rs.tera
-
## Code Walk-Through
diff --git a/docs/user/README.md b/docs/user/README.md
index 5b7502132f..f45c0d7d15 100644
--- a/docs/user/README.md
+++ b/docs/user/README.md
@@ -1,6 +1,6 @@
The main interface to rust-analyzer is the
[LSP](https://microsoft.github.io/language-server-protocol/) implementation. To
-install lsp server, use `cargo install-ra --server`, which is a shorthand for `cargo
+install lsp server, use `cargo xtask install --server`, which is a shorthand for `cargo
install --package ra_lsp_server`. The binary is named `ra_lsp_server`, you
should be able to use it with any LSP-compatible editor. We use custom
extensions to LSP, so special client-side support is required to take full
@@ -33,7 +33,7 @@ following commands:
```
$ git clone https://github.com/rust-analyzer/rust-analyzer.git --depth 1
$ cd rust-analyzer
-$ cargo install-ra
+$ cargo xtask install
```
The 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
invoke via Ctrl+Shift+P or bind to a shortcut. See [./features.md](./features.md)
for details.
-For updates, pull the latest changes from the master branch, run `cargo install-ra` again, and **restart** VS Code instance.
+For updates, pull the latest changes from the master branch, run `cargo xtask install` again, and **restart** VS Code instance.
See [microsoft/vscode#72308](https://github.com/microsoft/vscode/issues/72308) for why a full restart is needed.
### Settings
diff --git a/crates/ra_tools/Cargo.toml b/xtask/Cargo.toml
similarity index 93%
rename from crates/ra_tools/Cargo.toml
rename to xtask/Cargo.toml
index 9cceacee3d..4fc1c744bf 100644
--- a/crates/ra_tools/Cargo.toml
+++ b/xtask/Cargo.toml
@@ -1,6 +1,6 @@
[package]
edition = "2018"
-name = "ra_tools"
+name = "xtask"
version = "0.1.0"
authors = ["rust-analyzer developers"]
publish = false
diff --git a/crates/ra_tools/src/bin/pre-commit.rs b/xtask/src/bin/pre-commit.rs
similarity index 100%
rename from crates/ra_tools/src/bin/pre-commit.rs
rename to xtask/src/bin/pre-commit.rs
diff --git a/crates/ra_tools/src/boilerplate_gen.rs b/xtask/src/boilerplate_gen.rs
similarity index 100%
rename from crates/ra_tools/src/boilerplate_gen.rs
rename to xtask/src/boilerplate_gen.rs
diff --git a/crates/ra_tools/src/help.rs b/xtask/src/help.rs
similarity index 83%
rename from crates/ra_tools/src/help.rs
rename to xtask/src/help.rs
index 72dfabacd2..4c6bf6b53c 100644
--- a/crates/ra_tools/src/help.rs
+++ b/xtask/src/help.rs
@@ -12,15 +12,15 @@ SUBCOMMANDS:
format
format-hook
fuzz-tests
- gen-syntax
+ codegen
gen-tests
- install-ra
+ install
lint";
-pub const INSTALL_RA_HELP: &str = "ra_tools-install-ra
+pub const INSTALL_HELP: &str = "ra_tools-install
USAGE:
- ra_tools.exe install-ra [FLAGS]
+ ra_tools.exe install [FLAGS]
FLAGS:
--client-code
@@ -43,5 +43,5 @@ FLAGS:
pub const INSTALL_RA_CONFLICT: &str =
"error: The argument `--server` cannot be used with `--client-code`
-
+
For more information try --help";
diff --git a/crates/ra_tools/src/lib.rs b/xtask/src/lib.rs
similarity index 99%
rename from crates/ra_tools/src/lib.rs
rename to xtask/src/lib.rs
index aa993a38ab..761592e85e 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)> {
}
pub fn project_root() -> PathBuf {
- Path::new(&env!("CARGO_MANIFEST_DIR")).ancestors().nth(2).unwrap().to_path_buf()
+ Path::new(&env!("CARGO_MANIFEST_DIR")).ancestors().nth(1).unwrap().to_path_buf()
}
pub struct Cmd<'a> {
diff --git a/crates/ra_tools/src/main.rs b/xtask/src/main.rs
similarity index 97%
rename from crates/ra_tools/src/main.rs
rename to xtask/src/main.rs
index 161871ccf2..6230584368 100644
--- a/crates/ra_tools/src/main.rs
+++ b/xtask/src/main.rs
@@ -5,11 +5,11 @@ mod help;
use core::fmt::Write;
use core::str;
use pico_args::Arguments;
-use ra_tools::{
+use std::{env, path::PathBuf};
+use xtask::{
gen_tests, generate_boilerplate, install_format_hook, run, run_clippy, run_fuzzer, run_rustfmt,
Cmd, Overwrite, Result,
};
-use std::{env, path::PathBuf};
struct InstallOpt {
client: Option,
@@ -35,9 +35,9 @@ fn main() -> Result<()> {
let mut matches = Arguments::from_vec(std::env::args_os().skip(2).collect());
let subcommand = &*subcommand.to_string_lossy();
match subcommand {
- "install-ra" | "install-code" => {
+ "install" => {
if matches.contains(["-h", "--help"]) {
- eprintln!("{}", help::INSTALL_RA_HELP);
+ eprintln!("{}", help::INSTALL_HELP);
return Ok(());
}
let server = matches.contains("--server");
@@ -61,7 +61,7 @@ fn main() -> Result<()> {
}
gen_tests(Overwrite)?
}
- "gen-syntax" => {
+ "codegen" => {
if matches.contains(["-h", "--help"]) {
help::print_no_param_subcommand_help(&subcommand);
return Ok(());
diff --git a/crates/ra_tools/tests/cli.rs b/xtask/tests/cli.rs
similarity index 100%
rename from crates/ra_tools/tests/cli.rs
rename to xtask/tests/cli.rs
diff --git a/crates/ra_tools/tests/docs.rs b/xtask/tests/docs.rs
similarity index 100%
rename from crates/ra_tools/tests/docs.rs
rename to xtask/tests/docs.rs
diff --git a/crates/ra_tools/tests/main.rs b/xtask/tests/main.rs
similarity index 100%
rename from crates/ra_tools/tests/main.rs
rename to xtask/tests/main.rs