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..de6b58818 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,17 @@ 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}`, + ); + } } if (!process.env.APPIUM_XCUITEST_TREAT_WARNINGS_AS_ERRORS) { @@ -260,9 +268,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);