kronenthaler / mod-pbxproj

A python module to manipulate XCode projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] can't add a .modulemap file

sunsetroads opened this issue · comments

Can't add a .modulemap file
When add file or folder that has a .modulemap, it will crash. If remove the .modulemap file, it will ok
I had add the file type in ProjectFiles.py u'.modulemap': (u'sourcecode.module-map', u'PBXFileReference')
System information

  1. pbxproj version used: 2.5.1
  2. python version used: 3.7
  3. Xcode version used: 11.3.1

Test Code

from pbxproj import XcodeProject
p = XcodeProject.load('../hantai/Unity-iPhone.xcodeproj/project.pbxproj')
p.add_folder('./firebase')
# p.add_file('./firebase/module.modulemap')
p.save()

Error Log

Traceback (most recent call last):
  File "test.py", line 4, in <module>
    p.add_folder('./firebase')
  File "/usr/local/lib/python3.7/site-packages/pbxproj/pbxextensions/ProjectFiles.py", line 384, in add_folder
    file_options=file_options)
  File "/usr/local/lib/python3.7/site-packages/pbxproj/pbxextensions/ProjectFiles.py", line 151, in add_file
    results.extend(self._create_build_files(file_ref, target_name, expected_build_phase, file_options))
  File "/usr/local/lib/python3.7/site-packages/pbxproj/pbxextensions/ProjectFiles.py", line 424, in _create_build_files
    build_phases = target.get_or_create_build_phase(expected_build_phase)
  File "/usr/local/lib/python3.7/site-packages/pbxproj/pbxsections/PBXGenericTarget.py", line 23, in get_or_create_build_phase
    build_phase = self._get_class_reference(build_phase_type).create(*create_parameters)
TypeError: create() missing 1 required positional argument: 'path'

Thanks for your report.
Normally .modulemap files are part of a framework file, and they shouldn't be added to you project directly.

To add a framework follow the wiki page

EDIT: the Firebase documentation explains the steps to follow to integrate manually.

9. If you're using Swift, or you want to use modules, drag module.modulemap into
your project and update your User Header Search Paths to contain the
directory that contains your module map.
  1. add the single file: Firebase/module.map
  2. add the flag mentioned: p.add_flag('USER_HEADER_SEARCH_PATHS', '/path/to/the/module.map')