From 185a9ab9fe2df41d4130700e79fbe40a2e44ecc7 Mon Sep 17 00:00:00 2001 From: fatme Date: Fri, 4 Oct 2019 08:48:31 +0300 Subject: [PATCH 1/3] fix: fix apple watch extension with space in name Rel to: https://github.com/NativeScript/nativescript-cli/issues/5005 --- lib/constants.js | 8 +++++++- lib/pbxProject.js | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/constants.js b/lib/constants.js index fefd9de..1275c3d 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -112,6 +112,11 @@ function unquoted(text) { return text == null ? '' : text.replace (/(^")|("$)/g, '') } +function quote(name) { + const quotedName = (name.indexOf(" ") >= 0 || name.indexOf("@") >= 0) && name[0] !== `"` ? `"${name}"` : name; + return quotedName; +} + function isModuleMapFileType(fileType) { return fileType === FILETYPE_BY_EXTENSION.modulemap; } @@ -137,5 +142,6 @@ module.exports = { isEntitlementFileType, isPlistFileType, isModuleMapFileType, - unquoted + unquoted, + quote } \ No newline at end of file diff --git a/lib/pbxProject.js b/lib/pbxProject.js index d510221..d10cfcb 100644 --- a/lib/pbxProject.js +++ b/lib/pbxProject.js @@ -550,7 +550,7 @@ pbxProject.prototype.addPbxGroup = function (filePathsArray, name, path, sourceT var groups = this.hash.project.objects['PBXGroup'], pbxGroupUuid = opt.uuid || this.generateUuid(), commentKey = f("%s_comment", pbxGroupUuid), - groupName = (name.indexOf(" ") >= 0 || name.indexOf("@") >= 0) && name[0] !== `"` ? `"${name}"` : name, + groupName = constants.quote(name), pbxGroup = { isa: 'PBXGroup', children: [], @@ -611,7 +611,7 @@ pbxProject.prototype.addPbxGroup = function (filePathsArray, name, path, sourceT } if(isEntitlementFileType(file.lastKnownFileType)) { - this.addToBuildSettings('CODE_SIGN_ENTITLEMENTS', file.path, opt.target); + this.addToBuildSettings('CODE_SIGN_ENTITLEMENTS', constants.quote(file.path), opt.target); continue; } From c785a4fa3479e971b0f246b73096930d1a0b9dc2 Mon Sep 17 00:00:00 2001 From: fatme Date: Fri, 4 Oct 2019 19:12:12 +0300 Subject: [PATCH 2/3] fix: fix PR comments --- lib/constants.js | 4 ++-- lib/pbxProject.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/constants.js b/lib/constants.js index 1275c3d..68d0b15 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -112,7 +112,7 @@ function unquoted(text) { return text == null ? '' : text.replace (/(^")|("$)/g, '') } -function quote(name) { +function quoteIfNeeded(name) { const quotedName = (name.indexOf(" ") >= 0 || name.indexOf("@") >= 0) && name[0] !== `"` ? `"${name}"` : name; return quotedName; } @@ -143,5 +143,5 @@ module.exports = { isPlistFileType, isModuleMapFileType, unquoted, - quote + quoteIfNeeded } \ No newline at end of file diff --git a/lib/pbxProject.js b/lib/pbxProject.js index d10cfcb..5d770bf 100644 --- a/lib/pbxProject.js +++ b/lib/pbxProject.js @@ -550,7 +550,7 @@ pbxProject.prototype.addPbxGroup = function (filePathsArray, name, path, sourceT var groups = this.hash.project.objects['PBXGroup'], pbxGroupUuid = opt.uuid || this.generateUuid(), commentKey = f("%s_comment", pbxGroupUuid), - groupName = constants.quote(name), + groupName = constants.quoteIfNeeded(name), pbxGroup = { isa: 'PBXGroup', children: [], @@ -611,7 +611,7 @@ pbxProject.prototype.addPbxGroup = function (filePathsArray, name, path, sourceT } if(isEntitlementFileType(file.lastKnownFileType)) { - this.addToBuildSettings('CODE_SIGN_ENTITLEMENTS', constants.quote(file.path), opt.target); + this.addToBuildSettings('CODE_SIGN_ENTITLEMENTS', constants.quoteIfNeeded(file.path), opt.target); continue; } From f88457fd02c9e3c368026bc7344b2765721065ff Mon Sep 17 00:00:00 2001 From: fatme Date: Fri, 4 Oct 2019 19:12:25 +0300 Subject: [PATCH 3/3] chore: bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5591b6a..3f78fc5 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "name": "nativescript-dev-xcode", "description": "parser for xcodeproj/project.pbxproj files", "main": "index.js", - "version": "0.2.0", + "version": "0.2.1", "repository": { "url": "https://github.com/NativeScript/nativescript-dev-xcode.git" },