Skip to content

Commit 22eecad

Browse files
fix: enable passing iOS codesigning options to LiveSync operations
Enable passing iOS Code signing options to operations like run/debug, etc. Currently the provision and teamId options are not passed to the controllers, so we do not use them during project preparation. To resolve this, include the buildData in the deviceDescriptors - this way we'll have all the codesigning data required for the specific device and we'll also allow having different codesign options for different devices. Also remove outputPath from deviceDescriptors as we can use it directly from the buildData.
1 parent 76dc9c4 commit 22eecad

File tree

7 files changed

+32
-15
lines changed

7 files changed

+32
-15
lines changed

lib/controllers/debug-controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export class DebugController extends EventEmitter implements IDebugController {
128128
const attachDebuggerData: IAttachDebuggerData = {
129129
deviceIdentifier,
130130
isEmulator: currentDeviceInstance.isEmulator,
131-
outputPath: deviceDescriptor.outputPath,
131+
outputPath: deviceDescriptor.buildData.outputPath,
132132
platform: currentDeviceInstance.deviceInfo.platform,
133133
projectDir,
134134
debugOptions

lib/controllers/run-controller.ts

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ export class RunController extends EventEmitter implements IRunController {
88

99
constructor(
1010
protected $analyticsService: IAnalyticsService,
11-
private $buildDataService: IBuildDataService,
1211
private $buildController: IBuildController,
1312
private $debugController: IDebugController,
1413
private $deviceInstallAppService: IDeviceInstallAppService,
@@ -191,7 +190,7 @@ export class RunController extends EventEmitter implements IRunController {
191190
projectDir: projectData.projectDir,
192191
deviceIdentifier,
193192
debugOptions: deviceDescriptor.debugOptions,
194-
outputPath: deviceDescriptor.outputPath
193+
outputPath: deviceDescriptor.buildData.outputPath
195194
};
196195
this.emit(USER_INTERACTION_NEEDED_EVENT_NAME, attachDebuggerOptions);
197196
}
@@ -242,9 +241,16 @@ export class RunController extends EventEmitter implements IRunController {
242241
const deviceAction = async (device: Mobile.IDevice) => {
243242
const deviceDescriptor = _.find(deviceDescriptors, dd => dd.identifier === device.deviceInfo.identifier);
244243
const platformData = this.$platformsDataService.getPlatformData(device.deviceInfo.platform, projectData);
245-
const prepareData = this.$prepareDataService.getPrepareData(liveSyncInfo.projectDir, device.deviceInfo.platform, { ...liveSyncInfo, watch: !liveSyncInfo.skipWatcher, nativePrepare: { skipNativePrepare: !!deviceDescriptor.skipNativePrepare } });
246-
const buildData = this.$buildDataService.getBuildData(projectData.projectDir, device.deviceInfo.platform, { ...liveSyncInfo, outputPath: deviceDescriptor.outputPath, buildForDevice: !device.isEmulator });
244+
const prepareData = this.$prepareDataService.getPrepareData(liveSyncInfo.projectDir, device.deviceInfo.platform,
245+
{
246+
...liveSyncInfo,
247+
watch: !liveSyncInfo.skipWatcher,
248+
nativePrepare: { skipNativePrepare: !!deviceDescriptor.skipNativePrepare },
249+
...deviceDescriptor.buildData,
250+
});
251+
247252
const prepareResultData = await this.$prepareController.prepare(prepareData);
253+
const buildData = { ...deviceDescriptor.buildData, buildForDevice: !device.isEmulator };
248254

249255
try {
250256
let packageFilePath: string = null;
@@ -312,7 +318,13 @@ export class RunController extends EventEmitter implements IRunController {
312318
const deviceAction = async (device: Mobile.IDevice) => {
313319
const deviceDescriptor = _.find(deviceDescriptors, dd => dd.identifier === device.deviceInfo.identifier);
314320
const platformData = this.$platformsDataService.getPlatformData(data.platform, projectData);
315-
const prepareData = this.$prepareDataService.getPrepareData(projectData.projectDir, data.platform, { ...liveSyncInfo, watch: !liveSyncInfo.skipWatcher });
321+
const prepareData = this.$prepareDataService.getPrepareData(liveSyncInfo.projectDir, device.deviceInfo.platform,
322+
{
323+
...liveSyncInfo,
324+
watch: !liveSyncInfo.skipWatcher,
325+
nativePrepare: { skipNativePrepare: !!deviceDescriptor.skipNativePrepare },
326+
...deviceDescriptor.buildData,
327+
});
316328

317329
try {
318330
const rebuiltInfo = this.rebuiltInformation[platformData.platformNameLowerCase] && (this.$mobileHelper.isAndroidPlatform(platformData.platformNameLowerCase) || this.rebuiltInformation[platformData.platformNameLowerCase].isEmulator === device.isEmulator);

lib/definitions/livesync.d.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ declare global {
4848
/**
4949
* Describes information for LiveSync on a device.
5050
*/
51-
interface ILiveSyncDeviceDescriptor extends IOptionalOutputPath, IOptionalDebuggingOptions {
51+
interface ILiveSyncDeviceDescriptor extends IOptionalDebuggingOptions {
5252
/**
5353
* Device identifier.
5454
*/
@@ -68,6 +68,11 @@ declare global {
6868
* Whether debugging has been enabled for this device or not
6969
*/
7070
debuggingEnabled?: boolean;
71+
72+
/**
73+
* Describes the data used for building the application
74+
*/
75+
buildData: IBuildData;
7176
}
7277

7378
/**
@@ -80,7 +85,7 @@ declare global {
8085
* Defines if the watcher should be skipped. If not passed, fs.Watcher will be started.
8186
*/
8287
skipWatcher?: boolean;
83-
88+
8489
/**
8590
* Forces a build before the initial livesync.
8691
*/

lib/definitions/prepare.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ declare global {
99
watch?: boolean;
1010
}
1111

12-
interface IiOSPrepareData extends IPrepareData {
12+
interface IiOSCodeSigningData {
1313
teamId: string;
1414
provision: string;
1515
mobileProvisionData: any;
1616
}
1717

18-
interface IAndroidPrepareData extends IPrepareData { }
18+
interface IiOSPrepareData extends IPrepareData, IiOSCodeSigningData { }
1919

2020
interface IPrepareDataService {
2121
getPrepareData(projectDir: string, platform: string, data: any): IPrepareData;
@@ -34,4 +34,4 @@ declare global {
3434
interface IPrepareNativePlatformService {
3535
prepareNativePlatform(platformData: IPlatformData, projectData: IProjectData, prepareData: IPrepareData): Promise<boolean>;
3636
}
37-
}
37+
}

lib/helpers/deploy-command-helper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ export class DeployCommandHelper {
4343
buildAction,
4444
debuggingEnabled: additionalOptions && additionalOptions.deviceDebugMap && additionalOptions.deviceDebugMap[d.deviceInfo.identifier],
4545
debugOptions: this.$options,
46-
outputPath,
4746
skipNativePrepare: additionalOptions && additionalOptions.skipNativePrepare,
47+
buildData
4848
};
4949

5050
return info;

lib/helpers/livesync-command-helper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ export class LiveSyncCommandHelper implements ILiveSyncCommandHelper {
7979
buildAction,
8080
debuggingEnabled: additionalOptions && additionalOptions.deviceDebugMap && additionalOptions.deviceDebugMap[d.deviceInfo.identifier],
8181
debugOptions: this.$options,
82-
outputPath,
8382
skipNativePrepare: additionalOptions && additionalOptions.skipNativePrepare,
83+
buildData
8484
};
8585

8686
return info;

test/controllers/run-controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ const projectDir = "/path/to/my/projecDir";
1818
const buildOutputPath = `${projectDir}/platform/ios/build/myproject.app`;
1919

2020
const iOSDevice = <any>{ deviceInfo: { identifier: "myiOSDevice", platform: "ios" } };
21-
const iOSDeviceDescriptor = { identifier: "myiOSDevice", buildAction: async () => buildOutputPath };
21+
const iOSDeviceDescriptor = { identifier: "myiOSDevice", buildAction: async () => buildOutputPath, buildData: <any>{} };
2222
const androidDevice = <any>{ deviceInfo: { identifier: "myAndroidDevice", platform: "android" } };
23-
const androidDeviceDescriptor = { identifier: "myAndroidDevice", buildAction: async () => buildOutputPath };
23+
const androidDeviceDescriptor = { identifier: "myAndroidDevice", buildAction: async () => buildOutputPath, buildData: <any>{} };
2424

2525
const map: IDictionary<{ device: Mobile.IDevice, descriptor: ILiveSyncDeviceDescriptor }> = {
2626
myiOSDevice: {

0 commit comments

Comments
 (0)