diff --git a/lib/definitions/xcode.d.ts b/lib/definitions/xcode.d.ts index c865650fc7..9f1d2380a9 100644 --- a/lib/definitions/xcode.d.ts +++ b/lib/definitions/xcode.d.ts @@ -20,6 +20,8 @@ declare module "xcode" { addPbxGroup(filePathsArray: any[], name: string, path: string, sourceTree: string): void; + removePbxGroup(groupName: string, path: string): void; + addToHeaderSearchPaths(options?: Options): void; removeFromHeaderSearchPaths(options?: Options): void; updateBuildProperty(key: string, value: any): void; diff --git a/lib/node/xcode.ts b/lib/node/xcode.ts index 0e306d8a1a..c391e2f242 100644 --- a/lib/node/xcode.ts +++ b/lib/node/xcode.ts @@ -8,4 +8,6 @@ declare global { } } +export { xcode }; + $injector.register("xcode", xcode); diff --git a/lib/services/ios-project-service.ts b/lib/services/ios-project-service.ts index 6866df6f76..cebfa0ded5 100644 --- a/lib/services/ios-project-service.ts +++ b/lib/services/ios-project-service.ts @@ -17,6 +17,12 @@ import * as mobileprovision from "ios-mobileprovision-finder"; import { SpawnOptions } from "child_process"; import { BUILD_XCCONFIG_FILE_NAME } from "../constants"; +interface INativeSourceCodeGroup { + name: string; + path: string; + files: string[]; +} + export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase implements IPlatformProjectService { private static XCODE_PROJECT_EXT_NAME = ".xcodeproj"; private static XCODE_SCHEME_EXT_NAME = ".xcscheme"; @@ -924,6 +930,12 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f public async preparePluginNativeCode(pluginData: IPluginData, projectData: IProjectData, opts?: any): Promise { const pluginPlatformsFolderPath = pluginData.pluginPlatformsFolderPath(IOSProjectService.IOS_PLATFORM_NAME); + const sourcePath = path.join(pluginPlatformsFolderPath, "src"); + if (this.$fs.exists(pluginPlatformsFolderPath) && this.$fs.exists(sourcePath)) { + await this.prepareNativeSourceCode(pluginData.name, sourcePath, projectData); + } + + await this.prepareResources(pluginPlatformsFolderPath, pluginData, projectData); await this.prepareFrameworks(pluginPlatformsFolderPath, pluginData, projectData); await this.prepareStaticLibs(pluginPlatformsFolderPath, pluginData, projectData); await this.prepareCocoapods(pluginPlatformsFolderPath, projectData); @@ -932,6 +944,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f public async removePluginNativeCode(pluginData: IPluginData, projectData: IProjectData): Promise { const pluginPlatformsFolderPath = pluginData.pluginPlatformsFolderPath(IOSProjectService.IOS_PLATFORM_NAME); + this.removeNativeSourceCode(pluginPlatformsFolderPath, pluginData, projectData); this.removeFrameworks(pluginPlatformsFolderPath, pluginData, projectData); this.removeStaticLibs(pluginPlatformsFolderPath, pluginData, projectData); this.removeCocoapods(pluginPlatformsFolderPath, projectData); @@ -1103,6 +1116,40 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f return childProcess; } + private async prepareNativeSourceCode(pluginName: string, pluginPlatformsFolderPath: string, projectData: IProjectData): Promise { + const project = this.createPbxProj(projectData); + const group = this.getRootGroup(pluginName, pluginPlatformsFolderPath); + project.addPbxGroup(group.files, group.name, group.path, null, {isMain:true}); + project.addToHeaderSearchPaths(group.path); + this.savePbxProj(project, projectData); + } + + private getRootGroup(name: string, rootPath: string) { + const filePathsArr: string[] = []; + const rootGroup: INativeSourceCodeGroup = { name: name, files: filePathsArr, path: rootPath }; + + if (this.$fs.exists(rootPath) && !this.$fs.isEmptyDir(rootPath)) { + this.$fs.readDirectory(rootPath).forEach(fileName => { + const filePath = path.join(rootGroup.path, fileName); + filePathsArr.push(filePath); + }); + } + + return rootGroup; + } + + private async prepareResources(pluginPlatformsFolderPath: string, pluginData: IPluginData, projectData: IProjectData): Promise { + const project = this.createPbxProj(projectData); + const resourcesPath = path.join(pluginPlatformsFolderPath, "Resources"); + if (this.$fs.exists(resourcesPath) && !this.$fs.isEmptyDir(resourcesPath)) { + for (const fileName of this.$fs.readDirectory(resourcesPath)) { + const filePath = path.join(resourcesPath, fileName); + + project.addResourceFile(filePath); + } + } + this.savePbxProj(project, projectData); + } private async prepareFrameworks(pluginPlatformsFolderPath: string, pluginData: IPluginData, projectData: IProjectData): Promise { for (const fileName of this.getAllLibsForPluginWithFileExtension(pluginData, ".framework")) { await this.addFramework(path.join(pluginPlatformsFolderPath, fileName), projectData); @@ -1147,6 +1194,14 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f } } + private removeNativeSourceCode(pluginPlatformsFolderPath: string, pluginData: IPluginData, projectData: IProjectData): void { + const project = this.createPbxProj(projectData); + const group = this.getRootGroup(pluginData.name, pluginPlatformsFolderPath); + project.removePbxGroup(group.name, group.path); + project.removeFromHeaderSearchPaths(group.path); + this.savePbxProj(project, projectData); + } + private removeFrameworks(pluginPlatformsFolderPath: string, pluginData: IPluginData, projectData: IProjectData): void { const project = this.createPbxProj(projectData); _.each(this.getAllLibsForPluginWithFileExtension(pluginData, ".framework"), fileName => { diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 4f3c58ba23..c0e986f2a3 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -6,7 +6,7 @@ "dependencies": { "@sinonjs/formatio": { "version": "2.0.0", - "resolved": "http://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz", "integrity": "sha512-ls6CAMA6/5gG+O/IdsBcblvnd8qcO/l1TYoNeAzp3wcISOxlPXQEus0mLcdwazEkWjaBdaJ3TaxmNgCLWwvWzg==", "dev": true, "requires": { @@ -16,13 +16,13 @@ "@types/chai": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.0.1.tgz", - "integrity": "sha1-N/6neWF8/sP9KxmgJH6LvdUTO/Y=", + "integrity": "sha512-DWrdkraJO+KvBB7+Jc6AuDd2+fwV6Z9iK8cqEEoYpcurYrH7GiUZmwjFuQIIWj5HhFz6NsSxdN72YMIHT7Fy2Q==", "dev": true }, "@types/chai-as-promised": { "version": "0.0.31", "resolved": "https://registry.npmjs.org/@types/chai-as-promised/-/chai-as-promised-0.0.31.tgz", - "integrity": "sha1-4ekF6m2XHa/K02VgyPH3p9aQxeU=", + "integrity": "sha512-DWT96QeM5AeASIkChnFtEOy6O45WvKmaw27MPhAKLkx06TaFNqrzJuWVurKjCEo3PqVV89YLR2iVON8PhTRaLg==", "dev": true, "requires": { "@types/chai": "4.0.1" @@ -79,7 +79,7 @@ "@types/lockfile": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@types/lockfile/-/lockfile-1.0.0.tgz", - "integrity": "sha1-dqfBnFD+juKxZm1lP/XVV8MP4P8=", + "integrity": "sha512-pD6JuijPmrfi84qF3/TzGQ7zi0QIX+d7ZdetD6jUA6cp+IsCzAquXZfi5viesew+pfpOTIdAVKuh1SHA7KeKzg==", "dev": true }, "@types/node": { @@ -109,7 +109,7 @@ "@types/request": { "version": "0.0.45", "resolved": "https://registry.npmjs.org/@types/request/-/request-0.0.45.tgz", - "integrity": "sha1-xuUr6LEI6wNcNaqa9Wo4omDD5+Y=", + "integrity": "sha512-OIIREjT58pnpfJjEY5PeBEuRtRR2ED4DF1Ez3Dj9474kCqEKfE+iNAYyM/P3RxxDjNxBhipo+peNBW0S/7Wrzg==", "dev": true, "requires": { "@types/form-data": "2.2.1", @@ -137,7 +137,7 @@ "@types/universal-analytics": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/@types/universal-analytics/-/universal-analytics-0.4.1.tgz", - "integrity": "sha1-7mESGwqJiwvqXuskcgCJjg+o8Jw=", + "integrity": "sha512-AZSPpDUEZ4mAgO9geHc62dp/xCLmBJ1yIpbgTq5W/cWcVQsxmU/FyKwYKHXk2hnT9TAmYVFFdAijMrCdYjuHsA==", "dev": true }, "@types/ws": { @@ -638,7 +638,7 @@ "chai-as-promised": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/chai-as-promised/-/chai-as-promised-7.0.0.tgz", - "integrity": "sha1-yH7mE+qhlnZjk9pvu0BS8RKs9nU=", + "integrity": "sha512-7YYdnXPq2pV9nvRBb36Wi/MXfT8j2iL/H76GtenlOMatXbMoQLb+PonuVHGFsw5wE2M6R/VFciq8AnSSAix0GA==", "dev": true, "requires": { "check-error": "1.0.2", @@ -678,7 +678,7 @@ "requires": { "anymatch": "1.3.2", "async-each": "1.0.1", - "fsevents": "1.2.3", + "fsevents": "1.2.4", "glob-parent": "2.0.0", "inherits": "2.0.3", "is-binary-path": "1.0.1", @@ -1612,13 +1612,13 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, "fsevents": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.3.tgz", - "integrity": "sha512-X+57O5YkDTiEQGiw8i7wYc2nQgweIekqkepI8Q3y4wVlurgBt2SuwxTeYUYMZIGpLZH3r/TsMjczCMXE5ZOt7Q==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.4.tgz", + "integrity": "sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg==", "optional": true, "requires": { "nan": "2.10.0", - "node-pre-gyp": "0.9.1" + "node-pre-gyp": "0.10.0" }, "dependencies": { "abbrev": { @@ -1699,9 +1699,9 @@ } }, "deep-extend": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.4.2.tgz", - "integrity": "sha1-SLaZwn4zS/ifEIkr5DL25MfTSn8=", + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.5.1.tgz", + "integrity": "sha512-N8vBdOa+DF7zkRrDCsaOXoCs/E2fJfx9B9MrKnnSiHNh4ws7eSys6YQE4KvT1cecKmOASYQBhbKjeuDD9lT81w==", "optional": true }, "delegates": { @@ -1877,9 +1877,9 @@ } }, "node-pre-gyp": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.9.1.tgz", - "integrity": "sha1-8RwHUW3ZL4cZnbx+GDjqt81WyeA=", + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.10.0.tgz", + "integrity": "sha512-G7kEonQLRbcA/mOoFoxvlMrw6Q6dPf92+t/l0DFSMuSlDoWaI9JWIyPwK0jyE1bph//CUEL65/Fz1m2vJbmjQQ==", "optional": true, "requires": { "detect-libc": "1.0.3", @@ -1888,7 +1888,7 @@ "nopt": "4.0.1", "npm-packlist": "1.1.10", "npmlog": "4.1.2", - "rc": "1.2.6", + "rc": "1.2.7", "rimraf": "2.6.2", "semver": "5.5.0", "tar": "4.4.1" @@ -1986,12 +1986,12 @@ "optional": true }, "rc": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.6.tgz", - "integrity": "sha1-6xiYnG1PTxYsOZ953dKfODVWgJI=", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.7.tgz", + "integrity": "sha512-LdLD8xD4zzLsAT5xyushXDNscEjB7+2ulnl8+r1pnESlYtlJtVSoCMBGr30eDRJ3+2Gq89jK9P9e4tCEH1+ywA==", "optional": true, "requires": { - "deep-extend": "0.4.2", + "deep-extend": "0.5.1", "ini": "1.3.5", "minimist": "1.2.0", "strip-json-comments": "2.0.1" @@ -2217,7 +2217,7 @@ "glob": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha1-wZyd+aAocC1nhhI4SmVSQExjbRU=", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "requires": { "fs.realpath": "1.0.0", "inflight": "1.0.6", @@ -2230,7 +2230,7 @@ "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "requires": { "brace-expansion": "1.1.11" } @@ -2266,7 +2266,7 @@ "globals": { "version": "9.18.0", "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", - "integrity": "sha1-qjiWs+abSH8X4x7SFD1pqOMMLYo=", + "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", "dev": true }, "globby": { @@ -2708,9 +2708,9 @@ } }, "http-parser-js": { - "version": "0.4.12", - "resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.4.12.tgz", - "integrity": "sha1-uc+/Sizybw/DSxDKFImid3HjR08=", + "version": "0.4.13", + "resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.4.13.tgz", + "integrity": "sha1-O9bW/ebjFyyTNMOzO2wZPYD+ETc=", "dev": true }, "http-signature": { @@ -3364,7 +3364,7 @@ "parse-bmfont-ascii": "1.0.6", "parse-bmfont-binary": "1.0.6", "parse-bmfont-xml": "1.1.3", - "xhr": "2.4.1", + "xhr": "2.5.0", "xtend": "4.0.1" } }, @@ -3526,9 +3526,9 @@ } }, "lolex": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.4.1.tgz", - "integrity": "sha512-8QdNQMqlAE2kkc2YWR3Ld0evgE452mmyYZR4HTh54PeH8UAjDipHYh/FHq6y9cAvM68nxGxj5jAz97+WQ2AQEQ==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.7.0.tgz", + "integrity": "sha512-uJkH2e0BVfU5KOJUevbTOtpDduooSarH5PopO+LfM/vZf8Z9sJzODqKev804JYM2i++ktJfUmC1le4LwFQ1VMg==", "dev": true }, "longest": { @@ -3856,7 +3856,7 @@ "requires": { "@sinonjs/formatio": "2.0.0", "just-extend": "1.1.27", - "lolex": "2.4.1", + "lolex": "2.7.0", "path-to-regexp": "1.7.0", "text-encoding": "0.6.4" } @@ -3886,7 +3886,7 @@ "normalize-package-data": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", - "integrity": "sha1-EvlaMH1YNSB1oEkHuErIvpisAS8=", + "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", "requires": { "hosted-git-info": "2.6.0", "is-builtin-module": "1.0.0", @@ -4627,7 +4627,7 @@ "performance-now": "2.1.0", "qs": "6.5.2", "safe-buffer": "5.1.2", - "stringstream": "0.0.5", + "stringstream": "0.0.6", "tough-cookie": "2.3.4", "tunnel-agent": "0.6.0", "uuid": "3.2.1" @@ -4731,7 +4731,7 @@ "sax": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", - "integrity": "sha1-KBYjTiN4vdxOU1T6tcqold9xANk=" + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" }, "semver": { "version": "5.3.0", @@ -4776,7 +4776,7 @@ }, "should-equal": { "version": "0.5.0", - "resolved": "https://registry.npmjs.org/should-equal/-/should-equal-0.5.0.tgz", + "resolved": "http://registry.npmjs.org/should-equal/-/should-equal-0.5.0.tgz", "integrity": "sha1-x5fxNfMGf+tp6+zbMGscP+IbPm8=", "dev": true, "requires": { @@ -4855,7 +4855,7 @@ "diff": "3.5.0", "formatio": "1.2.0", "lodash.get": "4.4.2", - "lolex": "2.4.1", + "lolex": "2.7.0", "nise": "1.3.3", "supports-color": "4.5.0", "type-detect": "4.0.8" @@ -5081,9 +5081,9 @@ } }, "stringstream": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", - "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=" + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.6.tgz", + "integrity": "sha512-87GEBAkegbBcweToUrdzf3eLhWNg06FJTebl4BVJz/JgWy8CvEr9dRtX5qWphiynMSQlxxi+QqN0z5T32SLlhA==" }, "strip-ansi": { "version": "3.0.1", @@ -5295,9 +5295,9 @@ "dev": true }, "tslib": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.0.tgz", - "integrity": "sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ==", + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.1.tgz", + "integrity": "sha512-avfPS28HmGLLc2o4elcc2EIq2FcH++Yo5YxpBZi9Yw93BCTGFthI4HPE4Rpep6vSYQaK8e69PelM44tPj+RaQg==", "dev": true }, "tslint": { @@ -5314,8 +5314,8 @@ "minimatch": "3.0.4", "resolve": "1.7.1", "semver": "5.3.0", - "tslib": "1.9.0", - "tsutils": "2.26.2" + "tslib": "1.9.1", + "tsutils": "2.27.1" }, "dependencies": { "diff": { @@ -5327,7 +5327,7 @@ "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { "brace-expansion": "1.1.11" @@ -5336,12 +5336,12 @@ } }, "tsutils": { - "version": "2.26.2", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.26.2.tgz", - "integrity": "sha512-uzwnhmrSbyinPCiwfzGsOY3IulBTwoky7r83HmZdz9QNCjhSCzavkh47KLWuU0zF2F2WbpmmzoJUIEiYyd+jEQ==", + "version": "2.27.1", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.27.1.tgz", + "integrity": "sha512-AE/7uzp32MmaHvNNFES85hhUDHFdFZp6OAiZcd6y4ZKKIg6orJTm8keYWBhIhrJQH3a4LzNKat7ZPXZt5aTf6w==", "dev": true, "requires": { - "tslib": "1.9.0" + "tslib": "1.9.1" } }, "tunnel-agent": { @@ -5476,7 +5476,7 @@ "universal-analytics": { "version": "0.4.15", "resolved": "https://registry.npmjs.org/universal-analytics/-/universal-analytics-0.4.15.tgz", - "integrity": "sha1-SrxhsVn/52W+FE4Ht7c54O57iKs=", + "integrity": "sha512-9Dt6WBWsHsmv74G+N/rmEgi6KFZxVvQXkVhr0disegeUryybQAUQwMD1l5EtqaOu+hSOGbhL/hPPQYisZIqPRw==", "requires": { "async": "1.2.1", "request": "2.85.0", @@ -5586,7 +5586,7 @@ "integrity": "sha1-DK+dLXVdk67gSdS90NP+LMoqJOs=", "dev": true, "requires": { - "http-parser-js": "0.4.12", + "http-parser-js": "0.4.13", "websocket-extensions": "0.1.3" } }, @@ -5658,17 +5658,17 @@ } }, "xcode": { - "version": "https://github.com/NativeScript/node-xcode/archive/1.4.0.tar.gz", - "integrity": "sha512-zOoJmXPyb0V4bERR/MZ19K/DgmyTqXTNfabZJ3k1ZABtuApugvsVfclxzopt4mn6BGp0SVZ5DemKjuGmeMcejQ==", + "version": "https://github.com/NativeScript/node-xcode/archive/NativeScript-1.5.0.tar.gz", + "integrity": "sha512-2q3ALXJ/kyJht3TyQxfYpMLbWkoB0ndcp3gl9Jj03CQxrFeFRc6xiFPnye29QSnlAkzx83JRfOUgyZNcXjsr7g==", "requires": { "node-uuid": "1.3.3", "pegjs": "0.6.2" } }, "xhr": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.4.1.tgz", - "integrity": "sha512-pAIU5vBr9Hiy5cpFIbPnwf0C18ZF86DBsZKrlsf87N5De/JbA6RJ83UP/cv+aljl4S40iRVMqP4pr4sF9Dnj0A==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.5.0.tgz", + "integrity": "sha512-4nlO/14t3BNUZRXIXfXe+3N6w3s1KoxcJUUURctd64BLRe67E4gRwp4PjywtDY72fXpZ1y6Ch0VZQRY/gMPzzQ==", "requires": { "global": "4.3.2", "is-function": "1.0.1", diff --git a/package.json b/package.json index 51981060da..8376304cbc 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,7 @@ "uuid": "3.0.1", "winreg": "0.0.17", "ws": "5.1.0", - "xcode": "https://github.com/NativeScript/node-xcode/archive/1.4.0.tar.gz", + "xcode": "https://github.com/NativeScript/node-xcode/archive/NativeScript-1.5.0.tar.gz", "xml2js": "0.4.19", "xmldom": "0.1.21", "xmlhttprequest": "https://github.com/telerik/node-XMLHttpRequest/tarball/master", diff --git a/test/files/project.pbxproj b/test/files/project.pbxproj new file mode 100644 index 0000000000..450910ae8a --- /dev/null +++ b/test/files/project.pbxproj @@ -0,0 +1,378 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 858B842D18CA22B800AB12DE /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 858B833A18CA111C00AB12DE /* InfoPlist.strings */; }; + CD45EE7C18DC2D5800FB50C0 /* app in Resources */ = {isa = PBXBuildFile; fileRef = CD45EE7A18DC2D5800FB50C0 /* app */; }; + CD62955D1BB2678900AE3A93 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = CD62955C1BB2678900AE3A93 /* main.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 85F5BDFC1A9363BE006B9701 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 858B832E18CA111C00AB12DE /* TNSBlank.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TNSBlank.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 858B833918CA111C00AB12DE /* TNSBlank-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "TNSBlank-Info.plist"; sourceTree = ""; }; + 858B833B18CA111C00AB12DE /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + 858B833F18CA111C00AB12DE /* TNSBlank-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "TNSBlank-Prefix.pch"; sourceTree = ""; }; + 858B843318CA22B800AB12DE /* TNSBlank.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TNSBlank.app; sourceTree = BUILT_PRODUCTS_DIR; }; + CD45EE7A18DC2D5800FB50C0 /* app */ = {isa = PBXFileReference; lastKnownFileType = folder; path = app; sourceTree = ""; }; + CD62955C1BB2678900AE3A93 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = internal/main.m; sourceTree = SOURCE_ROOT; }; + CDD59A261BB43B5D00EC2671 /* build-debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "build-debug.xcconfig"; sourceTree = ""; }; + CDD59A271BB43B5D00EC2671 /* build-release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "build-release.xcconfig"; sourceTree = ""; }; + CDF4743E1BA4855C0087EA85 /* build.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = build.xcconfig; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 858B83F418CA22B800AB12DE /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 858B832518CA111C00AB12DE = { + isa = PBXGroup; + children = ( + E070579D1B39A9D000214BF1 /* Resources */, + 858B833718CA111C00AB12DE /* TNSBlank */, + 858B833018CA111C00AB12DE /* Frameworks */, + 858B832F18CA111C00AB12DE /* Products */, + ); + sourceTree = ""; + }; + 858B832F18CA111C00AB12DE /* Products */ = { + isa = PBXGroup; + children = ( + 858B832E18CA111C00AB12DE /* TNSBlank.app */, + 858B843318CA22B800AB12DE /* TNSBlank.app */, + ); + name = Products; + sourceTree = ""; + }; + 858B833018CA111C00AB12DE /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; + 858B833718CA111C00AB12DE /* TNSBlank */ = { + isa = PBXGroup; + children = ( + CD45EE7A18DC2D5800FB50C0 /* app */, + 858B833818CA111C00AB12DE /* Supporting Files */, + ); + path = TNSBlank; + sourceTree = ""; + }; + 858B833818CA111C00AB12DE /* Supporting Files */ = { + isa = PBXGroup; + children = ( + CDF4743E1BA4855C0087EA85 /* build.xcconfig */, + CDD59A261BB43B5D00EC2671 /* build-debug.xcconfig */, + CDD59A271BB43B5D00EC2671 /* build-release.xcconfig */, + 858B833918CA111C00AB12DE /* TNSBlank-Info.plist */, + 858B833A18CA111C00AB12DE /* InfoPlist.strings */, + CD62955C1BB2678900AE3A93 /* main.m */, + 858B833F18CA111C00AB12DE /* TNSBlank-Prefix.pch */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + E070579D1B39A9D000214BF1 /* Resources */ = { + isa = PBXGroup; + children = ( + ); + name = Resources; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 858B83EF18CA22B800AB12DE /* TNSBlank */ = { + isa = PBXNativeTarget; + buildConfigurationList = 858B843018CA22B800AB12DE /* Build configuration list for PBXNativeTarget "TNSBlank" */; + buildPhases = ( + C97FD7AC1ADE5369004DB2A4 /* NativeScript PreBuild */, + 858B83F218CA22B800AB12DE /* Sources */, + CD62955B1BB2651D00AE3A93 /* NativeScript PreLink */, + 858B83F418CA22B800AB12DE /* Frameworks */, + 858B842C18CA22B800AB12DE /* Resources */, + 85F5BDFC1A9363BE006B9701 /* Embed Frameworks */, + CD3EAD351B05FF060042DBFC /* NativeScript PostBuild */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = TNSBlank; + productName = JDBridgeApp; + productReference = 858B843318CA22B800AB12DE /* TNSBlank.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 858B832618CA111C00AB12DE /* Project object */ = { + isa = PBXProject; + attributes = { + CLASSPREFIX = TNS; + LastUpgradeCheck = 0500; + ORGANIZATIONNAME = Telerik; + }; + buildConfigurationList = 858B832918CA111C00AB12DE /* Build configuration list for PBXProject "TNSBlank" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 858B832518CA111C00AB12DE; + productRefGroup = 858B832F18CA111C00AB12DE /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 858B83EF18CA22B800AB12DE /* TNSBlank */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 858B842C18CA22B800AB12DE /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + CD45EE7C18DC2D5800FB50C0 /* app in Resources */, + 858B842D18CA22B800AB12DE /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + C97FD7AC1ADE5369004DB2A4 /* NativeScript PreBuild */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "NativeScript PreBuild"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"$SRCROOT/internal/nativescript-pre-build\""; + showEnvVarsInLog = 0; + }; + CD3EAD351B05FF060042DBFC /* NativeScript PostBuild */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "NativeScript PostBuild"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"$SRCROOT/internal/nativescript-post-build\""; + showEnvVarsInLog = 0; + }; + CD62955B1BB2651D00AE3A93 /* NativeScript PreLink */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "NativeScript PreLink"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"$SRCROOT/internal/nativescript-pre-link\""; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 858B83F218CA22B800AB12DE /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + CD62955D1BB2678900AE3A93 /* main.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 858B833A18CA111C00AB12DE /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 858B833B18CA111C00AB12DE /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 858B835818CA111C00AB12DE /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALID_ARCHS = "armv7 arm64"; + }; + name = Debug; + }; + 858B835918CA111C00AB12DE /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VALID_ARCHS = "armv7 arm64"; + }; + name = Release; + }; + 858B843118CA22B800AB12DE /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = CDD59A261BB43B5D00EC2671 /* build-debug.xcconfig */; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD)"; + CLANG_ENABLE_MODULES = NO; + CLANG_MODULES_AUTOLINK = NO; + ENABLE_BITCODE = NO; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "TNSBlank/TNSBlank-Prefix.pch"; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + "DEBUG=1", + ); + INFOPLIST_FILE = "$(SRCROOT)/TNSBlank/TNSBlank-Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_NAME = TNSBlank; + VALID_ARCHS = "armv7 arm64"; + WRAPPER_EXTENSION = app; + }; + name = Debug; + }; + 858B843218CA22B800AB12DE /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = CDD59A271BB43B5D00EC2671 /* build-release.xcconfig */; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD)"; + CLANG_ENABLE_MODULES = NO; + CLANG_MODULES_AUTOLINK = NO; + ENABLE_BITCODE = NO; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "TNSBlank/TNSBlank-Prefix.pch"; + INFOPLIST_FILE = "$(SRCROOT)/TNSBlank/TNSBlank-Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_NAME = TNSBlank; + VALID_ARCHS = "armv7 arm64"; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 858B832918CA111C00AB12DE /* Build configuration list for PBXProject "TNSBlank" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 858B835818CA111C00AB12DE /* Debug */, + 858B835918CA111C00AB12DE /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 858B843018CA22B800AB12DE /* Build configuration list for PBXNativeTarget "TNSBlank" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 858B843118CA22B800AB12DE /* Debug */, + 858B843218CA22B800AB12DE /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 858B832618CA111C00AB12DE /* Project object */; +} diff --git a/test/ios-project-service.ts b/test/ios-project-service.ts index 48d17b7bea..12eef30b8a 100644 --- a/test/ios-project-service.ts +++ b/test/ios-project-service.ts @@ -35,8 +35,8 @@ import { IOSProvisionService } from "../lib/services/ios-provision-service"; import { SettingsService } from "../lib/common/test/unit-tests/stubs"; import { BUILD_XCCONFIG_FILE_NAME } from "../lib/constants"; import { ProjectDataStub } from "./stubs"; +import { xcode } from "../lib/node/xcode"; import temp = require("temp"); - temp.track(); class IOSSimulatorDiscoveryMock extends DeviceDiscovery { @@ -49,7 +49,7 @@ class IOSSimulatorDiscoveryMock extends DeviceDiscovery { } } -function createTestInjector(projectPath: string, projectName: string): IInjector { +function createTestInjector(projectPath: string, projectName: string, xcode?: IXcode): IInjector { const testInjector = new yok.Yok(); testInjector.register("childProcess", ChildProcessLib.ChildProcess); testInjector.register("config", ConfigLib.Configuration); @@ -107,7 +107,7 @@ function createTestInjector(projectPath: string, projectName: string): IInjector testInjector.register("processService", {}); testInjector.register("sysInfo", {}); testInjector.register("pbxprojDomXcode", {}); - testInjector.register("xcode", { + testInjector.register("xcode", xcode || { project: class { constructor() { /* */ } parseSync() { /* */ } @@ -417,6 +417,8 @@ describe("Cocoapods support", () => { return { updateBuildProperty: () => { return {}; }, pbxXCBuildConfigurationSection: () => { return {}; }, + removePbxGroup: () => { return {}; }, + removeFromHeaderSearchPaths: () => { return {}; }, }; }; iOSProjectService.savePbxProj = (): Promise => Promise.resolve(); @@ -456,6 +458,124 @@ describe("Cocoapods support", () => { } }); +describe("Source code in plugin support", () => { + if (require("os").platform() !== "darwin") { + console.log("Skipping Source code in plugin tests. They cannot work on windows"); + } else { + + const preparePluginWithFiles = async (files: string[], prepareMethodToCall: string) => { + // Arrange + const projectName = "projectDirectory"; + const projectPath = temp.mkdirSync(projectName); + const testInjector = createTestInjector(projectPath, projectName, xcode); + const fs: IFileSystem = testInjector.resolve("fs"); + + const packageJsonData = { + "name": "myProject", + "version": "0.1.0", + "nativescript": { + "id": "org.nativescript.myProject", + "tns-ios": { + "version": "1.0.0" + } + } + }; + fs.writeJson(path.join(projectPath, "package.json"), packageJsonData); + + const platformsFolderPath = path.join(projectPath, "platforms", "ios"); + fs.createDirectory(platformsFolderPath); + + const iOSProjectService = testInjector.resolve("iOSProjectService"); + + const mockPrepareMethods = ["prepareFrameworks", "prepareStaticLibs", "prepareResources", "prepareNativeSourceCode"]; + + mockPrepareMethods.filter(m => m !== prepareMethodToCall).forEach(methodName => { + iOSProjectService[methodName] = (pluginPlatformsFolderPath: string, pluginData: IPluginData): Promise => { + return Promise.resolve(); + }; + }); + + iOSProjectService.getXcodeprojPath = () => { + return path.join(__dirname, "files"); + }; + let pbxProj : any; + iOSProjectService.savePbxProj = (project: any): Promise => { + pbxProj = project; + return Promise.resolve(); + }; + + const pluginPath = temp.mkdirSync("pluginDirectory"); + const pluginPlatformsFolderPath = path.join(pluginPath, "platforms", "ios"); + files.forEach(file => { + const fullPath = path.join(pluginPlatformsFolderPath, file); + fs.createDirectory(path.dirname(fullPath)); + fs.writeFile(fullPath, ""); + }); + + const pluginData = { + name: "testPlugin", + pluginPlatformsFolderPath(platform: string): string { + return pluginPlatformsFolderPath; + } + }; + + const projectData: IProjectData = testInjector.resolve("projectData"); + + // Act + await iOSProjectService.preparePluginNativeCode(pluginData, projectData); + + return pbxProj; + }; + + it("adds plugin with Source files", async () => { + const sourceFileNames = [ + "src/Header.h", "src/ObjC.m", + "src/nested/Header.hpp", "src/nested/Source.cpp", "src/nested/ObjCpp.mm", + "src/nested/level2/Header2.hxx", "src/nested/level2/Source2.cxx", "src/nested/level2/Source3.c", + "src/SomeOtherExtension.donotadd", + ]; + + const pbxProj = await preparePluginWithFiles(sourceFileNames, "prepareNativeSourceCode"); + + const pbxFileReference = pbxProj.hash.project.objects.PBXFileReference; + const pbxFileReferenceValues = Object.keys(pbxFileReference).map(key => pbxFileReference[key]); + const buildPhaseFiles = pbxProj.hash.project.objects.PBXSourcesBuildPhase["858B83F218CA22B800AB12DE"].files; + + sourceFileNames.map(file => path.basename(file)).forEach(basename => { + const ext = path.extname(basename); + const shouldBeAdded = ext !== ".donotadd"; + if (shouldBeAdded) { + assert.notEqual(pbxFileReferenceValues.indexOf(basename), -1, `${basename} not added to PBXFileRefereces`); + + if (shouldBeAdded && !path.extname(basename).startsWith(".h")) { + assert.isDefined(buildPhaseFiles.find((fileObject: any) => fileObject.comment.startsWith(basename)), `${basename} not added to PBXSourcesBuildPhase`); + } + } else { + assert.equal(pbxFileReferenceValues.indexOf(basename), -1, `${basename} was added to PBXFileRefereces, but it shouldn't have been`); + } + }); + }); + it("adds plugin with Resource files", async () => { + const resFileNames = [ + "Resources/Image.png", "Resources/Jpeg.jpg", "Resources/screen.xib", + "Resources/TestBundle.bundle/bundled.png", + + ]; + + const pbxProj = await preparePluginWithFiles(resFileNames, "prepareResources"); + + const pbxFileReference = pbxProj.hash.project.objects.PBXFileReference; + const pbxFileReferenceValues = Object.keys(pbxFileReference).map(key => pbxFileReference[key]); + + resFileNames.forEach(filename => { + const dirName = path.dirname(filename); + const fileToCheck = dirName.endsWith(".bundle") ? dirName : filename; + assert.isTrue(pbxFileReferenceValues.indexOf(path.basename(fileToCheck)) !== -1, `Resource ${filename} not added to PBXFileRefereces`); + }); + }); + } +}); + describe("Static libraries support", () => { if (require("os").platform() !== "darwin") { console.log("Skipping static library tests. They work only on darwin.");