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
|
.vsconfig
|
||||||
yarn-error.log
|
yarn-error.log
|
||||||
.orig
|
.orig
|
||||||
|
.env
|
||||||
|
build/*
|
||||||
|
dist/unity-config/*.txt
|
11
.vscode/launch.json
vendored
11
.vscode/launch.json
vendored
@ -1,5 +1,16 @@
|
|||||||
{
|
{
|
||||||
"configurations": [
|
"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",
|
"type": "node",
|
||||||
"request": "launch",
|
"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
|
# 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
|
sudo chmod -R 777 /Library/Application\ Support/Unity
|
||||||
|
|
||||||
ACTIVATE_LICENSE_PATH="$ACTION_FOLDER/BlankProject"
|
ACTIVATE_LICENSE_PATH="$ACTION_FOLDER/BlankProject"
|
||||||
|
66
dist/platforms/mac/steps/activate.sh
vendored
66
dist/platforms/mac/steps/activate.sh
vendored
@ -6,19 +6,61 @@ pushd "$ACTIVATE_LICENSE_PATH"
|
|||||||
|
|
||||||
echo "Requesting activation"
|
echo "Requesting activation"
|
||||||
|
|
||||||
# Activate license
|
|
||||||
/Applications/Unity/Hub/Editor/$UNITY_VERSION/Unity.app/Contents/MacOS/Unity \
|
|
||||||
-logFile - \
|
|
||||||
-batchmode \
|
|
||||||
-nographics \
|
|
||||||
-quit \
|
|
||||||
-serial "$UNITY_SERIAL" \
|
|
||||||
-username "$UNITY_EMAIL" \
|
|
||||||
-password "$UNITY_PASSWORD" \
|
|
||||||
-projectPath "$ACTIVATE_LICENSE_PATH"
|
|
||||||
|
|
||||||
# Store the exit code from the verify command
|
if [[ -n "$UNITY_SERIAL" && -n "$UNITY_EMAIL" && -n "$UNITY_PASSWORD" ]]; then
|
||||||
UNITY_EXIT_CODE=$?
|
|
||||||
|
|
||||||
|
# Activate license
|
||||||
|
/Applications/Unity/Hub/Editor/$UNITY_VERSION/Unity.app/Contents/MacOS/Unity \
|
||||||
|
-logFile - \
|
||||||
|
-batchmode \
|
||||||
|
-nographics \
|
||||||
|
-quit \
|
||||||
|
-serial "$UNITY_SERIAL" \
|
||||||
|
-username "$UNITY_EMAIL" \
|
||||||
|
-password "$UNITY_PASSWORD" \
|
||||||
|
-projectPath "$ACTIVATE_LICENSE_PATH"
|
||||||
|
|
||||||
|
# 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
|
# 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 \
|
-quit \
|
||||||
-batchmode \
|
-batchmode \
|
||||||
-nographics \
|
-nographics \
|
||||||
-username "$UNITY_EMAIL" \
|
|
||||||
-password "$UNITY_PASSWORD" \
|
|
||||||
-customBuildName "$BUILD_NAME" \
|
-customBuildName "$BUILD_NAME" \
|
||||||
-projectPath "$UNITY_PROJECT_PATH" \
|
-projectPath "$UNITY_PROJECT_PATH" \
|
||||||
-buildTarget "$BUILD_TARGET" \
|
-buildTarget "$BUILD_TARGET" \
|
||||||
|
30
dist/platforms/mac/steps/return_license.sh
vendored
30
dist/platforms/mac/steps/return_license.sh
vendored
@ -4,15 +4,27 @@
|
|||||||
echo "Changing to \"$ACTIVATE_LICENSE_PATH\" directory."
|
echo "Changing to \"$ACTIVATE_LICENSE_PATH\" directory."
|
||||||
pushd "$ACTIVATE_LICENSE_PATH"
|
pushd "$ACTIVATE_LICENSE_PATH"
|
||||||
|
|
||||||
/Applications/Unity/Hub/Editor/$UNITY_VERSION/Unity.app/Contents/MacOS/Unity \
|
|
||||||
-logFile - \
|
if [[ -n "$UNITY_LICENSING_SERVER" ]]; then
|
||||||
-batchmode \
|
#
|
||||||
-nographics \
|
# Return any floating license used.
|
||||||
-quit \
|
#
|
||||||
-username "$UNITY_EMAIL" \
|
echo "Returning floating license: \"$FLOATING_LICENSE\""
|
||||||
-password "$UNITY_PASSWORD" \
|
/Applications/Unity/Hub/Editor/$UNITY_VERSION/Unity.app/Contents/Frameworks/UnityLicensingClient.app/Contents/Resources/Unity.Licensing.Client --return-floating "$FLOATING_LICENSE"
|
||||||
-returnlicense \
|
|
||||||
-projectPath "$ACTIVATE_LICENSE_PATH"
|
else
|
||||||
|
|
||||||
|
/Applications/Unity/Hub/Editor/$UNITY_VERSION/Unity.app/Contents/MacOS/Unity \
|
||||||
|
-logFile - \
|
||||||
|
-batchmode \
|
||||||
|
-nographics \
|
||||||
|
-quit \
|
||||||
|
-username "$UNITY_EMAIL" \
|
||||||
|
-password "$UNITY_PASSWORD" \
|
||||||
|
-returnlicense \
|
||||||
|
-projectPath "$ACTIVATE_LICENSE_PATH"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
# Return to previous working directory
|
# Return to previous working directory
|
||||||
popd
|
popd
|
||||||
|
@ -23,6 +23,7 @@ class BuildParameters {
|
|||||||
public unityLicensingServer!: string;
|
public unityLicensingServer!: string;
|
||||||
public runnerTempPath!: string;
|
public runnerTempPath!: string;
|
||||||
public targetPlatform!: string;
|
public targetPlatform!: string;
|
||||||
|
public targetArchitecture!: string;
|
||||||
public projectPath!: string;
|
public projectPath!: string;
|
||||||
public buildName!: string;
|
public buildName!: string;
|
||||||
public buildPath!: string;
|
public buildPath!: string;
|
||||||
@ -134,6 +135,7 @@ class BuildParameters {
|
|||||||
unityLicensingServer: Input.unityLicensingServer,
|
unityLicensingServer: Input.unityLicensingServer,
|
||||||
runnerTempPath: Input.runnerTempPath,
|
runnerTempPath: Input.runnerTempPath,
|
||||||
targetPlatform: Input.targetPlatform,
|
targetPlatform: Input.targetPlatform,
|
||||||
|
targetArchitecture: Input.targetArchitecture,
|
||||||
projectPath: Input.projectPath,
|
projectPath: Input.projectPath,
|
||||||
buildName: Input.buildName,
|
buildName: Input.buildName,
|
||||||
buildPath: `${Input.buildsPath}/${Input.targetPlatform}`,
|
buildPath: `${Input.buildsPath}/${Input.targetPlatform}`,
|
||||||
|
@ -80,6 +80,10 @@ class Input {
|
|||||||
return Input.getInput('targetPlatform') || Platform.default;
|
return Input.getInput('targetPlatform') || Platform.default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static get targetArchitecture(): string {
|
||||||
|
return Input.getInput('targetArchitecture') || Platform.defaultarch;
|
||||||
|
}
|
||||||
|
|
||||||
static get unityVersion(): string {
|
static get unityVersion(): string {
|
||||||
return Input.getInput('unityVersion') || 'auto';
|
return Input.getInput('unityVersion') || 'auto';
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ class SetupMac {
|
|||||||
const moduleArgument = [];
|
const moduleArgument = [];
|
||||||
switch (targetPlatform) {
|
switch (targetPlatform) {
|
||||||
case 'iOS':
|
case 'iOS':
|
||||||
moduleArgument.push('--module', 'ios');
|
moduleArgument.push('--module', 'ios', '--module', 'android');
|
||||||
break;
|
break;
|
||||||
case 'tvOS':
|
case 'tvOS':
|
||||||
moduleArgument.push('--module', 'tvos');
|
moduleArgument.push('--module', 'tvos');
|
||||||
@ -85,7 +85,7 @@ class SetupMac {
|
|||||||
moduleArgument.push('--module', 'mac-il2cpp');
|
moduleArgument.push('--module', 'mac-il2cpp');
|
||||||
break;
|
break;
|
||||||
case 'Android':
|
case 'Android':
|
||||||
moduleArgument.push('--module', 'android');
|
moduleArgument.push('--module', 'android', '--module', 'ios');
|
||||||
break;
|
break;
|
||||||
case 'WebGL':
|
case 'WebGL':
|
||||||
moduleArgument.push('--module', 'webgl');
|
moduleArgument.push('--module', 'webgl');
|
||||||
@ -111,6 +111,7 @@ class SetupMac {
|
|||||||
|
|
||||||
const unityChangeset = await getUnityChangeset(buildParameters.editorVersion);
|
const unityChangeset = await getUnityChangeset(buildParameters.editorVersion);
|
||||||
const moduleArguments = SetupMac.getModuleParametersForTargetPlatform(buildParameters.targetPlatform);
|
const moduleArguments = SetupMac.getModuleParametersForTargetPlatform(buildParameters.targetPlatform);
|
||||||
|
const unityArch = buildParameters.targetArchitecture;
|
||||||
|
|
||||||
const execArguments: string[] = [
|
const execArguments: string[] = [
|
||||||
'--',
|
'--',
|
||||||
@ -120,6 +121,7 @@ class SetupMac {
|
|||||||
...['--changeset', unityChangeset.changeset],
|
...['--changeset', unityChangeset.changeset],
|
||||||
...moduleArguments,
|
...moduleArguments,
|
||||||
'--childModules',
|
'--childModules',
|
||||||
|
...['--architecture', unityArch],
|
||||||
];
|
];
|
||||||
|
|
||||||
// Ignoring return code because the log seems to overflow the internal buffer which triggers
|
// Ignoring return code because the log seems to overflow the internal buffer which triggers
|
||||||
|
@ -3,6 +3,17 @@ class Platform {
|
|||||||
return Platform.types.StandaloneWindows64;
|
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() {
|
static get types() {
|
||||||
return {
|
return {
|
||||||
StandaloneOSX: 'StandaloneOSX',
|
StandaloneOSX: 'StandaloneOSX',
|
||||||
|
Loading…
Reference in New Issue
Block a user