Skip to content

Commit

Permalink
Docs via make (#124)
Browse files Browse the repository at this point in the history
## What Changed?

Simplifies the doc setup by performing the necessary steps via
cargo-make

## Why Does It Need To?

Describe the concern this change addresses. 

The program in `doc-src` is no longer necessary.

## Checklist

- [x] Above description has been filled out so that upon quash merge we
have a
  good record of what changed.
- [x] New functions, methods, types are documented. Old documentation is
updated
  if necessary
- [x] Documentation in Notion has been updated
- [x] Tests for new behaviors are provided
  - [x] New test suites (if any) ave been added to the CI tests (in
`.github/workflows/rust.yml`) either as compiler test or integration
test.
*Or* justification for their omission from CI has been provided in this
PR
    description.
  • Loading branch information
JustusAdam authored Feb 22, 2024
1 parent 446e310 commit 33d2a8f
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 66 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,19 @@ jobs:
run: |
git config --local user.email "docmaster+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Install cargo-make
uses: actions-rs/cargo@v1
with:
command: install
args: --debug cargo-make
- name: Prepare
run: |
cargo doc --document-private-items
mkdir docs
cp -R target/doc docs/libs
rm -R .github
- name: Copy Rustc Docs
run: cargo run
working-directory: doc-src
- name: Copy index page
run: cp doc-src/index.html docs/index.html
- name: Copy rustc docs and index page
run: cargo make populate-doc-dir
- name: Commit Doc Generation
run: |
git add docs
Expand Down
14 changes: 14 additions & 0 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,17 @@ end
cd crates/paralegal-policy/tests/test-crate
exec cargo %{FORMAT_ARGS}
'''

[tasks.populate-doc-dir]
dependencies = ["get-rustc-docs"]
script_runner = "@duckscript"
script = '''
source_path = concat ${RUSTUP_HOME} /toolchains/ ${RUSTUP_TOOLCHAIN} /share/doc/rust/html/rustc
mkdir docs
mv doc-src/index.html docs
mv ${source_path} docs/compiler
'''

[tasks.get-rustc-docs]
command = "rustup"
args = ["component", "add", "rustc-docs"]
1 change: 0 additions & 1 deletion doc-src/.gitignore

This file was deleted.

7 changes: 0 additions & 7 deletions doc-src/Cargo.lock

This file was deleted.

13 changes: 0 additions & 13 deletions doc-src/Cargo.toml

This file was deleted.

40 changes: 0 additions & 40 deletions doc-src/compose.rs

This file was deleted.

0 comments on commit 33d2a8f

Please sign in to comment.