From 0c3d4a3ececdbf8b658979ac83fbecd07dd99a5d Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Fri, 28 Nov 2025 14:33:54 -0500 Subject: [PATCH 1/2] unity-cli@v1.6.9 - skip entitlements check for floating licenses - add --showContext call when polling for license server configuration updates --- package-lock.json | 4 ++-- package.json | 2 +- src/cli.ts | 2 +- src/license-client.ts | 10 +++++++--- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7fa26a1..f88a6a6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@rage-against-the-pixel/unity-cli", - "version": "1.6.7", + "version": "1.6.9", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@rage-against-the-pixel/unity-cli", - "version": "1.6.7", + "version": "1.6.9", "license": "MIT", "dependencies": { "@electron/asar": "^4.0.1", diff --git a/package.json b/package.json index d2442ab..cf6626c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@rage-against-the-pixel/unity-cli", - "version": "1.6.8", + "version": "1.6.9", "description": "A command line utility for the Unity Game Engine.", "author": "RageAgainstThePixel", "license": "MIT", diff --git a/src/cli.ts b/src/cli.ts index de477eb..aef0894 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -42,7 +42,7 @@ program.command('activate-license') .option('-e, --email ', 'Email associated with the Unity account. Required when activating a personal or professional license.') .option('-p, --password ', 'Password for the Unity account. Required when activating a personal or professional license.') .option('-s, --serial ', 'License serial number. Required when activating a professional license.') - .option('-c, --config ', 'Path to the configuration file, or base64 encoded JSON string. Required when activating a floating license.') + .option('-c, --config ', 'Path to the configuration file, raw JSON, or base64 encoded JSON string. Required when activating a floating license.') .option('--verbose', 'Enable verbose logging.') .option('--json', 'Prints the last line of output as JSON string.') .action(async (options) => { diff --git a/src/license-client.ts b/src/license-client.ts index 05aab81..66466dd 100644 --- a/src/license-client.ts +++ b/src/license-client.ts @@ -513,7 +513,8 @@ export class LicensingClient { } catch (error) { if ((error as NodeJS.ErrnoException).code !== 'ENOENT') { - this.logger.debug(`Failed to inspect licensing client log: ${error}`); + this.logger.error(`Failed to inspect licensing client log: ${error}`); + continue; } } @@ -531,11 +532,12 @@ export class LicensingClient { } if (notConfiguredPattern.test(line)) { - this.logger.warn('Floating license server is not configured. Waiting for configuration...'); + this.logger.debug('Floating license server is not configured. Waiting for configuration...'); } } } + await this.exec(['--showContext'], true); await new Promise((resolve) => setTimeout(resolve, pollIntervalMs)); } @@ -561,6 +563,9 @@ export class LicensingClient { this.logger.debug(`Using services config at: ${servicesConfigPath}`); } + // For floating licenses, skip the entitlement check + skipEntitlementCheck = options.licenseType === LicenseType.floating; + if (!skipEntitlementCheck) { const activeLicenses = await this.GetActiveEntitlements(); @@ -572,7 +577,6 @@ export class LicensingClient { switch (options.licenseType) { case LicenseType.floating: { - await this.Context(); await this.waitForLicenseServerConfiguration(); const output = await this.exec([`--acquire-floating`], true); const tokenMatch = output.match(/with token:\s*"(?[\w-]+)"/); From 35bd2848519af378bf339b1df5fdba66050e673e Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Fri, 28 Nov 2025 14:48:43 -0500 Subject: [PATCH 2/2] update tests --- tests/license-client.test.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/license-client.test.ts b/tests/license-client.test.ts index b5dfe5a..f256e10 100644 --- a/tests/license-client.test.ts +++ b/tests/license-client.test.ts @@ -39,13 +39,13 @@ describe('LicensingClient services config handling', () => { }); describe('LicensingClient floating activation order', () => { - it('prepares services config before checking entitlements', async () => { + it('prepares services config without checking entitlements', async () => { const client = new LicensingClient(); const setupSpy = jest.spyOn(client as any, 'setupServicesConfig').mockResolvedValue('/tmp/services-config.json'); const entitlementsSpy = jest.spyOn(client, 'GetActiveEntitlements').mockResolvedValue([]); jest.spyOn(client, 'Context').mockResolvedValue(); - jest.spyOn(client as any, 'waitForLicenseServerConfiguration').mockResolvedValue(undefined); - jest.spyOn(client as any, 'exec').mockResolvedValue('Successfully acquired with token: "token-123"'); + const waitSpy = jest.spyOn(client as any, 'waitForLicenseServerConfiguration').mockResolvedValue(undefined); + const execSpy = jest.spyOn(client as any, 'exec').mockResolvedValue('Successfully acquired with token: "token-123"'); await client.Activate({ licenseType: LicenseType.floating, @@ -53,8 +53,10 @@ describe('LicensingClient floating activation order', () => { }); expect(setupSpy).toHaveBeenCalledTimes(1); - expect(entitlementsSpy).toHaveBeenCalledTimes(1); - expect(entitlementsSpy.mock.invocationCallOrder[0]).toBeGreaterThan(setupSpy.mock.invocationCallOrder[0]); + expect(entitlementsSpy).not.toHaveBeenCalled(); + expect(waitSpy).toHaveBeenCalledTimes(1); + expect(execSpy).toHaveBeenCalledTimes(1); + expect(execSpy.mock.invocationCallOrder[0]).toBeGreaterThan(waitSpy.mock.invocationCallOrder[0]); }); }); @@ -69,6 +71,7 @@ describe('LicensingClient waitForLicenseServerConfiguration', () => { const client = new LicensingClient(); const tempLog = createTempLog(); jest.spyOn(LicensingClient, 'ClientLogPath').mockReturnValue(tempLog); + jest.spyOn(client as any, 'exec').mockResolvedValue(''); setTimeout(() => { fs.appendFileSync(tempLog, '\nFloating license server URL is: https://example.com (via config file)\n'); @@ -82,6 +85,7 @@ describe('LicensingClient waitForLicenseServerConfiguration', () => { const client = new LicensingClient(); const tempLog = createTempLog(); jest.spyOn(LicensingClient, 'ClientLogPath').mockReturnValue(tempLog); + jest.spyOn(client as any, 'exec').mockResolvedValue(''); await expect((client as any).waitForLicenseServerConfiguration(200, 10)).rejects.toThrow(/Timed out waiting for floating license server configuration/); fs.rmSync(tempLog, { force: true });