Skip to content

feat: add iCloudContainerEnvironment build option #4526

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

Merged
merged 1 commit into from
Apr 11, 2019
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
1 change: 1 addition & 0 deletions docs/man_pages/project/testing/build-ios.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ General | `$ tns build ios [--for-device] [--release] [--copy-to <File Path>] [-

* `--release` - If set, produces a release build. Otherwise, produces a debug build.
* `--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.
* `--i-cloud-container-environment` - If set, adds the passed `iCloudContainerEnvironment` when exporting an application package with the `--for-device` option.
* `--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.
* `--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.
* `--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.
Expand Down
1 change: 1 addition & 0 deletions lib/commands/appstore-upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export class PublishIOS implements ICommand {
provision: this.$options.provision,
teamId: this.$options.teamId,
buildForDevice: true,
iCloudContainerEnvironment: this.$options.iCloudContainerEnvironment,
mobileProvisionIdentifier,
codeSignIdentity
};
Expand Down
1 change: 1 addition & 0 deletions lib/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export abstract class BuildCommandBase extends ValidatePlatformCommandBase {
await this.$platformService.preparePlatform(platformInfo);
const buildConfig: IBuildConfig = {
buildForDevice: this.$options.forDevice,
iCloudContainerEnvironment: this.$options.iCloudContainerEnvironment,
projectDir: this.$options.path,
clean: this.$options.clean,
teamId: this.$options.teamId,
Expand Down
1 change: 1 addition & 0 deletions lib/declarations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ interface IOptions extends IRelease, IDeviceIdentifier, IJustLaunch, IAvd, IAvai
copyTo: string;
debugTransport: boolean;
forDevice: boolean;
iCloudContainerEnvironment: string;
framework: string;
frameworkName: string;
frameworkVersion: string;
Expand Down
6 changes: 5 additions & 1 deletion lib/definitions/project.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,10 @@ interface IBuildForDevice {
buildForDevice: boolean;
}

interface IiCloudContainerEnvironment {
iCloudContainerEnvironment: string;
}

interface INativePrepare {
skipNativePrepare: boolean;
}
Expand All @@ -317,7 +321,7 @@ interface IBuildConfig extends IAndroidBuildOptionsSettings, IiOSBuildConfig, IP
/**
* Describes iOS-specific build configuration properties
*/
interface IiOSBuildConfig extends IBuildForDevice, IDeviceIdentifier, IProvision, ITeamIdentifier, IRelease {
interface IiOSBuildConfig extends IBuildForDevice, IiCloudContainerEnvironment, IDeviceIdentifier, IProvision, ITeamIdentifier, IRelease {
/**
* Identifier of the mobile provision which will be used for the build. If not set a provision will be selected automatically if possible.
*/
Expand Down
1 change: 1 addition & 0 deletions lib/helpers/livesync-command-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export class LiveSyncCommandHelper implements ILiveSyncCommandHelper {

const buildConfig: IBuildConfig = {
buildForDevice: !d.isEmulator,
iCloudContainerEnvironment: this.$options.iCloudContainerEnvironment,
projectDir: this.$options.path,
clean: this.$options.clean,
teamId: this.$options.teamId,
Expand Down
1 change: 1 addition & 0 deletions lib/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export class Options {
framework: { type: OptionType.String, hasSensitiveValue: false },
frameworkVersion: { type: OptionType.String, hasSensitiveValue: false },
forDevice: { type: OptionType.Boolean, hasSensitiveValue: false },
iCloudContainerEnvironment: { type: OptionType.String, hasSensitiveValue: false },
provision: { type: OptionType.Object, hasSensitiveValue: true },
client: { type: OptionType.Boolean, default: true, hasSensitiveValue: false },
env: { type: OptionType.Object, hasSensitiveValue: false },
Expand Down
13 changes: 12 additions & 1 deletion lib/services/ios-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,10 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
return exportFile;
}

private iCloudContainerEnvironment(buildConfig: IBuildConfig): string {
return buildConfig && buildConfig.iCloudContainerEnvironment ? buildConfig.iCloudContainerEnvironment : null;
}

/**
* Exports .xcarchive for a development device.
*/
Expand All @@ -287,6 +291,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
const projectRoot = platformData.projectRoot;
const archivePath = options.archivePath;
const exportOptionsMethod = await this.getExportOptionsMethod(projectData, archivePath);
const iCloudContainerEnvironment = this.iCloudContainerEnvironment(buildConfig);
let plistTemplate = `<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
Expand All @@ -304,7 +309,13 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
<key>uploadBitcode</key>
<false/>
<key>compileBitcode</key>
<false/>
<false/>`;
if (iCloudContainerEnvironment) {
plistTemplate += `
<key>iCloudContainerEnvironment</key>
<string>${iCloudContainerEnvironment}</string>`;
}
plistTemplate += `
</dict>
</plist>`;

Expand Down
1 change: 1 addition & 0 deletions lib/services/livesync/livesync-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,7 @@ export class LiveSyncService extends EventEmitter implements IDebugLiveSyncServi
private getInstallApplicationBuildConfig(deviceIdentifier: string, projectDir: string, opts: { isEmulator: boolean }): IBuildConfig {
const buildConfig: IBuildConfig = {
buildForDevice: !opts.isEmulator,
iCloudContainerEnvironment: null,
release: false,
device: deviceIdentifier,
provision: null,
Expand Down
1 change: 1 addition & 0 deletions lib/services/platform-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ export class PlatformService extends EventEmitter implements IPlatformService {
const action = async (device: Mobile.IDevice): Promise<void> => {
const buildConfig: IBuildConfig = {
buildForDevice: !this.$devicesService.isiOSSimulator(device),
iCloudContainerEnvironment: null,
projectDir: deployInfo.deployOptions.projectDir,
release: deployInfo.deployOptions.release,
device: deployInfo.deployOptions.device,
Expand Down
1 change: 1 addition & 0 deletions lib/services/test-execution-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export class TestExecutionService implements ITestExecutionService {
buildAction: async (): Promise<string> => {
const buildConfig: IBuildConfig = {
buildForDevice: !d.isEmulator,
iCloudContainerEnvironment: this.$options.iCloudContainerEnvironment,
projectDir: this.$options.path,
clean: this.$options.clean,
teamId: this.$options.teamId,
Expand Down
1 change: 1 addition & 0 deletions test/services/android-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const getDefautlBuildConfig = (): IBuildConfig => {
return {
release: true,
buildForDevice: false,
iCloudContainerEnvironment: null,
device: "testDevice",
provision: null,
teamId: "",
Expand Down