diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000000000..9a216b15685783 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ + +# build workspace +/dotnet diff --git a/README.md b/README.md index f4673865a4203f..62e14cca97dbd5 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,18 @@ # The Book of the Runtime Build Repo +[![Build Docs](https://github.com/jurakovic/runtime/actions/workflows/build.yaml/badge.svg)](https://github.com/jurakovic/runtime/actions/workflows/build.yaml) + This repository is a fork of the [dotnet/runtime](https://github.com/dotnet/runtime), created solely to build the [_Book of the Runtime_](https://github.com/dotnet/runtime/tree/main/docs/design/coreclr/botr/README.md) using MkDocs and host it on GitHub Pages. The site provides easy-to-navigate interface with dark and light themes and interactive search functionality. It is available at . +> **Disclaimer:** +> This is an unofficial documentation site and is not affiliated with Microsoft. +> Microsoft and .NET are trademarks of Microsoft Corporation. + ## Overview This repo has two *main* branches: diff --git a/build.sh b/build.sh index 74f48c8030a370..bfbf08d5f5d679 100644 --- a/build.sh +++ b/build.sh @@ -1,75 +1,95 @@ #!/bin/bash -echo "Creating new 'dotnet' worktree with 'main' branch" -git worktree add dotnet main -cd dotnet -git pull - -# clear any leftovers -rm -rf site - -# temp config -cp ../mkdocs.yml . - -# copy out-of-scope files -cp docs/design/coreclr/botr/../jit/ryujit-overview.md docs/design/coreclr/botr/ryujit-overview.md -cp docs/design/coreclr/botr/../jit/porting-ryujit.md docs/design/coreclr/botr/porting-ryujit.md - -# fix profiling.md; e.g. List => List<int> -sed -i -r 's/(\w+)(<)([a-zA-Z,]+)(>)/\1\<\3\>/g' docs/design/coreclr/botr/profiling.md - -# temp fix to images path in jit file -sed -i -r 's;]\(images;]\(https://raw.githubusercontent.com/dotnet/runtime/refs/heads/main/docs/design/coreclr/jit/images;g' docs/design/coreclr/botr/ryujit-overview.md - -mapfile -t files < <(find docs/design/coreclr/botr -type f -iwholename "*.md") -for file in "${files[@]}"; do - # hide toc on all pages (no other proposed solutions work) - sed -i '1s/^/---\nhide:\n - toc\n---\n/' "$file" - # update links to jit files, because they are copied to botr dir (cp commands above) - sed -i -r 's;(\.\.\/jit\/)(.*\.md);\2;g' "$file" - # change relative links for out-of-scope files to github - sed -i -r 's;(\(|]: )\.\./\.\./\.\./\.\./;\1https://github.com/dotnet/runtime/blob/main/;g' "$file" - sed -i -r 's;(\(|]: )\.\./\.\./\.\./;\1https://github.com/dotnet/runtime/blob/main/docs/;g' "$file" - sed -i -r 's;(\(|]: )\.\./\.\./;\1https://github.com/dotnet/runtime/blob/main/docs/design/;g' "$file" - sed -i -r 's;(\(|]: )\.\./;\1https://github.com/dotnet/runtime/blob/main/docs/design/coreclr/;g' "$file" -done - -echo "Staring mkdocs build" -docker run --rm -v ${PWD}:/docs ghcr.io/jurakovic/mkdocs-botr:latest build All Book of the Runtime \(BOTR\) chapters on GitHub)|" target="_blank\1|' docs/index.html - -# add footer url -text='in jurakovic/runtime' -mapfile -t files < <(find docs -type f -iwholename "*.html") -for file in "${files[@]}"; do - total_lines=$(wc -l < "$file") - insert_line=$((total_lines - 48)) - sed -i "${insert_line}i$text" "$file" -done - -echo "Removing 'dotnet' worktree" -git worktree remove dotnet --force - -echo "Done" +docs_dir='docs/design/coreclr/botr' + +function add_worktree { + echo "Adding new 'dotnet' worktree with 'main' branch" + git worktree add dotnet main + cd dotnet + git pull +} + +function copy_mkdocs_config { + cp ../mkdocs.yml . + cp ../custom.css $docs_dir/custom.css + mkdir -p overrides/partials + cp ../favicon.svg $docs_dir/favicon.svg + cp ../copyright.html overrides/partials/copyright.html +} + +function pre_build { + # copy out-of-scope files + cp $docs_dir/../jit/ryujit-overview.md $docs_dir/ryujit-overview.md + cp $docs_dir/../jit/porting-ryujit.md $docs_dir/porting-ryujit.md + + # fix profiling.md; e.g. List => List<int> + sed -i -r 's/(\w+)(<)([a-zA-Z,]+)(>)/\1\<\3\>/g' $docs_dir/profiling.md + + # temp fix to images path in jit file + sed -i -r 's;]\(images;]\(https://raw.githubusercontent.com/dotnet/runtime/refs/heads/main/docs/design/coreclr/jit/images;g' $docs_dir/ryujit-overview.md + + mapfile -t files < <(find $docs_dir -type f -iwholename "*.md") + for file in "${files[@]}"; do + # hide toc on all pages (no other proposed solutions work) + sed -i '1s/^/---\nhide:\n - toc\n---\n/' "$file" + # update links to jit files, because they are copied to botr dir (cp commands above) + sed -i -r 's;(\.\.\/jit\/)(.*\.md);\2;g' "$file" + # change relative links for out-of-scope files to github + sed -i -r 's;(\(|]: )\.\./\.\./\.\./\.\./;\1https://github.com/dotnet/runtime/blob/main/;g' "$file" + sed -i -r 's;(\(|]: )\.\./\.\./\.\./;\1https://github.com/dotnet/runtime/blob/main/docs/;g' "$file" + sed -i -r 's;(\(|]: )\.\./\.\./;\1https://github.com/dotnet/runtime/blob/main/docs/design/;g' "$file" + sed -i -r 's;(\(|]: )\.\./;\1https://github.com/dotnet/runtime/blob/main/docs/design/coreclr/;g' "$file" + done +} + +function build { + echo "Staring mkdocs build" + + # clear any leftovers + rm -rf site + + docker run --rm -v ${PWD}:/docs ghcr.io/jurakovic/mkdocs-botr:latest build All Book of the Runtime \(BOTR\) chapters on GitHub)|" target="_blank\1|' docs/index.html +} + +function remove_worktree { + echo "Removing 'dotnet' worktree" + rm -rf dotnet + git worktree remove dotnet --force +} + +function main { + #cd dotnet + add_worktree + copy_mkdocs_config + pre_build + build + post_build + remove_worktree + echo "Done" +} + +main diff --git a/check.sh b/check.sh index 6806429bdeecad..381dc526c94caa 100644 --- a/check.sh +++ b/check.sh @@ -4,6 +4,11 @@ curr=$(curl -s "https://api.github.com/repos/dotnet/runtime/commits?path=docs/design/coreclr/botr&per_page=1" | jq -r '.[0].sha') prev=$(cat commit.txt) +if [ -z "$curr" ] || [ "$curr" = "null" ]; then + echo "Failed to fetch latest commit" + exit 1 +fi + if [ $curr = $prev ] then echo "There are no changes" @@ -17,3 +22,5 @@ if [ -z "$yn" ] || [ "$yn" != "y" ]; then exit 1; fi; ./build.sh echo "$curr" > commit.txt + +git diff --name-only $prev $curr -- docs/design/coreclr/botr diff --git a/copyright.html b/copyright.html new file mode 100644 index 00000000000000..5a109092de695b --- /dev/null +++ b/copyright.html @@ -0,0 +1,17 @@ + diff --git a/custom.css b/custom.css new file mode 100644 index 00000000000000..61d410d9d53fd0 --- /dev/null +++ b/custom.css @@ -0,0 +1,21 @@ + +:root { + --md-text-font: "Segoe UI"; + --md-text-font-family: "Segoe UI", "Segoe UI Variable Text", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif; +} + +.md-typeset { + font-size: .75rem; +} + +.md-copyright { + font-size: .55rem; +} + +[data-md-color-scheme="slate"] { + --md-default-bg-color: #1F1F1F; +} + +[data-md-color-primary=black] .md-header { + background-color: #1F1F1F; +} diff --git a/docs/404.html b/docs/404.html index 3d5a32421c0e59..df1b2e71ff9d10 100644 --- a/docs/404.html +++ b/docs/404.html @@ -11,7 +11,7 @@ - + @@ -34,14 +34,10 @@ - - - - - - + + @@ -69,7 +65,7 @@ - + @@ -92,7 +88,7 @@