diff options
-rw-r--r-- | .cargo/config | 2 | ||||
-rw-r--r-- | .travis.yml | 4 | ||||
-rw-r--r-- | Cargo.lock | 7 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | website/src/index.html | 21 | ||||
-rw-r--r-- | website/src/wasm-demo/index.html | 13 | ||||
-rw-r--r-- | website/website-gen/Cargo.toml | 9 | ||||
-rw-r--r-- | website/website-gen/src/main.rs | 64 |
9 files changed, 120 insertions, 4 deletions
diff --git a/.cargo/config b/.cargo/config index 92a3acfd0..9f9b24a49 100644 --- a/.cargo/config +++ b/.cargo/config | |||
@@ -5,6 +5,8 @@ gen-syntax = "run --package ra_tools --bin ra_tools -- gen-syntax" | |||
5 | # Extracts the tests from | 5 | # Extracts the tests from |
6 | gen-tests = "run --package ra_tools --bin ra_tools -- gen-tests" | 6 | gen-tests = "run --package ra_tools --bin ra_tools -- gen-tests" |
7 | 7 | ||
8 | build-website = "run --package website-gen" | ||
9 | |||
8 | # Installs the visual studio code extension | 10 | # Installs the visual studio code extension |
9 | install-ra = "run --package ra_tools --bin ra_tools -- install-ra" | 11 | install-ra = "run --package ra_tools --bin ra_tools -- install-ra" |
10 | install-code = "run --package ra_tools --bin ra_tools -- install-ra" # just an alias | 12 | install-code = "run --package ra_tools --bin ra_tools -- install-ra" # just an alias |
diff --git a/.travis.yml b/.travis.yml index 52af05375..c198cc5f7 100644 --- a/.travis.yml +++ b/.travis.yml | |||
@@ -28,7 +28,7 @@ matrix: | |||
28 | language: rust | 28 | language: rust |
29 | rust: stable | 29 | rust: stable |
30 | script: | 30 | script: |
31 | - cargo doc --all --no-deps | 31 | - cargo build-website |
32 | env: | 32 | env: |
33 | - RUSTFLAGS="-D warnings", CARGO_INCREMENTAL=0 | 33 | - RUSTFLAGS="-D warnings", CARGO_INCREMENTAL=0 |
34 | 34 | ||
@@ -59,7 +59,7 @@ deploy: | |||
59 | skip-cleanup: true | 59 | skip-cleanup: true |
60 | github-token: $DOCS_TOKEN # Set in the settings page of your repository, as a secure variable | 60 | github-token: $DOCS_TOKEN # Set in the settings page of your repository, as a secure variable |
61 | keep-history: true | 61 | keep-history: true |
62 | local-dir: target/doc | 62 | local-dir: target/website/ |
63 | on: | 63 | on: |
64 | branch: master | 64 | branch: master |
65 | condition: $DEPLOY_DOCS = 1 | 65 | condition: $DEPLOY_DOCS = 1 |
diff --git a/Cargo.lock b/Cargo.lock index ffcce476e..d1fa5ebee 100644 --- a/Cargo.lock +++ b/Cargo.lock | |||
@@ -1777,6 +1777,13 @@ version = "0.5.0" | |||
1777 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1777 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1778 | 1778 | ||
1779 | [[package]] | 1779 | [[package]] |
1780 | name = "website-gen" | ||
1781 | version = "0.0.0" | ||
1782 | dependencies = [ | ||
1783 | "walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)", | ||
1784 | ] | ||
1785 | |||
1786 | [[package]] | ||
1780 | name = "winapi" | 1787 | name = "winapi" |
1781 | version = "0.2.8" | 1788 | version = "0.2.8" |
1782 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1789 | source = "registry+https://github.com/rust-lang/crates.io-index" |
diff --git a/Cargo.toml b/Cargo.toml index e44c9570f..317c63795 100644 --- a/Cargo.toml +++ b/Cargo.toml | |||
@@ -1,5 +1,5 @@ | |||
1 | [workspace] | 1 | [workspace] |
2 | members = [ "crates/*" ] | 2 | members = [ "crates/*", "website/website-gen" ] |
3 | 3 | ||
4 | [profile.release] | 4 | [profile.release] |
5 | incremental = true | 5 | incremental = true |
@@ -55,7 +55,7 @@ https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frls-2.2E0 | |||
55 | ## Quick Links | 55 | ## Quick Links |
56 | 56 | ||
57 | * Work List: https://paper.dropbox.com/doc/RLS-2.0-work-list--AZ3BgHKKCtqszbsi3gi6sjchAQ-42vbnxzuKq2lKwW0mkn8Y | 57 | * Work List: https://paper.dropbox.com/doc/RLS-2.0-work-list--AZ3BgHKKCtqszbsi3gi6sjchAQ-42vbnxzuKq2lKwW0mkn8Y |
58 | * API docs: https://rust-analyzer.github.io/rust-analyzer/ra_ide_api/index.html | 58 | * API docs: https://rust-analyzer.github.io/rust-analyzer/api-docs/ra_ide_api/index.html |
59 | * CI: https://travis-ci.org/rust-analyzer/rust-analyzer | 59 | * CI: https://travis-ci.org/rust-analyzer/rust-analyzer |
60 | 60 | ||
61 | ## License | 61 | ## License |
diff --git a/website/src/index.html b/website/src/index.html new file mode 100644 index 000000000..0b678b499 --- /dev/null +++ b/website/src/index.html | |||
@@ -0,0 +1,21 @@ | |||
1 | <!DOCTYPE HTML> | ||
2 | <html> | ||
3 | |||
4 | <head> | ||
5 | <meta charset="utf-8"> | ||
6 | <title>Hello World! Site Title</title> | ||
7 | </head> | ||
8 | |||
9 | <body> | ||
10 | <h1>rust-analyzer</h1> | ||
11 | <ul> | ||
12 | <li> | ||
13 | <a href="./api-docs/ra_ide_api/index.html">API Docs</a> | ||
14 | </li> | ||
15 | <li> | ||
16 | <a href="./wasm-demo/index.html">WASM Demo</a> | ||
17 | </li> | ||
18 | </ul> | ||
19 | </body> | ||
20 | |||
21 | </html> | ||
diff --git a/website/src/wasm-demo/index.html b/website/src/wasm-demo/index.html new file mode 100644 index 000000000..e81ccb0f7 --- /dev/null +++ b/website/src/wasm-demo/index.html | |||
@@ -0,0 +1,13 @@ | |||
1 | <!DOCTYPE HTML> | ||
2 | <html> | ||
3 | |||
4 | <head> | ||
5 | <meta charset="utf-8"> | ||
6 | <title>Hello World! Site Title</title> | ||
7 | </head> | ||
8 | |||
9 | <body> | ||
10 | TBD | ||
11 | </body> | ||
12 | |||
13 | </html> | ||
diff --git a/website/website-gen/Cargo.toml b/website/website-gen/Cargo.toml new file mode 100644 index 000000000..b471a81fd --- /dev/null +++ b/website/website-gen/Cargo.toml | |||
@@ -0,0 +1,9 @@ | |||
1 | [package] | ||
2 | name = "website-gen" | ||
3 | version = "0.0.0" | ||
4 | authors = ["Aleksey Kladov <[email protected]>"] | ||
5 | edition = "2018" | ||
6 | publish = false | ||
7 | |||
8 | [dependencies] | ||
9 | walkdir = "2.2.0" | ||
diff --git a/website/website-gen/src/main.rs b/website/website-gen/src/main.rs new file mode 100644 index 000000000..7d35a37cf --- /dev/null +++ b/website/website-gen/src/main.rs | |||
@@ -0,0 +1,64 @@ | |||
1 | use std::{fs, path::Path, process::Command}; | ||
2 | |||
3 | type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>; | ||
4 | |||
5 | /// This tool builds the github-pages website to the `./target/website` folder | ||
6 | fn main() { | ||
7 | if let Err(err) = try_main() { | ||
8 | eprintln!("{}", err); | ||
9 | std::process::exit(-1); | ||
10 | } | ||
11 | } | ||
12 | |||
13 | fn try_main() -> Result<()> { | ||
14 | check_cwd()?; | ||
15 | build_scaffold()?; | ||
16 | build_docs()?; | ||
17 | println!("Finished\n./target/website/index.html"); | ||
18 | Ok(()) | ||
19 | } | ||
20 | |||
21 | fn cargo() -> Command { | ||
22 | Command::new("cargo") | ||
23 | } | ||
24 | |||
25 | fn check_cwd() -> Result<()> { | ||
26 | let toml = std::fs::read_to_string("./Cargo.toml")?; | ||
27 | if !toml.contains("[workspace]") { | ||
28 | Err("website-gen should be run from the root of workspace")?; | ||
29 | } | ||
30 | Ok(()) | ||
31 | } | ||
32 | |||
33 | fn build_docs() -> Result<()> { | ||
34 | let status = cargo().args(&["doc", "--all", "--no-deps"]).status()?; | ||
35 | if !status.success() { | ||
36 | Err("cargo doc failed")?; | ||
37 | } | ||
38 | sync_dir("./target/doc", "./target/website/api-docs")?; | ||
39 | Ok(()) | ||
40 | } | ||
41 | |||
42 | fn build_scaffold() -> Result<()> { | ||
43 | sync_dir("./website/src", "./target/website") | ||
44 | } | ||
45 | |||
46 | fn sync_dir(src: impl AsRef<Path>, dst: impl AsRef<Path>) -> Result<()> { | ||
47 | return sync_dir(src.as_ref(), dst.as_ref()); | ||
48 | |||
49 | fn sync_dir(src: &Path, dst: &Path) -> Result<()> { | ||
50 | let _ = fs::remove_dir_all(dst); | ||
51 | fs::create_dir_all(dst)?; | ||
52 | for entry in walkdir::WalkDir::new(src) { | ||
53 | let entry = entry?; | ||
54 | let src_path = entry.path(); | ||
55 | let dst_path = dst.join(src_path.strip_prefix(src)?); | ||
56 | if src_path.is_dir() { | ||
57 | fs::create_dir_all(dst_path)?; | ||
58 | } else { | ||
59 | fs::copy(src_path, dst_path)?; | ||
60 | } | ||
61 | } | ||
62 | Ok(()) | ||
63 | } | ||
64 | } | ||