Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/workflows/build-options.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
"macos-latest"
],
"unity-version": [
"4.7.2",
"5.6.7f1 (e80cc3114ac1)",
"2017.4.40f1",
"2018",
"2019.x",
"2020.*",
"2021.3.x",
Expand Down
52 changes: 46 additions & 6 deletions .github/workflows/unity-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,31 +61,32 @@ jobs:
echo "UNITY_PROJECT_PATH: ${UNITY_PROJECT_PATH}" # Expected to be empty at this point

if [ -z "${UNITY_HUB_PATH}" ]; then
echo "Error: UNITY_HUB_PATH is not set"
echo "::error::UNITY_HUB_PATH is not set"
exit 1
fi

if [ "${{ matrix.unity-version }}" != "none" ] && [ -z "${UNITY_EDITOR_PATH}" ]; then
echo "Error: UNITY_EDITOR_PATH is not set"
echo "::error::UNITY_EDITOR_PATH is not set"
exit 1
fi
- name: Activate License
if : ${{ matrix.unity-version != 'none' }}
if: ${{ matrix.unity-version != 'none' }}
shell: bash
run: |
unity-cli license-context
unity-cli activate-license --license personal --email "${{ secrets.UNITY_USERNAME }}" --password "${{ secrets.UNITY_PASSWORD }}"
- name: Create Unity Project
if : ${{ matrix.unity-version != 'none' }}
if: ${{ matrix.unity-version != 'none' }}
shell: bash
run: |
unity-cli list-project-templates --unity-editor "${UNITY_EDITOR_PATH}" --json
unity-cli create-project --name "Unity Project" --unity-editor "${UNITY_EDITOR_PATH}" --json
- name: Verify UNITY_PROJECT_PATH variable
if : ${{ matrix.unity-version != 'none' }}
if: ${{ matrix.unity-version != 'none' }}
shell: bash
run: |
if [ -z "${UNITY_PROJECT_PATH}" ]; then
echo "Error: UNITY_PROJECT_PATH is not set"
echo "::error::UNITY_PROJECT_PATH is not set"
exit 1
fi
# check if the project can be built. Only Unity 2019.4+ and newer majors support the build pipeline package
Expand Down Expand Up @@ -134,6 +135,45 @@ jobs:
exit 0
fi
unity-cli uninstall-unity --unity-editor "${UNITY_EDITOR_PATH}"
- name: Print log paths
if: ${{ matrix.unity-version != 'none' }}
shell: bash
run: |
HUB_LOG_PATH=$(unity-cli hub-logs)
PACKAGE_MANAGER_LOG_PATH=$(unity-cli package-manager-logs)
LICENSING_CLIENT_LOG_PATH=$(unity-cli licensing-client-logs)
LICENSING_AUDIT_LOG_PATH=$(unity-cli licensing-audit-logs)

echo "Hub Log Path: ${HUB_LOG_PATH}"
echo "Package Manager Log Path: ${PACKAGE_MANAGER_LOG_PATH}"
echo "Licensing Client Log Path: ${LICENSING_CLIENT_LOG_PATH}"
echo "Licensing Audit Log Path: ${LICENSING_AUDIT_LOG_PATH}"

if [ ! -f "${HUB_LOG_PATH}" ]; then
echo "::warning:: Hub log file does not exist at ${HUB_LOG_PATH}"
# find all info-log.json files in ~/.config/unity3d/ - print their paths
find ~/.config/unity3d/ -type f \( -name "info-log.json" \) -exec echo "{}" \;
# also try to find in UNITY_HUB_PATH parent directory if set
if [ -n "${UNITY_HUB_PATH}" ]; then
HUB_DIR=$(dirname "${UNITY_HUB_PATH}")
find "${HUB_DIR}" -type f \( -name "info-log.json" \) -exec echo "{}" \;
fi
# print all files found in ~/.config/
find ~/.config/ -type f -exec echo "{}" \;
echo "::error:: Hub log file does not exist at any known location"
fi

if [ ! -f "${PACKAGE_MANAGER_LOG_PATH}" ]; then
echo "::error::Package Manager log file does not exist at ${PACKAGE_MANAGER_LOG_PATH}"
fi

if [ ! -f "${LICENSING_CLIENT_LOG_PATH}" ]; then
echo "::error::Licensing Client log file does not exist at ${LICENSING_CLIENT_LOG_PATH}"
fi

if [ ! -f "${LICENSING_AUDIT_LOG_PATH}" ]; then
echo "::error::Licensing Audit log file does not exist at ${LICENSING_AUDIT_LOG_PATH}"
fi
- name: Return License
if: always()
shell: bash
Expand Down
35 changes: 31 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ A powerful command line utility for the Unity Game Engine. Automate Unity projec
- [Activate License](#activate-license)
- [Return License](#return-license)
- [License Context](#license-context)
- [Licensing Logs](#licensing-logs)
- [Licensing Client Logs](#licensing-client-logs)
- [Licensing Audit Logs](#licensing-audit-logs)
- [Unity Hub](#unity-hub)
- [Hub Version](#hub-version)
- [Hub Path](#hub-path)
- [Hub Logs](#hub-logs)
- [Package Manager Logs](#package-manager-logs)
- [Unity Hub Install](#unity-hub-install)
- [Run Unity Hub Commands](#run-unity-hub-commands)
- [Setup Unity Editor](#setup-unity-editor)
Expand Down Expand Up @@ -121,12 +124,20 @@ unity-cli return-license --license personal
unity-cli license-context
```

##### Licensing Logs
##### Licensing Client Logs

`licensing-logs`: Prints the path to the Unity Licensing Client log files.
`licensing-client-logs`: Prints the path to the Unity Licensing Client log file.

```bash
unity-cli licensing-logs
unity-cli licensing-client-logs
```

##### Licensing Audit Logs

`licensing-audit-logs`: Prints the path to the Unity Licensing Client audit log.

```bash
unity-cli licensing-audit-logs
```

#### Unity Hub
Expand All @@ -147,6 +158,22 @@ unity-cli hub-version
unity-cli hub-path
```

##### Hub Logs

`hub-logs`: Prints the path to the Unity Hub log file.

```bash
unity-cli hub-logs
```

##### Package Manager Logs

`package-manager-logs`: Prints the path to the Unity Package Manager log file.

```bash
unity-cli package-manager-logs
```

##### Unity Hub Install

`hub-install [options]`: Install or update the Unity Hub
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rage-against-the-pixel/unity-cli",
"version": "1.6.4",
"version": "1.6.5",
"description": "A command line utility for the Unity Game Engine.",
"author": "RageAgainstThePixel",
"license": "MIT",
Expand Down
28 changes: 24 additions & 4 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,17 @@ program.command('license-context')
process.exit(0);
});

program.command('licensing-logs')
.description('Prints the path to the Unity Licensing Client log files.')
program.command('licensing-client-logs')
.description('Prints the path to the Unity Licensing Client log file.')
.action(async () => {
const client = new LicensingClient();
process.stdout.write(`${client.logPath()}\n`);
process.stdout.write(`${LicensingClient.ClientLogPath()}\n`);
process.exit(0);
});

program.command('licensing-audit-logs')
.description('Prints the path to the Unity Licensing Client audit log file.')
.action(async () => {
process.stdout.write(`${LicensingClient.ClientAuditLogPath()}\n`);
process.exit(0);
});

Expand Down Expand Up @@ -189,6 +195,20 @@ program.command('hub-path')
process.exit(0);
});

program.command('hub-logs')
.description('Prints the path to the Unity Hub log file.')
.action(async () => {
process.stdout.write(`${UnityHub.LogPath()}\n`);
process.exit(0);
});

program.command('package-manager-logs')
.description('Prints the path to the Unity Package Manager log file.')
.action(async () => {
process.stdout.write(`${UnityHub.PackageManagerLogsPath()}\n`);
process.exit(0);
});

program.command('hub-install')
.description('Install the Unity Hub.')
.option('--verbose', 'Enable verbose logging.')
Expand Down
27 changes: 24 additions & 3 deletions src/license-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,38 @@ export class LicensingClient {
* @see https://docs.unity.com/en-us/licensing-server/troubleshooting-client#logs
* @returns The path to the log file.
*/
public logPath(): string {
public static ClientLogPath(): string {
switch (process.platform) {
case 'win32':
// $env:LOCALAPPDATA\Unity\Unity.Licensing.Client.log
return path.join(process.env.LOCALAPPDATA || '', 'Unity', 'Unity.Licensing.Client.log');
case 'darwin':
// ~/Library/Logs/Unity/Unity.Licensing.Client.log
return path.join(os.homedir(), 'Library', 'Logs', 'Unity', 'Unity.Licensing.Client.log');
return path.join(process.env.HOME || '', 'Library', 'Logs', 'Unity', 'Unity.Licensing.Client.log');
case 'linux':
// ~/.config/unity3d/Unity/Unity.Licensing.Client.log
return path.join(os.homedir(), '.config', 'unity3d', 'Unity', 'Unity.Licensing.Client.log');
return path.join(process.env.HOME || '', '.config', 'unity3d', 'Unity', 'Unity.Licensing.Client.log');
default:
throw new Error(`Unsupported platform: ${process.platform}`);
}
}

/**
* Gets the path to the Unity Licensing Client audit log file.
* @see https://docs.unity.com/en-us/licensing-server/troubleshooting-client#logs
* @returns The path to the audit log file.
*/
public static ClientAuditLogPath(): string {
switch (process.platform) {
case 'win32':
// $env:LOCALAPPDATA\Unity\Unity.Entitlements.Audit.log
return path.join(process.env.LOCALAPPDATA || '', 'Unity', 'Unity.Entitlements.Audit.log');
case 'darwin':
// ~/Library/Logs/Unity/Unity.Entitlements.Audit.log
return path.join(process.env.HOME || '', 'Library', 'Logs', 'Unity', 'Unity.Entitlements.Audit.log');
case 'linux':
// ~/.config/unity3d/Unity/Unity.Entitlements.Audit.log
return path.join(process.env.HOME || '', '.config', 'unity3d', 'Unity', 'Unity.Entitlements.Audit.log');
default:
throw new Error(`Unsupported platform: ${process.platform}`);
}
Expand Down
9 changes: 4 additions & 5 deletions src/unity-editor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as os from 'os';
import * as fs from 'fs';
import * as path from 'path';
import { Logger } from './logging';
Expand Down Expand Up @@ -453,12 +452,12 @@ export class UnityEditor {
*/
static GetEditorLogsDirectory() {
switch (process.platform) {
case 'darwin':
return path.join(os.homedir(), 'Library', 'Logs', 'Unity');
case 'linux':
return path.join(os.homedir(), '.config', 'unity3d', 'Editor');
case 'win32':
return path.join(process.env.LOCALAPPDATA || '', 'Unity', 'Editor');
case 'darwin':
return path.join(process.env.HOME || '', 'Library', 'Logs', 'Unity');
case 'linux':
return path.join(process.env.HOME || '', '.config', 'unity3d', 'Editor');
default:
throw new Error(`Unsupported platform: ${process.platform}`);
}
Expand Down
42 changes: 42 additions & 0 deletions src/unity-hub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1258,4 +1258,46 @@ done

return moduleMap;
}

/**
* Returns the path to the Unity Hub log file.
* @see https://docs.unity.com/en-us/licensing-server/troubleshooting-client#logs
* @returns The Unity Hub log file path.
*/
public static LogPath(): string {
switch (process.platform) {
case 'win32':
// %APPDATA%\UnityHub\logs\info-log.json
return path.join(process.env.APPDATA || '', 'UnityHub', 'logs', 'info-log.json');
case 'darwin':
// ~/Library/Application Support/UnityHub/logs/info-log.json
return path.join(process.env.HOME || '', 'Library', 'Application Support', 'UnityHub', 'logs', 'info-log.json');
case 'linux':
// ~/.config/UnityHub/logs/info-log.json
return path.join(process.env.HOME || '', '.config', 'UnityHub', 'logs', 'info-log.json');
default:
throw new Error(`Unsupported platform: ${process.platform}`);
}
}

/**
* Returns the path to the Unity Package Manager log file.
* @see https://docs.unity3d.com/Manual/LogFiles.html
* @returns The Unity Package Manager log file path.
*/
public static PackageManagerLogsPath(): string {
switch (process.platform) {
case 'win32':
// C:\Users\username\AppData\Local\Unity\Editor\upm.log
return path.join(process.env.LOCALAPPDATA || '', 'Unity', 'Editor', 'upm.log');
case 'darwin':
// ~/Library/Logs/Unity/upm.log
return path.join(process.env.HOME || '', 'Library', 'Logs', 'Unity', 'upm.log');
case 'linux':
// ~/.config/unity3d/upm.log
return path.join(process.env.HOME || '', '.config', 'unity3d', 'upm.log');
default:
throw new Error(`Unsupported platform: ${process.platform}`);
}
}
}
Loading