-
Notifications
You must be signed in to change notification settings - Fork 458
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for parsing XCLocalSwiftPackageReference objects.
- Loading branch information
Showing
7 changed files
with
64 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
lib/xcodeproj/project/object/swift_package_local_reference.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
module Xcodeproj | ||
class Project | ||
module Object | ||
# This class represents a local Swift package reference. | ||
# | ||
class XCLocalSwiftPackageReference < AbstractObject | ||
# @!group Attributes | ||
|
||
# @return [String] the repository url this Swift package was installed from. | ||
# | ||
attribute :path, String | ||
|
||
# @!group AbstractObject Hooks | ||
#--------------------------------------# | ||
|
||
def ascii_plist_annotation | ||
" #{isa} \"#{File.basename(display_name)}\" " | ||
end | ||
|
||
# @return [String] the path of the local Swift package reference. | ||
# | ||
def display_name | ||
return path if path | ||
super | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require File.expand_path('../../../spec_helper', __FILE__) | ||
|
||
module ProjectSpecs | ||
describe Xcodeproj::Project::Object::XCRemoteSwiftPackageReference do | ||
before do | ||
@proxy = @project.new(XCLocalSwiftPackageReference) | ||
end | ||
|
||
it 'returns default display_name if path is not set' do | ||
@proxy.display_name.should == 'LocalSwiftPackageReference' | ||
end | ||
|
||
it 'returns path for display_name if path is set' do | ||
@proxy.path = '../path' | ||
@proxy.display_name.should == '../path' | ||
end | ||
|
||
it 'returns the ascii plist annotation with the last component of path' do | ||
@proxy.path = '../path' | ||
@proxy.ascii_plist_annotation.should == ' XCLocalSwiftPackageReference "path" ' | ||
end | ||
end | ||
end |