Skip to content

Commit

Permalink
Improve UnitySetup installation
Browse files Browse the repository at this point in the history
  • Loading branch information
keveleigh committed Jun 22, 2022
1 parent 5ee6d0e commit 3fcb671
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 7 deletions.
6 changes: 4 additions & 2 deletions pipelines/templates/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ parameters:

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

# Build Standalone x64.
Expand Down
6 changes: 4 additions & 2 deletions pipelines/templates/tasks/assetretargeting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ parameters:

steps:
- powershell: |
# Some machines require that the protocol be explicitly set to Tls12
# Module management requires TLS 1.2.
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-Module -Name UnitySetup -Scope CurrentUser -Force
if (-not (Get-InstalledModule -Name UnitySetup)) {
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
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

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

parameters:
Expand Down
12 changes: 11 additions & 1 deletion pipelines/templates/tasks/build-unity.yaml
Original file line number Diff line number Diff line change
@@ -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,14 @@ parameters:
default: ''

steps:
- powershell: |
- pwsh: |
# Module management requires TLS 1.2.
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
# UnitySetup 5.5.146-develop specifically added support for Unity 2021.
if (-not (Get-InstalledModule -Name UnitySetup -MinimumVersion "5.5.146-develop" -AllowPrerelease)) {
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
6 changes: 4 additions & 2 deletions pipelines/templates/tasks/generate-projects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ parameters:

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

- powershell: |
Expand Down

0 comments on commit 3fcb671

Please sign in to comment.