Skip to content

Commit 3270ecd

Browse files
author
Fatme
authored
Merge pull request #4526 from jzgoda/add-icloud-container-environment
feat: add iCloudContainerEnvironment build option
2 parents 04ef643 + cd00be9 commit 3270ecd

File tree

12 files changed

+27
-2
lines changed

12 files changed

+27
-2
lines changed

docs/man_pages/project/testing/build-ios.md

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ General | `$ tns build ios [--for-device] [--release] [--copy-to <File Path>] [-
2323

2424
* `--release` - If set, produces a release build. Otherwise, produces a debug build.
2525
* `--for-device` - If set, produces an application package that you can deploy on device. Otherwise, produces a build that you can run only in the native iOS Simulator.
26+
* `--i-cloud-container-environment` - If set, adds the passed `iCloudContainerEnvironment` when exporting an application package with the `--for-device` option.
2627
* `--copy-to` - Specifies the file path where the built `.ipa` will be copied. If it points to a non-existent directory path, it will be created. If the specified value is existing directory, the original file name will be used.
2728
* `--team-id` - If used without parameter, lists all team names and ids. If used with team name or id, it will switch to automatic signing mode and configure the .xcodeproj file of your app. In this case .xcconfig should not contain any provisioning/team id flags. This team id will be further used for codesigning the app. For Xcode 9.0+, xcodebuild will be allowed to update and modify automatically managed provisioning profiles.
2829
* `--provision` - If used without parameter, lists all eligible provisioning profiles. If used with UUID or name of your provisioning profile, it will switch to manual signing mode and configure the .xcodeproj file of your app. In this case xcconfig should not contain any provisioning/team id flags. This provisioning profile will be further used for codesigning the app.

lib/commands/appstore-upload.ts

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ export class PublishIOS implements ICommand {
7878
provision: this.$options.provision,
7979
teamId: this.$options.teamId,
8080
buildForDevice: true,
81+
iCloudContainerEnvironment: this.$options.iCloudContainerEnvironment,
8182
mobileProvisionIdentifier,
8283
codeSignIdentity
8384
};

lib/commands/build.ts

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export abstract class BuildCommandBase extends ValidatePlatformCommandBase {
3333
await this.$platformService.preparePlatform(platformInfo);
3434
const buildConfig: IBuildConfig = {
3535
buildForDevice: this.$options.forDevice,
36+
iCloudContainerEnvironment: this.$options.iCloudContainerEnvironment,
3637
projectDir: this.$options.path,
3738
clean: this.$options.clean,
3839
teamId: this.$options.teamId,

lib/declarations.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ interface IOptions extends IRelease, IDeviceIdentifier, IJustLaunch, IAvd, IAvai
544544
copyTo: string;
545545
debugTransport: boolean;
546546
forDevice: boolean;
547+
iCloudContainerEnvironment: string;
547548
framework: string;
548549
frameworkName: string;
549550
frameworkVersion: string;

lib/definitions/project.d.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,10 @@ interface IBuildForDevice {
304304
buildForDevice: boolean;
305305
}
306306

307+
interface IiCloudContainerEnvironment {
308+
iCloudContainerEnvironment: string;
309+
}
310+
307311
interface INativePrepare {
308312
skipNativePrepare: boolean;
309313
}
@@ -317,7 +321,7 @@ interface IBuildConfig extends IAndroidBuildOptionsSettings, IiOSBuildConfig, IP
317321
/**
318322
* Describes iOS-specific build configuration properties
319323
*/
320-
interface IiOSBuildConfig extends IBuildForDevice, IDeviceIdentifier, IProvision, ITeamIdentifier, IRelease {
324+
interface IiOSBuildConfig extends IBuildForDevice, IiCloudContainerEnvironment, IDeviceIdentifier, IProvision, ITeamIdentifier, IRelease {
321325
/**
322326
* Identifier of the mobile provision which will be used for the build. If not set a provision will be selected automatically if possible.
323327
*/

lib/helpers/livesync-command-helper.ts

+1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export class LiveSyncCommandHelper implements ILiveSyncCommandHelper {
7676

7777
const buildConfig: IBuildConfig = {
7878
buildForDevice: !d.isEmulator,
79+
iCloudContainerEnvironment: this.$options.iCloudContainerEnvironment,
7980
projectDir: this.$options.path,
8081
clean: this.$options.clean,
8182
teamId: this.$options.teamId,

lib/options.ts

+1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export class Options {
7676
framework: { type: OptionType.String, hasSensitiveValue: false },
7777
frameworkVersion: { type: OptionType.String, hasSensitiveValue: false },
7878
forDevice: { type: OptionType.Boolean, hasSensitiveValue: false },
79+
iCloudContainerEnvironment: { type: OptionType.String, hasSensitiveValue: false },
7980
provision: { type: OptionType.Object, hasSensitiveValue: true },
8081
client: { type: OptionType.Boolean, default: true, hasSensitiveValue: false },
8182
env: { type: OptionType.Object, hasSensitiveValue: false },

lib/services/ios-project-service.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,10 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
279279
return exportFile;
280280
}
281281

282+
private iCloudContainerEnvironment(buildConfig: IBuildConfig): string {
283+
return buildConfig && buildConfig.iCloudContainerEnvironment ? buildConfig.iCloudContainerEnvironment : null;
284+
}
285+
282286
/**
283287
* Exports .xcarchive for a development device.
284288
*/
@@ -287,6 +291,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
287291
const projectRoot = platformData.projectRoot;
288292
const archivePath = options.archivePath;
289293
const exportOptionsMethod = await this.getExportOptionsMethod(projectData, archivePath);
294+
const iCloudContainerEnvironment = this.iCloudContainerEnvironment(buildConfig);
290295
let plistTemplate = `<?xml version="1.0" encoding="UTF-8"?>
291296
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
292297
<plist version="1.0">
@@ -304,7 +309,13 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
304309
<key>uploadBitcode</key>
305310
<false/>
306311
<key>compileBitcode</key>
307-
<false/>
312+
<false/>`;
313+
if (iCloudContainerEnvironment) {
314+
plistTemplate += `
315+
<key>iCloudContainerEnvironment</key>
316+
<string>${iCloudContainerEnvironment}</string>`;
317+
}
318+
plistTemplate += `
308319
</dict>
309320
</plist>`;
310321

lib/services/livesync/livesync-service.ts

+1
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,7 @@ export class LiveSyncService extends EventEmitter implements IDebugLiveSyncServi
858858
private getInstallApplicationBuildConfig(deviceIdentifier: string, projectDir: string, opts: { isEmulator: boolean }): IBuildConfig {
859859
const buildConfig: IBuildConfig = {
860860
buildForDevice: !opts.isEmulator,
861+
iCloudContainerEnvironment: null,
861862
release: false,
862863
device: deviceIdentifier,
863864
provision: null,

lib/services/platform-service.ts

+1
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,7 @@ export class PlatformService extends EventEmitter implements IPlatformService {
548548
const action = async (device: Mobile.IDevice): Promise<void> => {
549549
const buildConfig: IBuildConfig = {
550550
buildForDevice: !this.$devicesService.isiOSSimulator(device),
551+
iCloudContainerEnvironment: null,
551552
projectDir: deployInfo.deployOptions.projectDir,
552553
release: deployInfo.deployOptions.release,
553554
device: deployInfo.deployOptions.device,

lib/services/test-execution-service.ts

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export class TestExecutionService implements ITestExecutionService {
8484
buildAction: async (): Promise<string> => {
8585
const buildConfig: IBuildConfig = {
8686
buildForDevice: !d.isEmulator,
87+
iCloudContainerEnvironment: this.$options.iCloudContainerEnvironment,
8788
projectDir: this.$options.path,
8889
clean: this.$options.clean,
8990
teamId: this.$options.teamId,

test/services/android-project-service.ts

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ const getDefautlBuildConfig = (): IBuildConfig => {
4343
return {
4444
release: true,
4545
buildForDevice: false,
46+
iCloudContainerEnvironment: null,
4647
device: "testDevice",
4748
provision: null,
4849
teamId: "",

0 commit comments

Comments
 (0)