Skip to content

Commit ea0cc26

Browse files
authored
Merge pull request #919 from taphouseio/fix-local-package
Use relative_path for local Swift packages
2 parents 2ce68b6 + 4933515 commit ea0cc26

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

lib/xcodeproj/project/object/swift_package_local_reference.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ class XCLocalSwiftPackageReference < AbstractObject
1010
#
1111
attribute :path, String
1212

13+
# @return [String] the repository path where the package is located relative
14+
# to the Xcode project.
15+
#
16+
attribute :relative_path, String
17+
1318
# @!group AbstractObject Hooks
1419
#--------------------------------------#
1520

@@ -20,7 +25,7 @@ def ascii_plist_annotation
2025
# @return [String] the path of the local Swift package reference.
2126
#
2227
def display_name
23-
return path if path
28+
return relative_path if relative_path
2429
super
2530
end
2631
end

spec/project/object/swift_package_local_reference_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ module ProjectSpecs
1111
end
1212

1313
it 'returns path for display_name if path is set' do
14-
@proxy.path = '../path'
14+
@proxy.relative_path = '../path'
1515
@proxy.display_name.should == '../path'
1616
end
1717

1818
it 'returns the ascii plist annotation with the last component of path' do
19-
@proxy.path = '../path'
19+
@proxy.relative_path = '../path'
2020
@proxy.ascii_plist_annotation.should == ' XCLocalSwiftPackageReference "path" '
2121
end
2222
end

0 commit comments

Comments
 (0)