Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'releaseCodeOptimization' argument option #71

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/Cake.Unity.FSharp.Tests/UnityEditorArgumentsTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,18 @@ let setExecuteMethod value (arguments : UnityEditorArguments) =
arguments.ExecuteMethod <- value
arguments

let setReleaseCodeOptimization value (arguments : UnityEditorArguments) =
arguments.ReleaseCodeOptimization <- value
arguments

[<Test>]
let ``CLI arguments with enabled BatchMode should contain "-batchmode"`` () =
() |> UnityEditorArguments |> setBatchMode true |> commandLineArguments |> should haveSubstring "-batchmode"

[<Test>]
let ``CLI arguments with release code optimization should contain "-releaseCodeOptimization"`` () =
() |> UnityEditorArguments |> setReleaseCodeOptimization true |> commandLineArguments |> should haveSubstring "-releaseCodeOptimization"

[<Test>]
let ``CLI arguments with custom argument "age" of value 18 should contain "--age=18"`` () =
let arguments = UnityEditorArguments ()
Expand Down
8 changes: 8 additions & 0 deletions src/Cake.Unity/UnityEditorArguments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@ public class UnityEditorArguments
/// </summary>
public bool AcceptAPIUpdate { get; set; }

/// <summary>
/// Enables release code optimization mode, overriding the current default code optimization mode for the session.
/// </summary>
public bool ReleaseCodeOptimization { get; set; }

/// <summary>
/// <para>Custom arguments which can further be processed in Unity Editor script by calling System.Environment.GetCommandLineArgs method. </para>
/// <para>They are supplied among other arguments in format "--key=value". </para>
Expand Down Expand Up @@ -474,6 +479,9 @@ internal ProcessArgumentBuilder CustomizeCommandLineArguments(ProcessArgumentBui
if (AcceptAPIUpdate)
builder.Append("-accept-apiupdate");

if (ReleaseCodeOptimization)
builder.Append("-releaseCodeOptimization");

foreach (var customArgument in customArguments)
builder.AppendQuoted($"--{customArgument.Key}={customArgument.Value}");

Expand Down