en-build.ps1 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. param (
  2. [switch]$API
  3. )
  4. # Remove build.log file
  5. If(Test-Path build.log)
  6. {
  7. Remove-Item build.log
  8. }
  9. Start-Transcript -Path build.log
  10. # Generate API doc
  11. if ($API)
  12. {
  13. Write-Host "Generating API documentation..."
  14. # Run MSBuild restore
  15. $msbuild = & ("${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe") -latest -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe | select-object -first 1
  16. & $msbuild ..\stride\build\Stride.sln /t:Restore
  17. if ($LastExitCode -ne 0)
  18. {
  19. Write-Host "Failed to restore nuget packages"
  20. exit $LastExitCode
  21. }
  22. # Build metadata from C# source
  23. deps\docfx\docfx.exe metadata en/docfx.json
  24. if ($LastExitCode -ne 0)
  25. {
  26. Write-Host "Failed to generate API metadata"
  27. exit $LastExitCode
  28. }
  29. }
  30. else
  31. {
  32. If(Test-Path en/api/.manifest)
  33. {
  34. Write-Host "Erasing API documentation..."
  35. Remove-Item en/api/*yml -recurse
  36. Remove-Item en/api/.manifest
  37. }
  38. }
  39. Write-Host "Generating documentation..."
  40. # Output to both build.log and console
  41. deps\docfx\docfx.exe build en\docfx.json
  42. if ($LastExitCode -ne 0)
  43. {
  44. Write-Host "Failed to build doc"
  45. exit $LastExitCode
  46. }
  47. # Copy extra items
  48. Copy-Item en/ReleaseNotes/ReleaseNotes.md _site/en/ReleaseNotes/
  49. Stop-Transcript