From de78502bff4cb8440b4c69d2493c27c01d935c15 Mon Sep 17 00:00:00 2001 From: Teodor Dermendzhiev Date: Tue, 10 Apr 2018 14:59:38 +0300 Subject: [PATCH 1/9] feat: Add Objective-C source code to .pbxproject Search for plugin's platforms/ios/src folder and add it and it's content (.h and .m files) to the native iOS project. --- lib/services/ios-project-service.ts | 40 +++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/lib/services/ios-project-service.ts b/lib/services/ios-project-service.ts index 365aa08448..84629012ae 100644 --- a/lib/services/ios-project-service.ts +++ b/lib/services/ios-project-service.ts @@ -18,6 +18,17 @@ import * as mobileprovision from "ios-mobileprovision-finder"; import { SpawnOptions } from "child_process"; import { BUILD_XCCONFIG_FILE_NAME } from "../constants"; +interface INativeSourceCodeDescription { + path: string; + name: string; +} + +interface INativeSourceCodeGroup { + name: string; + path: string; + files: INativeSourceCodeDescription[]; +} + export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase implements IPlatformProjectService { private static XCODE_PROJECT_EXT_NAME = ".xcodeproj"; private static XCODE_SCHEME_EXT_NAME = ".xcscheme"; @@ -924,6 +935,11 @@ 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.prepareFrameworks(pluginPlatformsFolderPath, pluginData, projectData); await this.prepareStaticLibs(pluginPlatformsFolderPath, pluginData, projectData); await this.prepareCocoapods(pluginPlatformsFolderPath, projectData); @@ -1103,6 +1119,30 @@ 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.map(f => f.path), group.name, group.path, null, {isMain:true}); + project.addToHeaderSearchPaths(group.path); + this.savePbxProj(project, projectData); + } + + private getRootGroup(name: string, rootPath: string) { + const filesArr: INativeSourceCodeDescription[] = []; + const rootGroup: INativeSourceCodeGroup = { name: name, files: filesArr, path: rootPath }; + + if (this.$fs.exists(rootPath) && !this.$fs.isEmptyDir(rootPath)) { + this.$fs.readDirectory(rootPath).forEach(fileName => { + const filePath = path.join(rootGroup.path, fileName); + const file: INativeSourceCodeDescription = { name: fileName, path: filePath}; + filesArr.push(file); + }); + } + + return rootGroup; + } + 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); From 9a33b41a4bcd19adf3b5c0d317d9b7a6a427d3b5 Mon Sep 17 00:00:00 2001 From: Martin Bektchiev Date: Wed, 16 May 2018 17:41:28 +0300 Subject: [PATCH 2/9] feat: Add support for platforms/ios/Resources directory * Implement support for adding resources * Write unit tests for `Resources` and `src` * TODO: fix node-xcode reference in package.json after merging Teo's PR --- lib/node/xcode.ts | 2 + lib/services/ios-project-service.ts | 14 +- npm-shrinkwrap.json | 4 +- package.json | 2 +- test/files/project.pbxproj | 378 ++++++++++++++++++++++++++++ test/ios-project-service.ts | 124 ++++++++- 6 files changed, 517 insertions(+), 7 deletions(-) create mode 100644 test/files/project.pbxproj 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 c7e5aa74a1..6c35329db3 100644 --- a/lib/services/ios-project-service.ts +++ b/lib/services/ios-project-service.ts @@ -940,6 +940,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f 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); @@ -1120,7 +1121,6 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f } 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.map(f => f.path), group.name, group.path, null, {isMain:true}); @@ -1143,6 +1143,18 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f 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); diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index c47db3fd05..44d8189879 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -5658,8 +5658,8 @@ } }, "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/tdermendzhiev/fix-addpbxgroup.tar.gz", + "integrity": "sha512-bGJhIcYor636IRHG51CvnS9Y4Ad8QEm2km0URdv6jxuBp5bVot/0GWM38CBCRBJExlg59V/eQPg/vJI7Rqvyxw==", "requires": { "node-uuid": "1.3.3", "pegjs": "0.6.2" diff --git a/package.json b/package.json index 908336848c..c2cae1a494 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/tdermendzhiev/fix-addpbxgroup.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..9bc67a5bd0 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() { /* */ } @@ -456,6 +456,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."); From 9a111d48c31cab7d623979f9a57c9d0fe5b1371b Mon Sep 17 00:00:00 2001 From: Teodor Dermendzhiev Date: Fri, 18 May 2018 11:09:01 +0300 Subject: [PATCH 3/9] Update lib/common submodule --- lib/common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/common b/lib/common index 1ea2aa65c1..8a13846f54 160000 --- a/lib/common +++ b/lib/common @@ -1 +1 @@ -Subproject commit 1ea2aa65c1fb98f59e9c5b5f63d11fb6bcb435f9 +Subproject commit 8a13846f54df67c62516f862001c59fe39c3ac6b From 5fd9448a3161dd7511c9ef4edfe5a314dee09732 Mon Sep 17 00:00:00 2001 From: Teodor Dermendzhiev Date: Tue, 22 May 2018 16:33:27 +0300 Subject: [PATCH 4/9] Remove plugin native source code on 'tns plugin remove' --- lib/services/ios-project-service.ts | 25 ++++++++++++++----------- package.json | 2 +- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/lib/services/ios-project-service.ts b/lib/services/ios-project-service.ts index 6c35329db3..fe4c20b372 100644 --- a/lib/services/ios-project-service.ts +++ b/lib/services/ios-project-service.ts @@ -17,15 +17,10 @@ import * as mobileprovision from "ios-mobileprovision-finder"; import { SpawnOptions } from "child_process"; import { BUILD_XCCONFIG_FILE_NAME } from "../constants"; -interface INativeSourceCodeDescription { - path: string; - name: string; -} - interface INativeSourceCodeGroup { name: string; path: string; - files: INativeSourceCodeDescription[]; + files: string[]; } export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase implements IPlatformProjectService { @@ -949,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); @@ -1123,20 +1119,19 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f 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.map(f => f.path), group.name, group.path, null, {isMain:true}); + 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 filesArr: INativeSourceCodeDescription[] = []; - const rootGroup: INativeSourceCodeGroup = { name: name, files: filesArr, path: rootPath }; + 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); - const file: INativeSourceCodeDescription = { name: fileName, path: filePath}; - filesArr.push(file); + filePathsArr.push(filePath); }); } @@ -1199,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/package.json b/package.json index 5b3cdc929f..f5f21ee151 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/tdermendzhiev/fix-addpbxgroup.tar.gz", + "xcode": "https://github.com/NativeScript/node-xcode/archive/1.4.0.tar.gz", "xml2js": "0.4.19", "xmldom": "0.1.21", "xmlhttprequest": "https://github.com/telerik/node-XMLHttpRequest/tarball/master", From ad1e823fb4279823916531b00309baf6f26caf43 Mon Sep 17 00:00:00 2001 From: Teodor Dermendzhiev Date: Tue, 22 May 2018 17:57:06 +0300 Subject: [PATCH 5/9] Update node-xcode version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f5f21ee151..7a58f70911 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", From 78c1daddc13756483419507adbaad1a18d0fe98b Mon Sep 17 00:00:00 2001 From: Teodor Dermendzhiev Date: Tue, 22 May 2018 18:28:35 +0300 Subject: [PATCH 6/9] Regenerate shrinkwrap --- npm-shrinkwrap.json | 54 ++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index b7f2b15f08..b4d700b28a 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -40,7 +40,7 @@ "@types/color": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@types/color/-/color-3.0.0.tgz", - "integrity": "sha512-5qqtNia+m2I0/85+pd2YzAXaTyKO8j+svirO5aN+XaQJ5+eZ8nx0jPtEWZLxCi50xwYsX10xUHetFzfb1WEs4Q==", + "integrity": "sha1-QPimvy/YbpaYdrM5qDfY/xsKbjA=", "dev": true, "requires": { "@types/color-convert": "1.9.0" @@ -49,7 +49,7 @@ "@types/color-convert": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/@types/color-convert/-/color-convert-1.9.0.tgz", - "integrity": "sha512-OKGEfULrvSL2VRbkl/gnjjgbbF7ycIlpSsX7Nkab4MOWi5XxmgBYvuiQ7lcCFY5cPDz7MUNaKgxte2VRmtr4Fg==", + "integrity": "sha1-v6ggPkHnxlRx6YQdfjBqfNi1Fy0=", "dev": true, "requires": { "@types/color-name": "1.1.0" @@ -58,7 +58,7 @@ "@types/color-name": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.0.tgz", - "integrity": "sha512-gZ/Rb+MFXF0pXSEQxdRoPMm5jeO3TycjOdvbpbcpHX/B+n9AqaHFe5q6Ga9CsZ7ir/UgIWPfrBzUzn3F19VH/w==", + "integrity": "sha1-km929+ZvScxZrYgLsVsDCrvwtm0=", "dev": true }, "@types/events": { @@ -91,7 +91,7 @@ "@types/ora": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/@types/ora/-/ora-1.3.3.tgz", - "integrity": "sha512-XaSVRyCfnGq1xGlb6iuoxnomMXPIlZnvIIkKiGNMTCeVOg7G1Si+FA9N1lPrykPEfiRHwbuZXuTCSoYcHyjcdg==", + "integrity": "sha1-0xhkGMPPN6gxeZs3a+ykqOG/yi0=", "dev": true, "requires": { "@types/node": "6.0.61" @@ -125,7 +125,7 @@ "@types/sinon": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-4.0.0.tgz", - "integrity": "sha512-cuK4xM8Lg2wd8cxshcQa8RG4IK/xfyB6TNE6tNVvkrShR4xdrYgsV04q6Dp6v1Lp6biEFdzD8k8zg/ujQeiw+A==", + "integrity": "sha1-mpP/pO4TKehRZieKXtmfgdxMg2I=", "dev": true }, "@types/source-map": { @@ -153,7 +153,7 @@ "@types/xml2js": { "version": "0.4.2", "resolved": "https://registry.npmjs.org/@types/xml2js/-/xml2js-0.4.2.tgz", - "integrity": "sha512-8aKUBSj3oGcnuiBmDLm3BIk09RYg01mz9HlQ2u4aS17oJ25DxjQrEUVGFSBVNOfM45pQW4OjcBPplq6r/exJdA==", + "integrity": "sha1-pLhLOHn/1HEJU/2Syr/emopOhFY=", "dev": true, "requires": { "@types/node": "6.0.61" @@ -272,7 +272,7 @@ "arr-flatten": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", - "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==" + "integrity": "sha1-NgSLv/TntH4TZkQxbJlmnqWukfE=" }, "array-find-index": { "version": "1.0.2", @@ -766,7 +766,7 @@ "color": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/color/-/color-3.0.0.tgz", - "integrity": "sha512-jCpd5+s0s0t7p3pHQKpnJ0TpQKKdleP71LWcA0aqiljpiuAkOSUFN/dyH8ZwF0hRmFlrIuRhufds1QyEP9EB+w==", + "integrity": "sha1-2SC0Mo1TSjrIKV1o971LpsQnvpo=", "requires": { "color-convert": "1.9.1", "color-string": "1.5.2" @@ -775,7 +775,7 @@ "color-convert": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.1.tgz", - "integrity": "sha512-mjGanIiwQJskCC18rPR6OmrZ6fm2Lc7PeGFYwCmy5J34wC6F1PzdGL6xeMfmgicfYcNLGuVFA3WzXtIDCQSZxQ==", + "integrity": "sha1-wSYRB66y8pTr/+ye2eytUppgl+0=", "requires": { "color-name": "1.1.3" } @@ -3312,7 +3312,7 @@ "just-extend": { "version": "1.1.27", "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-1.1.27.tgz", - "integrity": "sha512-mJVp13Ix6gFo3SBAy9U/kL+oeZqzlYYYLQBwXVBlVzIsZwBqGREnOro24oC/8s8aox+rJhtZ2DiQof++IrkA+g==", + "integrity": "sha1-7G55QQ/5FORyZSq/oOYDwD1g6QU=", "dev": true }, "kind-of": { @@ -3482,7 +3482,7 @@ "log-symbols": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", - "integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==", + "integrity": "sha1-V0Dhxdbw39pK2TI7UzIQfva0xAo=", "requires": { "chalk": "2.4.1" }, @@ -3490,7 +3490,7 @@ "ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "integrity": "sha1-QfuyAkPlCxK+DwS43tvwdSDOhB0=", "requires": { "color-convert": "1.9.1" } @@ -3556,7 +3556,7 @@ "marked": { "version": "0.3.12", "resolved": "https://registry.npmjs.org/marked/-/marked-0.3.12.tgz", - "integrity": "sha512-k4NaW+vS7ytQn6MgJn3fYpQt20/mOgYM5Ft9BYMfQJDz2QT6yEeS9XJ8k2Nw8JTeWK/znPPW2n3UJGzyYEiMoA==" + "integrity": "sha1-fPJf8iUmMvP+JAa94ljpTu6SdRk=" }, "marked-terminal": { "version": "2.0.0", @@ -3676,7 +3676,7 @@ "mime": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" + "integrity": "sha1-Ms2eXGRVO9WNGaVor0Uqz/BJgbE=" }, "mime-db": { "version": "1.33.0", @@ -3694,7 +3694,7 @@ "mimic-fn": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", - "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==" + "integrity": "sha1-ggyGo5M0ZA6ZUWkovQP8qIBX0CI=" }, "min-document": { "version": "2.19.0", @@ -3814,7 +3814,7 @@ "nativescript-doctor": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/nativescript-doctor/-/nativescript-doctor-0.12.0.tgz", - "integrity": "sha512-eGEx9MFagJ7i2mtFZv5Jbsg6YQqQsVLxLhmg2uOOjLC253daAkGUBFbPnpEajrqhPZX3PBmoYIh+oHfc9/trjA==", + "integrity": "sha1-bC5i5OUOlX4jZKcIRTaKrmiywiY=", "requires": { "osenv": "0.1.3", "semver": "5.3.0", @@ -4000,7 +4000,7 @@ "ora": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ora/-/ora-2.0.0.tgz", - "integrity": "sha512-g+IR0nMUXq1k4nE3gkENbN4wkF0XsVZFyxznTF6CdmwQ9qeTGONGpSR9LM5//1l0TVvJoJF3MkMtJp6slUsWFg==", + "integrity": "sha1-jsOjf6e/+1SjoMGIofZ5jn4YJ80=", "requires": { "chalk": "2.4.1", "cli-cursor": "2.1.0", @@ -4018,7 +4018,7 @@ "ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "integrity": "sha1-QfuyAkPlCxK+DwS43tvwdSDOhB0=", "requires": { "color-convert": "1.9.1" } @@ -4349,7 +4349,7 @@ "proxy-lib": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/proxy-lib/-/proxy-lib-0.4.0.tgz", - "integrity": "sha512-oUDDpf0NTtKPyXjBNUcKzwZhA9GjEdu8Z47GsxGv5rZvKyCqsSrHurJtlL1yp7uVzA2NOmxd4aX7qmB1ZOdCwQ==", + "integrity": "sha1-Dt7+MSUKacPMU8xJ7RR9zk8zbXs=", "requires": { "osenv": "0.1.4" }, @@ -4725,7 +4725,7 @@ "samsam": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/samsam/-/samsam-1.3.0.tgz", - "integrity": "sha512-1HwIYD/8UlOtFS3QO3w7ey+SdSDFE4HRNLZoZRYVQefrOY3l17epswImeB1ijgJFQJodIaHcwkp3r/myBjFVbg==", + "integrity": "sha1-jR2TUOJWItow3j5EumkrUiGrfFA=", "dev": true }, "sax": { @@ -4849,7 +4849,7 @@ "sinon": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/sinon/-/sinon-4.1.2.tgz", - "integrity": "sha512-5uLBZPdCWl59Lpbf45ygKj7Z0LVol+ftBe7RDIXOQV/sF58pcFmbK8raA7bt6eljNuGnvBP+/ZxlicVn0emDjA==", + "integrity": "sha1-ZWEFIdkm+1N0LdhM1ZnwuJqC9EA=", "dev": true, "requires": { "diff": "3.5.0", @@ -4937,7 +4937,7 @@ "source-map-support": { "version": "0.5.3", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.3.tgz", - "integrity": "sha512-eKkTgWYeBOQqFGXRfKabMFdnWepo51vWqEdoeikaEPFiJC7MCU5j2h4+6Q8npkZTeLGbSyecZvRxiSoWl3rh+w==", + "integrity": "sha1-Kz1f/ymM+k0a/X1DUtVp6aAVjnY=", "dev": true, "requires": { "source-map": "0.6.1" @@ -4946,7 +4946,7 @@ "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "integrity": "sha1-dHIq8y6WFOnCh6jQu95IteLxomM=", "dev": true } } @@ -5658,8 +5658,8 @@ } }, "xcode": { - "version": "https://github.com/NativeScript/node-xcode/archive/tdermendzhiev/fix-addpbxgroup.tar.gz", - "integrity": "sha512-bGJhIcYor636IRHG51CvnS9Y4Ad8QEm2km0URdv6jxuBp5bVot/0GWM38CBCRBJExlg59V/eQPg/vJI7Rqvyxw==", + "version": "https://github.com/NativeScript/node-xcode/archive/NativeScript-1.5.0.tar.gz", + "integrity": "sha512-H3Jtm95DP8QDoKOQWJEUdLfya7i9emrq6KtbCheQBrkIKd72PkvxvWjhGdD7QRBhOvvElUePD4vMP+FkGnCDjQ==", "requires": { "node-uuid": "1.3.3", "pegjs": "0.6.2" @@ -5668,7 +5668,7 @@ "xhr": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.4.1.tgz", - "integrity": "sha512-pAIU5vBr9Hiy5cpFIbPnwf0C18ZF86DBsZKrlsf87N5De/JbA6RJ83UP/cv+aljl4S40iRVMqP4pr4sF9Dnj0A==", + "integrity": "sha1-upgsztIFrl7sOHFprJ3HfKSFPTg=", "requires": { "global": "4.3.2", "is-function": "1.0.1", @@ -5684,7 +5684,7 @@ "xml2js": { "version": "0.4.19", "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", - "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", + "integrity": "sha1-aGwg8hMgnpSr8NG88e+qKRx4J6c=", "requires": { "sax": "1.2.4", "xmlbuilder": "9.0.7" From 0548294dd3540926594f71364e493b488a86e235 Mon Sep 17 00:00:00 2001 From: Teodor Dermendzhiev Date: Wed, 23 May 2018 10:57:04 +0300 Subject: [PATCH 7/9] Add removePbxGroup() to project class --- lib/definitions/xcode.d.ts | 2 ++ 1 file changed, 2 insertions(+) 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; From 6fdc25cd0bfc13e207faf5c31b09a67834ede74d Mon Sep 17 00:00:00 2001 From: Teodor Dermendzhiev Date: Wed, 23 May 2018 16:49:00 +0300 Subject: [PATCH 8/9] Add removePbxGroup and removeFromHeaderSearchPaths to createPbxProj mock method --- test/ios-project-service.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/ios-project-service.ts b/test/ios-project-service.ts index 9bc67a5bd0..12eef30b8a 100644 --- a/test/ios-project-service.ts +++ b/test/ios-project-service.ts @@ -417,6 +417,8 @@ describe("Cocoapods support", () => { return { updateBuildProperty: () => { return {}; }, pbxXCBuildConfigurationSection: () => { return {}; }, + removePbxGroup: () => { return {}; }, + removeFromHeaderSearchPaths: () => { return {}; }, }; }; iOSProjectService.savePbxProj = (): Promise => Promise.resolve(); From 4a9a6c02ec02ee8e931f63ab1ae3dd90d372577d Mon Sep 17 00:00:00 2001 From: Teodor Dermendzhiev Date: Fri, 25 May 2018 17:16:02 +0300 Subject: [PATCH 9/9] chore: Fix submodule reference --- lib/common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/common b/lib/common index 8a13846f54..a20a105da0 160000 --- a/lib/common +++ b/lib/common @@ -1 +1 @@ -Subproject commit 8a13846f54df67c62516f862001c59fe39c3ac6b +Subproject commit a20a105da0789a4c57bc6420ce6bb2b594789d77