From bbdcc79834faed95ec633ca36a8cf84476075bc6 Mon Sep 17 00:00:00 2001 From: Mykola Mokhnach Date: Fri, 22 Sep 2023 22:00:34 +0200 Subject: [PATCH 1/2] fix: Provide signing arguments as command line parameters --- lib/utils.js | 16 ++-------------- lib/xcodebuild.js | 20 +++++++++++++------- 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index 4a1191600..1474d929f 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -1,4 +1,4 @@ -import { fs, tempDir, plist } from '@appium/support'; +import { fs, plist } from '@appium/support'; import { exec } from 'teen_process'; import path from 'path'; import log from './logger'; @@ -157,18 +157,6 @@ async function setRealDeviceSecurity (keychainPath, keychainPassword) { await exec('security', ['set-keychain-settings', '-t', '3600', '-l', keychainPath]); } -async function generateXcodeConfigFile (orgId, signingId) { - log.debug(`Generating xcode config file for orgId '${orgId}' and signingId ` + - `'${signingId}'`); - const contents = `DEVELOPMENT_TEAM = ${orgId} -CODE_SIGN_IDENTITY = ${signingId} -`; - const xcconfigPath = await tempDir.path('appium-temp.xcconfig'); - log.debug(`Writing xcode config file to ${xcconfigPath}`); - await fs.writeFile(xcconfigPath, contents, 'utf8'); - return xcconfigPath; -} - /** * Information of the device under test * @typedef {Object} DeviceInfo @@ -394,7 +382,7 @@ async function getPIDsListeningOnPort (port, filteringFunc = null) { } export { updateProjectFile, resetProjectFile, setRealDeviceSecurity, - getAdditionalRunContent, getXctestrunFileName, generateXcodeConfigFile, + getAdditionalRunContent, getXctestrunFileName, setXctestrunFile, getXctestrunFilePath, killProcess, randomInt, getWDAUpgradeTimestamp, resetTestProcesses, getPIDsListeningOnPort, killAppUsingPattern, isTvOS diff --git a/lib/xcodebuild.js b/lib/xcodebuild.js index 23f365417..a54dc7423 100644 --- a/lib/xcodebuild.js +++ b/lib/xcodebuild.js @@ -4,7 +4,7 @@ import { fs, logger, timing } from '@appium/support'; import defaultLogger from './logger'; import B from 'bluebird'; import { - setRealDeviceSecurity, generateXcodeConfigFile, setXctestrunFile, + setRealDeviceSecurity, setXctestrunFile, updateProjectFile, resetProjectFile, killProcess, getWDAUpgradeTimestamp, isTvOS } from './utils'; import _ from 'lodash'; @@ -238,9 +238,18 @@ class XcodeBuild { 'Will build for the default platform instead'); } - if (this.realDevice && this.xcodeConfigFile) { - this.log.debug(`Using Xcode configuration file: '${this.xcodeConfigFile}'`); - args.push('-xcconfig', this.xcodeConfigFile); + if (this.realDevice) { + if (this.xcodeConfigFile) { + this.log.debug(`Using Xcode configuration file: '${this.xcodeConfigFile}'`); + args.push('-xcconfig', this.xcodeConfigFile); + } + if (this.xcodeOrgId && this.xcodeSigningId) { + args.push( + `DEVELOPMENT_TEAM=${this.xcodeOrgId}`, + `CODE_SIGN_IDENTITY=${this.xcodeSigningId}`, + 'CODE_SIGN_STYLE=Manual' + ); + } } if (!process.env.APPIUM_XCUITEST_TREAT_WARNINGS_AS_ERRORS) { @@ -260,9 +269,6 @@ class XcodeBuild { if (this.keychainPath && this.keychainPassword) { await setRealDeviceSecurity(this.keychainPath, this.keychainPassword); } - if (this.xcodeOrgId && this.xcodeSigningId && !this.xcodeConfigFile) { - this.xcodeConfigFile = await generateXcodeConfigFile(this.xcodeOrgId, this.xcodeSigningId); - } } const {cmd, args} = this.getCommand(buildOnly); From 1cbd6022c3effa73f97de2c31017877638be2960 Mon Sep 17 00:00:00 2001 From: Mykola Mokhnach Date: Sat, 23 Sep 2023 00:14:49 +0200 Subject: [PATCH 2/2] Address comments --- lib/xcodebuild.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/xcodebuild.js b/lib/xcodebuild.js index a54dc7423..de6b58818 100644 --- a/lib/xcodebuild.js +++ b/lib/xcodebuild.js @@ -247,7 +247,6 @@ class XcodeBuild { args.push( `DEVELOPMENT_TEAM=${this.xcodeOrgId}`, `CODE_SIGN_IDENTITY=${this.xcodeSigningId}`, - 'CODE_SIGN_STYLE=Manual' ); } }