appium-xcode 6.2.1 → 6.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/build/lib/helpers.d.ts +0 -9
- package/build/lib/helpers.d.ts.map +1 -1
- package/build/lib/helpers.js +10 -31
- package/build/lib/helpers.js.map +1 -1
- package/build/lib/index.d.ts +9 -3
- package/build/lib/index.d.ts.map +1 -1
- package/build/lib/xcode.d.ts +9 -3
- package/build/lib/xcode.d.ts.map +1 -1
- package/build/lib/xcode.js +7 -5
- package/build/lib/xcode.js.map +1 -1
- package/lib/helpers.ts +11 -40
- package/lib/xcode.ts +10 -7
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [6.2.2](https://github.com/appium/appium-xcode/compare/v6.2.1...v6.2.2) (2026-05-07)
|
|
2
|
+
|
|
3
|
+
### Miscellaneous Chores
|
|
4
|
+
|
|
5
|
+
* Use memoize import from support lib ([#175](https://github.com/appium/appium-xcode/issues/175)) ([b9cef87](https://github.com/appium/appium-xcode/commit/b9cef876da32eb55ec3301c9ccfe6f0d459a3fc3))
|
|
6
|
+
|
|
1
7
|
## [6.2.1](https://github.com/appium/appium-xcode/compare/v6.2.0...v6.2.1) (2026-04-29)
|
|
2
8
|
|
|
3
9
|
### Bug Fixes
|
package/build/lib/helpers.d.ts
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import type { TeenProcessExecResult } from 'teen_process';
|
|
2
2
|
export declare const XCRUN_TIMEOUT = 15000;
|
|
3
|
-
type AnyFunction = (this: any, ...args: any[]) => any;
|
|
4
|
-
/**
|
|
5
|
-
* Memoizes function calls by traversing a nested argument-keyed map.
|
|
6
|
-
*
|
|
7
|
-
* @param fn The function to memoize
|
|
8
|
-
* @returns A memoized wrapper around the input function
|
|
9
|
-
*/
|
|
10
|
-
export declare function memoize<F extends AnyFunction>(fn: F): F;
|
|
11
3
|
/**
|
|
12
4
|
* Executes 'xcrun' command line utility
|
|
13
5
|
*
|
|
@@ -31,5 +23,4 @@ export declare function findAppPaths(bundleId: string): Promise<string[]>;
|
|
|
31
23
|
* @returns All plist entries as an object or an empty object if no plist was found
|
|
32
24
|
*/
|
|
33
25
|
export declare function readXcodePlist(developerRoot: string): Promise<Record<string, any>>;
|
|
34
|
-
export {};
|
|
35
26
|
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../lib/helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,cAAc,CAAC;AAIxD,eAAO,MAAM,aAAa,QAAQ,CAAC;AAEnC
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../lib/helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,cAAc,CAAC;AAIxD,eAAO,MAAM,aAAa,QAAQ,CAAC;AAEnC;;;;;;;GAOG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,GAAE,MAAsB,GAC9B,OAAO,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAiBxC;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAwBtE;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAGxF"}
|
package/build/lib/helpers.js
CHANGED
|
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.XCRUN_TIMEOUT = void 0;
|
|
7
|
-
exports.memoize = memoize;
|
|
8
7
|
exports.runXcrunCommand = runXcrunCommand;
|
|
9
8
|
exports.findAppPaths = findAppPaths;
|
|
10
9
|
exports.readXcodePlist = readXcodePlist;
|
|
@@ -12,32 +11,6 @@ const teen_process_1 = require("teen_process");
|
|
|
12
11
|
const support_1 = require("@appium/support");
|
|
13
12
|
const node_path_1 = __importDefault(require("node:path"));
|
|
14
13
|
exports.XCRUN_TIMEOUT = 15000;
|
|
15
|
-
/**
|
|
16
|
-
* Memoizes function calls by traversing a nested argument-keyed map.
|
|
17
|
-
*
|
|
18
|
-
* @param fn The function to memoize
|
|
19
|
-
* @returns A memoized wrapper around the input function
|
|
20
|
-
*/
|
|
21
|
-
function memoize(fn) {
|
|
22
|
-
const rootCache = new Map();
|
|
23
|
-
const RESULT = Symbol('memoize.result');
|
|
24
|
-
function memoized(...args) {
|
|
25
|
-
let currentCache = rootCache;
|
|
26
|
-
for (const arg of args) {
|
|
27
|
-
if (!currentCache.has(arg)) {
|
|
28
|
-
currentCache.set(arg, new Map());
|
|
29
|
-
}
|
|
30
|
-
currentCache = currentCache.get(arg);
|
|
31
|
-
}
|
|
32
|
-
if (currentCache.has(RESULT)) {
|
|
33
|
-
return currentCache.get(RESULT);
|
|
34
|
-
}
|
|
35
|
-
const result = fn.apply(this, args);
|
|
36
|
-
currentCache.set(RESULT, result);
|
|
37
|
-
return result;
|
|
38
|
-
}
|
|
39
|
-
return memoized;
|
|
40
|
-
}
|
|
41
14
|
/**
|
|
42
15
|
* Executes 'xcrun' command line utility
|
|
43
16
|
*
|
|
@@ -51,11 +24,17 @@ async function runXcrunCommand(args, timeout = exports.XCRUN_TIMEOUT) {
|
|
|
51
24
|
return await (0, teen_process_1.exec)('xcrun', args, { timeout });
|
|
52
25
|
}
|
|
53
26
|
catch (err) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
27
|
+
if (err instanceof Error) {
|
|
28
|
+
// the true error can be hidden within the stderr
|
|
29
|
+
const stderr = err && typeof err === 'object' && 'stderr' in err
|
|
30
|
+
? String(err.stderr)
|
|
31
|
+
: '';
|
|
32
|
+
if (stderr) {
|
|
33
|
+
err.message = `${err.message}: ${stderr}`;
|
|
34
|
+
}
|
|
35
|
+
throw err;
|
|
57
36
|
}
|
|
58
|
-
throw err;
|
|
37
|
+
throw new Error(String(err), { cause: err });
|
|
59
38
|
}
|
|
60
39
|
}
|
|
61
40
|
/**
|
package/build/lib/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../lib/helpers.ts"],"names":[],"mappings":";;;;;;AAeA,
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../lib/helpers.ts"],"names":[],"mappings":";;;;;;AAeA,0CAoBC;AAQD,oCAwBC;AAQD,wCAGC;AA9ED,+CAAkC;AAElC,6CAA0C;AAC1C,0DAA6B;AAEhB,QAAA,aAAa,GAAG,KAAK,CAAC;AAEnC;;;;;;;GAOG;AACI,KAAK,UAAU,eAAe,CACnC,IAAc,EACd,UAAkB,qBAAa;IAE/B,IAAI,CAAC;QACH,OAAO,MAAM,IAAA,mBAAI,EAAC,OAAO,EAAE,IAAI,EAAE,EAAC,OAAO,EAAC,CAAC,CAAC;IAC9C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,KAAK,EAAE,CAAC;YACzB,iDAAiD;YACjD,MAAM,MAAM,GACV,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,QAAQ,IAAI,GAAG;gBAC/C,CAAC,CAAC,MAAM,CAAE,GAAyB,CAAC,MAAM,CAAC;gBAC3C,CAAC,CAAC,EAAE,CAAC;YACT,IAAI,MAAM,EAAE,CAAC;gBACX,GAAG,CAAC,OAAO,GAAG,GAAG,GAAG,CAAC,OAAO,KAAK,MAAM,EAAE,CAAC;YAC5C,CAAC;YACD,MAAM,GAAG,CAAC;QACZ,CAAC;QACD,MAAM,IAAI,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AC,CAAC,MAAM,eAAK,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACnF,CAAC"}
|
package/build/lib/index.d.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { getPath, getVersion, getMaxIOSSDK, getMaxTVOSSDK, getClangVersion } from './xcode';
|
|
2
2
|
declare const xcode: {
|
|
3
|
-
getPath: (timeout?: number) => Promise<string
|
|
3
|
+
getPath: ((timeout?: number) => Promise<string>) & {
|
|
4
|
+
cache: Map<unknown, Promise<string>>;
|
|
5
|
+
};
|
|
4
6
|
getVersion: typeof getVersion;
|
|
5
|
-
getMaxIOSSDK: (retries?: number, timeout?: number) => Promise<string | null
|
|
6
|
-
|
|
7
|
+
getMaxIOSSDK: ((retries?: number, timeout?: number) => Promise<string | null>) & {
|
|
8
|
+
cache: Map<unknown, Promise<string | null>>;
|
|
9
|
+
};
|
|
10
|
+
getMaxTVOSSDK: ((retries?: number, timeout?: number) => Promise<string>) & {
|
|
11
|
+
cache: Map<unknown, Promise<string>>;
|
|
12
|
+
};
|
|
7
13
|
getClangVersion: typeof getClangVersion;
|
|
8
14
|
};
|
|
9
15
|
export { getPath, getVersion, getMaxIOSSDK, getMaxTVOSSDK, getClangVersion };
|
package/build/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAC,MAAM,SAAS,CAAC;AAE1F,QAAA,MAAM,KAAK
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAC,MAAM,SAAS,CAAC;AAE1F,QAAA,MAAM,KAAK;;;;;;;;;;;;CAMV,CAAC;AAEF,OAAO,EAAC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAC,CAAC;AAC3E,eAAe,KAAK,CAAC;AAErB,YAAY,EAAC,YAAY,EAAC,MAAM,SAAS,CAAC"}
|
package/build/lib/xcode.d.ts
CHANGED
|
@@ -22,7 +22,9 @@ export declare function getPathFromDeveloperDir(): Promise<string>;
|
|
|
22
22
|
* @returns Full path to Xcode Developer subfolder timeout
|
|
23
23
|
* @throws {Error} If there was an error while retrieving the path.
|
|
24
24
|
*/
|
|
25
|
-
export declare const getPath: (timeout?: number) => Promise<string
|
|
25
|
+
export declare const getPath: ((timeout?: number) => Promise<string>) & {
|
|
26
|
+
cache: Map<unknown, Promise<string>>;
|
|
27
|
+
};
|
|
26
28
|
/**
|
|
27
29
|
* Retrieves Xcode version
|
|
28
30
|
*
|
|
@@ -59,7 +61,9 @@ export declare function getMaxIOSSDKWithoutRetry(timeout?: number): Promise<stri
|
|
|
59
61
|
* @returns The SDK version
|
|
60
62
|
* @throws {Error} If the SDK version number cannot be determined
|
|
61
63
|
*/
|
|
62
|
-
export declare const getMaxIOSSDK: (retries?: number, timeout?: number) => Promise<string | null
|
|
64
|
+
export declare const getMaxIOSSDK: ((retries?: number, timeout?: number) => Promise<string | null>) & {
|
|
65
|
+
cache: Map<unknown, Promise<string | null>>;
|
|
66
|
+
};
|
|
63
67
|
/**
|
|
64
68
|
* Retrieves the maximum version of tvOS SDK supported by the installed Xcode
|
|
65
69
|
*
|
|
@@ -76,5 +80,7 @@ export declare function getMaxTVOSSDKWithoutRetry(timeout?: number): Promise<str
|
|
|
76
80
|
* @returns The SDK version
|
|
77
81
|
* @throws {Error} If the SDK version number cannot be determined
|
|
78
82
|
*/
|
|
79
|
-
export declare const getMaxTVOSSDK: (retries?: number, timeout?: number) => Promise<string
|
|
83
|
+
export declare const getMaxTVOSSDK: ((retries?: number, timeout?: number) => Promise<string>) & {
|
|
84
|
+
cache: Map<unknown, Promise<string>>;
|
|
85
|
+
};
|
|
80
86
|
//# sourceMappingURL=xcode.d.ts.map
|
package/build/lib/xcode.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xcode.d.ts","sourceRoot":"","sources":["../../lib/xcode.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,SAAS,CAAC;AAO1C;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAAC,OAAO,GAAE,MAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"xcode.d.ts","sourceRoot":"","sources":["../../lib/xcode.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,SAAS,CAAC;AAO1C;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAAC,OAAO,GAAE,MAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,CA0C7F;AAED;;;;;;GAMG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,MAAM,CAAC,CAe/D;AAED;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,cACR,MAAM,KAAmB,OAAO,CAAC,MAAM,CAAC;;CAEnD,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAsB,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AACpG,wBAAsB,UAAU,CAC9B,KAAK,EAAE,IAAI,EACX,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,YAAY,CAAC,CAAC;AA0BzB;;;;;;;GAOG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAiB9D;AAED;;;;;;GAMG;AACH,wBAAsB,wBAAwB,CAAC,OAAO,GAAE,MAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,CAS/F;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,cACd,MAAM,YACN,MAAM;;CAGf,CAAC;AAEH;;;;;;GAMG;AACH,wBAAsB,yBAAyB,CAAC,OAAO,GAAE,MAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,CAQhG;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,cACf,MAAM,YACN,MAAM,KACd,OAAO,CAAC,MAAM,CAAC;;CAEhB,CAAC"}
|
package/build/lib/xcode.js
CHANGED
|
@@ -74,8 +74,10 @@ async function getPathFromXcodeSelect(timeout = helpers_1.XCRUN_TIMEOUT) {
|
|
|
74
74
|
({ stdout } = await (0, teen_process_1.exec)('xcode-select', ['--print-path'], { timeout }));
|
|
75
75
|
}
|
|
76
76
|
catch (e) {
|
|
77
|
+
const stderr = e && typeof e === 'object' && 'stderr' in e ? String(e.stderr) : '';
|
|
78
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
77
79
|
const msg = `Cannot determine the path to Xcode by running 'xcode-select -p' command. ` +
|
|
78
|
-
`Original error: ${
|
|
80
|
+
`Original error: ${stderr || message}`;
|
|
79
81
|
throw new Error(msg);
|
|
80
82
|
}
|
|
81
83
|
// trim and remove trailing slash
|
|
@@ -119,7 +121,7 @@ async function getPathFromDeveloperDir() {
|
|
|
119
121
|
* @returns Full path to Xcode Developer subfolder timeout
|
|
120
122
|
* @throws {Error} If there was an error while retrieving the path.
|
|
121
123
|
*/
|
|
122
|
-
exports.getPath =
|
|
124
|
+
exports.getPath = support_1.util.memoize((timeout = helpers_1.XCRUN_TIMEOUT) => process.env.DEVELOPER_DIR ? getPathFromDeveloperDir() : getPathFromXcodeSelect(timeout));
|
|
123
125
|
async function getVersion(parse = false, retries = DEFAULT_NUMBER_OF_RETRIES, timeout = helpers_1.XCRUN_TIMEOUT) {
|
|
124
126
|
const version = (await getVersionMemoized(retries, timeout));
|
|
125
127
|
// xcode version strings are not exactly semver string: patch versions of 0
|
|
@@ -189,7 +191,7 @@ async function getMaxIOSSDKWithoutRetry(timeout = helpers_1.XCRUN_TIMEOUT) {
|
|
|
189
191
|
* @returns The SDK version
|
|
190
192
|
* @throws {Error} If the SDK version number cannot be determined
|
|
191
193
|
*/
|
|
192
|
-
exports.getMaxIOSSDK =
|
|
194
|
+
exports.getMaxIOSSDK = support_1.util.memoize(function getMaxIOSSDK(retries = DEFAULT_NUMBER_OF_RETRIES, timeout = helpers_1.XCRUN_TIMEOUT) {
|
|
193
195
|
return (0, asyncbox_1.retry)(retries, getMaxIOSSDKWithoutRetry, timeout);
|
|
194
196
|
});
|
|
195
197
|
/**
|
|
@@ -216,7 +218,7 @@ async function getMaxTVOSSDKWithoutRetry(timeout = helpers_1.XCRUN_TIMEOUT) {
|
|
|
216
218
|
* @returns The SDK version
|
|
217
219
|
* @throws {Error} If the SDK version number cannot be determined
|
|
218
220
|
*/
|
|
219
|
-
exports.getMaxTVOSSDK =
|
|
221
|
+
exports.getMaxTVOSSDK = support_1.util.memoize(async function getMaxTVOSSDK(retries = DEFAULT_NUMBER_OF_RETRIES, timeout = helpers_1.XCRUN_TIMEOUT) {
|
|
220
222
|
return (await (0, asyncbox_1.retry)(retries, getMaxTVOSSDKWithoutRetry, timeout));
|
|
221
223
|
});
|
|
222
224
|
// Private helper functions
|
|
@@ -241,7 +243,7 @@ async function getVersionWithoutRetry(timeout = helpers_1.XCRUN_TIMEOUT) {
|
|
|
241
243
|
* @returns Xcode version
|
|
242
244
|
* @throws {Error} If there was a failure while retrieving the version
|
|
243
245
|
*/
|
|
244
|
-
const getVersionMemoized =
|
|
246
|
+
const getVersionMemoized = support_1.util.memoize(function getVersionMemoized(retries = DEFAULT_NUMBER_OF_RETRIES, timeout = helpers_1.XCRUN_TIMEOUT) {
|
|
245
247
|
return (0, asyncbox_1.retry)(retries, getVersionWithoutRetry, timeout);
|
|
246
248
|
});
|
|
247
249
|
//# sourceMappingURL=xcode.js.map
|
package/build/lib/xcode.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xcode.js","sourceRoot":"","sources":["../../lib/xcode.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,
|
|
1
|
+
{"version":3,"file":"xcode.js","sourceRoot":"","sources":["../../lib/xcode.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,wDA0CC;AASD,0DAeC;AA6BD,gCAuBC;AAUD,0CAiBC;AASD,4DASC;AAwBD,8DAQC;AAvND,6CAAiD;AACjD,0DAA6B;AAC7B,uCAA+B;AAC/B,+CAAkC;AAClC,+CAAiC;AACjC,uCAAuF;AAGvF,MAAM,yBAAyB,GAAG,CAAC,CAAC;AACpC,MAAM,eAAe,GAAG,oBAAoB,CAAC;AAE7C,MAAM,GAAG,GAAG,gBAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AAEtC;;;;;;GAMG;AACI,KAAK,UAAU,sBAAsB,CAAC,UAAkB,uBAAa;IAC1E,MAAM,oBAAoB,GAAG,KAAK,EAAE,MAAc,EAAmB,EAAE;QACrE,MAAM,UAAU,GAAG,MAAM,IAAA,sBAAY,EAAC,eAAe,CAAC,CAAC;QACvD,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;YACvB,OAAO,GAAG,MAAM,oDAAoD,CAAC;QACvE,CAAC;QAED,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,CAC9B,CAAC,CAAC,EAAE,EAAE,CAAC,6BAA6B,mBAAI,CAAC,IAAI,CAAC,CAAC,EAAE,UAAU,EAAE,WAAW,CAAC,GAAG,CAC7E,CAAC;QACF,OAAO,CACL,GAAG,MAAM,IAAI;YACb,mBAAmB,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,0BAA0B,CAC7G,CAAC;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C;IAC7C,qEAAqE;IACrE,MAAM,EAAC,0BAA0B,EAAC,GAAG,MAAM,IAAA,wBAAc,EAAC,aAAa,CAAC,CAAC;IACzE,OAAO,MAAM,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAC;AACnD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,kBAAkB,GAAG,cAAI,CAAC,OAAO,CAAC,SAAS,kBAAkB,CACjE,UAAkB,yBAAyB,EAC3C,UAAkB,uBAAa;IAE/B,OAAO,IAAA,gBAAK,EAAC,OAAO,EAAE,sBAAsB,EAAE,OAAO,CAAC,CAAC;AACzD,CAAC,CAAC,CAAC"}
|
package/lib/helpers.ts
CHANGED
|
@@ -5,41 +5,6 @@ import path from 'node:path';
|
|
|
5
5
|
|
|
6
6
|
export const XCRUN_TIMEOUT = 15000;
|
|
7
7
|
|
|
8
|
-
type AnyFunction = (this: any, ...args: any[]) => any;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Memoizes function calls by traversing a nested argument-keyed map.
|
|
12
|
-
*
|
|
13
|
-
* @param fn The function to memoize
|
|
14
|
-
* @returns A memoized wrapper around the input function
|
|
15
|
-
*/
|
|
16
|
-
export function memoize<F extends AnyFunction>(fn: F): F {
|
|
17
|
-
const rootCache = new Map<any, any>();
|
|
18
|
-
const RESULT = Symbol('memoize.result');
|
|
19
|
-
|
|
20
|
-
function memoized(this: ThisParameterType<F>, ...args: Parameters<F>): ReturnType<F> {
|
|
21
|
-
let currentCache = rootCache;
|
|
22
|
-
|
|
23
|
-
for (const arg of args) {
|
|
24
|
-
if (!currentCache.has(arg)) {
|
|
25
|
-
currentCache.set(arg, new Map());
|
|
26
|
-
}
|
|
27
|
-
currentCache = currentCache.get(arg);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (currentCache.has(RESULT)) {
|
|
31
|
-
return currentCache.get(RESULT);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const result = fn.apply(this, args);
|
|
35
|
-
currentCache.set(RESULT, result);
|
|
36
|
-
|
|
37
|
-
return result;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return memoized as F;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
8
|
/**
|
|
44
9
|
* Executes 'xcrun' command line utility
|
|
45
10
|
*
|
|
@@ -55,12 +20,18 @@ export async function runXcrunCommand(
|
|
|
55
20
|
try {
|
|
56
21
|
return await exec('xcrun', args, {timeout});
|
|
57
22
|
} catch (err) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
23
|
+
if (err instanceof Error) {
|
|
24
|
+
// the true error can be hidden within the stderr
|
|
25
|
+
const stderr =
|
|
26
|
+
err && typeof err === 'object' && 'stderr' in err
|
|
27
|
+
? String((err as {stderr: unknown}).stderr)
|
|
28
|
+
: '';
|
|
29
|
+
if (stderr) {
|
|
30
|
+
err.message = `${err.message}: ${stderr}`;
|
|
31
|
+
}
|
|
32
|
+
throw err;
|
|
61
33
|
}
|
|
62
|
-
|
|
63
|
-
throw err;
|
|
34
|
+
throw new Error(String(err), {cause: err});
|
|
64
35
|
}
|
|
65
36
|
}
|
|
66
37
|
|
package/lib/xcode.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {fs, logger} from '@appium/support';
|
|
1
|
+
import {fs, logger, util} from '@appium/support';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import {retry} from 'asyncbox';
|
|
4
4
|
import {exec} from 'teen_process';
|
|
5
5
|
import * as semver from 'semver';
|
|
6
|
-
import {runXcrunCommand, findAppPaths, XCRUN_TIMEOUT, readXcodePlist
|
|
6
|
+
import {runXcrunCommand, findAppPaths, XCRUN_TIMEOUT, readXcodePlist} from './helpers';
|
|
7
7
|
import type {XcodeVersion} from './types';
|
|
8
8
|
|
|
9
9
|
const DEFAULT_NUMBER_OF_RETRIES = 2;
|
|
@@ -38,9 +38,12 @@ export async function getPathFromXcodeSelect(timeout: number = XCRUN_TIMEOUT): P
|
|
|
38
38
|
try {
|
|
39
39
|
({stdout} = await exec('xcode-select', ['--print-path'], {timeout}));
|
|
40
40
|
} catch (e) {
|
|
41
|
+
const stderr =
|
|
42
|
+
e && typeof e === 'object' && 'stderr' in e ? String((e as {stderr: unknown}).stderr) : '';
|
|
43
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
41
44
|
const msg =
|
|
42
45
|
`Cannot determine the path to Xcode by running 'xcode-select -p' command. ` +
|
|
43
|
-
`Original error: ${
|
|
46
|
+
`Original error: ${stderr || message}`;
|
|
44
47
|
throw new Error(msg);
|
|
45
48
|
}
|
|
46
49
|
// trim and remove trailing slash
|
|
@@ -90,7 +93,7 @@ export async function getPathFromDeveloperDir(): Promise<string> {
|
|
|
90
93
|
* @returns Full path to Xcode Developer subfolder timeout
|
|
91
94
|
* @throws {Error} If there was an error while retrieving the path.
|
|
92
95
|
*/
|
|
93
|
-
export const getPath = memoize(
|
|
96
|
+
export const getPath = util.memoize(
|
|
94
97
|
(timeout: number = XCRUN_TIMEOUT): Promise<string> =>
|
|
95
98
|
process.env.DEVELOPER_DIR ? getPathFromDeveloperDir() : getPathFromXcodeSelect(timeout),
|
|
96
99
|
);
|
|
@@ -188,7 +191,7 @@ export async function getMaxIOSSDKWithoutRetry(timeout: number = XCRUN_TIMEOUT):
|
|
|
188
191
|
* @returns The SDK version
|
|
189
192
|
* @throws {Error} If the SDK version number cannot be determined
|
|
190
193
|
*/
|
|
191
|
-
export const getMaxIOSSDK = memoize(function getMaxIOSSDK(
|
|
194
|
+
export const getMaxIOSSDK = util.memoize(function getMaxIOSSDK(
|
|
192
195
|
retries: number = DEFAULT_NUMBER_OF_RETRIES,
|
|
193
196
|
timeout: number = XCRUN_TIMEOUT,
|
|
194
197
|
) {
|
|
@@ -220,7 +223,7 @@ export async function getMaxTVOSSDKWithoutRetry(timeout: number = XCRUN_TIMEOUT)
|
|
|
220
223
|
* @returns The SDK version
|
|
221
224
|
* @throws {Error} If the SDK version number cannot be determined
|
|
222
225
|
*/
|
|
223
|
-
export const getMaxTVOSSDK = memoize(async function getMaxTVOSSDK(
|
|
226
|
+
export const getMaxTVOSSDK = util.memoize(async function getMaxTVOSSDK(
|
|
224
227
|
retries: number = DEFAULT_NUMBER_OF_RETRIES,
|
|
225
228
|
timeout: number = XCRUN_TIMEOUT,
|
|
226
229
|
): Promise<string> {
|
|
@@ -253,7 +256,7 @@ async function getVersionWithoutRetry(
|
|
|
253
256
|
* @returns Xcode version
|
|
254
257
|
* @throws {Error} If there was a failure while retrieving the version
|
|
255
258
|
*/
|
|
256
|
-
const getVersionMemoized = memoize(function getVersionMemoized(
|
|
259
|
+
const getVersionMemoized = util.memoize(function getVersionMemoized(
|
|
257
260
|
retries: number = DEFAULT_NUMBER_OF_RETRIES,
|
|
258
261
|
timeout: number = XCRUN_TIMEOUT,
|
|
259
262
|
): Promise<semver.SemVer | null> {
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"ios",
|
|
7
7
|
"xcode"
|
|
8
8
|
],
|
|
9
|
-
"version": "6.2.
|
|
9
|
+
"version": "6.2.2",
|
|
10
10
|
"author": "Appium Contributors",
|
|
11
11
|
"license": "Apache-2.0",
|
|
12
12
|
"repository": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"CHANGELOG.md"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@appium/support": "^7.
|
|
31
|
+
"@appium/support": "^7.2.2",
|
|
32
32
|
"asyncbox": "^6.0.1",
|
|
33
33
|
"semver": "^7.0.0",
|
|
34
34
|
"teen_process": "^4.0.4"
|
|
@@ -57,8 +57,11 @@
|
|
|
57
57
|
"@appium/types": "^1.0.0-rc.1",
|
|
58
58
|
"@semantic-release/changelog": "^6.0.1",
|
|
59
59
|
"@semantic-release/git": "^10.0.1",
|
|
60
|
+
"@types/chai": "^5.2.3",
|
|
61
|
+
"@types/chai-as-promised": "^8.0.2",
|
|
60
62
|
"@types/mocha": "^10.0.1",
|
|
61
63
|
"@types/node": "^25.0.0",
|
|
64
|
+
"@types/semver": "^7.7.1",
|
|
62
65
|
"chai": "^6.0.0",
|
|
63
66
|
"chai-as-promised": "^8.0.0",
|
|
64
67
|
"conventional-changelog-conventionalcommits": "^9.0.0",
|