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

Fix missing vendored_library specification when packaging a static library #227

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
19 changes: 14 additions & 5 deletions lib/cocoapods-packager/spec_builder.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
module Pod
class SpecBuilder
def initialize(spec, source, embedded, dynamic)
def initialize(spec, source, embedded, library, dynamic)
@spec = spec
@source = source.nil? ? '{ :path => \'.\' }' : source
@embedded = embedded
@library = library
@dynamic = dynamic
end

Expand All @@ -15,12 +16,20 @@ def framework_path
end
end

def library_path
'lib' + @spec.name + '.a'
end

def spec_platform(platform)
fwk_base = platform.name.to_s + '/' + framework_path
spec = <<RB
s.#{platform.name}.deployment_target = '#{platform.deployment_target}'
s.#{platform.name}.vendored_framework = '#{fwk_base}'
RB
library_base = platform.name.to_s + '/' + library_path
spec = " s.#{platform.name}.deployment_target = '#{platform.deployment_target}'\n"

spec += if @library.nil?
" s.#{platform.name}.vendored_framework = '#{fwk_base}'\n"
else
" s.#{platform.name}.vendored_library = '#{library_base}'\n"
end

%w(frameworks weak_frameworks libraries requires_arc xcconfig).each do |attribute|
attributes_hash = @spec.attributes_hash[platform.name.to_s]
Expand Down
2 changes: 1 addition & 1 deletion lib/pod/command/package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def build_in_sandbox(platform)
end

def build_package
builder = SpecBuilder.new(@spec, @source, @embedded, @dynamic)
builder = SpecBuilder.new(@spec, @source, @embedded, @library, @dynamic)
newspec = builder.spec_metadata

@spec.available_platforms.each do |platform|
Expand Down
2 changes: 1 addition & 1 deletion spec/specification/spec_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def specification_from_builder(builder)
describe 'Preserve attributes from source specification' do
before do
@spec = Specification.from_file('spec/fixtures/Builder.podspec')
@builder = SpecBuilder.new(@spec, nil, false, nil)
@builder = SpecBuilder.new(@spec, nil, false, nil, nil)
end

it "preserves platform.frameworks" do
Expand Down