mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-07 20:35:33 -04:00
feat: macos build with licensing server
This commit is contained in:
parent
a13443a746
commit
8e3860c7de
3
.gitignore
vendored
3
.gitignore
vendored
@ -5,3 +5,6 @@ lib/
|
||||
.vsconfig
|
||||
yarn-error.log
|
||||
.orig
|
||||
.env
|
||||
build/*
|
||||
dist/unity-config/*.txt
|
11
.vscode/launch.json
vendored
11
.vscode/launch.json
vendored
@ -1,5 +1,16 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"type": "node-terminal",
|
||||
"request": "launch",
|
||||
"name": "Launch Program",
|
||||
"command": "ts-node -- ${workspaceFolder}/src/index.ts",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"envFile": "${workspaceRoot}/.env",
|
||||
"env": {
|
||||
"UNITY_NOPROXY": "localhost,127.0.0.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
|
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.
2
dist/platforms/mac/entrypoint.sh
vendored
2
dist/platforms/mac/entrypoint.sh
vendored
@ -4,7 +4,7 @@
|
||||
# Create directories for license activation
|
||||
#
|
||||
|
||||
sudo mkdir /Library/Application\ Support/Unity
|
||||
sudo mkdir -p /Library/Application\ Support/Unity/config
|
||||
sudo chmod -R 777 /Library/Application\ Support/Unity
|
||||
|
||||
ACTIVATE_LICENSE_PATH="$ACTION_FOLDER/BlankProject"
|
||||
|
50
dist/platforms/mac/steps/activate.sh
vendored
50
dist/platforms/mac/steps/activate.sh
vendored
@ -6,8 +6,12 @@ pushd "$ACTIVATE_LICENSE_PATH"
|
||||
|
||||
echo "Requesting activation"
|
||||
|
||||
# Activate license
|
||||
/Applications/Unity/Hub/Editor/$UNITY_VERSION/Unity.app/Contents/MacOS/Unity \
|
||||
|
||||
if [[ -n "$UNITY_SERIAL" && -n "$UNITY_EMAIL" && -n "$UNITY_PASSWORD" ]]; then
|
||||
|
||||
|
||||
# Activate license
|
||||
/Applications/Unity/Hub/Editor/$UNITY_VERSION/Unity.app/Contents/MacOS/Unity \
|
||||
-logFile - \
|
||||
-batchmode \
|
||||
-nographics \
|
||||
@ -17,8 +21,46 @@ echo "Requesting activation"
|
||||
-password "$UNITY_PASSWORD" \
|
||||
-projectPath "$ACTIVATE_LICENSE_PATH"
|
||||
|
||||
# Store the exit code from the verify command
|
||||
UNITY_EXIT_CODE=$?
|
||||
# Store the exit code from the verify command
|
||||
UNITY_EXIT_CODE=$?
|
||||
|
||||
elif [[ -n "$UNITY_LICENSING_SERVER" ]]; then
|
||||
|
||||
#
|
||||
# Custom Unity License Server
|
||||
#
|
||||
echo "Adding licensing server config"
|
||||
echo "Echoing the floating license address $UNITY_LICENSING_SERVER"
|
||||
echo "Copying the services-config.json to Library"
|
||||
cp ../unity-config/services-config.json /Library/Application\ Support/Unity/config/
|
||||
|
||||
/Applications/Unity/Hub/Editor/$UNITY_VERSION/Unity.app/Contents/Frameworks/UnityLicensingClient.app/Contents/Resources/Unity.Licensing.Client --acquire-floating > license.txt #is this accessible in a env variable?
|
||||
|
||||
##PARSEDFILE=$(grep -oP '\".*?\"' < license.txt | tr -d '"')
|
||||
FLOATING_LICENSE=$(cat license.txt | awk '/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/' | awk '{print $6}' | sed 's/.$//')
|
||||
export FLOATING_LICENSE
|
||||
##FLOATING_LICENSE=$(sed -n 2p <<< "$PARSEDFILE")
|
||||
#FLOATING_LICENSE_TIMEOUT=$(sed -n 4p <<< "$PARSEDFILE")
|
||||
|
||||
echo "Acquired floating license: \"$FLOATING_LICENSE\""
|
||||
# Store the exit code from the verify command
|
||||
UNITY_EXIT_CODE=$?
|
||||
|
||||
else
|
||||
#
|
||||
# NO LICENSE ACTIVATION STRATEGY MATCHED
|
||||
#
|
||||
# This will exit since no activation strategies could be matched.
|
||||
#
|
||||
echo "License activation strategy could not be determined."
|
||||
echo ""
|
||||
echo "Visit https://game.ci/docs/github/getting-started for more"
|
||||
echo "details on how to set up one of the possible activation strategies."
|
||||
|
||||
# Immediately exit as no UNITY_EXIT_CODE can be derrived.
|
||||
exit 1;
|
||||
|
||||
fi
|
||||
|
||||
#
|
||||
# Display information about the result
|
||||
|
2
dist/platforms/mac/steps/build.sh
vendored
2
dist/platforms/mac/steps/build.sh
vendored
@ -132,8 +132,6 @@ echo ""
|
||||
-quit \
|
||||
-batchmode \
|
||||
-nographics \
|
||||
-username "$UNITY_EMAIL" \
|
||||
-password "$UNITY_PASSWORD" \
|
||||
-customBuildName "$BUILD_NAME" \
|
||||
-projectPath "$UNITY_PROJECT_PATH" \
|
||||
-buildTarget "$BUILD_TARGET" \
|
||||
|
14
dist/platforms/mac/steps/return_license.sh
vendored
14
dist/platforms/mac/steps/return_license.sh
vendored
@ -4,7 +4,17 @@
|
||||
echo "Changing to \"$ACTIVATE_LICENSE_PATH\" directory."
|
||||
pushd "$ACTIVATE_LICENSE_PATH"
|
||||
|
||||
/Applications/Unity/Hub/Editor/$UNITY_VERSION/Unity.app/Contents/MacOS/Unity \
|
||||
|
||||
if [[ -n "$UNITY_LICENSING_SERVER" ]]; then
|
||||
#
|
||||
# Return any floating license used.
|
||||
#
|
||||
echo "Returning floating license: \"$FLOATING_LICENSE\""
|
||||
/Applications/Unity/Hub/Editor/$UNITY_VERSION/Unity.app/Contents/Frameworks/UnityLicensingClient.app/Contents/Resources/Unity.Licensing.Client --return-floating "$FLOATING_LICENSE"
|
||||
|
||||
else
|
||||
|
||||
/Applications/Unity/Hub/Editor/$UNITY_VERSION/Unity.app/Contents/MacOS/Unity \
|
||||
-logFile - \
|
||||
-batchmode \
|
||||
-nographics \
|
||||
@ -14,5 +24,7 @@ pushd "$ACTIVATE_LICENSE_PATH"
|
||||
-returnlicense \
|
||||
-projectPath "$ACTIVATE_LICENSE_PATH"
|
||||
|
||||
fi
|
||||
|
||||
# Return to previous working directory
|
||||
popd
|
||||
|
@ -23,6 +23,7 @@ class BuildParameters {
|
||||
public unityLicensingServer!: string;
|
||||
public runnerTempPath!: string;
|
||||
public targetPlatform!: string;
|
||||
public targetArchitecture!: string;
|
||||
public projectPath!: string;
|
||||
public buildName!: string;
|
||||
public buildPath!: string;
|
||||
@ -134,6 +135,7 @@ class BuildParameters {
|
||||
unityLicensingServer: Input.unityLicensingServer,
|
||||
runnerTempPath: Input.runnerTempPath,
|
||||
targetPlatform: Input.targetPlatform,
|
||||
targetArchitecture: Input.targetArchitecture,
|
||||
projectPath: Input.projectPath,
|
||||
buildName: Input.buildName,
|
||||
buildPath: `${Input.buildsPath}/${Input.targetPlatform}`,
|
||||
|
@ -80,6 +80,10 @@ class Input {
|
||||
return Input.getInput('targetPlatform') || Platform.default;
|
||||
}
|
||||
|
||||
static get targetArchitecture(): string {
|
||||
return Input.getInput('targetArchitecture') || Platform.defaultarch;
|
||||
}
|
||||
|
||||
static get unityVersion(): string {
|
||||
return Input.getInput('unityVersion') || 'auto';
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ class SetupMac {
|
||||
const moduleArgument = [];
|
||||
switch (targetPlatform) {
|
||||
case 'iOS':
|
||||
moduleArgument.push('--module', 'ios');
|
||||
moduleArgument.push('--module', 'ios', '--module', 'android');
|
||||
break;
|
||||
case 'tvOS':
|
||||
moduleArgument.push('--module', 'tvos');
|
||||
@ -85,7 +85,7 @@ class SetupMac {
|
||||
moduleArgument.push('--module', 'mac-il2cpp');
|
||||
break;
|
||||
case 'Android':
|
||||
moduleArgument.push('--module', 'android');
|
||||
moduleArgument.push('--module', 'android', '--module', 'ios');
|
||||
break;
|
||||
case 'WebGL':
|
||||
moduleArgument.push('--module', 'webgl');
|
||||
@ -111,6 +111,7 @@ class SetupMac {
|
||||
|
||||
const unityChangeset = await getUnityChangeset(buildParameters.editorVersion);
|
||||
const moduleArguments = SetupMac.getModuleParametersForTargetPlatform(buildParameters.targetPlatform);
|
||||
const unityArch = buildParameters.targetArchitecture;
|
||||
|
||||
const execArguments: string[] = [
|
||||
'--',
|
||||
@ -120,6 +121,7 @@ class SetupMac {
|
||||
...['--changeset', unityChangeset.changeset],
|
||||
...moduleArguments,
|
||||
'--childModules',
|
||||
...['--architecture', unityArch],
|
||||
];
|
||||
|
||||
// Ignoring return code because the log seems to overflow the internal buffer which triggers
|
||||
|
@ -3,6 +3,17 @@ class Platform {
|
||||
return Platform.types.StandaloneWindows64;
|
||||
}
|
||||
|
||||
static get defaultarch() {
|
||||
return Platform.archs.X86_64;
|
||||
}
|
||||
|
||||
static get archs() {
|
||||
return {
|
||||
X86_64: 'x86_64',
|
||||
Arm64: 'arm64',
|
||||
};
|
||||
}
|
||||
|
||||
static get types() {
|
||||
return {
|
||||
StandaloneOSX: 'StandaloneOSX',
|
||||
|
Loading…
Reference in New Issue
Block a user