From 8f98f404d57c61f52fc0eebe146d4c3673625693 Mon Sep 17 00:00:00 2001 From: Gary Ewan Park Date: Thu, 22 Aug 2019 21:32:04 +0100 Subject: [PATCH 1/7] (maint) Update to latest cake bootstrappers --- Build.ps1 | 172 ++++++++++++++++++++++++++++++++++++++---------------- build.sh | 117 +++++++++++++++++++++++++++++++++++++ 2 files changed, 239 insertions(+), 50 deletions(-) create mode 100755 build.sh diff --git a/Build.ps1 b/Build.ps1 index bdfb32b..7f1f813 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -5,11 +5,14 @@ ########################################################################## <# + .SYNOPSIS This is a Powershell script to bootstrap a Cake build. + .DESCRIPTION This Powershell script will download NuGet if missing, restore NuGet tools (including Cake) and execute your Cake build script with the parameters you provide. + .PARAMETER Script The build script to execute. .PARAMETER Target @@ -18,38 +21,52 @@ The build script target to run. The build configuration to use. .PARAMETER Verbosity Specifies the amount of information to be displayed. -.PARAMETER Experimental -Tells Cake to use the latest Roslyn release. -.PARAMETER WhatIf -Performs a dry run of the build script. -No tasks will be executed. -.PARAMETER Mono -Tells Cake to use the Mono scripting engine. +.PARAMETER ShowDescription +Shows description about tasks. +.PARAMETER DryRun +Performs a dry run. .PARAMETER SkipToolPackageRestore Skips restoring of packages. .PARAMETER ScriptArgs Remaining arguments are added here. + .LINK -http://cakebuild.net +https://cakebuild.net + #> [CmdletBinding()] Param( - [string]$Script = "setup.cake", - [string]$Target = "Default", - [ValidateSet("Release", "Debug")] - [string]$Configuration = "Release", + [string]$Script = "build.cake", + [string]$Target, + [string]$Configuration, [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")] - [string]$Verbosity = "Verbose", - [switch]$Experimental, - [Alias("DryRun","Noop")] - [switch]$WhatIf, - [switch]$Mono, + [string]$Verbosity, + [switch]$ShowDescription, + [Alias("WhatIf", "Noop")] + [switch]$DryRun, [switch]$SkipToolPackageRestore, [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] [string[]]$ScriptArgs ) +# Attempt to set highest encryption available for SecurityProtocol. +# PowerShell will not set this by default (until maybe .NET 4.6.x). This +# will typically produce a message for PowerShell v2 (just an info +# message though) +try { + # Set TLS 1.2 (3072), then TLS 1.1 (768), then TLS 1.0 (192), finally SSL 3.0 (48) + # Use integers because the enumeration values for TLS 1.2 and TLS 1.1 won't + # exist in .NET 4.0, even though they are addressable if .NET 4.5+ is + # installed (.NET 4.5 is an in-place upgrade). + # PowerShell Core already has support for TLS 1.2 so we can skip this if running in that. + if (-not $IsCoreCLR) { + [System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor 768 -bor 192 -bor 48 + } + } catch { + Write-Output 'Unable to set PowerShell to use TLS 1.2 and TLS 1.1 due to old .NET Framework installed. If you see underlying connection closed or trust errors, you may need to upgrade to .NET Framework 4.5+ and PowerShell v3' + } + [Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null function MD5HashFile([string] $filePath) { @@ -75,6 +92,15 @@ function MD5HashFile([string] $filePath) } } +function GetProxyEnabledWebClient +{ + $wc = New-Object System.Net.WebClient + $proxy = [System.Net.WebRequest]::GetSystemWebProxy() + $proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials + $wc.Proxy = $proxy + return $wc +} + Write-Host "Preparing to run build script..." if(!$PSScriptRoot){ @@ -82,42 +108,29 @@ if(!$PSScriptRoot){ } $TOOLS_DIR = Join-Path $PSScriptRoot "tools" +$ADDINS_DIR = Join-Path $TOOLS_DIR "Addins" +$MODULES_DIR = Join-Path $TOOLS_DIR "Modules" $NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe" $CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe" $NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" $PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config" $PACKAGES_CONFIG_MD5 = Join-Path $TOOLS_DIR "packages.config.md5sum" - -# Should we use mono? -$UseMono = ""; -if($Mono.IsPresent) { - Write-Verbose -Message "Using the Mono based scripting engine." - $UseMono = "-mono" -} - -# Should we use the new Roslyn? -$UseExperimental = ""; -if($Experimental.IsPresent -and !($Mono.IsPresent)) { - Write-Verbose -Message "Using experimental version of Roslyn." - $UseExperimental = "-experimental" -} - -# Is this a dry run? -$UseDryRun = ""; -if($WhatIf.IsPresent) { - $UseDryRun = "-dryrun" -} +$ADDINS_PACKAGES_CONFIG = Join-Path $ADDINS_DIR "packages.config" +$MODULES_PACKAGES_CONFIG = Join-Path $MODULES_DIR "packages.config" # Make sure tools folder exists if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) { Write-Verbose -Message "Creating tools directory..." - New-Item -Path $TOOLS_DIR -Type directory | out-null + New-Item -Path $TOOLS_DIR -Type Directory | Out-Null } # Make sure that packages.config exist. if (!(Test-Path $PACKAGES_CONFIG)) { Write-Verbose -Message "Downloading packages.config..." - try { (New-Object System.Net.WebClient).DownloadFile("http://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG) } catch { + try { + $wc = GetProxyEnabledWebClient + $wc.DownloadFile("https://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG) + } catch { Throw "Could not download packages.config." } } @@ -125,7 +138,7 @@ if (!(Test-Path $PACKAGES_CONFIG)) { # Try find NuGet.exe in path if not exists if (!(Test-Path $NUGET_EXE)) { Write-Verbose -Message "Trying to find nuget.exe in PATH..." - $existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_) } + $existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_ -PathType Container) } $NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1 if ($NUGET_EXE_IN_PATH -ne $null -and (Test-Path $NUGET_EXE_IN_PATH.FullName)) { Write-Verbose -Message "Found in PATH at $($NUGET_EXE_IN_PATH.FullName)." @@ -137,14 +150,20 @@ if (!(Test-Path $NUGET_EXE)) { if (!(Test-Path $NUGET_EXE)) { Write-Verbose -Message "Downloading NuGet.exe..." try { - (New-Object System.Net.WebClient).DownloadFile($NUGET_URL, $NUGET_EXE) + $wc = GetProxyEnabledWebClient + $wc.DownloadFile($NUGET_URL, $NUGET_EXE) } catch { Throw "Could not download NuGet.exe." } } # Save nuget.exe path to environment to be available to child processed -$ENV:NUGET_EXE = $NUGET_EXE +$env:NUGET_EXE = $NUGET_EXE +$env:NUGET_EXE_INVOCATION = if ($IsLinux -or $IsMacOS) { + "mono `"$NUGET_EXE`"" +} else { + "`"$NUGET_EXE`"" +} # Restore tools from NuGet? if(-Not $SkipToolPackageRestore.IsPresent) { @@ -152,24 +171,61 @@ if(-Not $SkipToolPackageRestore.IsPresent) { Set-Location $TOOLS_DIR # Check for changes in packages.config and remove installed tools if true. - [string] $md5Hash = MD5HashFile($PACKAGES_CONFIG) + [string] $md5Hash = MD5HashFile $PACKAGES_CONFIG if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or - ($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) { + ($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) { Write-Verbose -Message "Missing or changed package.config hash..." - Remove-Item * -Recurse -Exclude packages.config,nuget.exe + Get-ChildItem -Exclude packages.config,nuget.exe,Cake.Bakery | + Remove-Item -Recurse } Write-Verbose -Message "Restoring tools from NuGet..." - $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -PreRelease -OutputDirectory `"$TOOLS_DIR`" -Source https://www.myget.org/F/cake/api/v3/index.json" + + $NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`"" if ($LASTEXITCODE -ne 0) { - Throw "An error occured while restoring NuGet tools." + Throw "An error occurred while restoring NuGet tools." } else { $md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII" } - Write-Verbose -Message ($NuGetOutput | out-string) + Write-Verbose -Message ($NuGetOutput | Out-String) + + Pop-Location +} + +# Restore addins from NuGet +if (Test-Path $ADDINS_PACKAGES_CONFIG) { + Push-Location + Set-Location $ADDINS_DIR + + Write-Verbose -Message "Restoring addins from NuGet..." + $NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`"" + + if ($LASTEXITCODE -ne 0) { + Throw "An error occurred while restoring NuGet addins." + } + + Write-Verbose -Message ($NuGetOutput | Out-String) + + Pop-Location +} + +# Restore modules from NuGet +if (Test-Path $MODULES_PACKAGES_CONFIG) { + Push-Location + Set-Location $MODULES_DIR + + Write-Verbose -Message "Restoring modules from NuGet..." + $NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`"" + + if ($LASTEXITCODE -ne 0) { + Throw "An error occurred while restoring NuGet modules." + } + + Write-Verbose -Message ($NuGetOutput | Out-String) + Pop-Location } @@ -178,7 +234,23 @@ if (!(Test-Path $CAKE_EXE)) { Throw "Could not find Cake.exe at $CAKE_EXE" } +$CAKE_EXE_INVOCATION = if ($IsLinux -or $IsMacOS) { + "mono `"$CAKE_EXE`"" +} else { + "`"$CAKE_EXE`"" +} + + +# Build Cake arguments +$cakeArguments = @("$Script"); +if ($Target) { $cakeArguments += "-target=$Target" } +if ($Configuration) { $cakeArguments += "-configuration=$Configuration" } +if ($Verbosity) { $cakeArguments += "-verbosity=$Verbosity" } +if ($ShowDescription) { $cakeArguments += "-showdescription" } +if ($DryRun) { $cakeArguments += "-dryrun" } +$cakeArguments += $ScriptArgs + # Start Cake Write-Host "Running build script..." -Invoke-Expression "& `"$CAKE_EXE`" `"$Script`" -target=`"$Target`" -configuration=`"$Configuration`" -verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental $ScriptArgs" -exit $LASTEXITCODE \ No newline at end of file +Invoke-Expression "& $CAKE_EXE_INVOCATION $($cakeArguments -join " ")" +exit $LASTEXITCODE diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..b9e1252 --- /dev/null +++ b/build.sh @@ -0,0 +1,117 @@ +#!/usr/bin/env bash + +########################################################################## +# This is the Cake bootstrapper script for Linux and OS X. +# This file was downloaded from https://github.com/cake-build/resources +# Feel free to change this file to fit your needs. +########################################################################## + +# Define directories. +SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +TOOLS_DIR=$SCRIPT_DIR/tools +ADDINS_DIR=$TOOLS_DIR/Addins +MODULES_DIR=$TOOLS_DIR/Modules +NUGET_EXE=$TOOLS_DIR/nuget.exe +CAKE_EXE=$TOOLS_DIR/Cake/Cake.exe +PACKAGES_CONFIG=$TOOLS_DIR/packages.config +PACKAGES_CONFIG_MD5=$TOOLS_DIR/packages.config.md5sum +ADDINS_PACKAGES_CONFIG=$ADDINS_DIR/packages.config +MODULES_PACKAGES_CONFIG=$MODULES_DIR/packages.config + +# Define md5sum or md5 depending on Linux/OSX +MD5_EXE= +if [[ "$(uname -s)" == "Darwin" ]]; then + MD5_EXE="md5 -r" +else + MD5_EXE="md5sum" +fi + +# Define default arguments. +SCRIPT="build.cake" +CAKE_ARGUMENTS=() + +# Parse arguments. +for i in "$@"; do + case $1 in + -s|--script) SCRIPT="$2"; shift ;; + --) shift; CAKE_ARGUMENTS+=("$@"); break ;; + *) CAKE_ARGUMENTS+=("$1") ;; + esac + shift +done + +# Make sure the tools folder exist. +if [ ! -d "$TOOLS_DIR" ]; then + mkdir "$TOOLS_DIR" +fi + +# Make sure that packages.config exist. +if [ ! -f "$TOOLS_DIR/packages.config" ]; then + echo "Downloading packages.config..." + curl -Lsfo "$TOOLS_DIR/packages.config" https://cakebuild.net/download/bootstrapper/packages + if [ $? -ne 0 ]; then + echo "An error occurred while downloading packages.config." + exit 1 + fi +fi + +# Download NuGet if it does not exist. +if [ ! -f "$NUGET_EXE" ]; then + echo "Downloading NuGet..." + curl -Lsfo "$NUGET_EXE" https://dist.nuget.org/win-x86-commandline/latest/nuget.exe + if [ $? -ne 0 ]; then + echo "An error occurred while downloading nuget.exe." + exit 1 + fi +fi + +# Restore tools from NuGet. +pushd "$TOOLS_DIR" >/dev/null +if [ ! -f "$PACKAGES_CONFIG_MD5" ] || [ "$( cat "$PACKAGES_CONFIG_MD5" | sed 's/\r$//' )" != "$( $MD5_EXE "$PACKAGES_CONFIG" | awk '{ print $1 }' )" ]; then + find . -type d ! -name . ! -name 'Cake.Bakery' | xargs rm -rf +fi + +mono "$NUGET_EXE" install -ExcludeVersion +if [ $? -ne 0 ]; then + echo "Could not restore NuGet tools." + exit 1 +fi + +$MD5_EXE "$PACKAGES_CONFIG" | awk '{ print $1 }' >| "$PACKAGES_CONFIG_MD5" + +popd >/dev/null + +# Restore addins from NuGet. +if [ -f "$ADDINS_PACKAGES_CONFIG" ]; then + pushd "$ADDINS_DIR" >/dev/null + + mono "$NUGET_EXE" install -ExcludeVersion + if [ $? -ne 0 ]; then + echo "Could not restore NuGet addins." + exit 1 + fi + + popd >/dev/null +fi + +# Restore modules from NuGet. +if [ -f "$MODULES_PACKAGES_CONFIG" ]; then + pushd "$MODULES_DIR" >/dev/null + + mono "$NUGET_EXE" install -ExcludeVersion + if [ $? -ne 0 ]; then + echo "Could not restore NuGet modules." + exit 1 + fi + + popd >/dev/null +fi + +# Make sure that Cake has been installed. +if [ ! -f "$CAKE_EXE" ]; then + echo "Could not find Cake.exe at '$CAKE_EXE'." + exit 1 +fi + +# Start Cake +exec mono "$CAKE_EXE" $SCRIPT "${CAKE_ARGUMENTS[@]}" From 0dd91958531c987cdfbf8bb04a466edda0467712 Mon Sep 17 00:00:00 2001 From: Gary Ewan Park Date: Thu, 22 Aug 2019 21:33:05 +0100 Subject: [PATCH 2/7] (maint) Switch to recipe.cake file This provides some immediate information that a repository is using Cake.Recipe, and it is a convention now followed by a number of other repositories. --- .appveyor.yml | 2 +- Build.ps1 | 4 ++-- build.sh | 2 +- setup.cake => recipe.cake | 0 4 files changed, 4 insertions(+), 4 deletions(-) rename setup.cake => recipe.cake (100%) diff --git a/.appveyor.yml b/.appveyor.yml index bd21071..3d9e9b5 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -28,4 +28,4 @@ branches: #---------------------------------# cache: - src\packages -> src\**\packages.config -- tools -> setup.cake \ No newline at end of file +- tools -> recipe.cake diff --git a/Build.ps1 b/Build.ps1 index 7f1f813..4514a51 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -37,7 +37,7 @@ https://cakebuild.net [CmdletBinding()] Param( - [string]$Script = "build.cake", + [string]$Script = "recipe.cake", [string]$Target, [string]$Configuration, [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")] @@ -180,7 +180,7 @@ if(-Not $SkipToolPackageRestore.IsPresent) { } Write-Verbose -Message "Restoring tools from NuGet..." - + $NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`"" if ($LASTEXITCODE -ne 0) { diff --git a/build.sh b/build.sh index b9e1252..7fc4599 100755 --- a/build.sh +++ b/build.sh @@ -27,7 +27,7 @@ else fi # Define default arguments. -SCRIPT="build.cake" +SCRIPT="recipe.cake" CAKE_ARGUMENTS=() # Parse arguments. diff --git a/setup.cake b/recipe.cake similarity index 100% rename from setup.cake rename to recipe.cake From fec61cc73df30070380bdbe29e185cf7f7e9944c Mon Sep 17 00:00:00 2001 From: Gary Ewan Park Date: Thu, 22 Aug 2019 21:34:09 +0100 Subject: [PATCH 3/7] (build) Always run GitVersion So that builds work on other operating systems. --- recipe.cake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipe.cake b/recipe.cake index 9e9fc53..44df27f 100644 --- a/recipe.cake +++ b/recipe.cake @@ -8,7 +8,8 @@ BuildParameters.SetParameters(context: Context, title: "Cake.Unity", repositoryOwner: "cake-contrib", repositoryName: "Cake.Unity", - appVeyorAccountName: "cakecontrib"); + appVeyorAccountName: "cakecontrib", + shouldRunGitVersion: true); BuildParameters.PrintParameters(Context); From bd47c23bafdcad869b6d2c547129d209a16d02f4 Mon Sep 17 00:00:00 2001 From: Gary Ewan Park Date: Thu, 22 Aug 2019 21:35:06 +0100 Subject: [PATCH 4/7] (maint) Update NuGet Metadata --- nuspec/nuget/Cake.Unity.nuspec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nuspec/nuget/Cake.Unity.nuspec b/nuspec/nuget/Cake.Unity.nuspec index 7e5a363..901a6b5 100644 --- a/nuspec/nuget/Cake.Unity.nuspec +++ b/nuspec/nuget/Cake.Unity.nuspec @@ -7,11 +7,12 @@ patriksvensson, cake-contrib, kolesnick Cake Unity AddIn. Cake AddIn that extends Cake with ability to execute the Unity Editor as a command line utility. - https://github.com/cake-contrib/Cake.Unity/blob/master/LICENSE https://github.com/cake-contrib/Cake.Unity/ https://cdn.jsdelivr.net/gh/cake-contrib/graphics/png/cake-contrib-medium.png false Copyright (c) Cake Contributions 2014 - Present + MIT + Cake, Script, Build, Unity From 556e244907eb6a9aa9682b4336dca4356cfa8b76 Mon Sep 17 00:00:00 2001 From: AleksandrBerestovoy Date: Wed, 23 Oct 2019 15:22:26 +0300 Subject: [PATCH 5/7] Add&Fix unity editor arguments for NUnitTests --- src/Cake.Unity/Arguments/TestPlatform.cs | 17 ++++++++++++++ src/Cake.Unity/UnityEditorArguments.cs | 30 +++++++++++++++++------- 2 files changed, 39 insertions(+), 8 deletions(-) create mode 100644 src/Cake.Unity/Arguments/TestPlatform.cs diff --git a/src/Cake.Unity/Arguments/TestPlatform.cs b/src/Cake.Unity/Arguments/TestPlatform.cs new file mode 100644 index 0000000..b8b1b08 --- /dev/null +++ b/src/Cake.Unity/Arguments/TestPlatform.cs @@ -0,0 +1,17 @@ +namespace Cake.Unity.Arguments +{ + public enum TestPlatform + { + editmode, + playmode, + StandaloneWindows, + StandaloneWindows64, + StandaloneOSXIntel, + StandaloneOSXIntel64, + iOS, + tvOS, + Android, + PS4, + XboxOne, + } +} diff --git a/src/Cake.Unity/UnityEditorArguments.cs b/src/Cake.Unity/UnityEditorArguments.cs index 73c8cc5..fff7773 100644 --- a/src/Cake.Unity/UnityEditorArguments.cs +++ b/src/Cake.Unity/UnityEditorArguments.cs @@ -99,7 +99,7 @@ public class UnityEditorArguments /// /// Path location to place the result file. If the path is a folder, the command line uses a default file name. If not specified, it places the results in the project’s root folder. /// - public FilePath EditorTestsResultFile { get; set; } + public FilePath TestResultsFile { get; set; } /// /// Execute the static method as soon as Unity opens the project, and after the optional Asset server update is complete. You can use this to do tasks such as continous integration, performing Unit Tests, making builds or preparing data. To return an error from the command line process, either throw an exception which causes Unity to exit with return code 1, or call EditorApplication.Exit with a non-zero return code. To pass parameters, add them to the command line and retrieve them inside the function using System.Environment.GetCommandLineArgs. To use -executeMethod, you need to place the enclosing script in an Editor folder. The method you execute must be defined as static. @@ -193,9 +193,14 @@ public class UnityEditorArguments public bool ReturnLicense { get; set; } /// - /// Run Editor tests from the project. This argument requires the projectPath, and it’s good practice to run it with batchmode argument. quit is not required, because the Editor automatically closes down after the run is finished. + /// Run all your test by your TestPlatform; /// - public bool RunEditorTests { get; set; } + public bool RunTests { get; set; } + + /// + /// Allows the selection of an active test platform. + /// + public TestPlatform? TestPlatform { get; set; } /// /// Activate Unity with the specified serial key. It is good practice to pass the -batchmode and -quit arguments as well, in order to quit Unity when done, if using this for automated activation of Unity. Please allow a few seconds before the license file is created, because Unity needs to communicate with the license server. Make sure that license file folder exists, and has appropriate permissions before running Unity with this argument. If activation fails, see the Editor.log for info. @@ -263,6 +268,10 @@ public class UnityEditorArguments internal ProcessArgumentBuilder CustomizeCommandLineArguments(ProcessArgumentBuilder builder, ICakeEnvironment environment) { + if (Quit && RunTests) + throw new Exception( + $"Unable to start unit testing if argument {nameof(Quit)} is true.\nPlease set {nameof(Quit)} or {nameof(RunTests)} to false"); + if (AssetServerUpdate != null) { builder.Append("-assetServerUpdate"); @@ -354,10 +363,10 @@ internal ProcessArgumentBuilder CustomizeCommandLineArguments(ProcessArgumentBui .Append("-editorTestsFilter") .Append(EditorTestsFilter); - if (EditorTestsResultFile != null) + if (TestResultsFile != null) builder - .Append("-editorTestsResultFile") - .AppendQuoted(EditorTestsResultFile.MakeAbsolute(environment).FullPath); + .Append("-testResults") + .AppendQuoted(TestResultsFile.MakeAbsolute(environment).FullPath); if (ExecuteMethod != null) builder @@ -429,8 +438,13 @@ internal ProcessArgumentBuilder CustomizeCommandLineArguments(ProcessArgumentBui if (ReturnLicense) builder.Append("-returnlicense"); - if (RunEditorTests && ProjectPath != null) - builder.Append("-runEditorTests"); + if (RunTests && ProjectPath != null) + builder.Append("-runTests"); + + if (RunTests && TestPlatform.HasValue) + builder + .Append("-testPlatform") + .Append(TestPlatform.Value.ToString()); if (Serial != null) builder From 900cea9daa878893c2b2f73dd266b23877f68768 Mon Sep 17 00:00:00 2001 From: AleksandrBerestovoy Date: Wed, 23 Oct 2019 16:14:44 +0300 Subject: [PATCH 6/7] Rename TestResultsFile argument to TestResults --- src/Cake.Unity/UnityEditorArguments.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Cake.Unity/UnityEditorArguments.cs b/src/Cake.Unity/UnityEditorArguments.cs index fff7773..9ea439f 100644 --- a/src/Cake.Unity/UnityEditorArguments.cs +++ b/src/Cake.Unity/UnityEditorArguments.cs @@ -99,7 +99,7 @@ public class UnityEditorArguments /// /// Path location to place the result file. If the path is a folder, the command line uses a default file name. If not specified, it places the results in the project’s root folder. /// - public FilePath TestResultsFile { get; set; } + public FilePath TestResults { get; set; } /// /// Execute the static method as soon as Unity opens the project, and after the optional Asset server update is complete. You can use this to do tasks such as continous integration, performing Unit Tests, making builds or preparing data. To return an error from the command line process, either throw an exception which causes Unity to exit with return code 1, or call EditorApplication.Exit with a non-zero return code. To pass parameters, add them to the command line and retrieve them inside the function using System.Environment.GetCommandLineArgs. To use -executeMethod, you need to place the enclosing script in an Editor folder. The method you execute must be defined as static. @@ -122,6 +122,7 @@ public class UnityEditorArguments /// public bool ForceDeviceIndex { get; set; } + /// /// /// MacOS only. Make the Editor use Metal as the default graphics API. /// @@ -363,10 +364,10 @@ internal ProcessArgumentBuilder CustomizeCommandLineArguments(ProcessArgumentBui .Append("-editorTestsFilter") .Append(EditorTestsFilter); - if (TestResultsFile != null) + if (TestResults != null) builder .Append("-testResults") - .AppendQuoted(TestResultsFile.MakeAbsolute(environment).FullPath); + .AppendQuoted(TestResults.MakeAbsolute(environment).FullPath); if (ExecuteMethod != null) builder From 7062d829998e8d6c3794adf8ce28b990bc3d35bd Mon Sep 17 00:00:00 2001 From: AleksandrBerestovoy Date: Wed, 23 Oct 2019 16:32:14 +0300 Subject: [PATCH 7/7] Remove badly formed XML comment - summary --- src/Cake.Unity/UnityEditorArguments.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Cake.Unity/UnityEditorArguments.cs b/src/Cake.Unity/UnityEditorArguments.cs index 9ea439f..3614f63 100644 --- a/src/Cake.Unity/UnityEditorArguments.cs +++ b/src/Cake.Unity/UnityEditorArguments.cs @@ -122,7 +122,6 @@ public class UnityEditorArguments /// public bool ForceDeviceIndex { get; set; } - /// /// /// MacOS only. Make the Editor use Metal as the default graphics API. ///