From 0ac06b173ade190aeb5c9352047ee96fa00c02ff Mon Sep 17 00:00:00 2001 From: dabing1022 Date: Tue, 12 Jan 2021 17:46:20 +0800 Subject: [PATCH 1/2] feat: print upload result --- .../lib/cocoapods-imy-bin/helpers/upload_helper.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cocoapods-imy-bin/lib/cocoapods-imy-bin/helpers/upload_helper.rb b/cocoapods-imy-bin/lib/cocoapods-imy-bin/helpers/upload_helper.rb index 2a907d2..c689531 100755 --- a/cocoapods-imy-bin/lib/cocoapods-imy-bin/helpers/upload_helper.rb +++ b/cocoapods-imy-bin/lib/cocoapods-imy-bin/helpers/upload_helper.rb @@ -43,7 +43,7 @@ def spec_creator end #推送二进制 - # curl http://ci.xxx:9192/frameworks -F "name=IMYFoundation" -F "version=7.7.4.2" -F "annotate=IMYFoundation_7.7.4.2_log" -F "file=@bin_zip/bin_IMYFoundation_7.7.4.2.zip" + # curl http://ci.xxx:9192/frameworks -F "name=IMYFoundation" -F "version=7.7.4.2" -F "annotate=IMYFoundation_7.7.4.2_log" -F "file=@bin-zip/bin_IMYFoundation_7.7.4.2.zip" def curl_zip zip_file = "#{CBin::Config::Builder.instance.library_file(@spec)}.zip" res = File.exist?(zip_file) @@ -52,11 +52,13 @@ def curl_zip res = File.exist?(zip_file) end if res + command = "curl #{CBin.config.binary_upload_url} -F \"name=#{@spec.name}\" -F \"version=#{@spec.version}\" -F \"annotate=#{@spec.name}_#{@spec.version}_log\" -F \"file=@#{zip_file}\"" print < Date: Tue, 12 Jan 2021 20:44:30 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=201.=20=E5=BA=93=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E4=B8=AD=E5=90=AB=E6=9C=89=E4=B8=AD=E5=88=92=E7=BA=BF=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E5=A4=B4=E6=96=87=E4=BB=B6=E6=89=BE=E4=B8=8D=E5=88=B0?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D=202.=20=E5=AE=8C?= =?UTF-8?q?=E5=96=84modulemap=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cocoapods-imy-bin/helpers/build_utils.rb | 23 ++++++++++++++----- .../helpers/framework_builder.rb | 13 +++++++---- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/cocoapods-imy-bin/lib/cocoapods-imy-bin/helpers/build_utils.rb b/cocoapods-imy-bin/lib/cocoapods-imy-bin/helpers/build_utils.rb index 133ec5a..dedc660 100755 --- a/cocoapods-imy-bin/lib/cocoapods-imy-bin/helpers/build_utils.rb +++ b/cocoapods-imy-bin/lib/cocoapods-imy-bin/helpers/build_utils.rb @@ -14,6 +14,22 @@ def Utils.is_framework(spec) return Utils.is_swift_module(spec) end + def Utils.spec_header_dir(spec) + spec_header_dir = "./Headers/Public/#{spec.name}" + + unless File.exist?(spec_header_dir) + spec_header_dir = "./Pods/Headers/Public/#{spec.name}" + end + + unless File.exist?(spec_header_dir) + # 一些库名称中使用了中划线如AAA-BBB,public header中库名称会默认处理成下划线AAA_BBB + module_name = spec.name.gsub("-", "_") + spec_header_dir = "./Pods/Headers/Public/#{module_name}" + end + + spec_header_dir + end + def Utils.is_swift_module(spec) is_framework = false @@ -21,12 +37,7 @@ def Utils.is_swift_module(spec) #auto 走这里 if File.exist?(dir) Dir.chdir(dir) do - public_headers = Array.new - spec_header_dir = "./Headers/Public/#{spec.name}" - - unless File.exist?(spec_header_dir) - spec_header_dir = "./Pods/Headers/Public/#{spec.name}" - end + spec_header_dir = Utils.spec_header_dir(spec) return false unless File.exist?(spec_header_dir) is_framework = File.exist?(File.join(spec_header_dir, "#{spec.name}-umbrella.h")) diff --git a/cocoapods-imy-bin/lib/cocoapods-imy-bin/helpers/framework_builder.rb b/cocoapods-imy-bin/lib/cocoapods-imy-bin/helpers/framework_builder.rb index 25529b1..bdfc494 100755 --- a/cocoapods-imy-bin/lib/cocoapods-imy-bin/helpers/framework_builder.rb +++ b/cocoapods-imy-bin/lib/cocoapods-imy-bin/helpers/framework_builder.rb @@ -217,11 +217,9 @@ def copy_headers #by slj 如果没有头文件,去 "Headers/Public"拿 # if public_headers.empty? - spec_header_dir = "./Headers/Public/#{@spec.name}" - unless File.exist?(spec_header_dir) - spec_header_dir = "./Pods/Headers/Public/#{@spec.name}" - end + spec_header_dir = CBin::Build::Utils.spec_header_dir(@spec) raise "copy_headers #{spec_header_dir} no exist " unless File.exist?(spec_header_dir) + Dir.chdir(spec_header_dir) do headers = Dir.glob('*.h') headers.each do |h| @@ -253,6 +251,13 @@ def copy_headers module * { export * } } MAP + else + # by ChildhoodAndy + # try to read modulemap file from public header + module_map_file = File.join(spec_header_dir, "#{@spec.name}.modulemap") + if Pathname(module_map_file).exist? + module_map = File.read(module_map_file) + end end unless module_map.nil?