diff --git a/cocoapods-imy-bin/cocoapods-imy-bin-0.3.1.2.gem b/cocoapods-imy-bin/cocoapods-imy-bin-0.3.1.2.gem new file mode 100644 index 0000000..a557cd9 Binary files /dev/null and b/cocoapods-imy-bin/cocoapods-imy-bin-0.3.1.2.gem differ 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 dedc660..7a29903 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 @@ -15,19 +15,40 @@ def Utils.is_framework(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 + header_dir = "./Headers/Public/#{spec.name}" + header_dir = "./Pods/Headers/Public/#{spec.name}" unless File.exist?(header_dir) - unless File.exist?(spec_header_dir) + unless File.exist?(header_dir) # 一些库名称中使用了中划线如AAA-BBB,public header中库名称会默认处理成下划线AAA_BBB module_name = spec.name.gsub("-", "_") - spec_header_dir = "./Pods/Headers/Public/#{module_name}" + header_dir = "./Pods/Headers/Public/#{module_name}" + end + + # 暂时只支持:ios + consumer = Pod::Specification::Consumer.new(spec, :ios) + unless consumer.header_dir.nil? + header_dir = File.join(header_dir, consumer.header_dir) end - spec_header_dir + header_dir + end + + def Utils.spec_module_dir(spec) + if spec.module_name.nil? + module_dir = "./Headers/Public/#{spec.name}" + module_dir = "./Pods/Headers/Public/#{spec.name}" unless File.exist?(module_dir) + unless File.exist?(module_dir) + # 一些库名称中使用了中划线如AAA-BBB,public header中库名称会默认处理成下划线AAA_BBB + module_name = spec.name.gsub("-", "_") + module_dir = "./Pods/Headers/Public/#{module_name}" + end + else + module_dir = "./Headers/Public/#{spec.module_name}" + module_dir = "./Pods/Headers/Public/#{spec.module_name}" unless File.exist?(module_dir) + end + + module_dir end def Utils.is_swift_module(spec) @@ -37,10 +58,9 @@ def Utils.is_swift_module(spec) #auto 走这里 if File.exist?(dir) Dir.chdir(dir) do - 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")) + spec_module_dir = Utils.spec_module_dir(spec) + return false unless File.exist?(spec_module_dir) + is_framework = File.exist?(File.join(spec_module_dir, "#{spec.name}-umbrella.h")) end end 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 dca5ecc..b93ebc6 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 @@ -9,7 +9,7 @@ module CBin class Framework class Builder include Pod -#Debug下还待完成 + #Debug下还待完成 def initialize(spec, file_accessor, platform, source_dir, isRootSpec = true, build_model="Debug") @spec = spec @source_dir = source_dir @@ -93,22 +93,22 @@ def build_static_library_for_ios(output) UI.message "Building ios libraries with archs #{ios_architectures}" static_libs = static_libs_in_sandbox('build') + static_libs_in_sandbox('build-simulator') + @vendored_libraries # if is_debug_model - ios_architectures.map do |arch| - static_libs += static_libs_in_sandbox("build-#{arch}") + @vendored_libraries - end - ios_architectures_sim do |arch| - static_libs += static_libs_in_sandbox("build-#{arch}") + @vendored_libraries - end + ios_architectures.map do |arch| + static_libs += static_libs_in_sandbox("build-#{arch}") + @vendored_libraries + end + ios_architectures_sim do |arch| + static_libs += static_libs_in_sandbox("build-#{arch}") + @vendored_libraries + end # end build_path = Pathname("build") build_path.mkpath unless build_path.exist? # if is_debug_model - libs = (ios_architectures + ios_architectures_sim) .map do |arch| - library = "build-#{arch}/lib#{@spec.name}.a" - library - end + libs = (ios_architectures + ios_architectures_sim) .map do |arch| + library = "build-#{arch}/lib#{@spec.name}.a" + library + end # else # libs = ios_architectures.map do |arch| # library = "build/package-#{@spec.name}-#{arch}.a" @@ -163,13 +163,13 @@ def compile options = ios_build_options # if is_debug_model - archs = ios_architectures - # archs = %w[arm64 armv7 armv7s] - archs.map do |arch| - xcodebuild(defines, "ARCHS=\'#{arch}\' OTHER_CFLAGS=\'-fembed-bitcode -Qunused-arguments\'","build-#{arch}",@build_model) - end + archs = ios_architectures + # archs = %w[arm64 armv7 armv7s] + archs.map do |arch| + xcodebuild(defines, "ARCHS=\'#{arch}\' OTHER_CFLAGS=\'-fembed-bitcode -Qunused-arguments\'","build-#{arch}",@build_model) + end # else - # xcodebuild(defines,options) + # xcodebuild(defines,options) # end defines @@ -253,8 +253,8 @@ 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") + # try to read modulemap file from module dir + module_map_file = File.join(CBin::Build::Utils.spec_module_dir(@spec), "#{@spec.name}.modulemap") if Pathname(module_map_file).exist? module_map = File.read(module_map_file) end @@ -285,9 +285,9 @@ def copy_resources bundle_names = [@spec, *@spec.recursive_subspecs].flat_map do |spec| consumer = spec.consumer(@platform) consumer.resource_bundles.keys + - consumer.resources.map do |r| - File.basename(r, '.bundle') if File.extname(r) == 'bundle' - end + consumer.resources.map do |r| + File.basename(r, '.bundle') if File.extname(r) == 'bundle' + end end.compact.uniq bundles.select! do |bundle| @@ -300,7 +300,7 @@ def copy_resources bundle_files = bundles.join(' ') `cp -rp #{bundle_files} #{framework.resources_path} 2>&1` end - + real_source_dir = @source_dir unless @isRootSpec spec_source_dir = File.join(Dir.pwd,"#{@spec.name}") @@ -339,10 +339,10 @@ def expand_paths(source_dir, path_specs) def framework @framework ||= begin - framework = Framework.new(@spec.name, @platform.name.to_s) - framework.make - framework - end + framework = Framework.new(@spec.name, @platform.name.to_s) + framework.make + framework + end end