yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Ellie HermaszewskaFind slangc in more places in doc generation script (#5461)90bde4769

master
3.0 KiB62 linesraw
1# This script uses `slangc` to generate the core module reference documentation and push the updated
2# documents to shader-slang/stdlib-reference repository.
3# The stdlib-reference repository has github-pages setup so that the markdown files we generate
4# in this step will be rendered as html pages by Jekyll upon a commit to the repository.
5# So we we need to do here is to pull the stdlib-reference repository, regenerate the markdown files
6# and push the changes back to the repository.
7
8# The generated markdown files will be located in three folders:
9# - ./global-decls
10# - ./interfaces
11# - ./types
12# In addition, slangc will generate a table of content file `toc.html` which will be copied to
13# ./_includes/stdlib-reference-toc.html for Jekyll for consume it correctly.
14
15# If stdlib-reference folder does not exist, clone from github repo
16if (-not (Test-Path ".\stdlib-reference")) {
17    git clone https://github.com/shader-slang/stdlib-reference/
18}
19else {
20# If it already exist, just pull the latest changes.
21    cd stdlib-reference
22    git pull
23    cd ../
24}
25# Remove the old generated files.
26Remove-Item -Path ".\stdlib-reference\global-decls" -Recurse -Force
27Remove-Item -Path ".\stdlib-reference\interfaces" -Recurse -Force
28Remove-Item -Path ".\stdlib-reference\types" -Recurse -Force
29Remove-Item -Path ".\stdlib-reference\attributes" -Recurse -Force
30
31# Use git describe to produce a version string and write it to _includes/version.inc.
32# This file will be included by the stdlib-reference Jekyll template.
33git describe --tags | Out-File -FilePath ".\stdlib-reference\_includes\version.inc" -Encoding ASCII
34
35cd stdlib-reference
36$slangPaths = @(
37    "../../build/RelWithDebInfo/bin/slangc.exe",
38    "../../build/Release/bin/slangc.exe",
39    "../../build/Debug/bin/slangc.exe"
40)
41$slangExe = $slangPaths | Where-Object { Test-Path $_ } | Select-Object -First 1
42if ($slangExe) {
43    & $slangExe -compile-core-module -doc
44    Move-Item -Path ".\toc.html" -Destination ".\_includes\stdlib-reference-toc.html" -Force
45    git config user.email "bot@shader-slang.com"
46    git config user.name "Stdlib Reference Bot"
47    git add .
48    git commit -m "Update the core module reference"
49    git push
50} else {
51    Write-Error "Could not find slangc executable in RelWithDebInfo or Release directories"
52}
53cd ../
54
55# For local debugging only.
56# Remove-Item -Path "D:\git_repo\stdlib-reference\global-decls" -Recurse -Force
57# Remove-Item -Path "D:\git_repo\stdlib-reference\interfaces" -Recurse -Force
58# Remove-Item -Path "D:\git_repo\stdlib-reference\types" -Recurse -Force
59# Copy-Item -Path .\stdlib-reference\global-decls -Destination D:\git_repo\stdlib-reference\global-decls -Recurse -Force
60# Copy-Item -Path .\stdlib-reference\interfaces -Destination D:\git_repo\stdlib-reference\interfaces -Recurse -Force
61# Copy-Item -Path .\stdlib-reference\types -Destination D:\git_repo\stdlib-reference\types -Recurse -Force
62# Copy-Item -Path .\stdlib-reference\_includes\stdlib-reference-toc.html -Destination D:\git_repo\stdlib-reference\_includes\stdlib-reference-toc.html -Force