Skip to content

Commit b08e3d2

Browse files
unity-cli@v1.6.5 (#52)
- renamed `licensing-logs` command to `licensing-client-logs` - added `licensing-audit-logs` - added `hub-logs` - added `package-manager-logs`
1 parent e010489 commit b08e3d2

File tree

9 files changed

+174
-29
lines changed

9 files changed

+174
-29
lines changed

.github/workflows/build-options.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
"macos-latest"
66
],
77
"unity-version": [
8-
"4.7.2",
9-
"5.6.7f1 (e80cc3114ac1)",
10-
"2017.4.40f1",
11-
"2018",
128
"2019.x",
139
"2020.*",
1410
"2021.3.x",

.github/workflows/unity-build.yml

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,31 +61,32 @@ jobs:
6161
echo "UNITY_PROJECT_PATH: ${UNITY_PROJECT_PATH}" # Expected to be empty at this point
6262
6363
if [ -z "${UNITY_HUB_PATH}" ]; then
64-
echo "Error: UNITY_HUB_PATH is not set"
64+
echo "::error::UNITY_HUB_PATH is not set"
6565
exit 1
6666
fi
6767
6868
if [ "${{ matrix.unity-version }}" != "none" ] && [ -z "${UNITY_EDITOR_PATH}" ]; then
69-
echo "Error: UNITY_EDITOR_PATH is not set"
69+
echo "::error::UNITY_EDITOR_PATH is not set"
7070
exit 1
7171
fi
7272
- name: Activate License
73-
if : ${{ matrix.unity-version != 'none' }}
73+
if: ${{ matrix.unity-version != 'none' }}
7474
shell: bash
7575
run: |
76+
unity-cli license-context
7677
unity-cli activate-license --license personal --email "${{ secrets.UNITY_USERNAME }}" --password "${{ secrets.UNITY_PASSWORD }}"
7778
- name: Create Unity Project
78-
if : ${{ matrix.unity-version != 'none' }}
79+
if: ${{ matrix.unity-version != 'none' }}
7980
shell: bash
8081
run: |
8182
unity-cli list-project-templates --unity-editor "${UNITY_EDITOR_PATH}" --json
8283
unity-cli create-project --name "Unity Project" --unity-editor "${UNITY_EDITOR_PATH}" --json
8384
- name: Verify UNITY_PROJECT_PATH variable
84-
if : ${{ matrix.unity-version != 'none' }}
85+
if: ${{ matrix.unity-version != 'none' }}
8586
shell: bash
8687
run: |
8788
if [ -z "${UNITY_PROJECT_PATH}" ]; then
88-
echo "Error: UNITY_PROJECT_PATH is not set"
89+
echo "::error::UNITY_PROJECT_PATH is not set"
8990
exit 1
9091
fi
9192
# check if the project can be built. Only Unity 2019.4+ and newer majors support the build pipeline package
@@ -134,6 +135,45 @@ jobs:
134135
exit 0
135136
fi
136137
unity-cli uninstall-unity --unity-editor "${UNITY_EDITOR_PATH}"
138+
- name: Print log paths
139+
if: ${{ matrix.unity-version != 'none' }}
140+
shell: bash
141+
run: |
142+
HUB_LOG_PATH=$(unity-cli hub-logs)
143+
PACKAGE_MANAGER_LOG_PATH=$(unity-cli package-manager-logs)
144+
LICENSING_CLIENT_LOG_PATH=$(unity-cli licensing-client-logs)
145+
LICENSING_AUDIT_LOG_PATH=$(unity-cli licensing-audit-logs)
146+
147+
echo "Hub Log Path: ${HUB_LOG_PATH}"
148+
echo "Package Manager Log Path: ${PACKAGE_MANAGER_LOG_PATH}"
149+
echo "Licensing Client Log Path: ${LICENSING_CLIENT_LOG_PATH}"
150+
echo "Licensing Audit Log Path: ${LICENSING_AUDIT_LOG_PATH}"
151+
152+
if [ ! -f "${HUB_LOG_PATH}" ]; then
153+
echo "::warning:: Hub log file does not exist at ${HUB_LOG_PATH}"
154+
# find all info-log.json files in ~/.config/unity3d/ - print their paths
155+
find ~/.config/unity3d/ -type f \( -name "info-log.json" \) -exec echo "{}" \;
156+
# also try to find in UNITY_HUB_PATH parent directory if set
157+
if [ -n "${UNITY_HUB_PATH}" ]; then
158+
HUB_DIR=$(dirname "${UNITY_HUB_PATH}")
159+
find "${HUB_DIR}" -type f \( -name "info-log.json" \) -exec echo "{}" \;
160+
fi
161+
# print all files found in ~/.config/
162+
find ~/.config/ -type f -exec echo "{}" \;
163+
echo "::error:: Hub log file does not exist at any known location"
164+
fi
165+
166+
if [ ! -f "${PACKAGE_MANAGER_LOG_PATH}" ]; then
167+
echo "::error::Package Manager log file does not exist at ${PACKAGE_MANAGER_LOG_PATH}"
168+
fi
169+
170+
if [ ! -f "${LICENSING_CLIENT_LOG_PATH}" ]; then
171+
echo "::error::Licensing Client log file does not exist at ${LICENSING_CLIENT_LOG_PATH}"
172+
fi
173+
174+
if [ ! -f "${LICENSING_AUDIT_LOG_PATH}" ]; then
175+
echo "::error::Licensing Audit log file does not exist at ${LICENSING_AUDIT_LOG_PATH}"
176+
fi
137177
- name: Return License
138178
if: always()
139179
shell: bash

README.md

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,13 @@ A powerful command line utility for the Unity Game Engine. Automate Unity projec
1515
- [Activate License](#activate-license)
1616
- [Return License](#return-license)
1717
- [License Context](#license-context)
18-
- [Licensing Logs](#licensing-logs)
18+
- [Licensing Client Logs](#licensing-client-logs)
19+
- [Licensing Audit Logs](#licensing-audit-logs)
1920
- [Unity Hub](#unity-hub)
2021
- [Hub Version](#hub-version)
2122
- [Hub Path](#hub-path)
23+
- [Hub Logs](#hub-logs)
24+
- [Package Manager Logs](#package-manager-logs)
2225
- [Unity Hub Install](#unity-hub-install)
2326
- [Run Unity Hub Commands](#run-unity-hub-commands)
2427
- [Setup Unity Editor](#setup-unity-editor)
@@ -121,12 +124,20 @@ unity-cli return-license --license personal
121124
unity-cli license-context
122125
```
123126

124-
##### Licensing Logs
127+
##### Licensing Client Logs
125128

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

128131
```bash
129-
unity-cli licensing-logs
132+
unity-cli licensing-client-logs
133+
```
134+
135+
##### Licensing Audit Logs
136+
137+
`licensing-audit-logs`: Prints the path to the Unity Licensing Client audit log.
138+
139+
```bash
140+
unity-cli licensing-audit-logs
130141
```
131142

132143
#### Unity Hub
@@ -147,6 +158,22 @@ unity-cli hub-version
147158
unity-cli hub-path
148159
```
149160

161+
##### Hub Logs
162+
163+
`hub-logs`: Prints the path to the Unity Hub log file.
164+
165+
```bash
166+
unity-cli hub-logs
167+
```
168+
169+
##### Package Manager Logs
170+
171+
`package-manager-logs`: Prints the path to the Unity Package Manager log file.
172+
173+
```bash
174+
unity-cli package-manager-logs
175+
```
176+
150177
##### Unity Hub Install
151178

152179
`hub-install [options]`: Install or update the Unity Hub

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@rage-against-the-pixel/unity-cli",
3-
"version": "1.6.4",
3+
"version": "1.6.5",
44
"description": "A command line utility for the Unity Game Engine.",
55
"author": "RageAgainstThePixel",
66
"license": "MIT",

src/cli.ts

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,17 @@ program.command('license-context')
148148
process.exit(0);
149149
});
150150

151-
program.command('licensing-logs')
152-
.description('Prints the path to the Unity Licensing Client log files.')
151+
program.command('licensing-client-logs')
152+
.description('Prints the path to the Unity Licensing Client log file.')
153153
.action(async () => {
154-
const client = new LicensingClient();
155-
process.stdout.write(`${client.logPath()}\n`);
154+
process.stdout.write(`${LicensingClient.ClientLogPath()}\n`);
155+
process.exit(0);
156+
});
157+
158+
program.command('licensing-audit-logs')
159+
.description('Prints the path to the Unity Licensing Client audit log file.')
160+
.action(async () => {
161+
process.stdout.write(`${LicensingClient.ClientAuditLogPath()}\n`);
156162
process.exit(0);
157163
});
158164

@@ -189,6 +195,20 @@ program.command('hub-path')
189195
process.exit(0);
190196
});
191197

198+
program.command('hub-logs')
199+
.description('Prints the path to the Unity Hub log file.')
200+
.action(async () => {
201+
process.stdout.write(`${UnityHub.LogPath()}\n`);
202+
process.exit(0);
203+
});
204+
205+
program.command('package-manager-logs')
206+
.description('Prints the path to the Unity Package Manager log file.')
207+
.action(async () => {
208+
process.stdout.write(`${UnityHub.PackageManagerLogsPath()}\n`);
209+
process.exit(0);
210+
});
211+
192212
program.command('hub-install')
193213
.description('Install the Unity Hub.')
194214
.option('--verbose', 'Enable verbose logging.')

src/license-client.ts

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,38 @@ export class LicensingClient {
124124
* @see https://docs.unity.com/en-us/licensing-server/troubleshooting-client#logs
125125
* @returns The path to the log file.
126126
*/
127-
public logPath(): string {
127+
public static ClientLogPath(): string {
128128
switch (process.platform) {
129129
case 'win32':
130130
// $env:LOCALAPPDATA\Unity\Unity.Licensing.Client.log
131131
return path.join(process.env.LOCALAPPDATA || '', 'Unity', 'Unity.Licensing.Client.log');
132132
case 'darwin':
133133
// ~/Library/Logs/Unity/Unity.Licensing.Client.log
134-
return path.join(os.homedir(), 'Library', 'Logs', 'Unity', 'Unity.Licensing.Client.log');
134+
return path.join(process.env.HOME || '', 'Library', 'Logs', 'Unity', 'Unity.Licensing.Client.log');
135135
case 'linux':
136136
// ~/.config/unity3d/Unity/Unity.Licensing.Client.log
137-
return path.join(os.homedir(), '.config', 'unity3d', 'Unity', 'Unity.Licensing.Client.log');
137+
return path.join(process.env.HOME || '', '.config', 'unity3d', 'Unity', 'Unity.Licensing.Client.log');
138+
default:
139+
throw new Error(`Unsupported platform: ${process.platform}`);
140+
}
141+
}
142+
143+
/**
144+
* Gets the path to the Unity Licensing Client audit log file.
145+
* @see https://docs.unity.com/en-us/licensing-server/troubleshooting-client#logs
146+
* @returns The path to the audit log file.
147+
*/
148+
public static ClientAuditLogPath(): string {
149+
switch (process.platform) {
150+
case 'win32':
151+
// $env:LOCALAPPDATA\Unity\Unity.Entitlements.Audit.log
152+
return path.join(process.env.LOCALAPPDATA || '', 'Unity', 'Unity.Entitlements.Audit.log');
153+
case 'darwin':
154+
// ~/Library/Logs/Unity/Unity.Entitlements.Audit.log
155+
return path.join(process.env.HOME || '', 'Library', 'Logs', 'Unity', 'Unity.Entitlements.Audit.log');
156+
case 'linux':
157+
// ~/.config/unity3d/Unity/Unity.Entitlements.Audit.log
158+
return path.join(process.env.HOME || '', '.config', 'unity3d', 'Unity', 'Unity.Entitlements.Audit.log');
138159
default:
139160
throw new Error(`Unsupported platform: ${process.platform}`);
140161
}

src/unity-editor.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import * as os from 'os';
21
import * as fs from 'fs';
32
import * as path from 'path';
43
import { Logger } from './logging';
@@ -453,12 +452,12 @@ export class UnityEditor {
453452
*/
454453
static GetEditorLogsDirectory() {
455454
switch (process.platform) {
456-
case 'darwin':
457-
return path.join(os.homedir(), 'Library', 'Logs', 'Unity');
458-
case 'linux':
459-
return path.join(os.homedir(), '.config', 'unity3d', 'Editor');
460455
case 'win32':
461456
return path.join(process.env.LOCALAPPDATA || '', 'Unity', 'Editor');
457+
case 'darwin':
458+
return path.join(process.env.HOME || '', 'Library', 'Logs', 'Unity');
459+
case 'linux':
460+
return path.join(process.env.HOME || '', '.config', 'unity3d', 'Editor');
462461
default:
463462
throw new Error(`Unsupported platform: ${process.platform}`);
464463
}

src/unity-hub.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,4 +1258,46 @@ done
12581258

12591259
return moduleMap;
12601260
}
1261+
1262+
/**
1263+
* Returns the path to the Unity Hub log file.
1264+
* @see https://docs.unity.com/en-us/licensing-server/troubleshooting-client#logs
1265+
* @returns The Unity Hub log file path.
1266+
*/
1267+
public static LogPath(): string {
1268+
switch (process.platform) {
1269+
case 'win32':
1270+
// %APPDATA%\UnityHub\logs\info-log.json
1271+
return path.join(process.env.APPDATA || '', 'UnityHub', 'logs', 'info-log.json');
1272+
case 'darwin':
1273+
// ~/Library/Application Support/UnityHub/logs/info-log.json
1274+
return path.join(process.env.HOME || '', 'Library', 'Application Support', 'UnityHub', 'logs', 'info-log.json');
1275+
case 'linux':
1276+
// ~/.config/UnityHub/logs/info-log.json
1277+
return path.join(process.env.HOME || '', '.config', 'UnityHub', 'logs', 'info-log.json');
1278+
default:
1279+
throw new Error(`Unsupported platform: ${process.platform}`);
1280+
}
1281+
}
1282+
1283+
/**
1284+
* Returns the path to the Unity Package Manager log file.
1285+
* @see https://docs.unity3d.com/Manual/LogFiles.html
1286+
* @returns The Unity Package Manager log file path.
1287+
*/
1288+
public static PackageManagerLogsPath(): string {
1289+
switch (process.platform) {
1290+
case 'win32':
1291+
// C:\Users\username\AppData\Local\Unity\Editor\upm.log
1292+
return path.join(process.env.LOCALAPPDATA || '', 'Unity', 'Editor', 'upm.log');
1293+
case 'darwin':
1294+
// ~/Library/Logs/Unity/upm.log
1295+
return path.join(process.env.HOME || '', 'Library', 'Logs', 'Unity', 'upm.log');
1296+
case 'linux':
1297+
// ~/.config/unity3d/upm.log
1298+
return path.join(process.env.HOME || '', '.config', 'unity3d', 'upm.log');
1299+
default:
1300+
throw new Error(`Unsupported platform: ${process.platform}`);
1301+
}
1302+
}
12611303
}

0 commit comments

Comments
 (0)