You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by er...@apache.org on 2021/10/18 03:10:51 UTC
[cordova-paramedic] branch master updated: feat(ios): add Xcode 13
& iOS 15 support (#226)
This is an automated email from the ASF dual-hosted git repository.
erisu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-paramedic.git
The following commit(s) were added to refs/heads/master by this push:
new a77e7b7 feat(ios): add Xcode 13 & iOS 15 support (#226)
a77e7b7 is described below
commit a77e7b7f4afd05c04aefd17d00d5bc10b79d542f
Author: Tommy Goode <ai...@users.noreply.github.com>
AuthorDate: Sun Oct 17 22:10:47 2021 -0500
feat(ios): add Xcode 13 & iOS 15 support (#226)
The `instruments` command has been deprecated in Xcode 12 and removed in Xcode 13, which causes the `getSimulatorCollection()` function to fail to list the simulators. The `instruments` command in Xcode 12 includes a deprecation warning that says to use `xcrun xctrace` instead.
Fixes #225.
* Adjust the simulator ID regex instead of manually removing " Simulator" from the line.
* Update simulator ID regex to support instruments and Xcode 12/13 xcrun.
* Add support for Xcode 11's instruments command.
* ci: add iOS 15.x w/ Xcode 13.x Support
* ci(appium): Increase the WebDriverAgent Launch Timeout for iOS (XCUITest)
Co-authored-by: Erisu <er...@apache.org>
---
.github/workflows/ios.yml | 4 +++
conf/pr/local/ios-15.x.config.json | 7 ++++
lib/appium/helpers/wdHelper.js | 4 +++
lib/utils/utilities.js | 71 +++++++++++++++++++++++---------------
4 files changed, 59 insertions(+), 27 deletions(-)
diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml
index 2f6a93a..4697cf0 100644
--- a/.github/workflows/ios.yml
+++ b/.github/workflows/ios.yml
@@ -61,6 +61,10 @@ jobs:
ios-version: 14.x
xcode-version: 12.x
+ - os-version: macos-11
+ ios-version: 15.x
+ xcode-version: 13.x
+
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
diff --git a/conf/pr/local/ios-15.x.config.json b/conf/pr/local/ios-15.x.config.json
new file mode 100644
index 0000000..b0bedd9
--- /dev/null
+++ b/conf/pr/local/ios-15.x.config.json
@@ -0,0 +1,7 @@
+{
+ "platform": "ios@latest",
+ "action": "run",
+ "cleanUpAfterRun": true,
+ "target": "iPhone-13, 15.0",
+ "verbose": true
+}
diff --git a/lib/appium/helpers/wdHelper.js b/lib/appium/helpers/wdHelper.js
index 9bc4c44..6c97c92 100644
--- a/lib/appium/helpers/wdHelper.js
+++ b/lib/appium/helpers/wdHelper.js
@@ -85,6 +85,10 @@ module.exports.getDriver = function (platform) {
automationName
};
+ if (platform.toLowerCase() === utilities.IOS) {
+ driverConfig.wdaLaunchTimeout = 150000;
+ }
+
if (global.UDID) {
driverConfig.udid = global.UDID;
}
diff --git a/lib/utils/utilities.js b/lib/utils/utilities.js
index 5e974bc..a0224d2 100644
--- a/lib/utils/utilities.js
+++ b/lib/utils/utilities.js
@@ -104,59 +104,76 @@ function getSimulatorCollection () {
if (simulatorCollection) return simulatorCollection;
// Next, figure out the ID of the simulator we found
- const instrCommand = 'instruments -s devices | grep ^iPhone';
+ const cmd = '(xcrun xctrace list devices || instruments -s devices) 2>&1 | grep ^iPhone';
logger.info('running:');
- logger.info(' ' + instrCommand);
+ logger.info(' ' + cmd);
- const instrResult = exec(instrCommand);
+ const cmdResult = exec(cmd);
- if (instrResult.code > 0) {
+ if (cmdResult.code > 0) {
logger.error('Failed to get the list of simulators');
return false;
}
- simulatorCollection = instrResult.stdout.split('\n');
+ simulatorCollection = cmdResult.stdout.split('\n');
return simulatorCollection;
}
-function getSimulatorData (findSimResult) {
- if (simulatorDataCollection[findSimResult]) return simulatorDataCollection[findSimResult];
-
- const simulators = getSimulatorCollection();
-
- const split = findSimResult.split(', ');
- // Format of the output is "iPhone-6s-Plus, 9.1"
- // Extract the device name and the version number
- const device = split[0].replace(/-/g, ' ').trim();
- const version = split[1].trim();
-
- // This matches <device> (<version>) [<simulator-id>]
- const simIdRegex = /^([a-zA-Z\d ]+) \(([\d.]+)\) \[([a-zA-Z\d-]*)\].*$/;
- const simulatorIds = simulators
+function filterForSimulatorIds (simulatorData, simulatorCollection) {
+ return simulatorCollection
.reduce((result, line) => {
// replace ʀ in iPhone Xʀ to match ios-sim changes
if (line.indexOf('ʀ') > -1) {
line = line.replace('ʀ', 'R');
}
+ // remove ' Simulator' if it exists (Xcode 13 xcrun output)
+ if (line.indexOf(' Simulator') > -1) {
+ line = line.replace(' Simulator', '');
+ }
+ const simIdRegex = /^([a-zA-Z\d ]+) \(([\d.]+)\) [[(]([a-zA-Z\d-]*)[\])].*$/;
const simIdMatch = simIdRegex.exec(line);
- if (simIdMatch && simIdMatch.length === 4 && simIdMatch[1] === device && simIdMatch[2] === version) {
+ if (simIdMatch && simIdMatch.length === 4 && simIdMatch[1] === simulatorData.device && simIdMatch[2] === simulatorData.version) {
result.push(encodeURIComponent(simIdMatch[3]));
}
return result;
}, []);
+}
- if (simulatorIds.length > 1) {
- logger.warn('Multiple matching emulators found. Will use the first matching simulator');
- }
+function getSimulatorData (findSimResult) {
+ if (simulatorDataCollection[findSimResult]) return simulatorDataCollection[findSimResult];
+
+ // Format of the output is "iPhone-6s-Plus, 9.1"
+ // Extract the device name and the version number
+ const split = findSimResult.split(', ');
- simulatorDataCollection[findSimResult] = {
- device,
- version,
- simId: simulatorIds[0]
+ // The target simulator data
+ const simulatorData = {
+ device: split[0].replace(/-/g, ' ').trim(),
+ version: split[1].trim()
};
+ // Fetch the environment's installed simulator collection data
+ const simulators = getSimulatorCollection();
+
+ // Try to find the simulator ids from the simulator collection
+ const simulatorIds = filterForSimulatorIds(simulatorData, simulators);
+
+ // Warn if no data was found.
+ if (simulatorIds.length === 0) {
+ logger.error('No simulator found.');
+ } else if (simulatorIds.length > 1) {
+ logger.warn('Multiple matching simulators found. Will use the first matching simulator');
+ }
+
+ // Add the Simulator ID to the Simulator Data object
+ simulatorData.simId = simulatorIds[0];
+
+ // Update the Simulator Data Collection
+ simulatorDataCollection[findSimResult] = simulatorData;
+
+ // Return the newly created Simulator Data object
return simulatorDataCollection[findSimResult];
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org