You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by er...@apache.org on 2026/10/29 12:30:58 UTC

(cordova-node-xcode) branch master updated: feat: support objcpp source files ('mm' extensions) (#199)

This is an automated email from the ASF dual-hosted git repository.

erisu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-node-xcode.git


The following commit(s) were added to refs/heads/master by this push:
     new 7c2d76c  feat: support objcpp source files ('mm' extensions) (#199)
7c2d76c is described below

commit 7c2d76cbf5a978ad57e6b467b1031d834e267a9c
Author: エリス <er...@users.noreply.github.com>
AuthorDate: Thu Oct 29 21:30:51 2026 +0900

    feat: support objcpp source files ('mm' extensions) (#199)
    
    - Updated mappings 'FILETYPE_BY_EXTENSION', 'GROUP_BY_FILETYPE', and 'ENCODING_BY_FILETYPE'
    - Added new 'addSourceFile' test cases to confirm PBXFile data for objc, objcpp, and swift source files.
---
 lib/pbxFile.js        |  3 +++
 test/addSourceFile.js | 27 +++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/lib/pbxFile.js b/lib/pbxFile.js
index 59dcef9..2ed90be 100644
--- a/lib/pbxFile.js
+++ b/lib/pbxFile.js
@@ -34,6 +34,7 @@ const FILETYPE_BY_EXTENSION = {
     framework: 'wrapper.framework',
     h: 'sourcecode.c.h',
     m: 'sourcecode.c.objc',
+    mm: 'sourcecode.cpp.objcpp',
     markdown: 'text',
     mdimporter: 'wrapper.cfbundle',
     octest: 'wrapper.cfbundle',
@@ -58,6 +59,7 @@ const GROUP_BY_FILETYPE = {
     'embedded.framework': 'Embed Frameworks',
     'sourcecode.c.h': 'Resources',
     'sourcecode.c.objc': 'Sources',
+    'sourcecode.cpp.objcpp': 'Sources',
     'sourcecode.swift': 'Sources'
 };
 const PATH_BY_FILETYPE = {
@@ -73,6 +75,7 @@ const SOURCETREE_BY_FILETYPE = {
 const ENCODING_BY_FILETYPE = {
     'sourcecode.c.h': 4,
     'sourcecode.c.objc': 4,
+    'sourcecode.cpp.objcpp': 4,
     'sourcecode.swift': 4,
     text: 4,
     'text.plist.xml': 4,
diff --git a/test/addSourceFile.js b/test/addSourceFile.js
index 409bad0..053fae7 100644
--- a/test/addSourceFile.js
+++ b/test/addSourceFile.js
@@ -162,4 +162,31 @@ describe('addSourceFile', () => {
         assert.strictEqual(plugins.children.length, 1);
         assert.strictEqual(sources.files.length, 3);
     });
+
+    it('should add objc source files and return pbxFile', () => {
+        const newFile = proj.addSourceFile('file.m');
+        assert.strictEqual(newFile.constructor, PBXFile);
+        assert.strictEqual(newFile.lastKnownFileType, 'sourcecode.c.objc');
+        assert.strictEqual(newFile.group, 'Sources');
+        assert.strictEqual(newFile.defaultEncoding, 4);
+        assert.strictEqual(newFile.fileEncoding, 4);
+    });
+
+    it('should add objc++ source files and return pbxFile', () => {
+        const newFile = proj.addSourceFile('file.mm');
+        assert.strictEqual(newFile.constructor, PBXFile);
+        assert.strictEqual(newFile.lastKnownFileType, 'sourcecode.cpp.objcpp');
+        assert.strictEqual(newFile.group, 'Sources');
+        assert.strictEqual(newFile.defaultEncoding, 4);
+        assert.strictEqual(newFile.fileEncoding, 4);
+    });
+
+    it('should add swift source files and return pbxFile', () => {
+        const newFile = proj.addSourceFile('file.swift');
+        assert.strictEqual(newFile.constructor, PBXFile);
+        assert.strictEqual(newFile.lastKnownFileType, 'sourcecode.swift');
+        assert.strictEqual(newFile.group, 'Sources');
+        assert.strictEqual(newFile.defaultEncoding, 4);
+        assert.strictEqual(newFile.fileEncoding, 4);
+    });
 });


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org