more
This commit is contained in:
@@ -68,22 +68,7 @@ MonoBehaviour:
|
|||||||
- rid: 8296452132320575489
|
- rid: 8296452132320575489
|
||||||
- rid: 8296452132320575490
|
- rid: 8296452132320575490
|
||||||
m_RuntimeSettings:
|
m_RuntimeSettings:
|
||||||
m_List:
|
m_List: []
|
||||||
- rid: 6852985685364965378
|
|
||||||
- rid: 6852985685364965379
|
|
||||||
- rid: 6852985685364965380
|
|
||||||
- rid: 6852985685364965381
|
|
||||||
- rid: 6852985685364965384
|
|
||||||
- rid: 6852985685364965392
|
|
||||||
- rid: 6852985685364965394
|
|
||||||
- rid: 8712630790384254976
|
|
||||||
- rid: 3051812572998926336
|
|
||||||
- rid: 8026737403946074113
|
|
||||||
- rid: 8026737403946074114
|
|
||||||
- rid: 8026737403946074118
|
|
||||||
- rid: 8026737403946074120
|
|
||||||
- rid: 8026737403946074121
|
|
||||||
- rid: 8296452132320575488
|
|
||||||
m_AssetVersion: 10
|
m_AssetVersion: 10
|
||||||
m_ObsoleteDefaultVolumeProfile: {fileID: 0}
|
m_ObsoleteDefaultVolumeProfile: {fileID: 0}
|
||||||
m_RenderingLayerNames:
|
m_RenderingLayerNames:
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
--- !u!159 &1
|
--- !u!159 &1
|
||||||
EditorSettings:
|
EditorSettings:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
serializedVersion: 13
|
serializedVersion: 16
|
||||||
m_SerializationMode: 2
|
m_SerializationMode: 2
|
||||||
m_LineEndingsForNewScripts: 0
|
m_LineEndingsForNewScripts: 0
|
||||||
m_DefaultBehaviorMode: 0
|
m_DefaultBehaviorMode: 0
|
||||||
@@ -23,6 +23,8 @@ EditorSettings:
|
|||||||
m_EnableTextureStreamingInPlayMode: 1
|
m_EnableTextureStreamingInPlayMode: 1
|
||||||
m_EnableEditorAsyncCPUTextureLoading: 0
|
m_EnableEditorAsyncCPUTextureLoading: 0
|
||||||
m_AsyncShaderCompilation: 1
|
m_AsyncShaderCompilation: 1
|
||||||
|
m_BlockShaders: 0
|
||||||
|
m_UnlockBlockShaders: 0
|
||||||
m_PrefabModeAllowAutoSave: 1
|
m_PrefabModeAllowAutoSave: 1
|
||||||
m_EnterPlayModeOptionsEnabled: 1
|
m_EnterPlayModeOptionsEnabled: 1
|
||||||
m_EnterPlayModeOptions: 0
|
m_EnterPlayModeOptions: 0
|
||||||
@@ -33,16 +35,19 @@ EditorSettings:
|
|||||||
m_UseLegacyProbeSampleCount: 0
|
m_UseLegacyProbeSampleCount: 0
|
||||||
m_SerializeInlineMappingsOnOneLine: 1
|
m_SerializeInlineMappingsOnOneLine: 1
|
||||||
m_DisableCookiesInLightmapper: 0
|
m_DisableCookiesInLightmapper: 0
|
||||||
|
m_ShadowmaskStitching: 0
|
||||||
m_AssetPipelineMode: 1
|
m_AssetPipelineMode: 1
|
||||||
m_RefreshImportMode: 0
|
m_RefreshImportMode: 0
|
||||||
m_CacheServerMode: 0
|
m_CacheServerMode: 1
|
||||||
m_CacheServerEndpoint:
|
m_CacheServerEndpoint: unity-accelerator.moustos.net
|
||||||
m_CacheServerNamespacePrefix: default
|
m_CacheServerNamespacePrefix: default
|
||||||
m_CacheServerEnableDownload: 1
|
m_CacheServerEnableDownload: 1
|
||||||
m_CacheServerEnableUpload: 1
|
m_CacheServerEnableUpload: 1
|
||||||
m_CacheServerEnableAuth: 0
|
|
||||||
m_CacheServerEnableTls: 0
|
m_CacheServerEnableTls: 0
|
||||||
|
m_CacheServerImportResultCachingEnabled: 0
|
||||||
m_CacheServerValidationMode: 2
|
m_CacheServerValidationMode: 2
|
||||||
m_CacheServerDownloadBatchSize: 128
|
m_CacheServerDownloadBatchSize: 128
|
||||||
m_EnableEnlightenBakedGI: 0
|
m_EnableEnlightenBakedGI: 0
|
||||||
m_ReferencedClipsExactNaming: 1
|
m_ReferencedClipsExactNaming: 1
|
||||||
|
m_ForceAssetUnloadAndGCOnSceneLoad: 1
|
||||||
|
m_HideBuildProfileClassicPlatforms: 0
|
||||||
|
|||||||
+163
-100
@@ -4,13 +4,11 @@ param(
|
|||||||
|
|
||||||
$ErrorActionPreference = "Stop"
|
$ErrorActionPreference = "Stop"
|
||||||
|
|
||||||
Write-Host "===================================="
|
Write-Host "Unity CI Build - Target: $Target"
|
||||||
Write-Host " Unity CI Build (Windows Agent)"
|
|
||||||
Write-Host " Target: $Target"
|
|
||||||
Write-Host "===================================="
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
# Load toolchain config
|
# Load toolchain config
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
@@ -19,7 +17,7 @@ try {
|
|||||||
$unityVersion = $config.unityVersion
|
$unityVersion = $config.unityVersion
|
||||||
$unityRoot = $config.windows.unityRoot
|
$unityRoot = $config.windows.unityRoot
|
||||||
|
|
||||||
$hubExe = "${env:ProgramFiles}\Unity Hub\Unity Hub.exe"
|
$hubExe = Join-Path $env:ProgramFiles "Unity Hub\Unity Hub.exe"
|
||||||
|
|
||||||
if (!(Test-Path $hubExe)) {
|
if (!(Test-Path $hubExe)) {
|
||||||
throw "Unity Hub not found at: $hubExe"
|
throw "Unity Hub not found at: $hubExe"
|
||||||
@@ -32,133 +30,198 @@ try {
|
|||||||
|
|
||||||
if (!(Test-Path $unityEditorPath)) {
|
if (!(Test-Path $unityEditorPath)) {
|
||||||
|
|
||||||
Write-Host "Unity $unityVersion not found. Installing via Unity Hub..."
|
Write-Host "Installing Unity $unityVersion..."
|
||||||
|
|
||||||
# Install Unity Editor
|
|
||||||
& $hubExe -- --headless install `
|
& $hubExe -- --headless install `
|
||||||
--version $unityVersion
|
--version $unityVersion
|
||||||
|
|
||||||
if ($LASTEXITCODE -ne 0) {
|
if ($LASTEXITCODE -ne 0) {
|
||||||
throw "Failed to install Unity $unityVersion"
|
throw "Failed to install Unity $unityVersion"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(Test-Path $unityEditorPath)) {
|
||||||
|
throw "Unity installation completed but editor not found: $unityEditorPath"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host "Unity found: $unityEditorPath"
|
Write-Host "Unity: $unityVersion"
|
||||||
|
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
# Ensure required modules
|
# Ensure required modules
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
# NOTE:
|
|
||||||
# Unity Hub CLI installs modules per version.
|
|
||||||
# These are cached per editor version, not reinstalled each build.
|
|
||||||
|
|
||||||
$modules = $config.windows.modules
|
$modules = $config.windows.modules
|
||||||
|
|
||||||
Write-Host "Ensuring Unity modules: $($modules -join ', ')"
|
if ($modules.Count -gt 0) {
|
||||||
|
|
||||||
foreach ($module in $modules) {
|
Write-Host "Checking Unity modules..."
|
||||||
|
|
||||||
Write-Host "Checking module: $module"
|
# Query installed editors/modules once
|
||||||
|
$installedEditors = & $hubExe -- --headless editors --installed
|
||||||
|
|
||||||
# Check installed modules via Unity Hub
|
foreach ($module in $modules) {
|
||||||
$installed = & $hubExe -- --headless editors --installed
|
|
||||||
|
|
||||||
if ($installed -notmatch "$unityVersion.*$module") {
|
if ($installedEditors -notmatch "$unityVersion.*$module") {
|
||||||
|
|
||||||
Write-Host "Installing module: $module"
|
Write-Host "Installing module: $module"
|
||||||
|
|
||||||
& $hubExe -- --headless install-modules `
|
& $hubExe -- --headless install-modules `
|
||||||
--version $unityVersion `
|
--version $unityVersion `
|
||||||
--module $module
|
--module $module
|
||||||
|
|
||||||
if ($LASTEXITCODE -ne 0) {
|
if ($LASTEXITCODE -ne 0) {
|
||||||
throw "Failed to install module: $module"
|
throw "Failed to install module: $module"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
Write-Host "Module already installed: $module"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
# Resolve Unity build method
|
# Resolve Unity build method
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
if (!$Target) {
|
if ([string]::IsNullOrWhiteSpace($Target)) {
|
||||||
Write-Host "No Target Provided"
|
throw "No Target provided."
|
||||||
exit
|
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
$method = switch ($Target) {
|
|
||||||
"Windows" { "BuildScript.Windows" }
|
|
||||||
"Android" { "BuildScript.Android" }
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Host "Using Unity method: $method"
|
$method = switch ($Target) {
|
||||||
|
"Windows" { "BuildScript.Windows" }
|
||||||
Write-Host "===================================================================="
|
"Android" { "BuildScript.Android" }
|
||||||
Write-Host "===================== Starting Unity Build ========================="
|
default { throw "Unsupported target: $Target" }
|
||||||
Write-Host "===================================================================="
|
|
||||||
|
|
||||||
$ErrorActionPreference = "Stop"
|
|
||||||
|
|
||||||
# 1. Define paths
|
|
||||||
$logFile = "$PWD/unity_build.log"
|
|
||||||
$artifactLog = "$PWD/Builds/unity_build.log"
|
|
||||||
|
|
||||||
New-Item -ItemType Directory -Force -Path "$PWD/BuildLog" | Out-Null
|
|
||||||
|
|
||||||
# 2. Build arguments
|
|
||||||
$unityArgs = @(
|
|
||||||
"-batchmode",
|
|
||||||
"-nographics",
|
|
||||||
"-quit",
|
|
||||||
"-projectPath", "$PWD",
|
|
||||||
"-executeMethod", "$method",
|
|
||||||
"-logFile", "$logFile",
|
|
||||||
"-verbose"
|
|
||||||
)
|
|
||||||
|
|
||||||
Write-Host "Starting Unity..."
|
|
||||||
Write-Host "Log: $logFile"
|
|
||||||
|
|
||||||
# 3. Start Unity
|
|
||||||
$process = Start-Process `
|
|
||||||
-FilePath $unityEditorPath `
|
|
||||||
-ArgumentList $unityArgs `
|
|
||||||
-NoNewWindow `
|
|
||||||
-PassThru
|
|
||||||
|
|
||||||
# 4. Stream log live (simple + reliable)
|
|
||||||
while (-not $process.HasExited) {
|
|
||||||
if (Test-Path $logFile) {
|
|
||||||
Get-Content $logFile -Tail 20 -ErrorAction SilentlyContinue | ForEach-Object {
|
|
||||||
Write-Host $_
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Start-Sleep -Milliseconds 500
|
|
||||||
}
|
|
||||||
|
|
||||||
$process.WaitForExit()
|
|
||||||
|
|
||||||
# 5. Copy Log to Builds Folder
|
|
||||||
Copy-Item $logFile $artifactLog -Force
|
|
||||||
|
|
||||||
|
|
||||||
# 6. Exit handling
|
|
||||||
if ($process.ExitCode -ne 0) {
|
|
||||||
Write-Error "Unity build failed with exit code $($process.ExitCode)"
|
|
||||||
exit $process.ExitCode
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Host "===================================="
|
|
||||||
Write-Host " BUILD SUCCESS: $Target"
|
|
||||||
Write-Host "===================================="
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Write-Host "Build Method: $method"
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Paths
|
||||||
|
# -----------------------------
|
||||||
|
$logFile = Join-Path $PWD "unity_build.log"
|
||||||
|
|
||||||
|
$artifactDir = Join-Path $PWD "Builds"
|
||||||
|
$artifactLog = Join-Path $artifactDir "unity_build.log"
|
||||||
|
|
||||||
|
New-Item -ItemType Directory -Force -Path $artifactDir | Out-Null
|
||||||
|
|
||||||
|
# Remove previous log
|
||||||
|
if (Test-Path $logFile) {
|
||||||
|
Remove-Item $logFile -Force
|
||||||
|
}
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Unity Arguments
|
||||||
|
# -----------------------------
|
||||||
|
$unityArgs = @(
|
||||||
|
"-batchmode"
|
||||||
|
"-nographics"
|
||||||
|
"-quit"
|
||||||
|
"-projectPath", "$PWD"
|
||||||
|
"-executeMethod", "$method"
|
||||||
|
"-logFile", "$logFile"
|
||||||
|
)
|
||||||
|
|
||||||
|
Write-Host "Starting Unity build..."
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Start Unity
|
||||||
|
# -----------------------------
|
||||||
|
$process = Start-Process `
|
||||||
|
-FilePath $unityEditorPath `
|
||||||
|
-ArgumentList $unityArgs `
|
||||||
|
-NoNewWindow `
|
||||||
|
-PassThru
|
||||||
|
|
||||||
|
$process.WaitForExit()
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Wait for log file creation
|
||||||
|
# -----------------------------
|
||||||
|
$timeoutSeconds = 30
|
||||||
|
$elapsed = 0
|
||||||
|
|
||||||
|
while (!(Test-Path $logFile) -and $elapsed -lt $timeoutSeconds) {
|
||||||
|
Start-Sleep -Seconds 1
|
||||||
|
$elapsed++
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(Test-Path $logFile)) {
|
||||||
|
throw "Unity log file was not created."
|
||||||
|
}
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Wait for file writes to finish
|
||||||
|
# -----------------------------
|
||||||
|
$previousLength = -1
|
||||||
|
|
||||||
|
do {
|
||||||
|
$currentLength = (Get-Item $logFile).Length
|
||||||
|
|
||||||
|
if ($currentLength -eq $previousLength) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
$previousLength = $currentLength
|
||||||
|
|
||||||
|
Start-Sleep -Milliseconds 500
|
||||||
|
|
||||||
|
} while ($true)
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Archive log
|
||||||
|
# -----------------------------
|
||||||
|
Copy-Item $logFile $artifactLog -Force
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Build failed
|
||||||
|
# -----------------------------
|
||||||
|
if ($process.ExitCode -ne 0) {
|
||||||
|
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host "===== Unity Build Failed ====="
|
||||||
|
Write-Host "Exit Code: $($process.ExitCode)"
|
||||||
|
Write-Host ""
|
||||||
|
|
||||||
|
if (Test-Path $logFile) {
|
||||||
|
Write-Host "===== Last 500 Log Lines ====="
|
||||||
|
Get-Content $logFile -Tail 500
|
||||||
|
}
|
||||||
|
|
||||||
|
exit $process.ExitCode
|
||||||
|
}
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Build succeeded
|
||||||
|
# -----------------------------
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host "===== Build Summary ====="
|
||||||
|
|
||||||
|
if (Test-Path $logFile) {
|
||||||
|
|
||||||
|
Get-Content $logFile |
|
||||||
|
Select-String `
|
||||||
|
-Pattern @(
|
||||||
|
"Build completed"
|
||||||
|
"Build succeeded"
|
||||||
|
"Build finished"
|
||||||
|
"Total time"
|
||||||
|
) `
|
||||||
|
-SimpleMatch |
|
||||||
|
ForEach-Object {
|
||||||
|
Write-Host $_.Line
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host "===== Last 50 Log Lines ====="
|
||||||
|
|
||||||
|
Get-Content $logFile -Tail 50
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host "SUCCESS: $Target"
|
||||||
|
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
throw
|
Write-Error $_.Exception.Message
|
||||||
}
|
exit 1
|
||||||
finally {
|
}
|
||||||
Write-Host "Cleaning Up"
|
finally {
|
||||||
# Stop-Process -Name "Unity", "Unity Hub" -Force
|
Write-Host "Cleanup complete."
|
||||||
|
# Stop-Process -Name "Unity","Unity Hub" -Force -ErrorAction SilentlyContinue
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user