Skip to content

Commit 9f21e60

Browse files
committed
Initialize submodules and build only if needed
1 parent bbcbd82 commit 9f21e60

2 files changed

Lines changed: 34 additions & 6 deletions

File tree

build.ps1

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
1+
# Exit on any error
12
$ErrorActionPreference = "Stop"
23

3-
Write-Host "Building MonoGame Assemblies..."-ForegroundColor Green
4-
dotnet build external/MonoGame/MonoGame.Framework.Content.Pipeline/MonoGame.Framework.Content.Pipeline.csproj -p:DisableNativeBuild=true
4+
$FrameworkDll = "external/MonoGame/Artifacts/MonoGame.Framework/DesktopGL/Debug/MonoGame.Framework.dll"
5+
$PipelineDll = "external/MonoGame/Artifacts/MonoGame.Framework.Content.Pipeline/Debug/MonoGame.Framework.Content.Pipeline.dll"
56

6-
Write-Host "Running DocFX..." -ForegroundColor Green
7+
# Check if submodules are initialized
8+
$submoduleStatus = git submodule status
9+
if ($submoduleStatus -match '^-') {
10+
Write-Host "Submodules not initialized. Running git submodule update..." -ForegroundColor Yellow
11+
git submodule update --init --recursive
12+
}
13+
14+
# Check if dlls are already built
15+
if (-not (Test-Path $FrameworkDll) -or -not (Test-Path $PipelineDll)) {
16+
Write-Host "Required Assemblies for documentation not found. Building assemblies..." -ForegroundColor Yellow
17+
dotnet build external/MonoGame/MonoGame.Framework.Content.Pipeline/MonoGame.Framework.Content.Pipeline.csproj -p:DisableNativeBuild=true
18+
}
19+
20+
# Build documentation
21+
Write-Host "Building DocFx..." -ForegroundColor Green
722
dotnet docfx docfx.json
823

924
Write-Host "Build and documentation generation completed successfully!" -ForegroundColor Green

build.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,23 @@
22

33
set -e
44

5-
echo "Building MonoGame Assemblies..."
6-
dotnet build external/MonoGame/MonoGame.Framework.Content.Pipeline/MonoGame.Framework.Content.Pipeline.csproj -p:DisableNativeBuild=true
5+
FRAMEWORK_DLL="external/MonoGame/Artifacts/MonoGame.Framework/DesktopGL/Debug/MonoGame.Framework.dll"
6+
PIPELINE_DLL="external/MonoGame/Artifacts/MonoGame.Framework.Content.Pipeline/Debug/MonoGame.Framework.Content.Pipeline.dll"
77

8-
echo "Running DocFX..."
8+
# Check if submodules are initialized
9+
if git submodule status | grep -q '^-'; then
10+
echo "Submodules not initialized. Running git submodule update..."
11+
git submodule update --init --recursive
12+
fi
13+
14+
# Check if dlls are already built
15+
if [ ! -f "$FRAMEWORK_DLL" ] || [ ! -f "$PIPELINE_DLL" ]; then
16+
echo "Required Assemblies for documentation not found. Building assemblies..."
17+
dotnet build external/MonoGame/MonoGame.Framework.Content.Pipeline/MonoGame.Framework.Content.Pipeline.csproj -p:DisableNativeBuild=true
18+
fi
19+
20+
# Build documentation
21+
echo "Building DocFx..."
922
dotnet docfx docfx.json
1023

1124
echo "Build and documentation generation completed successfully!"

0 commit comments

Comments
 (0)