Skip to content

chore: add wanrning for extensions beta support #4473

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 2 commits into from
Mar 25, 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
2 changes: 1 addition & 1 deletion lib/definitions/project.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ interface ICocoaPodsPlatformManager {
* Describes a service used to add and remove iOS extension
*/
interface IIOSExtensionsService {
addExtensionsFromPath(options: IAddExtensionsFromPathOptions): Promise<void>;
addExtensionsFromPath(options: IAddExtensionsFromPathOptions): Promise<boolean>;
removeExtensions(options: IRemoveExtensionsOptions): void;
}

Expand Down
8 changes: 6 additions & 2 deletions lib/services/ios-extensions-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ export class IOSExtensionsService implements IIOSExtensionsService {
private $xcode: IXcode) {
}

public async addExtensionsFromPath({extensionsFolderPath, projectData, platformData, pbxProjPath}: IAddExtensionsFromPathOptions): Promise<void> {
public async addExtensionsFromPath({extensionsFolderPath, projectData, platformData, pbxProjPath}: IAddExtensionsFromPathOptions): Promise<boolean> {
const targetUuids: string[] = [];
let addedExtensions = false;
if (!this.$fs.exists(extensionsFolderPath)) {
return;
return false;
}
const project = new this.$xcode.project(pbxProjPath);
project.parseSync();
Expand All @@ -23,10 +24,13 @@ export class IOSExtensionsService implements IIOSExtensionsService {
.forEach(extensionFolder => {
const targetUuid = this.addExtensionToProject(extensionsFolderPath, extensionFolder, project, projectData, platformData);
targetUuids.push(targetUuid);
addedExtensions = true;
});

this.$fs.writeFile(pbxProjPath, project.writeSync({omitEmptyValues: true}));
this.prepareExtensionSigning(targetUuids, projectData, pbxProjPath);

return addedExtensions;
}

private addExtensionToProject(extensionsFolderPath: string, extensionFolder: string, project: IXcode.project, projectData: IProjectData, platformData: IPlatformData): string {
Expand Down
10 changes: 8 additions & 2 deletions lib/services/ios-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1108,14 +1108,20 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
);
const platformData = this.getPlatformData(projectData);
const pbxProjPath = this.getPbxProjPath(projectData);
await this.$iOSExtensionsService.addExtensionsFromPath({extensionsFolderPath: resorcesExtensionsPath, projectData, platformData, pbxProjPath});
const addedExtensionsFromResources = await this.$iOSExtensionsService.addExtensionsFromPath({extensionsFolderPath: resorcesExtensionsPath, projectData, platformData, pbxProjPath});
const plugins = await this.getAllInstalledPlugins(projectData);
let addedExtensionsFromPlugins = false;
for (const pluginIndex in plugins) {
const pluginData = plugins[pluginIndex];
const pluginPlatformsFolderPath = pluginData.pluginPlatformsFolderPath(IOSProjectService.IOS_PLATFORM_NAME);

const extensionPath = path.join(pluginPlatformsFolderPath, constants.NATIVE_EXTENSION_FOLDER);
await this.$iOSExtensionsService.addExtensionsFromPath({extensionsFolderPath: extensionPath, projectData, platformData, pbxProjPath});
const addedExtensionFromPlugin = await this.$iOSExtensionsService.addExtensionsFromPath({extensionsFolderPath: extensionPath, projectData, platformData, pbxProjPath});
addedExtensionsFromPlugins = addedExtensionsFromPlugins || addedExtensionFromPlugin;
}

if (addedExtensionsFromResources || addedExtensionsFromPlugins) {
this.$logger.warn("The support for iOS App Extensions is currently in Beta. For more information about the current development state and any known issues, please check the relevant GitHub issue: https://github.com/NativeScript/nativescript-cli/issues/4472");
}
}

Expand Down