From 77471fea827ebcbdd32c4ac11aa1c718a7817af5 Mon Sep 17 00:00:00 2001 From: zhangyilin <123681512@qq.com> Date: Sat, 10 Nov 2018 14:03:55 +0800 Subject: [PATCH] support build static library copy public header files --- lib/cocoapods-packager/builder.rb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/cocoapods-packager/builder.rb b/lib/cocoapods-packager/builder.rb index a72c33f..a4992b6 100755 --- a/lib/cocoapods-packager/builder.rb +++ b/lib/cocoapods-packager/builder.rb @@ -45,6 +45,9 @@ def build_static_library else build_static_library_for_mac(output) end + + copy_headers_for_static_library + end def build_static_framework @@ -149,6 +152,7 @@ def build_static_library_for_ios(output) end `lipo -create -output #{output} #{libs.join(' ')}` + end def build_static_library_for_mac(output) @@ -192,9 +196,18 @@ def compile defines end - def copy_headers + def copy_headers_for_static_library + platform_path = Pathname.new(@platform.name.to_s) headers_source_root = "#{@public_headers_root}/#{@spec.name}" + Dir.glob("#{@public_headers_root}/**/*.h"). + each { |h| `ditto #{h} #{platform_path}/#{h.sub(headers_source_root, '')}` } + + end + + def copy_headers + headers_source_root = "#{@public_headers_root}/#{@spec.name}" + Dir.glob("#{headers_source_root}/**/*.h"). each { |h| `ditto #{h} #{@fwk.headers_path}/#{h.sub(headers_source_root, '')}` }