Skip to content

Commit

Permalink
feat: add support for XCLocalSwiftPackageReference (#346)
Browse files Browse the repository at this point in the history
Co-authored-by: Michal Szelag <[email protected]>
  • Loading branch information
kronenthaler and michalszelagsonos authored Apr 10, 2024
1 parent ecc86b7 commit 2f502e5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pbxproj/pbxsections/XCLocalSwiftPackageReference.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from pbxproj import PBXGenericObject


class XCLocalSwiftPackageReference(PBXGenericObject):
@classmethod
def create(cls, relative_path):
return cls().parse({
'_id': cls._generate_id(),
'isa': cls.__name__,
'relativePath': relative_path
})

def _get_comment(self):
return f'XCLocalSwiftPackageReference "{self.relativePath}"'
1 change: 1 addition & 0 deletions pbxproj/pbxsections/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@
from pbxproj.pbxsections.PBXGroup import *
from pbxproj.pbxsections.XCSwiftPackageProductDependency import *
from pbxproj.pbxsections.XCRemoteSwiftPackageReference import *
from pbxproj.pbxsections.XCLocalSwiftPackageReference import *
8 changes: 8 additions & 0 deletions tests/pbxsections/TestXCLocalSwiftPackageReference.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import unittest
from pbxproj.pbxsections.XCLocalSwiftPackageReference import *


class TestXCLocalSwiftPackageReference(unittest.TestCase):
def testGetComment(self):
obj = XCLocalSwiftPackageReference.create('MyPackage')
assert obj._get_comment() == 'XCLocalSwiftPackageReference "MyPackage"'

0 comments on commit 2f502e5

Please sign in to comment.