This commit is contained in:
nora 2025-07-27 16:40:29 +02:00
commit 2014bd8ee1
5 changed files with 96 additions and 0 deletions

27
.github/workflows/build.yml vendored Normal file
View file

@ -0,0 +1,27 @@
name: Build
on:
workflow_dispatch:
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: "Create root directory"
run: mkdir ./www-root
- name: Run the build
run: ./build.sh
- name: Upload static files as artifact
id: deployment
uses: actions/upload-pages-artifact@v3
with:
path: www-root
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
/doc
/rust

29
before.html Normal file
View file

@ -0,0 +1,29 @@
<script type="module">
const info = document.createElement("div");
info.classList.add("_internal-info");
info.innerHTML = `
<p>⚠ Internal Docs ⚠</p>
<p>This website was built by <a href="https://github.com/Noratrieb/std-internal-docs">Noratrieb</a>
<div>
<div>
<label for="target-select">
Select Target
</label>
</div>
<div>
<select id="target-select">
<option>x86_64-unknown-linux-gnu</option>
<option>x86_64-pc-windows-msvc</option>
<option>aarch64-apple-darwin</option>
</select>
</div>
</div>
`;
const elems = document.querySelector(".sidebar-elems");
elems.parentNode.insertBefore(info, elems);
document.getElementById("target-select").addEventListener("change", (e) => {
alert(e.target.value);
});
</script>

29
build.sh Normal file
View file

@ -0,0 +1,29 @@
#!/usr/bin/env bash
set -euxo pipefail
root=$(realpath "$PWD")
# use a higher depth because bootstrap might be broken with depth 1?
git clone --depth 50 https://github.com/rust-lang/rust.git
cd rust
./configure \
--set llvm.download-ci-llvm=true \
--set rust.download-rustc=true
targets=(x86_64-unknown-linux-gnu x86_64-pc-windows-msvc aarch64-apple-darwin)
for target in "${targets[@]}"; do
echo "Building $target"
export RUSTDOCFLAGS="--document-private-items \
--document-hidden-items \
--html-before-content=$root/before.html \
--extend-css=$root/style.css"
./x doc library --target "$target"
mkdir "$root/www-root/$target"
cp -r "./build/$target/doc" "$root/www-root/$target"
done

9
style.css Normal file
View file

@ -0,0 +1,9 @@
._internal-info {
background-color: red;
color: white;
font-weight: 600;
display: flex;
flex-direction: column;
justify-content: center;
}