Why is all Editor build-processing code gated to UNITY_EDITOR_OSX?
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 55/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 領域
- build-system, game-dev
研究方向
Start with the UNITY_EDITOR_OSX guards in Apple.Core/Editor/AppleBuildProfile.cs, AppleBuildStep.cs, AppleBuild.cs, AppleCoreBuildStep.cs, AppleSecurityBuildStep.cs, and the other plug-in Editor files; compare them with Apple.BackgroundAssets/Editor/BuildStep.cs. Reproduce the Linux batchmode BuildPipeline.BuildPlayer compilation failure, then verify the agreed guard scope against the later macOS xcodebuild step; done means Linux export compiles and produces the Xcode project without breaking the macOS archive path.
由索引模型根據 Issue 內容生成。
描述
Why is all Editor build-processing code gated to UNITY_EDITOR_OSX? (it blocks splitting the whole build to something like Unity export to happen on Linux machine and the Xcode build on macOS)
Context: the pipeline
Build split in two stages, on two different machines.
- Unity export, on a Linux machine — this is the step that opens the project in batchmode
and callsBuildPipeline.BuildPlayerfor iOS, producing the.xcodeproj. - Xcode build, on a macOS machine —
xcodebuild archive/export on the project produced
in step 1.
This is a common CI shape for people that build for multiple platforms (iOS + Android, etc.) from
one Unity project and want to keep the compute-heavy Linux fleet doing as much of the shared work
as possible, only handing macOS machines the part that strictly needs Xcode.
What broke
Every Editor build-processing file I've looked at, across every plug-in in this repo, is wrapped
in the identical condition:
#if (UNITY_EDITOR_OSX && (UNITY_IOS || UNITY_TVOS || UNITY_STANDALONE_OSX || UNITY_VISIONOS))
UNITY_EDITOR_OSX is defined based on the OS the Editor process is running on, not the build
target. Since my export runs on Linux, this symbol is false there, for every file, in every
plug-in, simultaneously — this isn't per-file behavior, it's one symbol shared by the whole compile.
Two consequences I hit:
Apple.BackgroundAssets/Editor/BuildStep.csis the one file in the whole repo missing this
guard (every sibling file —AppleBuildProfile.cs,AppleBuildStep.cs,AppleBuild.cs,
AppleCoreBuildStep.cs,AppleSecurityBuildStep.cs,AppleUserManagementBuildStep.cs, and the
equivalent files in Accessibility, CoreHaptics, GameController, GameKit, StoreKit — all have it).
BecauseAppleBuildProfilecompiles out to nothing on Linux, butBuildStep.csreferences it
unconditionally, Editor script compilation hard-fails there:
CS0246: The type or namespace name 'AppleBuildProfile' could not be found.
Why I don't think this needs to be macOS-only
I read through Apple.Core's Editor code specifically looking for something that would force it
to run on a macOS host, and didn't find one:
AppleBuildProfile(Apple.Core/Editor/AppleBuildProfile.cs) is a plainScriptableObject:
a dictionary, some strings,AssetDatabasecalls. No OS-specific API anywhere in it.AppleBuild.OnPostProcessBuild(Apple.Core/Editor/AppleBuild.cs) reads/writesInfo.plistand
entitlements files, opens the.pbxprojviaPBXProject, and builds a shell-script string that
gets written into a Run Script build phase. I grepped this file forProcess.Start,
ProcessStartInfo,DllImport,xcrun,codesign,lipo— anything that would mean this C#
code itself invokes a native macOS tool during export — and found nothing. The only appearance
ofcodesignin the file is as a literal string embedded in the generated build-phase script
(around lines 398/409/455/466), meant to run later, underxcodebuilditself. That anyway
must happen on a macOS machines regardless of this guard; it isn't a reason the export step
needs to be on macOS too.- More generally:
UnityEditor.iOS.Xcode(PBXProject,PlistDocument) is Unity's own managed,
cross-platform library for editing.pbxproj/.plistfiles as structured text. Building an iOS
Xcode project from a non-macOS Editor host and archiving it separately on macOS is a supported,
fairly common CI pattern in the Unity ecosystem specifically because these APIs don't require
Xcode or macOS to run — only the laterxcodebuildstep does.
Given all of that, I couldn't find a point in this code path where it actually needs the Editor
process itself to be on macOS, as opposed to needing a Mac only for the parts that were already
guaranteed to run there anyway (the later xcodebuild/archive step, and the earlier one-time
build.py step that produced the native libraries in the first place).
Where the guard came from
Introduced in commit b4002b66f01999e4b66f609974826aaf21d59eff ("Replacing Unity's native
library management", PR #27), which moved native-library selection/embedding from Unity's own
per-platform plugin importer into Apple.Core's own system.
Environment
- Unity: 6000.4.0f1
- Setup: Unity export on Linux, Xcode archive on macOS machines
Question
Is UNITY_EDITOR_OSX a hard technical requirement for this code, or a deliberate scope decision (i.e. "we only support this when the Editor host itself is macOS")? If it's the latter, would you consider narrowing the guard to only where it's actually load-bearing — e.g. around the native library embedding/signing calls specifically — so the rest of the Info.plist/entitlements/build-step machinery can run on a non-Mac Editor host, even if native library embedding itself still needs a Mac?
- 主要語言
- C#
- 星號
- 988
- 分支
- 251
- 平均合併
- 2 天 22 小時
- 30 天內合併 PR
- 11
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
apple/unityplugins 的其他 Issue
-
bug
難度 4/5 3-5 天 新手友好度 35/100
apple/unityplugins#124 ·
維護者通常 1 天內回覆
-
Arguments for Push Message localisation in SendExchange do not seem to work可能重新可做 @ryzngard 於 120 天前認領,目前沒有進行中的 PR。 未關閉bug Plug-in - GameKit
apple/unityplugins#98 · 2 則留言 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
Use internal when exposing low-level types like IntPtr可能重新可做 @ryzngard 於 147 天前認領,目前沒有進行中的 PR。 未關閉bug
apple/unityplugins#97 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
Provide pre-compiled .unitypackage files for the Apple Unity Plugins可能重新可做 @ryzngard 於 147 天前認領,目前沒有進行中的 PR。 未關閉feature request
apple/unityplugins#94 · 3 則留言 · 8 個 reaction · 已指派 1 人 ·
維護者通常 1 天內回覆
-
feature request Plug-in - GameKit
難度 5/5 一週以上 新手友好度 45/100
apple/unityplugins#93 · 1 個 reaction ·
維護者通常 1 天內回覆
查看 apple/unityplugins 的全部 Issue
相似的 Issue
-
bug P3
難度 2/5 1-3 小時 新手友好度 88/100
nightscout/nocturne#1908 ·
維護者通常 1 天內回覆
-
bug documentation Needs: Triage :mag:
難度 2/5 1-3 小時 新手友好度 78/100
-
WPF: each page's `Title` overwrites the window title, and returning to a page does not restore it未關閉
難度 2/5 1-3 小時 新手友好度 75/100
維護者通常 1 天內回覆
-
agentic-workflows area/Docs partner/agentic-workflows
難度 1/5 1 小時以內 新手友好度 82/100
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 78/100
jamesmontemagno/tiny-clips#378 · 2 則留言 ·
維護者通常 1 天內回覆