appium-xcode 5.2.0 → 5.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 +15 -0
- package/build/lib/helpers.js +78 -0
- package/build/lib/helpers.js.map +1 -0
- package/build/lib/index.js +22 -0
- package/build/lib/index.js.map +1 -0
- package/build/lib/xcode.js +248 -0
- package/build/lib/xcode.js.map +1 -0
- package/package.json +3 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## [5.2.2](https://github.com/appium/appium-xcode/compare/v5.2.1...v5.2.2) (2023-10-19)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Miscellaneous Chores
|
|
5
|
+
|
|
6
|
+
* **deps-dev:** bump eslint-config-prettier from 8.10.0 to 9.0.0 ([#112](https://github.com/appium/appium-xcode/issues/112)) ([59e434e](https://github.com/appium/appium-xcode/commit/59e434efc171b664f0fa79a310dbc067d24c801e))
|
|
7
|
+
* **deps:** bump @types/teen_process from 2.0.0 to 2.0.1 ([b4f2e1b](https://github.com/appium/appium-xcode/commit/b4f2e1b9244b1d607b58600fa5ca9f7828da3600))
|
|
8
|
+
|
|
9
|
+
## [5.2.1](https://github.com/appium/appium-xcode/compare/v5.2.0...v5.2.1) (2023-08-31)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* Tune package.json ([98db315](https://github.com/appium/appium-xcode/commit/98db315fc7b7614a86757dfb31b1bae2ea9ed2b2))
|
|
15
|
+
|
|
1
16
|
## [5.2.0](https://github.com/appium/appium-xcode/compare/v5.1.7...v5.2.0) (2023-08-31)
|
|
2
17
|
|
|
3
18
|
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.readXcodePlist = exports.findAppPaths = exports.runXcrunCommand = exports.XCRUN_TIMEOUT = void 0;
|
|
7
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
+
const bluebird_1 = __importDefault(require("bluebird"));
|
|
9
|
+
const teen_process_1 = require("teen_process");
|
|
10
|
+
const support_1 = require("@appium/support");
|
|
11
|
+
const path_1 = __importDefault(require("path"));
|
|
12
|
+
exports.XCRUN_TIMEOUT = 15000;
|
|
13
|
+
/**
|
|
14
|
+
* Executes 'xcrun' command line utility
|
|
15
|
+
*
|
|
16
|
+
* @param {string[]} args xcrun arguments
|
|
17
|
+
* @param {number} timeout [15000] The maximum number of milliseconds to wait until xcrun exists
|
|
18
|
+
* @returns {Promise<import("teen_process").TeenProcessExecResult>} The result of xcrun execution
|
|
19
|
+
* @throws {Error} If xcrun returned non-zero exit code or timed out
|
|
20
|
+
*/
|
|
21
|
+
async function runXcrunCommand(args, timeout = exports.XCRUN_TIMEOUT) {
|
|
22
|
+
try {
|
|
23
|
+
return await (0, teen_process_1.exec)('xcrun', args, { timeout });
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
// the true error can be hidden within the stderr
|
|
27
|
+
if (err.stderr) {
|
|
28
|
+
err.message = `${err.message}: ${err.stderr}`;
|
|
29
|
+
}
|
|
30
|
+
throw err;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.runXcrunCommand = runXcrunCommand;
|
|
34
|
+
/**
|
|
35
|
+
* Uses macOS Spotlight service to detect where the given app is installed
|
|
36
|
+
*
|
|
37
|
+
* @param {string} bundleId Bundle identifier of the target app
|
|
38
|
+
* @returns {Promise<string[]>} Full paths to where the app with the given bundle id is present.
|
|
39
|
+
*/
|
|
40
|
+
async function findAppPaths(bundleId) {
|
|
41
|
+
let stdout;
|
|
42
|
+
try {
|
|
43
|
+
({ stdout } = await (0, teen_process_1.exec)('/usr/bin/mdfind', [
|
|
44
|
+
`kMDItemCFBundleIdentifier=${bundleId}`
|
|
45
|
+
]));
|
|
46
|
+
}
|
|
47
|
+
catch (e) {
|
|
48
|
+
return [];
|
|
49
|
+
}
|
|
50
|
+
const matchedPaths = lodash_1.default.trim(stdout)
|
|
51
|
+
.split('\n')
|
|
52
|
+
.map(lodash_1.default.trim)
|
|
53
|
+
.filter(Boolean);
|
|
54
|
+
if (lodash_1.default.isEmpty(matchedPaths)) {
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
57
|
+
const results = matchedPaths.map((p) => (async () => {
|
|
58
|
+
if (await support_1.fs.exists(p)) {
|
|
59
|
+
return p;
|
|
60
|
+
}
|
|
61
|
+
})());
|
|
62
|
+
return /** @type {string[]} */ (await bluebird_1.default.all(results)).filter(Boolean);
|
|
63
|
+
}
|
|
64
|
+
exports.findAppPaths = findAppPaths;
|
|
65
|
+
/**
|
|
66
|
+
* Finds and retrieves the content of the Xcode's Info.plist file
|
|
67
|
+
*
|
|
68
|
+
* @param {string} developerRoot Full path to the Contents/Developer folder under Xcode.app root
|
|
69
|
+
* @returns {Promise<object>} All plist entries as an object or an empty object if no plist was found
|
|
70
|
+
*/
|
|
71
|
+
async function readXcodePlist(developerRoot) {
|
|
72
|
+
const plistPath = path_1.default.resolve(developerRoot, '..', 'Info.plist');
|
|
73
|
+
return await support_1.fs.exists(plistPath)
|
|
74
|
+
? await support_1.plist.parsePlistFile(plistPath)
|
|
75
|
+
: {};
|
|
76
|
+
}
|
|
77
|
+
exports.readXcodePlist = readXcodePlist;
|
|
78
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../lib/helpers.js"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,wDAAyB;AACzB,+CAAoC;AACpC,6CAA4C;AAC5C,gDAAwB;AAEX,QAAA,aAAa,GAAG,KAAK,CAAC;AAEnC;;;;;;;GAOG;AACI,KA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OAAO,CAAC,CAAC;AACvE,CAAC;AAvBD,oCAuBC;AAED;;;;;GAKG;AACI,KAAK,UAAU,cAAc,CAAE,aAAa;IACjD,MAAM,SAAS,GAAG,cAAI,CAAC,OAAO,CAAC,aAAa,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;IAClE,OAAO,MAAM,YAAE,CAAC,MAAM,CAAC,SAAS,CAAC;QAC/B,CAAC,CAAC,MAAM,eAAK,CAAC,cAAc,CAAC,SAAS,CAAC;QACvC,CAAC,CAAC,EAAE,CAAC;AACT,CAAC;AALD,wCAKC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getClangVersion = exports.getMaxTVOSSDK = exports.getMaxIOSSDK = exports.getVersion = exports.getPath = void 0;
|
|
4
|
+
// transpile:main
|
|
5
|
+
const xcode_1 = require("./xcode");
|
|
6
|
+
Object.defineProperty(exports, "getPath", { enumerable: true, get: function () { return xcode_1.getPath; } });
|
|
7
|
+
Object.defineProperty(exports, "getVersion", { enumerable: true, get: function () { return xcode_1.getVersion; } });
|
|
8
|
+
Object.defineProperty(exports, "getMaxIOSSDK", { enumerable: true, get: function () { return xcode_1.getMaxIOSSDK; } });
|
|
9
|
+
Object.defineProperty(exports, "getMaxTVOSSDK", { enumerable: true, get: function () { return xcode_1.getMaxTVOSSDK; } });
|
|
10
|
+
Object.defineProperty(exports, "getClangVersion", { enumerable: true, get: function () { return xcode_1.getClangVersion; } });
|
|
11
|
+
const xcode = {
|
|
12
|
+
getPath: xcode_1.getPath,
|
|
13
|
+
getVersion: xcode_1.getVersion,
|
|
14
|
+
getMaxIOSSDK: xcode_1.getMaxIOSSDK,
|
|
15
|
+
getMaxTVOSSDK: xcode_1.getMaxTVOSSDK,
|
|
16
|
+
getClangVersion: xcode_1.getClangVersion
|
|
17
|
+
};
|
|
18
|
+
exports.default = xcode;
|
|
19
|
+
/**
|
|
20
|
+
* @typedef {import('./xcode').XcodeVersion} XcodeVersion
|
|
21
|
+
*/
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/index.js"],"names":[],"mappings":";;;AAAA,iBAAiB;AACjB,mCAMiB;AAWf,wFAhBA,eAAO,OAgBA;AACP,2FAhBA,kBAAU,OAgBA;AACV,6FAhBA,oBAAY,OAgBA;AACZ,8FAhBA,qBAAa,OAgBA;AACb,gGAhBA,uBAAe,OAgBA;AAbjB,MAAM,KAAK,GAAG;IACZ,OAAO,EAAP,eAAO;IACP,UAAU,EAAV,kBAAU;IACV,YAAY,EAAZ,oBAAY;IACZ,aAAa,EAAb,qBAAa;IACb,eAAe,EAAf,uBAAe;CAChB,CAAC;AASF,kBAAe,KAAK,CAAC;AAErB;;GAEG"}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getPathFromXcodeSelect = exports.getPathFromDeveloperDir = exports.getClangVersion = exports.getMaxTVOSSDKWithoutRetry = exports.getMaxTVOSSDK = exports.getMaxIOSSDKWithoutRetry = exports.getMaxIOSSDK = exports.getVersion = exports.getPath = void 0;
|
|
7
|
+
const support_1 = require("@appium/support");
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const asyncbox_1 = require("asyncbox");
|
|
10
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
11
|
+
const teen_process_1 = require("teen_process");
|
|
12
|
+
const semver_1 = __importDefault(require("semver"));
|
|
13
|
+
const helpers_1 = require("./helpers");
|
|
14
|
+
const DEFAULT_NUMBER_OF_RETRIES = 2;
|
|
15
|
+
const XCODE_BUNDLE_ID = 'com.apple.dt.Xcode';
|
|
16
|
+
const log = support_1.logger.getLogger('Xcode');
|
|
17
|
+
/**
|
|
18
|
+
* Retrieves the full path to Xcode Developer subfolder via xcode-select
|
|
19
|
+
*
|
|
20
|
+
* @param {number} timeout The maximum timeout for xcode-select execution
|
|
21
|
+
* @returns {Promise<string>} Full path to Xcode Developer subfolder
|
|
22
|
+
* @throws {Error} If it is not possible to retrieve a proper path
|
|
23
|
+
*/
|
|
24
|
+
async function getPathFromXcodeSelect(timeout = helpers_1.XCRUN_TIMEOUT) {
|
|
25
|
+
/**
|
|
26
|
+
* @param {string} prefix
|
|
27
|
+
* @returns {Promise<string>}
|
|
28
|
+
*/
|
|
29
|
+
const generateErrorMessage = async (prefix) => {
|
|
30
|
+
const xcodePaths = await (0, helpers_1.findAppPaths)(XCODE_BUNDLE_ID);
|
|
31
|
+
if (lodash_1.default.isEmpty(xcodePaths)) {
|
|
32
|
+
return `${prefix}. Consider installing Xcode to address this issue.`;
|
|
33
|
+
}
|
|
34
|
+
const proposals = xcodePaths.map((p) => ` sudo xcode-select -s "${path_1.default.join(p, 'Contents', 'Developer')}"`);
|
|
35
|
+
return `${prefix}. ` +
|
|
36
|
+
`Consider running${proposals.length > 1 ? ' any of' : ''}:\n${proposals.join('\n')}\nto address this issue.`;
|
|
37
|
+
};
|
|
38
|
+
let stdout;
|
|
39
|
+
try {
|
|
40
|
+
({ stdout } = await (0, teen_process_1.exec)('xcode-select', ['--print-path'], { timeout }));
|
|
41
|
+
}
|
|
42
|
+
catch (e) {
|
|
43
|
+
const msg = `Cannot determine the path to Xcode by running 'xcode-select -p' command. ` +
|
|
44
|
+
`Original error: ${e.stderr || e.message}`;
|
|
45
|
+
log.error(msg);
|
|
46
|
+
throw new Error(msg);
|
|
47
|
+
}
|
|
48
|
+
// trim and remove trailing slash
|
|
49
|
+
const developerRoot = String(stdout).replace(/\/$/, '').trim();
|
|
50
|
+
if (!developerRoot) {
|
|
51
|
+
const msg = await generateErrorMessage(`'xcode-select -p' returned an empty string`);
|
|
52
|
+
log.error(msg);
|
|
53
|
+
throw new Error(msg);
|
|
54
|
+
}
|
|
55
|
+
// xcode-select might also return a path to command line tools
|
|
56
|
+
const { CFBundleIdentifier } = await (0, helpers_1.readXcodePlist)(developerRoot);
|
|
57
|
+
if (CFBundleIdentifier === XCODE_BUNDLE_ID) {
|
|
58
|
+
return developerRoot;
|
|
59
|
+
}
|
|
60
|
+
const msg = await generateErrorMessage(`'${developerRoot}' is not a valid Xcode path`);
|
|
61
|
+
log.error(msg);
|
|
62
|
+
throw msg;
|
|
63
|
+
}
|
|
64
|
+
exports.getPathFromXcodeSelect = getPathFromXcodeSelect;
|
|
65
|
+
/**
|
|
66
|
+
* Retrieves the full path to Xcode Developer subfolder via `DEVELOPER_DIR` environment variable
|
|
67
|
+
*
|
|
68
|
+
* @returns {Promise<string>} Full path to Xcode Developer subfolder
|
|
69
|
+
* @throws {Error} If it is not possible to retrieve a proper path
|
|
70
|
+
* @privateRemarks This method assumes `DEVELOPER_DIR` is defined.
|
|
71
|
+
*/
|
|
72
|
+
async function getPathFromDeveloperDir() {
|
|
73
|
+
const developerRoot = /** @type {string} */ (process.env.DEVELOPER_DIR);
|
|
74
|
+
const { CFBundleIdentifier } = await (0, helpers_1.readXcodePlist)(developerRoot);
|
|
75
|
+
if (CFBundleIdentifier === XCODE_BUNDLE_ID) {
|
|
76
|
+
return developerRoot;
|
|
77
|
+
}
|
|
78
|
+
const msg = `The path to Xcode Developer dir '${developerRoot}' provided in DEVELOPER_DIR ` +
|
|
79
|
+
`environment variable is not a valid path`;
|
|
80
|
+
log.error(msg);
|
|
81
|
+
throw new Error(msg);
|
|
82
|
+
}
|
|
83
|
+
exports.getPathFromDeveloperDir = getPathFromDeveloperDir;
|
|
84
|
+
/**
|
|
85
|
+
* Retrieves the full path to Xcode Developer subfolder.
|
|
86
|
+
* If `DEVELOPER_DIR` environment variable is provided then its value has a priority.
|
|
87
|
+
* @param {number} timeout The maximum timeout for xcode-select execution
|
|
88
|
+
* @returns {Promise<string>} Full path to Xcode Developer subfolder timeout
|
|
89
|
+
* @throws {Error} If there was an error while retrieving the path.
|
|
90
|
+
*/
|
|
91
|
+
const getPath = lodash_1.default.memoize(
|
|
92
|
+
/**
|
|
93
|
+
* @param {number} timeout
|
|
94
|
+
* @returns {Promise<string>}
|
|
95
|
+
*/
|
|
96
|
+
(timeout = helpers_1.XCRUN_TIMEOUT) => process.env.DEVELOPER_DIR ? getPathFromDeveloperDir() : getPathFromXcodeSelect(timeout));
|
|
97
|
+
exports.getPath = getPath;
|
|
98
|
+
/**
|
|
99
|
+
* Retrieves Xcode version
|
|
100
|
+
*
|
|
101
|
+
* @param {number} timeout [15000] Timeout of milliseconds to wait for terminal commands.
|
|
102
|
+
* @returns {Promise<import("semver").SemVer | null>} Xcode version
|
|
103
|
+
* @throws {Error} If there was a failure while retrieving the version
|
|
104
|
+
*/
|
|
105
|
+
async function getVersionWithoutRetry(timeout = helpers_1.XCRUN_TIMEOUT) {
|
|
106
|
+
const developerPath = await getPath(timeout);
|
|
107
|
+
// we want to read the CFBundleShortVersionString from Xcode's plist.
|
|
108
|
+
const { CFBundleShortVersionString } = await (0, helpers_1.readXcodePlist)(developerPath);
|
|
109
|
+
return semver_1.default.coerce(CFBundleShortVersionString);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Retrieves Xcode version or the cached one if called more than once
|
|
113
|
+
*
|
|
114
|
+
* @param {number} retries How many retries to apply for version retrieval
|
|
115
|
+
* @param {number} timeout Timeout of milliseconds to wait for terminal commands
|
|
116
|
+
* @returns {Promise<import("semver").SemVer | null>} Xcode version
|
|
117
|
+
* @throws {Error} If there was a failure while retrieving the version
|
|
118
|
+
*/
|
|
119
|
+
const getVersionMemoized = lodash_1.default.memoize(function getVersionMemoized(retries = DEFAULT_NUMBER_OF_RETRIES, timeout = helpers_1.XCRUN_TIMEOUT) {
|
|
120
|
+
return (0, asyncbox_1.retry)(retries, getVersionWithoutRetry, timeout);
|
|
121
|
+
});
|
|
122
|
+
/**
|
|
123
|
+
* @typedef {Object} XcodeVersion
|
|
124
|
+
* @property {string} versionString Xcode version as a string
|
|
125
|
+
* @property {number} versionFloat Xcode version as a float number
|
|
126
|
+
* @property {number} major Major number of Xcode version
|
|
127
|
+
* @property {number} minor Minor number of Xcode version
|
|
128
|
+
* @property {number} [patch] Patch number of Xcode version (if exists)
|
|
129
|
+
* @property {() => string} toString Returns Xcode version as a string
|
|
130
|
+
*/
|
|
131
|
+
/**
|
|
132
|
+
* Retrieves Xcode version
|
|
133
|
+
*
|
|
134
|
+
* @param {boolean} parse [false] Whether to parse the version to a XcodeVersion version
|
|
135
|
+
* @param {number} retries [2] How many retries to apply for getting the version number
|
|
136
|
+
* @param {number} timeout [15000] Timeout of milliseconds to wait for terminal commands
|
|
137
|
+
* @returns {Promise<XcodeVersion | string>} Xcode version depending on the value of `parse` flag
|
|
138
|
+
* @throws {Error} If there was a failure while retrieving the version
|
|
139
|
+
*/
|
|
140
|
+
async function getVersion(parse = false, retries = DEFAULT_NUMBER_OF_RETRIES, timeout = helpers_1.XCRUN_TIMEOUT) {
|
|
141
|
+
const version = /** @type {import('semver').SemVer} */ (await getVersionMemoized(retries, timeout));
|
|
142
|
+
// xcode version strings are not exactly semver string: patch versions of 0
|
|
143
|
+
// are removed (e.g., '10.0.0' => '10.0')
|
|
144
|
+
const versionString = version.patch > 0 ? version.version : `${version.major}.${version.minor}`;
|
|
145
|
+
if (!parse) {
|
|
146
|
+
return versionString;
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
versionString,
|
|
150
|
+
versionFloat: parseFloat(versionString),
|
|
151
|
+
major: version.major,
|
|
152
|
+
minor: version.minor,
|
|
153
|
+
patch: version.patch > 0 ? version.patch : undefined,
|
|
154
|
+
toString() {
|
|
155
|
+
return versionString;
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
exports.getVersion = getVersion;
|
|
160
|
+
/**
|
|
161
|
+
* Check https://trac.macports.org/wiki/XcodeVersionInfo
|
|
162
|
+
* to see the actual mapping between clang and other components.
|
|
163
|
+
*
|
|
164
|
+
* @returns {Promise<string|null>} The actual Clang version in x.x.x.x or x.x.x format,
|
|
165
|
+
* which is supplied with Command Line Tools. `null` is returned
|
|
166
|
+
* if CLT are not installed.
|
|
167
|
+
*/
|
|
168
|
+
async function getClangVersion() {
|
|
169
|
+
try {
|
|
170
|
+
await support_1.fs.which('clang');
|
|
171
|
+
}
|
|
172
|
+
catch (e) {
|
|
173
|
+
log.info('Cannot find clang executable on the local system. ' +
|
|
174
|
+
'Are Xcode Command Line Tools installed?');
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
const { stdout } = await (0, teen_process_1.exec)('clang', ['--version']);
|
|
178
|
+
const match = /clang-([0-9.]+)/.exec(stdout);
|
|
179
|
+
if (!match) {
|
|
180
|
+
log.info(`Cannot parse clang version from ${stdout}`);
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
return match[1];
|
|
184
|
+
}
|
|
185
|
+
exports.getClangVersion = getClangVersion;
|
|
186
|
+
/**
|
|
187
|
+
* Retrieves the maximum version of iOS SDK supported by the installed Xcode
|
|
188
|
+
*
|
|
189
|
+
* @param {number} timeout [15000] Timeout of milliseconds to wait for terminal commands
|
|
190
|
+
* @returns {Promise<string>} The SDK version
|
|
191
|
+
* @throws {Error} If the SDK version number cannot be determined
|
|
192
|
+
*/
|
|
193
|
+
async function getMaxIOSSDKWithoutRetry(timeout = helpers_1.XCRUN_TIMEOUT) {
|
|
194
|
+
const args = ['--sdk', 'iphonesimulator', '--show-sdk-version'];
|
|
195
|
+
const { stdout } = await (0, helpers_1.runXcrunCommand)(args, timeout);
|
|
196
|
+
const sdkVersion = stdout.trim();
|
|
197
|
+
const match = /\d.\d/.exec(stdout);
|
|
198
|
+
if (!match) {
|
|
199
|
+
throw new Error(`xcrun returned a non-numeric iOS SDK version: '${sdkVersion}'`);
|
|
200
|
+
}
|
|
201
|
+
return sdkVersion;
|
|
202
|
+
}
|
|
203
|
+
exports.getMaxIOSSDKWithoutRetry = getMaxIOSSDKWithoutRetry;
|
|
204
|
+
/**
|
|
205
|
+
* Retrieves the maximum version of iOS SDK supported by the installed Xcode
|
|
206
|
+
*
|
|
207
|
+
* @param {number} timeout Timeout of milliseconds to wait for terminal commands
|
|
208
|
+
* @param {number} retries The maximum number of retries
|
|
209
|
+
* @returns {string} The SDK version
|
|
210
|
+
* @throws {Error} If the SDK version number cannot be determined
|
|
211
|
+
*/
|
|
212
|
+
const getMaxIOSSDK = lodash_1.default.memoize(function getMaxIOSSDK(retries = DEFAULT_NUMBER_OF_RETRIES, timeout = helpers_1.XCRUN_TIMEOUT) {
|
|
213
|
+
return (0, asyncbox_1.retry)(retries, getMaxIOSSDKWithoutRetry, timeout);
|
|
214
|
+
});
|
|
215
|
+
exports.getMaxIOSSDK = getMaxIOSSDK;
|
|
216
|
+
/**
|
|
217
|
+
* Retrieves the maximum version of tvOS SDK supported by the installed Xcode
|
|
218
|
+
*
|
|
219
|
+
* @param {number} timeout Timeout of milliseconds to wait for terminal commands
|
|
220
|
+
* @returns {Promise<string>} The SDK version
|
|
221
|
+
* @throws {Error} If the SDK version number cannot be determined
|
|
222
|
+
*/
|
|
223
|
+
async function getMaxTVOSSDKWithoutRetry(timeout = helpers_1.XCRUN_TIMEOUT) {
|
|
224
|
+
const args = ['--sdk', 'appletvsimulator', '--show-sdk-version'];
|
|
225
|
+
const { stdout } = await (0, helpers_1.runXcrunCommand)(args, timeout);
|
|
226
|
+
const sdkVersion = stdout.trim();
|
|
227
|
+
if (isNaN(parseFloat(sdkVersion))) {
|
|
228
|
+
throw new Error(`xcrun returned a non-numeric tvOS SDK version: '${sdkVersion}'`);
|
|
229
|
+
}
|
|
230
|
+
return sdkVersion;
|
|
231
|
+
}
|
|
232
|
+
exports.getMaxTVOSSDKWithoutRetry = getMaxTVOSSDKWithoutRetry;
|
|
233
|
+
/**
|
|
234
|
+
* Retrieves the maximum version of tvOS SDK supported by the installed Xcode
|
|
235
|
+
*
|
|
236
|
+
* @throws {Error} If the SDK version number cannot be determined
|
|
237
|
+
*/
|
|
238
|
+
const getMaxTVOSSDK = lodash_1.default.memoize(
|
|
239
|
+
/**
|
|
240
|
+
* @param {number} timeout Timeout of milliseconds to wait for terminal commands
|
|
241
|
+
* @param {number} retries The maximum number of retries
|
|
242
|
+
* @returns {Promise<string>} The SDK version
|
|
243
|
+
*/
|
|
244
|
+
async function getMaxTVOSSDK(retries = DEFAULT_NUMBER_OF_RETRIES, timeout = helpers_1.XCRUN_TIMEOUT) {
|
|
245
|
+
return /** @type {string} */ (await (0, asyncbox_1.retry)(retries, getMaxTVOSSDKWithoutRetry, timeout));
|
|
246
|
+
});
|
|
247
|
+
exports.getMaxTVOSSDK = getMaxTVOSSDK;
|
|
248
|
+
//# sourceMappingURL=xcode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xcode.js","sourceRoot":"","sources":["../../lib/xcode.js"],"names":[],"mappings":";;;;;;AAAA,6CAA6C;AAC7C,gDAAwB;AACxB,uCAAiC;AACjC,oDAAuB;AACvB,+CAAoC;AACpC,oDAA4B;AAC5B,uCAEmB;AAEnB,MAAM,yBAAyB,GAAG,CAAC,CAAC;AACpC,MAAM,eAAe,GAAG,oBAAoB,CAAC;AAE7C,MAAM,GAAG,GAAG,gBAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AAEtC;;;;;;GAMG;AACH,KAAK,UAAU,sBAAsB,CAAE,OAAO,GAAG,uBAAa;IAC5D;;;OAGG;IACH,MAAM,oBAAoB,GAAG,KAAK,EAAE,MAAM,EAAE,EAAE;QAC5C,MAAM,UAAU,GAAG,MAAM,IAAA,sBAAY,EAAC,eAAe,CAAC,CAAC;QACvD,IAAI,gBAAC,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;YACzB,OAAO,GAAG,MAAM,oDAAoD,CAAC;SACtE;QAED,MAAM,SAAS,GAAG,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AC/D,MAAM,IAAI,GAAG,CAAC,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,CAAC,CAAC;IACjE,MAAM,EAAC,MAAM,EAAC,GAAG,MAAM,IAAA,yBAAe,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACtD,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;IACjC,IAAI,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,EAAE;QACjC,MAAM,IAAI,KAAK,CAAC,mDAAmD,UAAU,GAAG,CAAC,CAAC;KACnF;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAoBgB,8DAAyB;AAlB1C;;;;GAIG;AACH,MAAM,aAAa,GAAG,gBAAC,CAAC,OAAO;AAC7B;;;;GAIG;AACH,KAAK,UAAU,aAAa,CAAE,OAAO,GAAG,yBAAyB,EAAE,OAAO,GAAG,uBAAa;IACxF,OAAO,qBAAqB,CAAA,CAAC,MAAM,IAAA,gBAAK,EAAC,OAAO,EAAE,yBAAyB,EAAE,OAAO,CAAC,CAAC,CAAC;AACzF,CAAC,CACF,CAAC;AAIA,sCAAa"}
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"ios",
|
|
7
7
|
"xcode"
|
|
8
8
|
],
|
|
9
|
-
"version": "5.2.
|
|
9
|
+
"version": "5.2.2",
|
|
10
10
|
"author": "Appium Contributors",
|
|
11
11
|
"license": "Apache-2.0",
|
|
12
12
|
"repository": {
|
|
@@ -21,11 +21,7 @@
|
|
|
21
21
|
"npm": ">=8"
|
|
22
22
|
},
|
|
23
23
|
"main": "./build/lib/index.js",
|
|
24
|
-
"directories": {
|
|
25
|
-
"lib": "lib"
|
|
26
|
-
},
|
|
27
24
|
"files": [
|
|
28
|
-
"index.js",
|
|
29
25
|
"lib",
|
|
30
26
|
"build/lib",
|
|
31
27
|
"CHANGELOG.md"
|
|
@@ -83,14 +79,14 @@
|
|
|
83
79
|
"@types/node": "^20.4.7",
|
|
84
80
|
"@types/sinon": "^10.0.16",
|
|
85
81
|
"@types/sinon-chai": "^3.2.9",
|
|
86
|
-
"@types/teen_process": "2.0.
|
|
82
|
+
"@types/teen_process": "2.0.1",
|
|
87
83
|
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
88
84
|
"@typescript-eslint/parser": "^5.62.0",
|
|
89
85
|
"chai": "^4.1.2",
|
|
90
86
|
"chai-as-promised": "^7.1.1",
|
|
91
87
|
"conventional-changelog-conventionalcommits": "^7.0.1",
|
|
92
88
|
"eslint": "^8.46.0",
|
|
93
|
-
"eslint-config-prettier": "^
|
|
89
|
+
"eslint-config-prettier": "^9.0.0",
|
|
94
90
|
"eslint-import-resolver-typescript": "^3.5.5",
|
|
95
91
|
"eslint-plugin-import": "^2.28.0",
|
|
96
92
|
"eslint-plugin-mocha": "^10.1.0",
|