cocoapods-util 0.0.14 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c64106c89882c33e0febe8aa3623478f1b5c9a3325c7efdb6a10a4a2a998ab91
4
- data.tar.gz: ec9b2691eecd6fba14b374f0fd8b9a302595b958d314d85c8b065e85896b5f35
3
+ metadata.gz: 83da9a9a68fa2cc89f013255846c38e0ff5f7dd8631c96ac21555b4a30d58e14
4
+ data.tar.gz: 39a88b6de2d54f2d68a3ae0b84727650a3b89fb006d5a3aa3f03eef7070d0f06
5
5
  SHA512:
6
- metadata.gz: e21f0d9d26c4c4ae210f25f462f706e57a0867536316b4ec81321c9e422ce4469c3df09a3ee2637516f49c27026bbd83f428268efe1999204c83f0d4ec23c8b0
7
- data.tar.gz: '0818fdf44b6dc9cc552ba5464de71aa95e004190cea4a21b827d049b16641a82fd103feda06421c2d897e59faa0d303b8472205b7d1f08d8a8ea3bf369811730'
6
+ metadata.gz: 17ad6705b93f62ed103cccf0d8c102c684bc662506c682053b2e1c2120aa6f70522c24af830b1e7f8ac5148a6ae4096525889c4de1abab1d254d5f254d0db913
7
+ data.tar.gz: '09847e25cdcd0f23b107322a2ab76fb47f792031824bce7d0ef369d161765c144c80c56f9b566cf5374f9e612c21a160c22577c73c863528803a9523bf6c7c2a'
@@ -0,0 +1,23 @@
1
+ module BinaryPrebuild
2
+ def self.config
3
+ BinaryPrebuild::Config.instance
4
+ end
5
+
6
+ class Config
7
+ attr_accessor :enable_all, :enable_targets
8
+
9
+ def initialize()
10
+ @enable_all = false
11
+ @enable_targets = []
12
+ end
13
+
14
+ def self.instance
15
+ @instance ||= new()
16
+ end
17
+
18
+ def add_enable_target(name)
19
+ @enable_targets.push name
20
+ @enable_targets.uniq!
21
+ end
22
+ end
23
+ end
@@ -1,18 +1,24 @@
1
+ require_relative 'pre_install'
2
+ require_relative 'post_install'
3
+
1
4
  module CocoapodsUtilHook
2
- Pod::HooksManager.register('cocoapods-util', :pre_install) do |context, _|
3
- puts "pre_install"
5
+ Pod::HooksManager.register('cocoapods-util', :pre_install) do |installer_context, _|
6
+ BinaryPrebuild::PreInstall.new(installer_context).run
4
7
  end
8
+
5
9
  Pod::HooksManager.register('cocoapods-util', :pre_integrate) do |context, _|
6
- puts "pre_integrate"
10
+
7
11
  end
12
+
8
13
  Pod::HooksManager.register('cocoapods-util', :post_install) do |context, _|
9
- puts "post_install"
14
+ BinaryPrebuild::PostInstall.new(context).run
10
15
  end
16
+
11
17
  Pod::HooksManager.register('cocoapods-util', :post_integrate) do |context, _|
12
- puts "post_integrate"
18
+
13
19
  end
20
+
14
21
  Pod::HooksManager.register('cocoapods-util', :source_provider) do |context, _|
15
- puts "source_provider"
22
+
16
23
  end
17
- end
18
-
24
+ end
@@ -0,0 +1,10 @@
1
+ module BinaryPrebuild
2
+ class PostInstall
3
+ def initialize(installer_context)
4
+ @installer_context = installer_context
5
+ end
6
+
7
+ def run
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,20 @@
1
+ require_relative '../targets/pod_target'
2
+
3
+ module BinaryPrebuild
4
+ class PreInstall
5
+ def initialize(installer_context)
6
+ @installer_context = installer_context
7
+ end
8
+
9
+ def run
10
+ # [Check Environment]
11
+ # podfile = @installer_context.podfile
12
+ # podfile.target_definition_list.each do |target_definition|
13
+ # if not target_definition.uses_frameworks?
14
+ # STDERR.puts "[!] Cocoapods-binary requires `use_frameworks!`".red
15
+ # exit
16
+ # end
17
+ # end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,4 @@
1
+ require_relative 'config'
2
+ require_relative 'podfile_dsl'
3
+ require_relative 'prebuild'
4
+ require_relative 'hooks/CocoapodsUtilHook'
@@ -0,0 +1,27 @@
1
+ module Pod
2
+ class Podfile
3
+ module DSL
4
+ def self.enable_framework_header_keyword
5
+ :enable_framework_header
6
+ end
7
+
8
+ def enable_all_framework_header!(enable: true)
9
+ BinaryPrebuild.config.enable_all = enable
10
+ end
11
+
12
+ # hook
13
+ old_method = instance_method(:pod)
14
+ define_method(:pod) do |name, *args|
15
+ enable = BinaryPrebuild.config.enable_all
16
+ options = args.last
17
+ keyword = DSL.enable_framework_header_keyword
18
+ if options.is_a?(Hash) && options[keyword] != nil
19
+ enable = options.delete(keyword)
20
+ args.pop if options.empty?
21
+ end
22
+ BinaryPrebuild.config.add_enable_target name.to_s.gsub(/\/.*$/, '') if enable
23
+ old_method.bind(self).(name, *args)
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,3 @@
1
+ module BinaryPrebuild
2
+
3
+ end
@@ -0,0 +1,76 @@
1
+ module Pod
2
+ class Target
3
+ # @since 1.5.0
4
+ class BuildSettings
5
+ # missing framework header search paths
6
+ def missing_framework_header_search_path(pt)
7
+ return [] unless BinaryPrebuild.config.enable_targets.include? pt.name
8
+
9
+ paths = []
10
+ pt.file_accessors.each do |file_accessor|
11
+ # xcframeworks
12
+ greater_than_or_equal_to_1_10_0 = Gem::Version.new(Pod::VERSION) >= Gem::Version.new('1.10.0')
13
+ greater_than_or_equal_to_1_11_0 = Gem::Version.new(Pod::VERSION) >= Gem::Version.new('1.11.0')
14
+ file_accessor.vendored_xcframeworks.map { |path|
15
+ if greater_than_or_equal_to_1_11_0
16
+ Xcode::XCFramework.new(file_accessor.spec.name, path)
17
+ else
18
+ Xcode::XCFramework.new(path)
19
+ end
20
+ }.each { |xcfwk|
21
+ xcfwk.slices.each { |slice|
22
+ fwk_name = slice.path.basename
23
+ if greater_than_or_equal_to_1_11_0
24
+ paths.push "${PODS_XCFRAMEWORKS_BUILD_DIR}/#{xcfwk.target_name}/#{fwk_name}/Headers"
25
+ elsif greater_than_or_equal_to_1_10_0
26
+ paths.push "${PODS_XCFRAMEWORKS_BUILD_DIR}/#{fwk_name.to_s.gsub(/\.framework$/, '')}/#{fwk_name}/Headers"
27
+ else
28
+ paths.push "${PODS_CONFIGURATION_BUILD_DIR}/#{fwk_name}/Headers"
29
+ end
30
+ }
31
+ }
32
+ # Cocoapods 1.9.x bugs
33
+ if Gem::Version.new(Pod::VERSION) < Gem::Version.new('1.10.0')
34
+ file_accessor.vendored_xcframeworks.each { |path|
35
+ Dir.glob("#{path.to_s}/**/*.framework").each do |fwk_path|
36
+ header_path = Pathname.new("#{fwk_path}/Headers")
37
+ next unless header_path.exist?
38
+ paths.push "${PODS_ROOT}/#{header_path.relative_path_from(pt.sandbox.root)}"
39
+ end
40
+ }
41
+ end
42
+
43
+ # frameworks
44
+ (file_accessor.vendored_frameworks - file_accessor.vendored_xcframeworks).each { |framework|
45
+ header_path = Pathname.new("#{framework}/Headers")
46
+ next unless header_path.exist?
47
+ paths.push "${PODS_ROOT}/#{header_path.relative_path_from(pt.sandbox.root)}"
48
+ }
49
+ end
50
+ paths.uniq
51
+ end
52
+
53
+ # A subclass that generates build settings for a `PodTarget`
54
+ class AggregateTargetSettings
55
+ # @return [Array<String>]
56
+ alias_method :old_raw_header_search_paths, :_raw_header_search_paths
57
+ def _raw_header_search_paths
58
+ header_search_paths = old_raw_header_search_paths
59
+ header_search_paths.concat pod_targets.flat_map { |pt| missing_framework_header_search_path(pt) }
60
+ header_search_paths.uniq
61
+ end
62
+ end
63
+
64
+ # A subclass that generates build settings for a {PodTarget}
65
+ class PodTargetSettings
66
+ # @return [Array<String>]
67
+ alias_method :old_raw_header_search_paths, :_raw_header_search_paths
68
+ def _raw_header_search_paths
69
+ header_search_paths = old_raw_header_search_paths
70
+ header_search_paths.concat dependent_targets.flat_map { |pt| missing_framework_header_search_path(pt) } if target.should_build?
71
+ header_search_paths.uniq
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
@@ -40,7 +40,11 @@ module Pod
40
40
  check_all_componment
41
41
  else
42
42
  installed = pod_installed
43
- help! "没有找到#{@name}组件的相关信息,请检查输入的组件名称" unless installed.include?(@name)
43
+ help! "没有找到#{@name}组件的相关信息,请检查输入的组件名称" unless installed.include?(@name) || installed.map do |item|
44
+ downcase = item.downcase
45
+ @name = item if @name.downcase == downcase
46
+ downcase
47
+ end.include?(@name.downcase)
44
48
  check_componment_with_name(@name)
45
49
  end
46
50
  end
@@ -63,10 +67,11 @@ module Pod
63
67
  UI.puts " - SPEC REPO: ".yellow "#{repo_name}".green unless repo_name.nil?
64
68
 
65
69
  # external sources
66
- external_dict = @lockfile.internal_data['EXTERNAL SOURCES']
67
- unless external_dict.nil?
68
- external = external_dict[name]
69
- external.each { |key, value| UI.puts " - #{key}: ".yellow "#{value}".green } unless external.nil?
70
+ external_sources = @lockfile.internal_data['EXTERNAL SOURCES']
71
+ unless external_sources.nil?
72
+ external_dict = external_sources[name]
73
+ UI.puts " - EXTERNAL SOURCES: ".yellow unless external_dict.nil?
74
+ external_dict.each { |key, value| UI.puts " - #{key}: ".yellow "#{value}".green } unless external_dict.nil?
70
75
  end
71
76
 
72
77
  # subspecs、dependencies、parents
@@ -74,23 +79,33 @@ module Pod
74
79
  end
75
80
 
76
81
  def show_moreinfo(name)
77
- subspecs = []
78
- dependencies = []
79
- parents = Array.new
82
+ # checkout options
83
+ checkout_options = @lockfile.internal_data['CHECKOUT OPTIONS']
84
+ unless checkout_options.nil?
85
+ checkout_dict = checkout_options[name]
86
+ UI.puts " - CHECKOUT OPTIONS: ".yellow unless checkout_dict.nil?
87
+ checkout_dict.each { |key, value| UI.puts " - #{key}: ".yellow "#{value}".green } unless checkout_dict.nil?
88
+ end
89
+
90
+ subspecs, dependencies, parents = [], [], []
80
91
  @lockfile.internal_data["PODS"].each { |item|
92
+ # 取遍历的pod名称
81
93
  pod_name = item.keys.first if item.is_a?(Hash) && item.count == 1
82
94
  pod_name = item if item.is_a?(String)
83
- if pod_name =~ /^#{name}.*$/
84
- subspecs.push(pod_name.match(/^[^\s]*/).to_s) if pod_name =~ /^#{name}\/.*$/
95
+ if pod_name =~ /^#{name}[\s\/]/ # 以#{name}开头,后跟一个'空格'或一个'/'
96
+ subspecs.push(pod_name.match(/^[^\s]*/).to_s) if pod_name =~ /^#{name}\// # 如果#{name}后跟的是'/',则是subspec
85
97
  if item.is_a?(Hash)
86
98
  item.each_value do |value|
99
+ # 如果不是以#{name}开头的,则是dependency
87
100
  value.each {|dependency| dependencies.push(dependency.to_s) unless dependency =~ /^#{name}/ }
88
101
  end
89
102
  elsif item.is_a?(String)
103
+ # 如果不是以#{name}开头的,则是dependency
90
104
  dependencies.push(item.to_s) unless item =~ /^#{name}/
91
105
  end
92
106
  else
93
107
  next if pod_name.nil?
108
+ # 如果不是匹配到的pod名称,则检查是不是依赖了该pod
94
109
  if item.is_a?(Hash)
95
110
  item.each_value do |value|
96
111
  value.each {|dependency| parents.push(pod_name.match(/^[^\s\/]*/).to_s) if dependency =~ /^#{name}/ }
@@ -98,12 +113,9 @@ module Pod
98
113
  end
99
114
  end
100
115
  }
101
- subspecs.uniq!
102
- dependencies.uniq!
103
- parents.uniq!
104
- UI.puts " - SUBSPEC: ".yellow "#{subspecs.join('、')}".green unless subspecs.empty?
105
- UI.puts " - DEPENDENCIES: ".yellow "#{dependencies.join('、')}".green unless dependencies.empty?
106
- UI.puts " - DEPENDENTS: ".yellow "#{parents.join('、')}".green unless parents.empty?
116
+ UI.puts " - SUBSPECS: ".yellow "#{subspecs.uniq.join('、')}".green unless subspecs.empty?
117
+ UI.puts " - DEPENDENCIES: ".yellow "#{dependencies.uniq.join('、')}".green unless dependencies.empty?
118
+ UI.puts " - DEPENDS ON IT: ".yellow "#{parents.uniq.join('、')}".green unless parents.empty?
107
119
  end
108
120
 
109
121
  def pod_tags_info
@@ -114,10 +126,10 @@ module Pod
114
126
  @lockfile.internal_data["PODS"].each do |item|
115
127
  info = item.keys.first if item.is_a?(Hash) && item.count == 1
116
128
  info = item if item.is_a?(String)
117
- if info =~ /^[^\/]*$/
118
- name = info.match(/^[^\/\s]*/)
119
- tag = info.match(/\(.*\)/) || ''
120
- @tags_info[name.to_s] = tag.to_s
129
+ name = info.match(/^[^\/\s]*/).to_s
130
+ unless @tags_info.keys.include?(name)
131
+ tag = info.match(/\(.*\)/).to_s
132
+ @tags_info[name] = tag unless tag.empty?
121
133
  end
122
134
  end
123
135
  @tags_info
@@ -15,6 +15,7 @@ module Pod
15
15
 
16
16
  def initialize(argv)
17
17
  @skip_validate = argv.flag?('skip-validate', false)
18
+ @skip_build = argv.flag?('skip-build', false)
18
19
  super
19
20
  @argvs = argv.remainder!
20
21
 
@@ -31,6 +32,7 @@ module Pod
31
32
  @target = Pod::Command::Repo::Push.new(CLAide::ARGV.new(@argvs))
32
33
  @target.validate!
33
34
  @target.skip_validate = @skip_validate
35
+ @target.skip_build = @skip_build
34
36
  @target.run
35
37
  end
36
38
  end
@@ -1,29 +1,23 @@
1
- class Module
2
- def strong_alias(to, from)
3
- # https://tieba.baidu.com/p/5535445605?red_tag=0735709674 贴吧大神给出的方案
4
- # 类方法可以看做singleton class(单例类)的实例方法,下面两个方法都可以,上面这个方式也适用于早起的ruby版本
5
- (class << self;self;end).send(:alias_method, to, from)
6
- # self.singleton_class.send(:alias_method, to, from)
7
- end
8
- end
9
-
10
1
  module Pod
11
2
  class Command
12
3
  class Repo < Command
13
4
  class Push < Repo
14
- attr_accessor :skip_validate
15
-
16
- self.strong_alias(:old_options, :options)
5
+ attr_accessor :skip_validate, :skip_build
6
+
7
+ class_alias_method(:old_options, :options)
17
8
  def self.options
18
9
  [
19
- ['--skip-validate', '跳过验证,不验证推送的podspec文件,默认为验证']
10
+ ['--skip-validate', '跳过整个验证,不验证推送的podspec文件,默认为验证'],
11
+ ['--skip-build', '跳过编译过程,还是会校验pod下载和依赖']
20
12
  ].concat(self.old_options)
21
13
  end
22
14
 
23
15
  # 调用原方法的两种方式
24
16
  old_validate_podspec_files = instance_method(:validate_podspec_files)
25
17
  define_method(:validate_podspec_files) do
18
+ Pod::Validator.skip_build = @skip_build
26
19
  old_validate_podspec_files.bind(self).() unless @skip_validate
20
+ Pod::Validator.skip_build = false
27
21
  end
28
22
 
29
23
  alias_method :old_check_repo_status, :check_repo_status
@@ -33,4 +27,25 @@ module Pod
33
27
  end
34
28
  end
35
29
  end
30
+ end
31
+
32
+ module Pod
33
+ class Validator
34
+ class_attr_accessor :skip_build
35
+
36
+ alias_method :old_build_pod, :build_pod
37
+ def build_pod
38
+ old_build_pod unless Pod::Validator.skip_build
39
+ end
40
+
41
+ alias_method :old_test_pod, :test_pod
42
+ def test_pod
43
+ old_test_pod unless Pod::Validator.skip_build
44
+ end
45
+
46
+ alias_method :old_validated?, :validated?
47
+ def validated?
48
+ Pod::Validator.skip_build || old_validated?
49
+ end
50
+ end
36
51
  end
@@ -29,9 +29,10 @@ module Pod
29
29
  default_build_settings = Hash.new
30
30
  default_build_settings["CLANG_MODULES_AUTOLINK"] = "NO"
31
31
  default_build_settings["GCC_GENERATE_DEBUGGING_SYMBOLS"] = "YES" # 生成Debug编译信息
32
- default_build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64" unless @xcframework && self.match_pod_version?('~> 1.11') # 非xcframework排除ios simulator 64位架构
33
- default_build_settings["EXCLUDED_ARCHS[sdk=appletvsimulator*]"] = "arm64" unless @xcframework && self.match_pod_version?('~> 1.11') # 非xcframework排除tvos simulator 64位架构
32
+ default_build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64" # unless @xcframework && Gem::Version.new(Pod::VERSION) >= Gem::Version.new('1.11')# 非xcframework排除ios simulator 64位架构
33
+ default_build_settings["EXCLUDED_ARCHS[sdk=appletvsimulator*]"] = "arm64" # unless @xcframework && Gem::Version.new(Pod::VERSION) >= Gem::Version.new('1.11') # 非xcframework排除tvos simulator 64位架构
34
34
  default_build_settings["BUILD_LIBRARY_FOR_DISTRIBUTION"] = "YES" # 编译swift生成swiftinterface文件
35
+ default_build_settings["CODE_SIGN_IDENTITY"] = "" if `xcodebuild -version`.lines.shift.gsub!('Xcode ', '') >= "14" #xcode版本大于等于xcode 14时需要添加
35
36
 
36
37
  # merge user setting
37
38
  default_build_settings.merge!(@build_settings) unless @build_settings.empty?
@@ -120,10 +121,6 @@ module Pod
120
121
 
121
122
  Specification.from_file(@path)
122
123
  end
123
-
124
- def match_pod_version?(*version)
125
- Gem::Dependency.new('', *version).match?('', Pod::VERSION)
126
- end
127
124
  end
128
125
  end
129
126
  end
@@ -1,3 +1,3 @@
1
1
  module CocoapodsUtil
2
- VERSION = "0.0.14"
2
+ VERSION = "0.0.16"
3
3
  end
@@ -0,0 +1,12 @@
1
+ class Module
2
+ def class_alias_method(to, from)
3
+ # https://tieba.baidu.com/p/5535445605?red_tag=0735709674 贴吧大神给出的方案
4
+ # 类方法可以看做singleton class(单例类)的实例方法,下面两个方法都可以,上面这个方式也适用于早期的ruby版本
5
+ (class << self;self;end).send(:alias_method, to, from)
6
+ # self.singleton_class.send(:alias_method, to, from)
7
+ end
8
+
9
+ def class_attr_accessor(symbol)
10
+ self.class.send(:attr_accessor, symbol)
11
+ end
12
+ end
@@ -1,2 +1,3 @@
1
+ require 'cocoapods-util/tool'
1
2
  require 'cocoapods-util/command'
2
- require 'cocoapods-util/CocoapodsUtilHook.rb'
3
+ require 'cocoapods-util/binary/main.rb'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-util
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - guojiashuang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-01 00:00:00.000000000 Z
11
+ date: 2023-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '1.3'
39
+ version: 2.2.33
40
40
  type: :development
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '1.3'
46
+ version: 2.2.33
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -68,7 +68,14 @@ files:
68
68
  - LICENSE
69
69
  - README.md
70
70
  - lib/cocoapods-util.rb
71
- - lib/cocoapods-util/CocoapodsUtilHook.rb
71
+ - lib/cocoapods-util/binary/config.rb
72
+ - lib/cocoapods-util/binary/hooks/CocoapodsUtilHook.rb
73
+ - lib/cocoapods-util/binary/hooks/post_install.rb
74
+ - lib/cocoapods-util/binary/hooks/pre_install.rb
75
+ - lib/cocoapods-util/binary/main.rb
76
+ - lib/cocoapods-util/binary/podfile_dsl.rb
77
+ - lib/cocoapods-util/binary/prebuild.rb
78
+ - lib/cocoapods-util/binary/targets/pod_target.rb
72
79
  - lib/cocoapods-util/command.rb
73
80
  - lib/cocoapods-util/command/cocoapods-extend/extend.rb
74
81
  - lib/cocoapods-util/command/cocoapods-extend/install.rb
@@ -90,7 +97,7 @@ files:
90
97
  - lib/cocoapods-util/command/xcframework/xcframework.rb
91
98
  - lib/cocoapods-util/command/xcframework/xcframework_build.rb
92
99
  - lib/cocoapods-util/gem_version.rb
93
- - lib/cocoapods-util/hooks/installer.rb
100
+ - lib/cocoapods-util/tool.rb
94
101
  - lib/cocoapods_plugin.rb
95
102
  homepage: https://github.com/CaryGo/cocoapods-util
96
103
  licenses:
@@ -1,4 +0,0 @@
1
- module Pod
2
- class Installer < Command
3
- end
4
- end