Repository navigation
Expand file tree
/
Copy pathBuildPreviewDocs.ps1
More file actions
51 lines (45 loc) · 2.41 KB
/
Copy pathBuildPreviewDocs.ps1
File metadata and controls
51 lines (45 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Builds "preview" documentation from StereoKit's develop branch into docs/preview/.
# This is the same pipeline as BuildDocs.ps1, but it targets the develop branch
# (which builds as net8.0) and writes into a disjoint docs/preview/ folder so it
# never clobbers the stable docs built from master.
git clone --depth=1 --branch=develop https://github.com/StereoKit/StereoKit.git repos/StereoKit-develop
Push-Location $PSScriptRoot/repos/StereoKit-develop
git fetch
git pull
Pop-Location
$SKFolder = "$PSScriptRoot/repos/StereoKit-develop"
# Remove all generated files from the previous builds
Remove-Item -Path "$PSScriptRoot/docs/preview/Pages/" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "$PSScriptRoot/docs/preview/img/screenshots/" -Recurse -Force -ErrorAction SilentlyContinue
New-Item -ItemType Directory -Force -Path "$PSScriptRoot/docs/preview/img/screenshots/" | Out-Null
# Build and run StereoKit tests to generate screenshots and XML documentation
Push-Location $SKFolder
cmake --preset Linux_x64_Release
cmake --build --preset Linux_x64_Release
Push-Location StereoKit
dotnet build
Pop-Location
Push-Location $SKFolder/Examples/StereoKitTest
dotnet build -c Release StereoKitTest.csproj
dotnet run --project StereoKitTest.csproj -c Release -- -test -headless -screenfolder "$PSScriptRoot/docs/preview/img/screenshots/"
Pop-Location
Pop-Location
# Some screenshots are hand-made (StereoKitInk.jpg, SKMapsTutorial.jpg, etc.)
# rather than generated by the test run, and only exist in the stable site's
# screenshot folder. Preview pages link to the preview screenshot folder for
# everything, so backfill any the test run didn't produce.
$stableShots = "$PSScriptRoot/docs/img/screenshots"
$previewShots = "$PSScriptRoot/docs/preview/img/screenshots"
Get-ChildItem -Path $stableShots -Recurse -File | ForEach-Object {
$relative = $_.FullName.Substring($stableShots.Length)
$target = Join-Path $previewShots $relative
if (!(Test-Path $target)) {
New-Item -ItemType Directory -Force -Path (Split-Path $target) | Out-Null
Copy-Item $_.FullName $target
}
}
# Run the documenter to assemble the preview site
Push-Location StereoKitDocumenter
dotnet build
dotnet run -- --xml "$SKFolder/bin/net8.0/StereoKit.xml" --library "$SKFolder/bin/net8.0/StereoKit.dll" --samples "$SKFolder/Examples/StereoKitTest/" --out "$PSScriptRoot/docs/preview/Pages/" --ai-out "$PSScriptRoot/docs/preview/" --lenient --url-sub preview
Pop-Location