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? 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 <