Skip to content

Commit

Permalink
Improve UnitySetup installation
Browse files Browse the repository at this point in the history
  • Loading branch information
keveleigh committed Mar 24, 2022
1 parent 374346a commit b86a309
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 10 deletions.
8 changes: 5 additions & 3 deletions pipelines/templates/common.yml
Expand Up @@ -10,9 +10,11 @@ parameters:

steps:
- powershell: |
# Some machines require that the protocol be explicitly set to Tls12
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-Module -Name UnitySetup -Scope CurrentUser -Force
if (-not (Get-InstalledModule -Name UnitySetup)) {
# Some machines require that the protocol be explicitly set to Tls12
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-Module -Name UnitySetup -Scope CurrentUser -Force
}
displayName: Install unitysetup.powershell

# Build Standalone x64.
Expand Down
8 changes: 5 additions & 3 deletions pipelines/templates/tasks/assetretargeting.yml
Expand Up @@ -5,9 +5,11 @@ parameters:

steps:
- powershell: |
# Some machines require that the protocol be explicitly set to Tls12
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-Module -Name UnitySetup -Scope CurrentUser -Force
if (-not (Get-InstalledModule -Name UnitySetup)) {
# Some machines require that the protocol be explicitly set to Tls12
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-Module -Name UnitySetup -Scope CurrentUser -Force
}
displayName: Install unitysetup.powershell

- powershell: |
Expand Down
3 changes: 3 additions & 0 deletions pipelines/templates/tasks/build-appx.yaml
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

# [Template] Build appx from a Unity-built sln.

parameters:
Expand Down
11 changes: 10 additions & 1 deletion pipelines/templates/tasks/build-unity.yaml
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

# [Template] Build project inside Unity.

parameters:
Expand Down Expand Up @@ -25,7 +28,13 @@ parameters:
default: ''

steps:
- powershell: |
- pwsh: |
# UnitySetup 5.5.146-develop specifically added support for Unity 2021.
if (-not (Get-InstalledModule -Name UnitySetup -MinimumVersion "5.5.146-develop" -AllowPrerelease)) {
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-Module UnitySetup -Scope CurrentUser -Force -AllowPrerelease
}
$logFile = Join-Path $(Agent.TempDirectory) "build_${{ parameters.BuildTarget }}.log"
$proc = Start-UnityEditor -Project ${{ parameters.PathToProject }} -Version ${{ parameters.UnityVersion }} -ExecuteMethod ${{ parameters.CommandLineBuildMethod }} -BatchMode -Quit -PassThru -LogFile $logFile -BuildTarget ${{ parameters.BuildTarget }} -OutputPath ${{ parameters.OutputPath }} -AdditionalArguments "-CacheServerIPAddress ${Env:COG-UnityCache-WUS2-01} ${{ parameters.AdditionalArguments }}"
$ljob = Start-Job -ScriptBlock { param($log) Get-Content "$log" -Wait } -ArgumentList $logFile
Expand Down
8 changes: 5 additions & 3 deletions pipelines/templates/tasks/generate-projects.yml
Expand Up @@ -5,9 +5,11 @@ parameters:

steps:
- powershell: |
# Some machines require that the protocol be explicitly set to Tls12
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-Module -Name UnitySetup -Scope CurrentUser -Force
if (-not (Get-InstalledModule -Name UnitySetup)) {
# Some machines require that the protocol be explicitly set to Tls12
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-Module -Name UnitySetup -Scope CurrentUser -Force
}
displayName: Install unitysetup.powershell

- powershell: |
Expand Down

0 comments on commit b86a309

Please sign in to comment.