BuildCofiguration.xmlの優先順位について

お世話になっております。

BuildCofiguration.xmlの優先順位について正しい情報をお伺いしたく、投稿させていただきました。

文面が長くなってしまうので、この中では以下のように仮称します。

AppRoamingConfig : <USER>/AppData/Roaming/Unreal Engine/UnrealBuildTool/BuildConfiguration.xml
ProjectConfig : <PROJECT_DIRECTORY>/Saved/UnrealBuildTool/BuildConfiguration.xml
EngineConfig : Engine/Saved/UnrealBuildTool/BuildConfiguration.xml

現状私の環境で確認している限りでは、AppRoamingConfig と ProjectConfig にのみ配置した場合

Compile Tools Win64 では AppRoamingConfig を参照しているのに対し

Compile Editor Win64 では ProjectConfig の設定を参照しているように見えます。

尚、EngineConfig と AppRoamingConfig にのみ配置した場合は

Compile Tools Win64, Compile Editor Win64の両方とも AppRoamingConfig を参照しているようでした。

動作確認時はIntermediateやSaveフォルダなどを削除しているため、

Engine\Intermediate\Build\UnrealBuildTool.Env.BuildConfiguration.xml などのキャッシュされたBuildConfigurationが読まれている線はないと思っております。

優先順位を知りたい理由としては、EngineConfig で設定同期しつつも

ジョブ用マシンや個別対応で AppRoamingConfig/ProjectConfig などで Overrideしたいといったユースケースがあるため

正確な優先順位について実態を知りたかった流れとなります。

しかし、一部処理において優先順位を守らないパターンが今回確認できたため、

この点についてバグなのか、意図した挙動なのか、優先順位としてどうなっているのかをご回答いただけないでしょうか。

検証した構成やログを以下に記載いたします。

◆ 検証構成

UE5.8.0

Horde Server 5.8.0

Horde Agent 5.8.0

▼ AppRoamingConfig

補足: 検証用にあえて繋がらないHorde Serverを指定する

Path : %LOCALAPPDATA%\Unreal Engine\UnrealBuildTool\BuildConfiguration.xml

<?xml version="1.0" encoding="utf-8" ?>
<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
	<BuildConfiguration>
		<!-- Enable support for UnrealBuildAccelerator -->
		<bAllowUBAExecutor>true</bAllowUBAExecutor>
		<bAllowSNDBS>false</bAllowSNDBS>
		<bAllowFASTBuild>false</bAllowFASTBuild>
		<bAllowXGE>false</bAllowXGE>
	</BuildConfiguration>
 
	<Horde>
		<!-- Address of the Horde server -->
		<Server>http://localhost:1000/</Server>
 
		<!-- Pool of machines to offload work to. Horde configures Win-UE5 by default. -->
		<WindowsPool>Win-UE5</WindowsPool>
	</Horde>
</Configuration>

▼ ProjectConfig / EngineConfig

Path : projects/ShooterGame/Saved/UnrealBuildTool/BuildConfiguration.xml

Path : Engine/Saved/UnrealBuildTool/BuildConfiguration.xml

<?xml version="1.0" encoding="utf-8" ?>
<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
	<BuildConfiguration>
		<!-- Enable support for UnrealBuildAccelerator -->
		<bAllowUBAExecutor>true</bAllowUBAExecutor>
		<bAllowSNDBS>false</bAllowSNDBS>
		<bAllowFASTBuild>false</bAllowFASTBuild>
		<bAllowXGE>false</bAllowXGE>
	</BuildConfiguration>
 
	<Horde>
		<!-- Address of the Horde server -->
		<Server>HordeServerURL</Server>
 
		<!-- Pool of machines to offload work to. Horde configures Win-UE5 by default. -->
		<WindowsPool>Win-UE5</WindowsPool>
		<MaxCores>20</MaxCores>
	</Horde>
</Configuration>

◆ AppRoamingConfig + ProjectConfig 時のログ

添付いたしました。

以上、よろしくお願いいたします。

[Attachment Removed]

再現手順

  • ビルド対象のIntermediate, Save, DerivedDataCacheなどを削除しておく
  • 以下に繋がらないHorde設定を記載する

<USER>/AppData/Roaming/Unreal Engine/UnrealBuildTool/BuildConfiguration.xml

  • 以下に正しいHorde設定を記載する

<PROJECT_DIRECTORY>/Saved/UnrealBuildTool/BuildConfiguration.xml

  • 以下のようなビルドコマンドを実行する

.\RunUAT.bat BuildGraph -Script=Engine/Build/Graph/Tasks/BuildAndTestProject.xml -Target="BuildAndTest ShooterGame" -set:ProjectFile=projects/ShooterGame/ShooterGame.uproject -set:TargetName=ShooterGame -set:EditorTargetName=ShooterGameEditor -set:WithDeviceReservation=false -set:ExtraEditorCompileArguments=Project=../../../../projects/ShooterGame/ShooterGame.uproject -set:ExtraTargetCompileArguments=Project=../../../../projects/ShooterGame/ShooterGame.uproject -set:PublishBuilds=false -set:PublishHordeArtifacts=false -set:GenericCompileArguments=-UTF8Output -set:ExtraCookArguments=-UTF8Output -UTF8Output -set:WithWin64Editor=true -set:EditorBootTest=false -set:WithWin64=true -set:WithPS4=false -set:WithPS5=false -set:WithXSX=false -set:WithSwitch=false -set:WithSwitch2=false -set:WithMac=false -set:WithLinux=false -set:WithAndroid=false -set:WithIOS=false -set:WithTVOS=false -set:WithDevelopmentTargets=false -set:WithDevelopmentPackages=false -set:TargetBootTest=false -set:GauntletDeviceService=http://localhost:13340 -set:GauntletDevicePool=hogehoge

  • Compile Tools Win64 ではAppdata/Roaming以下のConfigを参照し、Compile Editor Win64ではprojects/Saved以下のConfigを参照している
    [Attachment Removed]

お世話になっております。

まずBuildConfiguration.xml の優先度について、​XmlConfig.ReadConfigFiles(public static InputFile[] InputFiles)で存在するファイルを順に読み込みを行い、同じキーは後から読んだ方が優先となります。そのため、優先順位は以下のようになります(高→低)。

  • Env 合成: Engine/Intermediate/Build/UnrealBuildTool.Env.BuildConfiguration.xml
  • ProjectConfig: <Project>/Saved/UnrealBuildTool/BuildConfiguration.xml (※ただし条件付き)
  • User:%USERPROFILE%/Documents/Unreal Engine/UnrealBuildTool/BuildConfiguration.xml
  • Local:%LOCALAPPDATA%/Unreal Engine/UnrealBuildTool/BuildConfiguration.xml
  • AppRoaming:%APPDATA%/Unreal Engine/UnrealBuildTool/BuildConfiguration.xml
  • ProgramData:%ProgramData%/Unreal Engine/UnrealBuildTool/BuildConfiguration.xml
  • EngineConfig:Engine/Saved/UnrealBuildTool/BuildConfiguration.xml
  • NotForLicensees:​Engine/Restricted/NotForLicensees/…/BuildConfiguration.xml

Tools と Editor で違う理由として、ProjectConfig は projectRootDirectory != null のときだけ Input に追加されます。そのルートは -Project=(または同等の project 解決)から決まります。

  • Compile Tools: ShaderCompileWorker などに Project=なし→ProjectConfig未読込→AppRoamingがEngineConfigより上で適用
  • Compile Editor: Project="$(TargetProject)"あり→ProjectConfigがAppRoamingの後に読まれるため適用

そのため、ご確認いただいた構成においては、Engine+AppRoaming → Tools=AppRoaming, Editor=AppRoaming となり、AppRoaming となるのは期待された結果で、その他ご確認いただいた点においても、意図した適用となります。

​もし Override が必要な場合には、以下の配置であることを想定しておくと良いかと思います。

  • ブランチ共通のベース: EngineConfig
  • マシン/ユーザー単位の上書き: AppRoaming(または LocalAppData、同キーなら Local が Roaming より後)
  • プロジェクト専用の上書き: ProjectConfig(-Project= が付くUBT呼び出しに限る)
  • CI/ジョブ最優先: 環境変数 → Env XML(全呼び出しで最上位)​

[Attachment Removed]

詳細ご回答いただきありがとうございます!

直近別の確認をしておりここの確認ができておりませんが、次回確認時に参考にさせていただきます。

[Attachment Removed]