33f5ad68bf
Project CI / AI game creator shell Rust shard 1/4 (push) Successful in 7m19s
Project CI / AI game creator shell Rust shard 3/4 (push) Successful in 7m26s
Project CI / AI game creator shell Rust shard 4/4 (push) Successful in 7m32s
Project CI / AI game creator shell Rust shard 2/4 (push) Successful in 7m34s
Project CI / AI game creator shell Rust smoke (push) Successful in 1m57s
Project CI / AI game creator shell Rust crates (push) Successful in 3m18s
Project CI / Native shell tests (push) Successful in 10m54s
Project CI / Backend tests (push) Successful in 12m42s
Project CI / Frontend tests (push) Successful in 13m4s
Project CI / AI game creator shell web tests (push) Successful in 5m1s
Project CI / Repository checks (push) Successful in 12m48s
AGC 原有插件系统无法直接操作已打开的 Unity Editor。本变更增加内置 `agc-unity-editor`,在 Windows x64 / Unity Mono 上支持当前项目探测、连接与 C# 执行,不向 Unity 工程安装 UPM 桥接包。 ## 主要变更 - 固定复用 DotCraft.Unity 0.4.3 的 Attach 核心,提供自包含 .NET helper,保留上游许可证、来源及修改记录。 - GUI、Runtime、DirectProject 共用 Runner 执行服务;补齐项目身份、并发、总期限、回执确认与持久不确定状态阻断。 - 现有打开项目入口支持 Unity,按项目类型及开关暴露插件和 Agent 工具。 - Windows 构建准备 helper 并随包分发;插件 JS/Rust 测试接入现有 CI 组,Jenkins 增加 .NET 10 工具链预检。 ## 验证 - .NET helper 27 项测试、自包含发布及最小环境协议 smoke 通过。 - Unity 6000.3.7f1 实机验证通过:连接、C# 执行、编译错误修复、断连重连、Domain Reload 后重新握手;真实 Runner 的 ACK、并发拒绝和跨重启阻断通过。 - 宿主 Unity、PluginHost、Cocos、MCP、工具目录与引擎识别定向回归通过;前端类型检查、插件 JS/Rust、CI 配置、格式、编码和文档门禁通过。 Linux CI 不代替 Windows helper/实机验证;发行安装包 UI smoke、其它 Unity 版本和 Unity CoreCLR 未验证。Unity 演示工程中的场景和组件已撤销,不在此 PR 范围内。 --------- Co-authored-by: kdletters <61648117+kdletters@users.noreply.github.com> Reviewed-on: http://192.168.35.82/git/GenarrativeAI/Genarrative/pulls/423
58 lines
4.3 KiB
PowerShell
58 lines
4.3 KiB
PowerShell
param([ValidateSet('Debug', 'Release')][string]$Configuration = 'Release', [switch]$SkipTests)
|
|
$ErrorActionPreference = 'Stop'
|
|
if (![System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform([System.Runtime.InteropServices.OSPlatform]::Windows)) {
|
|
throw 'Unity Attach 发布仅支持 Windows x64。'
|
|
}
|
|
$vswhere = Join-Path ${env:ProgramFiles(x86)} 'Microsoft Visual Studio/Installer/vswhere.exe'
|
|
if (!(Test-Path -LiteralPath $vswhere)) { throw '需要 Visual Studio C++ x64 构建工具。' }
|
|
$visualStudio = & $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
|
|
if (!$visualStudio) { throw '需要 Visual Studio C++ x64 构建工具。' }
|
|
$vcvars = Join-Path $visualStudio 'VC/Auxiliary/Build/vcvars64.bat'
|
|
$nativeSource = Join-Path $PSScriptRoot 'vendor/Native/Bootstrap.cpp'
|
|
$nativeOutput = Join-Path $PSScriptRoot 'vendor/obj/native'
|
|
New-Item -ItemType Directory -Force -Path $nativeOutput | Out-Null
|
|
$command = 'call "{0}" >nul && cl /nologo /Brepro /LD /EHsc /MT /O2 "{1}" /Fo"{2}" /link /Brepro /OUT:"{3}" /IMPLIB:"{4}"' -f $vcvars,$nativeSource,(Join-Path $nativeOutput 'Bootstrap.obj'),(Join-Path $nativeOutput 'DotCraft.Unity.Native.dll'),(Join-Path $nativeOutput 'DotCraft.Unity.Native.lib')
|
|
& cmd.exe /d /c $command
|
|
if ($LASTEXITCODE -ne 0) { throw 'Unity Attach native bootstrap 构建失败。' }
|
|
if (!$SkipTests) {
|
|
& dotnet run --project (Join-Path $PSScriptRoot 'tests/Agc.Unity.Attach.Tests.csproj') -c $Configuration
|
|
if ($LASTEXITCODE -ne 0) { throw 'Unity Attach helper 测试失败。' }
|
|
}
|
|
$output = Join-Path $PSScriptRoot 'publish/win-x64'
|
|
& dotnet publish (Join-Path $PSScriptRoot 'Agc.Unity.Attach.csproj') -c $Configuration -r win-x64 --self-contained true -p:PublishSingleFile=true -p:PublishTrimmed=false -o $output
|
|
if ($LASTEXITCODE -ne 0) { throw 'Unity Attach helper 发布失败。' }
|
|
$licenses = Join-Path $output 'licenses'
|
|
New-Item -ItemType Directory -Force -Path $licenses | Out-Null
|
|
Copy-Item -LiteralPath (Join-Path $PSScriptRoot 'vendor/LICENSE') -Destination (Join-Path $licenses 'DotCraft-Apache-2.0.txt')
|
|
Copy-Item -LiteralPath (Join-Path $PSScriptRoot 'licenses/Roslyn-MIT.txt') -Destination $licenses
|
|
Copy-Item -LiteralPath (Join-Path $PSScriptRoot 'NOTICE'),(Join-Path $PSScriptRoot 'THIRD-PARTY-NOTICES.txt') -Destination $output
|
|
Copy-Item -LiteralPath (Join-Path $PSScriptRoot 'vendor/upstream.json') -Destination $licenses
|
|
$assets = Get-Content -LiteralPath (Join-Path $PSScriptRoot 'obj/project.assets.json') -Raw | ConvertFrom-Json
|
|
$runtime = @($assets.project.frameworks.PSObject.Properties | ForEach-Object { $_.Value.downloadDependencies } | Where-Object name -EQ 'Microsoft.NETCore.App.Runtime.win-x64' | Select-Object -Unique name, version)
|
|
if ($runtime.Count -ne 1) { throw '无法定位自包含 .NET runtime 许可。' }
|
|
$runtimeVersion = $runtime[0].version.Trim('[',']').Split(',')[0].Trim()
|
|
$runtimeDirectory = $null
|
|
foreach ($folder in $assets.packageFolders.PSObject.Properties.Name) {
|
|
$candidate = Join-Path $folder ('microsoft.netcore.app.runtime.win-x64/' + $runtimeVersion)
|
|
if (Test-Path -LiteralPath $candidate) { $runtimeDirectory = $candidate; break }
|
|
}
|
|
if (!$runtimeDirectory) { throw '无法定位自包含 .NET runtime 包。' }
|
|
foreach ($name in @('LICENSE.TXT', 'THIRD-PARTY-NOTICES.TXT')) {
|
|
$source = Join-Path $runtimeDirectory $name
|
|
if (!(Test-Path -LiteralPath $source)) { throw "缺少 .NET runtime 许可文件:$name" }
|
|
Copy-Item -LiteralPath $source -Destination (Join-Path $licenses ('dotnet-' + $name))
|
|
}
|
|
foreach ($package in @('microsoft.codeanalysis.common', 'microsoft.codeanalysis.csharp')) {
|
|
$notice = $null
|
|
foreach ($folder in $assets.packageFolders.PSObject.Properties.Name) {
|
|
$candidate = Join-Path $folder ($package + '/5.3.0/ThirdPartyNotices.rtf')
|
|
if (Test-Path -LiteralPath $candidate) { $notice = $candidate; break }
|
|
}
|
|
if (!$notice) { throw "缺少 Roslyn 第三方声明:$package" }
|
|
Copy-Item -LiteralPath $notice -Destination (Join-Path $licenses ($package + '-ThirdPartyNotices.rtf'))
|
|
}
|
|
$oldDebugFile = Join-Path $output 'DotCraft.Unity.Attach.pdb'
|
|
if (Test-Path -LiteralPath $oldDebugFile) { Remove-Item -LiteralPath $oldDebugFile }
|
|
if (!(Test-Path -LiteralPath (Join-Path $output 'Agc.Unity.Attach.exe'))) { throw '缺少 self-contained helper。' }
|
|
Write-Output "Unity Attach helper 已发布:$output"
|