Skip to content

Commit 3d94aa6

Browse files
committed
fix(node-xcode): Update to 1.5.1 tag
Fix issue with C++ source code files being added to Resources instead of Sources group. Add unit tests.
1 parent 9b35c64 commit 3d94aa6

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

npm-shrinkwrap.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"uuid": "3.0.1",
7474
"winreg": "0.0.17",
7575
"ws": "5.1.0",
76-
"xcode": "https://github.com/NativeScript/node-xcode/archive/NativeScript-1.5.0.tar.gz",
76+
"xcode": "https://github.com/NativeScript/node-xcode/archive/NativeScript-1.5.1.tar.gz",
7777
"xml2js": "0.4.19",
7878
"xmldom": "0.1.21",
7979
"xmlhttprequest": "https://github.com/telerik/node-XMLHttpRequest/tarball/master",

test/ios-project-service.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,9 @@ describe("Source code in plugin support", () => {
548548
assert.notEqual(pbxFileReferenceValues.indexOf(basename), -1, `${basename} not added to PBXFileRefereces`);
549549

550550
if (shouldBeAdded && !path.extname(basename).startsWith(".h")) {
551-
assert.isDefined(buildPhaseFiles.find((fileObject: any) => fileObject.comment.startsWith(basename)), `${basename} not added to PBXSourcesBuildPhase`);
551+
const buildPhaseFile = buildPhaseFiles.find((fileObject: any) => fileObject.comment.startsWith(basename));
552+
assert.isDefined(buildPhaseFile, `${basename} not added to PBXSourcesBuildPhase`);
553+
assert.include(buildPhaseFile.comment, "in Sources", `${basename} must be added to Sources group`);
552554
}
553555
} else {
554556
assert.equal(pbxFileReferenceValues.indexOf(basename), -1, `${basename} was added to PBXFileRefereces, but it shouldn't have been`);
@@ -566,11 +568,19 @@ describe("Source code in plugin support", () => {
566568

567569
const pbxFileReference = pbxProj.hash.project.objects.PBXFileReference;
568570
const pbxFileReferenceValues = Object.keys(pbxFileReference).map(key => pbxFileReference[key]);
571+
const buildPhaseFiles = pbxProj.hash.project.objects.PBXResourcesBuildPhase["858B842C18CA22B800AB12DE"].files;
569572

570573
resFileNames.forEach(filename => {
571574
const dirName = path.dirname(filename);
572575
const fileToCheck = dirName.endsWith(".bundle") ? dirName : filename;
573-
assert.isTrue(pbxFileReferenceValues.indexOf(path.basename(fileToCheck)) !== -1, `Resource ${filename} not added to PBXFileRefereces`);
576+
const basename = path.basename(fileToCheck);
577+
578+
assert.isTrue(pbxFileReferenceValues.indexOf(basename) !== -1, `Resource ${filename} not added to PBXFileRefereces`);
579+
580+
const buildPhaseFile = buildPhaseFiles.find((fileObject: any) => fileObject.comment.startsWith(basename));
581+
assert.isDefined(buildPhaseFile, `${fileToCheck} not added to PBXResourcesBuildPhase`);
582+
assert.include(buildPhaseFile.comment, "in Resources", `${fileToCheck} must be added to Resources group`);
583+
574584
});
575585
});
576586
}

0 commit comments

Comments
 (0)