From 36f7c9f4358e79df18a53309181b65b05fdc4767 Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Fri, 5 Jul 2024 18:42:42 -0700 Subject: [PATCH 01/11] fix: optional groups when using embedding against host projects --- lib/pbxProject.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pbxProject.js b/lib/pbxProject.js index bc458de..1582859 100644 --- a/lib/pbxProject.js +++ b/lib/pbxProject.js @@ -2143,7 +2143,7 @@ function correctForFrameworksPath(file, project) { function correctForPath(file, project, group) { var r_group_dir = new RegExp('^' + group + '[\\\\/]'); - if (project.pbxGroupByName(group).path) + if (project.pbxGroupByName(group)?.path) file.path = file.path.replace(r_group_dir, ''); return file; @@ -2393,7 +2393,7 @@ pbxProject.prototype.getPBXGroupByKey = function(key) { }; pbxProject.prototype.getPBXVariantGroupByKey = function(key) { - return this.hash.project.objects['PBXVariantGroup'][key]; + return this.hash.project.objects['PBXVariantGroup']?.[key]; }; From bcb1f9be1af585cbeb349b03d7a805dbae6a664f Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Mon, 8 Jul 2024 14:27:49 -0700 Subject: [PATCH 02/11] fix: add PBXCopyFilesBuildPhase if does not exist --- lib/pbxProject.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/pbxProject.js b/lib/pbxProject.js index 1582859..a6424a5 100644 --- a/lib/pbxProject.js +++ b/lib/pbxProject.js @@ -1324,7 +1324,13 @@ pbxProject.prototype.pbxFrameworksBuildPhaseObj = function(target) { } pbxProject.prototype.pbxEmbedFrameworksBuildPhaseObj = function (target) { - return this.buildPhaseObject('PBXCopyFilesBuildPhase', 'Embed Frameworks', target); + let buildPhase = this.buildPhaseObject('PBXCopyFilesBuildPhase', 'Embed Frameworks', target); + if (!buildPhase) { + // Create CopyFiles phase in parent target + const phase = this.addBuildPhase([], 'PBXCopyFilesBuildPhase', 'Embed Frameworks', target); + buildPhase = phase.buildPhase; + } + return buildPhase; }; // Find Build Phase from group/target From 4b846bbe6907210d9bc0c39c35f409df77d923bd Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Mon, 8 Jul 2024 14:28:02 -0700 Subject: [PATCH 03/11] release: 0.7.1-alpha.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5b0cdec..774be68 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.7.0", + "version": "0.7.1-alpha.1", "files": [ "lib", "!lib/parser/pbxproj.pegjs" From a1fbeca0d787c8179aaef79d00cb1b4a3f2d62a2 Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Mon, 8 Jul 2024 21:02:56 -0700 Subject: [PATCH 04/11] fix: add PBXFrameworksBuildPhase if does not exist --- lib/pbxProject.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/pbxProject.js b/lib/pbxProject.js index a6424a5..234590d 100644 --- a/lib/pbxProject.js +++ b/lib/pbxProject.js @@ -1320,7 +1320,13 @@ pbxProject.prototype.pbxResourcesBuildPhaseObj = function(target) { } pbxProject.prototype.pbxFrameworksBuildPhaseObj = function(target) { - return this.buildPhaseObject('PBXFrameworksBuildPhase', 'Frameworks', target); + let buildPhase = this.buildPhaseObject('PBXFrameworksBuildPhase', 'Frameworks', target); + if (!buildPhase) { + // Create Frameworks phase in parent target + const phase = this.addBuildPhase([], 'PBXFrameworksBuildPhase', 'Frameworks', target); + buildPhase = phase.buildPhase; + } + return buildPhase; } pbxProject.prototype.pbxEmbedFrameworksBuildPhaseObj = function (target) { From 3dec27ce4497fbfd73e419ffa5cefb70a096f006 Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Mon, 8 Jul 2024 21:03:20 -0700 Subject: [PATCH 05/11] release: 0.7.1-alpha.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 774be68..024684b 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.7.1-alpha.1", + "version": "0.7.1-alpha.2", "files": [ "lib", "!lib/parser/pbxproj.pegjs" From 4b8ef6e8a5e38c73c765d6c9a2e7bcb7632b5751 Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Mon, 8 Jul 2024 21:24:51 -0700 Subject: [PATCH 06/11] fix: ensure frameworks are added to destination type 'frameworks' on build --- lib/pbxProject.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pbxProject.js b/lib/pbxProject.js index 234590d..fdc3f38 100644 --- a/lib/pbxProject.js +++ b/lib/pbxProject.js @@ -1323,7 +1323,7 @@ pbxProject.prototype.pbxFrameworksBuildPhaseObj = function(target) { let buildPhase = this.buildPhaseObject('PBXFrameworksBuildPhase', 'Frameworks', target); if (!buildPhase) { // Create Frameworks phase in parent target - const phase = this.addBuildPhase([], 'PBXFrameworksBuildPhase', 'Frameworks', target); + const phase = this.addBuildPhase([], 'PBXFrameworksBuildPhase', 'Frameworks', target, 'frameworks'); buildPhase = phase.buildPhase; } return buildPhase; @@ -1333,7 +1333,7 @@ pbxProject.prototype.pbxEmbedFrameworksBuildPhaseObj = function (target) { let buildPhase = this.buildPhaseObject('PBXCopyFilesBuildPhase', 'Embed Frameworks', target); if (!buildPhase) { // Create CopyFiles phase in parent target - const phase = this.addBuildPhase([], 'PBXCopyFilesBuildPhase', 'Embed Frameworks', target); + const phase = this.addBuildPhase([], 'PBXCopyFilesBuildPhase', 'Embed Frameworks', target, 'frameworks'); buildPhase = phase.buildPhase; } return buildPhase; From 19adee4e00942be272f4caa8494aef82a9b13559 Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Mon, 8 Jul 2024 21:25:37 -0700 Subject: [PATCH 07/11] release: 0.7.1-alpha.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 024684b..2731a34 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.7.1-alpha.2", + "version": "0.7.1-alpha.3", "files": [ "lib", "!lib/parser/pbxproj.pegjs" From 8f7639fb2b65cddedd6e88af2b552478a841d076 Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Tue, 9 Jul 2024 16:53:35 +0200 Subject: [PATCH 08/11] fix: only set PBXGroup path when defined --- lib/pbxProject.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pbxProject.js b/lib/pbxProject.js index fdc3f38..2f31cf2 100644 --- a/lib/pbxProject.js +++ b/lib/pbxProject.js @@ -578,7 +578,7 @@ pbxProject.prototype.addPbxGroup = function (filePathsArray, name, path, sourceT filePathToReference = {}; //path is mandatory only for the main group - if(!opt.filesRelativeToProject) { + if(!opt.filesRelativeToProject && path) { pbxGroup.path = path; } From 99be00ff24b269d93d2cdd5637827a4ec7ebd118 Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Tue, 9 Jul 2024 16:53:51 +0200 Subject: [PATCH 09/11] fix: don't add duplicate HEADER_SEARCH_PATHS --- lib/pbxProject.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/pbxProject.js b/lib/pbxProject.js index 2f31cf2..1379e04 100644 --- a/lib/pbxProject.js +++ b/lib/pbxProject.js @@ -1566,7 +1566,11 @@ pbxProject.prototype.addToHeaderSearchPaths = function(file, productName) { buildSettings['HEADER_SEARCH_PATHS'] = [INHERITED]; } - buildSettings['HEADER_SEARCH_PATHS'].push(searchPathForFile(file, this)); + // Check if the search path is already in the HEADER_SEARCH_PATHS and add it if it's not. + const searchPath = searchPathForFile(file, this); + if (buildSettings['HEADER_SEARCH_PATHS'].indexOf(searchPath) < 0) { + buildSettings['HEADER_SEARCH_PATHS'].push(searchPath); + } } } From 5512dcc033628d22cd41164131a01ef2b1ae2263 Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Tue, 9 Jul 2024 16:54:27 +0200 Subject: [PATCH 10/11] fix: make sure Frameworks is a main group (so it's visible in xcode sidebar) --- lib/pbxProject.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pbxProject.js b/lib/pbxProject.js index 1379e04..b45e1be 100644 --- a/lib/pbxProject.js +++ b/lib/pbxProject.js @@ -885,7 +885,7 @@ pbxProject.prototype.removeFromResourcesPbxGroup = function(file) { pbxProject.prototype.addToFrameworksPbxGroup = function(file) { var pluginsGroup = this.pbxGroupByName('Frameworks'); if (!pluginsGroup) { - this.addPbxGroup([file.path], 'Frameworks'); + this.addPbxGroup([file.path], 'Frameworks', 'Frameworks', null, { isMain: true, filesRelativeToProject: true}); } else { pluginsGroup.children.push(pbxGroupChild(file)); } From 01f1563acaae85634508b957700524b8e200003f Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Tue, 9 Jul 2024 09:11:37 -0700 Subject: [PATCH 11/11] release: 0.7.1-alpha.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2731a34..a6d5785 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.7.1-alpha.3", + "version": "0.7.1-alpha.4", "files": [ "lib", "!lib/parser/pbxproj.pegjs"