Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Provide signing arguments as command line parameters #779

Merged
merged 2 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions lib/utils.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
19 changes: 12 additions & 7 deletions lib/xcodebuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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}`,
mykola-mokhnach marked this conversation as resolved.
Show resolved Hide resolved
);
}
}

if (!process.env.APPIUM_XCUITEST_TREAT_WARNINGS_AS_ERRORS) {
Expand All @@ -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);
Expand Down
Loading