diff --git a/src/Cake.Unity.FSharp.Tests/UnityEditorArgumentsTests.fs b/src/Cake.Unity.FSharp.Tests/UnityEditorArgumentsTests.fs index 8a18f60..14cdcfa 100644 --- a/src/Cake.Unity.FSharp.Tests/UnityEditorArgumentsTests.fs +++ b/src/Cake.Unity.FSharp.Tests/UnityEditorArgumentsTests.fs @@ -1,5 +1,7 @@ module Cake.Unity.Tests.UnityEditorArgumentsTests +open System +open Cake.Unity.Arguments open FSharp.Interop.Dynamic open FsUnit.TopLevelOperators open NUnit.Framework @@ -21,6 +23,11 @@ let setExecuteMethod value (arguments : UnityEditorArguments) = arguments.ExecuteMethod <- value arguments +let setCustomBuildTarget value (arguments : UnityEditorArguments) = + arguments.CustomBuildTarget <- value + arguments + + [] let ``CLI arguments with enabled BatchMode should contain "-batchmode"`` () = () |> UnityEditorArguments |> setBatchMode true |> commandLineArguments |> should haveSubstring "-batchmode" @@ -48,3 +55,8 @@ let ``default BatchMode value should be true`` () = [] let ``default Quit value should be true`` () = UnityEditorArguments().Quit |> should equal true + +[] +let ``CLI arguments with Custom argument "CustomBuildTarget" of value "PS5" should contain "-buildTarget PS5"`` () = + () |> UnityEditorArguments |> setCustomBuildTarget "PS5" |> commandLineArguments |> should haveSubstring "-buildTarget PS5" + diff --git a/src/Cake.Unity/Arguments/BuildTarget.cs b/src/Cake.Unity/Arguments/BuildTarget.cs index d5d5d4e..9917b84 100644 --- a/src/Cake.Unity/Arguments/BuildTarget.cs +++ b/src/Cake.Unity/Arguments/BuildTarget.cs @@ -23,5 +23,10 @@ public enum BuildTarget N3DS, tvOS, PSM, + + GameCoreXboxSeries, + GameCoreXboxOne, + GameCoreScarlett, + PS5, } } diff --git a/src/Cake.Unity/UnityEditorArguments.cs b/src/Cake.Unity/UnityEditorArguments.cs index ec716aa..329c38e 100644 --- a/src/Cake.Unity/UnityEditorArguments.cs +++ b/src/Cake.Unity/UnityEditorArguments.cs @@ -60,6 +60,11 @@ public class UnityEditorArguments /// public BuildTarget? BuildTarget { get; set; } + /// + /// Allows the selection of an active build target before loading a project (with string). + /// + public string CustomBuildTarget { get; set; } + /// /// Build a 32-bit standalone Windows player (for example, -buildWindowsPlayer path/to/your/build.exe). /// @@ -328,6 +333,18 @@ internal ProcessArgumentBuilder CustomizeCommandLineArguments(ProcessArgumentBui .Append("-buildTarget") .Append(BuildTarget.Value.ToString()); + if (CustomBuildTarget != null) + { + builder + .Append("-buildTarget") + .Append(CustomBuildTarget); + } + + if (CustomBuildTarget != null && BuildTarget.HasValue) + { + throw new ArgumentException("Providing both BuildTarget and CustomBuildTarget is not supported."); + } + if (BuildWindowsPlayer != null) builder .Append("-buildWindowsPlayer")