cocoapods-packager
cocoapods-packager copied to clipboard
NoMethodError - undefined method `framework?' for true:TrueClass
Command
/usr/local/bin/pod package HMIBaseline.podspec --dynamic --no-mangle --spec-sources=https://github.com/CocoaPods/Specs.git,[email protected]:infra/ios-common.git,https://artifactory.allride-ai.cn/artifactory/api/pods/cocoa-local --verbose
Report
- What did you do?
pod package HMIBaseline.spec.
- What did you expect to happen?
success
- What happened instead?
i meet an error
Stack
CocoaPods : 1.9.1
Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
RubyGems : 3.0.3
Host : Mac OS X 10.15 (19A582a)
Xcode : 11.3.1 (11C504)
Git : git version 2.21.1 (Apple Git-122.3)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : ARSpecRepo - git - [email protected]:infra/ios-common.git @ b1f3805d2a766c9509bde74f4574270917dce669
cocoa-local - file system
master - git - https://github.com/CocoaPods/Specs.git @ 163b8a8c3e6980b42c623bc76f6b136f8c68d19c
trunk - CDN - https://cdn.cocoapods.org/
Plugins
cocoapods-art : 1.0.4
cocoapods-deintegrate : 1.0.4
cocoapods-packager : 1.5.0
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.1.0
cocoapods-trunk : 1.4.1
cocoapods-try : 1.1.0
Error
NoMethodError - undefined method `framework?' for true:TrueClass
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/target.rb:112:in `build_as_framework?'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb:164:in `block (2 levels) in link_headers'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb:159:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb:159:in `block in link_headers'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/user_interface.rb:145:in `message'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb:158:in `link_headers'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb:51:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-packager-1.5.0/lib/cocoapods-packager/pod_utils.rb:204:in `install_file_references'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-packager-1.5.0/lib/cocoapods-packager/pod_utils.rb:139:in `install_dynamic_pod'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-packager-1.5.0/lib/pod/command/package.rb:97:in `build_in_sandbox'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-packager-1.5.0/lib/pod/command/package.rb:113:in `block in build_package'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-packager-1.5.0/lib/pod/command/package.rb:112:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-packager-1.5.0/lib/pod/command/package.rb:112:in `build_package'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-packager-1.5.0/lib/pod/command/package.rb:80:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
Need a sample app.
Need a sample app.
I just create a new project using:
pod lib create HMIApp-DemoApp
then I change the .podspec file to :
# Be sure to run `pod lib lint HMIApp-DemoApp.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'HMIApp-DemoApp'
s.version = '0.0.1'
s.summary = 'A short description of HMIApp-DemoApp.'
# This description is used to generate tags and improve search results.
# * Think: What does it do? Why did you write it? What is the focus?
# * Try to keep it short, snappy and to the point.
# * Write the description between the DESC delimiters below.
# * Finally, don't worry about the indent, CocoaPods strips it!
s.description = <<-DESC
TODO: Add long description of the pod here.
DESC
s.homepage = 'https://github.com/chen.yang/HMIApp-DemoApp'
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'chen.yang' => '[email protected]' }
s.source = { :git => '[email protected]:infra/ios-lib/hmiapp-demoapp.git', :tag => s.version }
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
s.ios.deployment_target = '11.0'
s.source_files = 'HMIApp-DemoApp/Classes/**/*'
# s.resource_bundles = {
# 'HMIApp-DemoApp' => ['HMIApp-DemoApp/Assets/*.png']
# }
# s.public_header_files = 'Pod/Classes/**/*.h'
# s.frameworks = 'UIKit', 'MapKit'
# s.dependency 'AFNetworking', '~> 2.3'
end
then I commit then tag then push to remote
when I tried to package the pod, I got the error:
Command
/usr/local/bin/pod package HMIApp-DemoApp.podspec --dynamic --no-mangle
Report
-
What did you do?
-
What did you expect to happen?
-
What happened instead?
Stack
CocoaPods : 1.9.1
Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
RubyGems : 3.0.3
Host : Mac OS X 10.15 (19A582a)
Xcode : 11.3.1 (11C504)
Git : git version 2.21.1 (Apple Git-122.3)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : ARSpecRepo - git - [email protected]:infra/ios-common.git @ b1f3805d2a766c9509bde74f4574270917dce669
cocoa-local - file system
master - git - https://github.com/CocoaPods/Specs.git @ 163b8a8c3e6980b42c623bc76f6b136f8c68d19c
trunk - CDN - https://cdn.cocoapods.org/
Plugins
cocoapods-art : 1.0.4
cocoapods-deintegrate : 1.0.4
cocoapods-packager : 1.5.0
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.1.0
cocoapods-trunk : 1.4.1
cocoapods-try : 1.1.0
Error
NoMethodError - undefined method `framework?' for true:TrueClass
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/target.rb:112:in `build_as_framework?'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb:164:in `block (2 levels) in link_headers'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb:159:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb:159:in `block in link_headers'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/user_interface.rb:145:in `message'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb:158:in `link_headers'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb:51:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-packager-1.5.0/lib/cocoapods-packager/pod_utils.rb:204:in `install_file_references'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-packager-1.5.0/lib/cocoapods-packager/pod_utils.rb:139:in `install_dynamic_pod'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-packager-1.5.0/lib/pod/command/package.rb:97:in `build_in_sandbox'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-packager-1.5.0/lib/pod/command/package.rb:113:in `block in build_package'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-packager-1.5.0/lib/pod/command/package.rb:112:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-packager-1.5.0/lib/pod/command/package.rb:112:in `build_package'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-packager-1.5.0/lib/pod/command/package.rb:80:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
~~~
I check the source code and I found these:
- this is where the error happened
https://github.com/CocoaPods/CocoaPods/blob/b812daedb782a5d808807db327aa1d8c01852e09/lib/cocoapods/target.rb#L118
- this is where the "true" value comes from:
https://github.com/CocoaPods/cocoapods-packager/blob/f95c6c2322614abb8e3085d7dfa01d4695db3178/lib/cocoapods-packager/pod_utils.rb#L161
- but the definition of initialize method is :
https://github.com/CocoaPods/CocoaPods/blob/b812daedb782a5d808807db327aa1d8c01852e09/lib/cocoapods/target/pod_target.rb#L137
- so maybe it should be a "build_type" instead of a "true"?
And how can I fix this problem and successfully package my pod?
Oh this bug is under cocoapods-packager plug in probably not working with the latest version. Transferring to that repo.
Specify what you want like: Pod::BuildType.static_framework()
or Pod::BuildType.static_library()
and it can run continue
def build_dynamic_target(dynamic_sandbox, static_installer, platform)
spec_targets = static_installer.pod_targets.select do |target|
target.name == @spec.name
end
static_target = spec_targets[0]
file_accessors = create_file_accessors(static_target, dynamic_sandbox)
archs = []
buildy_type = Pod::BuildType.static_framework()
dynamic_target = Pod::PodTarget.new(dynamic_sandbox, buildy_type, static_target.user_build_configurations, archs, platform, static_target.specs, static_target.target_definitions, file_accessors)
dynamic_target
end
same question! resolved?
how to solve this problem?
same issue
@lizuba yes, The new version of cocoapods uses Pod::BuildType to represent the build type.
def self.dynamic_library
new(:linkage => :dynamic, :packaging => :library)
end
# @return [BuildType] the build type for a static library
#
def self.static_library
new(:linkage => :static, :packaging => :library)
end
# @return [BuildType] the build type for a dynamic framework
#
def self.dynamic_framework
new(:linkage => :dynamic, :packaging => :framework)
end
# @return [BuildType] the build type for a static framework
#
def self.static_framework
new(:linkage => :static, :packaging => :framework)
end
Just select the replacement you need. for me ,choose the Pod::BuildType.dynamic_framework works well
@guzuqing
Is it adjusted like this??
@changwuguo 对的