From a68909af39fa908cbe3d4ffad4f24946f70d28ac Mon Sep 17 00:00:00 2001 From: "Kristian D. Dimitrov" Date: Mon, 25 Mar 2019 16:04:37 +0200 Subject: [PATCH 1/2] chore: add wanrning for extensions beta support --- lib/definitions/project.d.ts | 2 +- lib/services/ios-extensions-service.ts | 8 ++++++-- lib/services/ios-project-service.ts | 10 ++++++++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/lib/definitions/project.d.ts b/lib/definitions/project.d.ts index bc8aa2a854..066c3d781c 100644 --- a/lib/definitions/project.d.ts +++ b/lib/definitions/project.d.ts @@ -570,7 +570,7 @@ interface ICocoaPodsPlatformManager { * Describes a service used to add and remove iOS extension */ interface IIOSExtensionsService { - addExtensionsFromPath(options: IAddExtensionsFromPathOptions): Promise; + addExtensionsFromPath(options: IAddExtensionsFromPathOptions): Promise; removeExtensions(options: IRemoveExtensionsOptions): void; } diff --git a/lib/services/ios-extensions-service.ts b/lib/services/ios-extensions-service.ts index 67e850b2d8..e54420b635 100644 --- a/lib/services/ios-extensions-service.ts +++ b/lib/services/ios-extensions-service.ts @@ -6,10 +6,11 @@ export class IOSExtensionsService implements IIOSExtensionsService { private $xcode: IXcode) { } - public async addExtensionsFromPath({extensionsFolderPath, projectData, platformData, pbxProjPath}: IAddExtensionsFromPathOptions): Promise { + public async addExtensionsFromPath({extensionsFolderPath, projectData, platformData, pbxProjPath}: IAddExtensionsFromPathOptions): Promise { const targetUuids: string[] = []; + let addedExtensions = false; if (!this.$fs.exists(extensionsFolderPath)) { - return; + return false; } const project = new this.$xcode.project(pbxProjPath); project.parseSync(); @@ -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 { diff --git a/lib/services/ios-project-service.ts b/lib/services/ios-project-service.ts index 4a410a1d81..f6846f24b9 100644 --- a/lib/services/ios-project-service.ts +++ b/lib/services/ios-project-service.ts @@ -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 addedExtensionsFromPlugisns = 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}); + addedExtensionsFromPlugisns = addedExtensionsFromPlugisns || addedExtensionFromPlugin; + } + + if (addedExtensionsFromResources || addedExtensionsFromPlugisns) { + 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"); } } From 257e895e71daf7515a1e30353f8124818f1a9b41 Mon Sep 17 00:00:00 2001 From: "Kristian D. Dimitrov" Date: Mon, 25 Mar 2019 16:15:08 +0200 Subject: [PATCH 2/2] chore: fix comments --- lib/services/ios-project-service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/services/ios-project-service.ts b/lib/services/ios-project-service.ts index f6846f24b9..3af1eecc29 100644 --- a/lib/services/ios-project-service.ts +++ b/lib/services/ios-project-service.ts @@ -1110,17 +1110,17 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f const pbxProjPath = this.getPbxProjPath(projectData); const addedExtensionsFromResources = await this.$iOSExtensionsService.addExtensionsFromPath({extensionsFolderPath: resorcesExtensionsPath, projectData, platformData, pbxProjPath}); const plugins = await this.getAllInstalledPlugins(projectData); - let addedExtensionsFromPlugisns = false; + 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); const addedExtensionFromPlugin = await this.$iOSExtensionsService.addExtensionsFromPath({extensionsFolderPath: extensionPath, projectData, platformData, pbxProjPath}); - addedExtensionsFromPlugisns = addedExtensionsFromPlugisns || addedExtensionFromPlugin; + addedExtensionsFromPlugins = addedExtensionsFromPlugins || addedExtensionFromPlugin; } - if (addedExtensionsFromResources || addedExtensionsFromPlugisns) { + 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"); } }