This commit is contained in:
2026-06-22 23:38:39 +09:30
parent de8225789d
commit 1be7b69c5f
3 changed files with 28 additions and 43 deletions
+6 -23
View File
@@ -1,25 +1,19 @@
import jetbrains.buildServer.configs.kotlin.* import jetbrains.buildServer.configs.kotlin.*
import jetbrains.buildServer.configs.kotlin.buildSteps.powerShell import jetbrains.buildServer.configs.kotlin.buildSteps.powerShell
import jetbrains.buildServer.configs.kotlin.buildSteps.script
version = "2026.1" version = "2026.1"
project { project {
description = "Unity CI pipeline (Windows + Android + extensible)" description = "Unity CI (Windows + Android + extensible)"
buildType(UnityBuildCore) buildType(UnityBuildCore)
buildType(WindowsBuild) buildType(WindowsBuild)
buildType(AndroidBuild) buildType(AndroidBuild)
// Mac/iOS intentionally omitted until you have macOS agents
} }
/** /**
* ========================= * CORE BUILD (only place Unity runs)
* CORE UNITY BUILD PIPELINE
* =========================
* This is the only build that actually runs Unity.exe
*/ */
object UnityBuildCore : BuildType({ object UnityBuildCore : BuildType({
@@ -36,12 +30,13 @@ object UnityBuildCore : BuildType({
steps { steps {
powerShell { powerShell {
name = "Build Unity" name = "Run Unity Build"
scriptMode = file { scriptMode = file {
path = "ci/Build-Unity.ps1" path = "ci/Build-Unity.ps1"
} }
// SAFE: always passed from dependency configs
scriptArgs = "-Target %unity.target%" scriptArgs = "-Target %unity.target%"
} }
} }
@@ -52,9 +47,7 @@ object UnityBuildCore : BuildType({
}) })
/** /**
* ========================= * WINDOWS BUILD
* WINDOWS ENTRYPOINT
* =========================
*/ */
object WindowsBuild : BuildType({ object WindowsBuild : BuildType({
@@ -68,10 +61,6 @@ object WindowsBuild : BuildType({
root(DslContext.settingsRoot) root(DslContext.settingsRoot)
} }
steps {
// no-op (build happens in dependency)
}
dependencies { dependencies {
snapshot(UnityBuildCore) { snapshot(UnityBuildCore) {
onDependencyFailure = FailureAction.FAIL_TO_START onDependencyFailure = FailureAction.FAIL_TO_START
@@ -84,9 +73,7 @@ object WindowsBuild : BuildType({
}) })
/** /**
* ========================= * ANDROID BUILD
* ANDROID ENTRYPOINT
* =========================
*/ */
object AndroidBuild : BuildType({ object AndroidBuild : BuildType({
@@ -100,10 +87,6 @@ object AndroidBuild : BuildType({
root(DslContext.settingsRoot) root(DslContext.settingsRoot)
} }
steps {
// no-op (build happens in dependency)
}
dependencies { dependencies {
snapshot(UnityBuildCore) { snapshot(UnityBuildCore) {
onDependencyFailure = FailureAction.FAIL_TO_START onDependencyFailure = FailureAction.FAIL_TO_START
+22 -7
View File
@@ -1,20 +1,33 @@
param( param(
[Parameter(Mandatory)] [Parameter(Mandatory = $true)]
[string]$Target [string]$Target
) )
Write-Host "============================="
Write-Host "Unity Build Starting"
Write-Host "Target: $Target"
Write-Host "============================="
if ([string]::IsNullOrWhiteSpace($Target)) {
throw "ERROR: Target was empty. TeamCity did not pass unity.target correctly."
}
$config = Get-Content ".\ci\toolchain.json" | ConvertFrom-Json $config = Get-Content ".\ci\toolchain.json" | ConvertFrom-Json
if (-not $config.targets.$Target) { if (-not $config.targets.$Target) {
throw "Unknown target: $Target" throw "Unknown build target: $Target"
} }
$t = $config.targets.$Target $t = $config.targets.$Target
$UnityExe = .\ci\Ensure-UnityToolchain.ps1 $UnityExe = Join-Path $config.unityRoot "$($config.unityVersion)\Editor\Unity.exe"
Write-Host "Building target: $Target" if (!(Test-Path $UnityExe)) {
Write-Host "Method: $($t.method)" throw "Unity not installed at expected path: $UnityExe"
}
Write-Host "Using Unity: $UnityExe"
Write-Host "Executing method: $($t.method)"
Write-Host "Output: $($t.outputPath)" Write-Host "Output: $($t.outputPath)"
& $UnityExe ` & $UnityExe `
@@ -26,5 +39,7 @@ Write-Host "Output: $($t.outputPath)"
-logFile - -logFile -
if ($LASTEXITCODE -ne 0) { if ($LASTEXITCODE -ne 0) {
throw "Unity build failed: $Target" throw "Unity build FAILED for target: $Target"
} }
Write-Host "Build SUCCESS: $Target"
-13
View File
@@ -1,6 +1,5 @@
{ {
"unityVersion": "2022.3.62f1", "unityVersion": "2022.3.62f1",
"unityRoot": "C:\\Program Files\\Unity\\Hub\\Editor", "unityRoot": "C:\\Program Files\\Unity\\Hub\\Editor",
"targets": { "targets": {
@@ -14,18 +13,6 @@
"method": "BuildScript.Android", "method": "BuildScript.Android",
"outputPath": "Builds/Android/Game.aab", "outputPath": "Builds/Android/Game.aab",
"buildTarget": "Android" "buildTarget": "Android"
},
"Mac": {
"method": "BuildScript.Mac",
"outputPath": "Builds/Mac/Game.app",
"buildTarget": "StandaloneOSX"
},
"iOS": {
"method": "BuildScript.iOS",
"outputPath": "Builds/iOS",
"buildTarget": "iOS"
} }
} }
} }