Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add XCLocalSwiftPackageReference support #343

Merged
merged 4 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"'

Check warning on line 8 in tests/pbxsections/TestXCLocalSwiftPackageReference.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

tests/pbxsections/TestXCLocalSwiftPackageReference.py#L8

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Loading