mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-04 12:25:19 -04:00
Enable unity licensing server for Windows (#638)
* Enable unity licensing server for windows * Clarify validating logic with explicit variables
This commit is contained in:
parent
dd427466ce
commit
f2250e958e
BIN
dist/index.js
generated
vendored
BIN
dist/index.js
generated
vendored
Binary file not shown.
BIN
dist/index.js.map
generated
vendored
BIN
dist/index.js.map
generated
vendored
Binary file not shown.
24
dist/platforms/windows/activate.ps1
vendored
24
dist/platforms/windows/activate.ps1
vendored
@ -50,6 +50,30 @@ if ( ($null -ne ${env:UNITY_SERIAL}) -and ($null -ne ${env:UNITY_EMAIL}) -and ($
|
|||||||
Start-Sleep -Seconds 3
|
Start-Sleep -Seconds 3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
elseif( ($null -ne ${env:UNITY_LICENSING_SERVER}))
|
||||||
|
{
|
||||||
|
#
|
||||||
|
# Custom Unity License Server
|
||||||
|
#
|
||||||
|
|
||||||
|
Write-Output "Adding licensing server config"
|
||||||
|
|
||||||
|
$ACTIVATION_OUTPUT = Start-Process -FilePath "$Env:UNITY_PATH\Editor\Data\Resources\Licensing\Client\Unity.Licensing.Client.exe" `
|
||||||
|
-ArgumentList "--acquire-floating" `
|
||||||
|
-NoNewWindow `
|
||||||
|
-PassThru `
|
||||||
|
-Wait `
|
||||||
|
-RedirectStandardOutput "license.txt"
|
||||||
|
|
||||||
|
$PARSEDFILE = (Get-Content "license.txt" | Select-String -AllMatches -Pattern '\".*?\"' | ForEach-Object { $_.Matches.Value }) -replace '"'
|
||||||
|
|
||||||
|
$env:FLOATING_LICENSE = $PARSEDFILE[1]
|
||||||
|
$FLOATING_LICENSE_TIMEOUT = $PARSEDFILE[3]
|
||||||
|
|
||||||
|
Write-Output "Acquired floating license: ""$env:FLOATING_LICENSE"" with timeout $FLOATING_LICENSE_TIMEOUT"
|
||||||
|
# Store the exit code from the verify command
|
||||||
|
$ACTIVATION_EXIT_CODE = $ACTIVATION_OUTPUT.ExitCode
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#
|
#
|
||||||
|
11
dist/platforms/windows/return_license.ps1
vendored
11
dist/platforms/windows/return_license.ps1
vendored
@ -6,7 +6,16 @@ Write-Output "# Return License #"
|
|||||||
Write-Output "###########################"
|
Write-Output "###########################"
|
||||||
Write-Output ""
|
Write-Output ""
|
||||||
|
|
||||||
if (($null -ne ${env:UNITY_SERIAL}) -and ($null -ne ${env:UNITY_EMAIL}) -and ($null -ne ${env:UNITY_PASSWORD}))
|
if (($null -ne ${env:UNITY_LICENSING_SERVER}))
|
||||||
|
{
|
||||||
|
Write-Output "Returning floating license: ""$env:FLOATING_LICENSE"""
|
||||||
|
Start-Process -FilePath "$Env:UNITY_PATH\Editor\Data\Resources\Licensing\Client\Unity.Licensing.Client.exe" `
|
||||||
|
-ArgumentList "--return-floating ""$env:FLOATING_LICENSE"" " `
|
||||||
|
-NoNewWindow `
|
||||||
|
-Wait
|
||||||
|
}
|
||||||
|
|
||||||
|
elseif (($null -ne ${env:UNITY_SERIAL}) -and ($null -ne ${env:UNITY_EMAIL}) -and ($null -ne ${env:UNITY_PASSWORD}))
|
||||||
{
|
{
|
||||||
#
|
#
|
||||||
# SERIAL LICENSE MODE
|
# SERIAL LICENSE MODE
|
||||||
|
@ -113,6 +113,7 @@ class Docker {
|
|||||||
--volume "C:/ProgramData/Microsoft/VisualStudio":"C:/ProgramData/Microsoft/VisualStudio" \
|
--volume "C:/ProgramData/Microsoft/VisualStudio":"C:/ProgramData/Microsoft/VisualStudio" \
|
||||||
--volume "${actionFolder}/default-build-script":"c:/UnityBuilderAction" \
|
--volume "${actionFolder}/default-build-script":"c:/UnityBuilderAction" \
|
||||||
--volume "${actionFolder}/platforms/windows":"c:/steps" \
|
--volume "${actionFolder}/platforms/windows":"c:/steps" \
|
||||||
|
--volume "${actionFolder}/unity-config":"C:/ProgramData/Unity/config" \
|
||||||
--volume "${actionFolder}/BlankProject":"c:/BlankProject" \
|
--volume "${actionFolder}/BlankProject":"c:/BlankProject" \
|
||||||
--cpus=${dockerCpuLimit} \
|
--cpus=${dockerCpuLimit} \
|
||||||
--memory=${dockerMemoryLimit} \
|
--memory=${dockerMemoryLimit} \
|
||||||
|
@ -4,9 +4,14 @@ import { BuildParameters } from '..';
|
|||||||
class ValidateWindows {
|
class ValidateWindows {
|
||||||
public static validate(buildParameters: BuildParameters) {
|
public static validate(buildParameters: BuildParameters) {
|
||||||
ValidateWindows.validateWindowsPlatformRequirements(buildParameters.targetPlatform);
|
ValidateWindows.validateWindowsPlatformRequirements(buildParameters.targetPlatform);
|
||||||
if (!(process.env.UNITY_EMAIL && process.env.UNITY_PASSWORD)) {
|
|
||||||
throw new Error(`Unity email and password must be set for Windows based builds to
|
const { unityLicensingServer } = buildParameters;
|
||||||
authenticate the license. Make sure to set them inside UNITY_EMAIL
|
const hasLicensingCredentials = process.env.UNITY_EMAIL && process.env.UNITY_PASSWORD;
|
||||||
|
const hasValidLicensingStrategy = hasLicensingCredentials || unityLicensingServer;
|
||||||
|
|
||||||
|
if (!hasValidLicensingStrategy) {
|
||||||
|
throw new Error(`Unity email and password or alternatively a Unity licensing server url must be set for
|
||||||
|
Windows based builds to authenticate the license. Make sure to set them inside UNITY_EMAIL
|
||||||
and UNITY_PASSWORD in Github Secrets and pass them into the environment.`);
|
and UNITY_PASSWORD in Github Secrets and pass them into the environment.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user