cocoapods-dongjia 1.1.2 → 1.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,38 +4,62 @@ module Dongjia
4
4
 
5
5
  class PodsIterator
6
6
 
7
+ def self.update_build_setting(config, key, value)
8
+ if config.build_settings[key] != value
9
+ config.build_settings[key] = value
10
+ return true
11
+ else
12
+ return false
13
+ end
14
+ end
15
+
7
16
  # 关闭警告
8
17
  def self.disable_warnings(config, target_name)
18
+ changed = false
19
+
9
20
  # 禁用非 DJ 开头 Pod 的警告
10
- config.build_settings['GCC_WARN_INHIBIT_ALL_WARNINGS'] = "YES" unless target_name.start_with?('DJ')
11
-
21
+ changed ||= update_build_setting(config, 'GCC_WARN_INHIBIT_ALL_WARNINGS', 'YES') unless target_name.start_with?('DJ')
22
+
12
23
  # 不检测 block 中的隐式 self 调用
13
- config.build_settings['CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF'] = "NO"
24
+ changed ||= update_build_setting(config, 'CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF', "NO")
14
25
 
15
26
  # 不检测已废弃的方法
16
- config.build_settings['GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS'] = "NO"
17
-
18
- # 允许 objc_msgSend
19
- config.build_settings['ENABLE_STRICT_OBJC_MSGSEND'] = "NO"
27
+ changed ||= update_build_setting(config, 'GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS', "NO")
20
28
 
21
29
  # 不检测注释
22
- config.build_settings['CLANG_WARN_DOCUMENTATION_COMMENTS'] = "NO"
30
+ changed ||= update_build_setting(config, 'CLANG_WARN_DOCUMENTATION_COMMENTS', "NO")
23
31
 
24
- # 不严格的原型校验
25
- config.build_settings['CLANG_WARN_STRICT_PROTOTYPES'] = "NO"
26
-
27
- # 强制设置 deployment 版本为 8.0
28
- if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 8.0
29
- config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = "8.0"
32
+ # 强制设置 deployment 版本为 9.0
33
+ if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 9.0
34
+ changed ||= update_build_setting(config, 'IPHONEOS_DEPLOYMENT_TARGET', "9.0")
30
35
  end
31
36
 
32
37
  # 关闭 bitcode
33
- config.build_settings['ENABLE_BITCODE'] = "NO"
38
+ changed ||= update_build_setting(config, 'ENABLE_BITCODE', "NO")
39
+
40
+ changed
34
41
  end
35
42
 
36
43
  # 打开 LTO
37
44
  def self.enable_lto(config)
38
- config.build_settings['LLVM_LTO'] = 'YES_THIN' if config.name == 'Release'
45
+ changed = false
46
+ # changed ||= update_build_setting(config, 'LLVM_LTO', 'YES_THIN') if config.name == 'Release'
47
+ changed
48
+ end
49
+
50
+ # 将 umbrella 导出的头文件改为尖括号形式
51
+ def self.convert_umbrella_header_import(pod_name)
52
+ umbrella_path = "./Pods/Target Support Files/#{pod_name}/#{pod_name}-umbrella.h"
53
+ return unless File.exist?(umbrella_path)
54
+ contents = File.read(umbrella_path)
55
+ return unless contents.include?("#import \"")
56
+ File.open(umbrella_path, 'r+') do |f|
57
+ x = f.read
58
+ begin x.gsub!("#import \"#{pod_name}/", "#import <#{pod_name}/").gsub!('.h"', '.h>') rescue nil end
59
+ begin x.gsub!('#import "', "#import <#{pod_name}/").gsub!('.h"', '.h>') rescue nil end
60
+ f.rewind
61
+ f.write(x)
62
+ end
39
63
  end
40
64
 
41
65
  # 遍历所有 Pod 工程配置
@@ -50,23 +74,27 @@ module Dongjia
50
74
 
51
75
  if name != 'Pods.xcodeproj'
52
76
  proj.build_configurations.each do | config |
53
- # 强制设置 deployment 版本为 8.0
54
- if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 8.0
55
- config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = "8.0"
77
+ # 强制设置 deployment 版本为 9.0
78
+ if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 9.0
79
+ config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = "9.0"
56
80
  end
57
81
  end
58
82
  end
59
83
 
60
84
  # project 的每个 target 配置
85
+ changed = false
61
86
  proj.targets.select {|t| !t.name.start_with?('Pods')}.each do | target |
62
87
  next if target.name.start_with?('Pods')
63
88
  target.build_configurations.each do | config |
64
- disable_warnings(config, target.name) if turn_off_warnings
65
- enable_lto(config) if lto_enabled
89
+ changed ||= disable_warnings(config, target.name) if turn_off_warnings
90
+ changed ||= enable_lto(config) if lto_enabled
91
+ convert_umbrella_header_import(target.name)
66
92
  end
67
93
  end
68
94
 
69
- proj.save
95
+ if changed
96
+ proj.save
97
+ end
70
98
 
71
99
  end
72
100
 
@@ -14,6 +14,8 @@ module Dongjia
14
14
 
15
15
  注意:此处的实现仅供查看,如需修改,请点击对应的 _redirect{type} 方法跳转至对应的实现
16
16
 
17
+ 跳转定义文档:https://cf.idongjia.cn/pages/viewpage.action?pageId=57351032
18
+
17
19
  */
18
20
 
19
21
 
@@ -0,0 +1,16 @@
1
+ module Pod
2
+ class Podfile
3
+ module DSL
4
+ # Hook Podfile 中的 install: 方法,将当前版本 Cocoapods 不支持的 option 剔除
5
+ original_install = instance_method(:install!)
6
+ define_method(:install!) do |installation_method, options = {}|
7
+ all_options = Installer::InstallationOptions::all_options
8
+ valid_options = {}
9
+ options.each do |k, v|
10
+ valid_options.merge!({k => v}) if all_options.include?(k.to_s)
11
+ end
12
+ original_install.bind(self).(installation_method, valid_options)
13
+ end
14
+ end
15
+ end
16
+ end
@@ -1,11 +1,11 @@
1
1
  require_relative 'dongjia_version_checker'
2
+ require_relative '../dongjia_binarization'
2
3
 
3
4
  module Pod
4
5
 
5
6
  class Installer
6
7
 
7
8
  class PodSourceInstaller
8
-
9
9
  # 关闭自己仓库中 pod 的安全警告
10
10
  old_method = instance_method(:verify_source_is_secure)
11
11
  define_method(:verify_source_is_secure) do |root_spec|
@@ -14,15 +14,29 @@ module Pod
14
14
  old_method.bind(self).(root_spec)
15
15
  end
16
16
  end
17
-
18
17
  end
19
18
 
19
+ # Hook post_installer
20
20
  origin_perform_post_install_actions = instance_method(:perform_post_install_actions)
21
21
  define_method :perform_post_install_actions do
22
22
  origin_perform_post_install_actions.bind(self).()
23
23
  Dongjia::DongjiaVersionChecker.check_version
24
24
  end
25
25
 
26
- end
26
+ # Hook Pods.xcodeproj 尚未写入
27
+ origin_run_podfile_post_install_hooks = instance_method(:run_podfile_post_install_hooks)
28
+ define_method :run_podfile_post_install_hooks do
29
+ origin_run_podfile_post_install_hooks.bind(self).()
30
+ # 处理二进制化
31
+ # Dongjia::Binarization.process(self)
32
+ end
27
33
 
34
+ # Hook Pods.xcodeproj 已生成完毕
35
+ origin_generate_pods_project = instance_method(:generate_pods_project)
36
+ define_method :generate_pods_project do
37
+ origin_generate_pods_project.bind(self).()
38
+ # 处理二进制化
39
+ Dongjia::Binarization.process(self)
40
+ end
41
+ end
28
42
  end
@@ -0,0 +1,60 @@
1
+ require_relative 'pod'
2
+
3
+ module Pod
4
+
5
+ class LocalSpec
6
+ @@local_spec_importing = false
7
+ @@local_spec_path = nil
8
+ def self.import_local_pod(path)
9
+ @@local_spec_importing = true
10
+ @@local_spec_path = path
11
+ yield if block_given?
12
+ @@local_spec_path = nil
13
+ @@local_spec_importing = false
14
+ end
15
+ def self.local_spec_importing?
16
+ @@local_spec_importing
17
+ end
18
+ def self.local_spec_path
19
+ @@local_spec_path
20
+ end
21
+ end
22
+
23
+ class Podfile
24
+
25
+ # 只在 debug 模式下集成的组件,默认为空
26
+ @@debug_only_pods = []
27
+
28
+ # 导入工程目录下相对位置的 pod
29
+ def import_relative_in(path = './')
30
+ LocalSpec.import_local_pod(path) do
31
+ yield if block_given?
32
+ end
33
+ end
34
+
35
+ original_pod = instance_method(:pod)
36
+ define_method(:pod) do |name = nil, *requirements|
37
+
38
+ if Pod::Podfile::is_release_mode?
39
+ realname = name.split('/').first
40
+ if @@debug_only_pods.include?(realname)
41
+ puts "#{realname} is only for debug, it will be removed."
42
+ next
43
+ end
44
+ end
45
+
46
+ if LocalSpec.local_spec_importing?
47
+ path_cfg = { :path => "#{LocalSpec.local_spec_path}/#{Pod::repo_name(name)}" }
48
+ if requirements.length == 0
49
+ requirements = [path_cfg]
50
+ else
51
+ cfg = requirements.first
52
+ cfg.merge!(path_cfg) unless cfg.has_key?(:path)
53
+ end
54
+ end
55
+ original_pod.bind(self).(name, *requirements)
56
+ end
57
+
58
+ end
59
+
60
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-dongjia
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - jiangzhuoyi
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-20 00:00:00.000000000 Z
11
+ date: 2021-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +66,34 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.13.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: down
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 5.2.0
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 5.2.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: archive-zip
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.12.0
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.12.0
69
97
  description: A short description of cocoapods-dongjia.
70
98
  email:
71
99
  - jiangzhuoyi@idongjia.cn
@@ -79,30 +107,31 @@ files:
79
107
  - lib/cocoapods-dongjia/command/install.rb
80
108
  - lib/cocoapods-dongjia/command/open.rb
81
109
  - lib/cocoapods-dongjia/command/reinstall.rb
110
+ - lib/cocoapods-dongjia/command/release.rb
82
111
  - lib/cocoapods-dongjia/command/strip.rb
83
112
  - lib/cocoapods-dongjia/gem_version.rb
84
113
  - lib/cocoapods_plugin.rb
85
- - lib/dongjia_branch_inspector.rb
114
+ - lib/dongjia_binarization.rb
86
115
  - lib/dongjia_config.rb
87
116
  - lib/dongjia_enterprise_inspector.rb
88
117
  - lib/dongjia_pods_iterator.rb
89
118
  - lib/dongjia_router.rb
90
- - lib/dongjia_scheme_manager.rb
91
119
  - lib/dongjia_source.rb
120
+ - lib/helper/Core/podfile/dsl.rb
92
121
  - lib/helper/dongjia_version_checker.rb
122
+ - lib/helper/installer.rb
93
123
  - lib/helper/pod.rb
94
- - lib/helper/podfile_local_importer.rb
124
+ - lib/helper/podfile.rb
95
125
  - lib/helper/podfile_options.rb
96
- - lib/helper/podfile_warnings.rb
97
126
  - lib/helper/project.rb
98
127
  homepage: https://github.com/EXAMPLE/cocoapods-dongjia
99
128
  licenses:
100
129
  - MIT
101
130
  metadata:
102
131
  update_desc: |2
103
- - 修复路由抓取错误
104
- - 修复 pod strip
105
- post_install_message:
132
+ - 修复源码和二进制切换后的集成依赖问题
133
+ - 修复一些导致 crash 的问题
134
+ post_install_message:
106
135
  rdoc_options: []
107
136
  require_paths:
108
137
  - lib
@@ -117,8 +146,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
146
  - !ruby/object:Gem::Version
118
147
  version: '0'
119
148
  requirements: []
120
- rubygems_version: 3.1.4
121
- signing_key:
149
+ rubygems_version: 3.2.19
150
+ signing_key:
122
151
  specification_version: 4
123
152
  summary: A longer description of cocoapods-dongjia.
124
153
  test_files: []
@@ -1,43 +0,0 @@
1
- require 'cocoapods'
2
-
3
- module Pod
4
-
5
- class Podfile
6
-
7
- gitdir = File.join(Dir.pwd, '.git')
8
- if File.exist?(gitdir)
9
-
10
- # 获取当前分支,仅对 dev 和 master 进行校验
11
- branch = `git symbolic-ref --short -q HEAD`.strip
12
- if branch == 'dev' or branch == 'master'
13
-
14
- # Hook pod 方法
15
- alias_method :pod_alias_by_inspector, :pod
16
-
17
- def pod(name = nil, *requirements, &block)
18
-
19
- if name.start_with?('DJ') && requirements.count > 0
20
- req = requirements.first
21
- if req[:branch] && req[:branch] != 'master'
22
- UI.warn "检测到 #{name} 指向了分支 #{req[:branch]}\n"
23
- exit -1
24
- elsif req[:tag]
25
- UI.warn "检测到 #{name} 指向了标签 #{req[:tag]}\n"
26
- exit -1
27
- elsif req[:commit]
28
- UI.warn "检测到 #{name} 指向了节点 #{req[:commit]}\n"
29
- exit -1
30
- end
31
- end
32
-
33
- pod_alias_by_inspector(name, *requirements, &block)
34
- end
35
-
36
- end
37
-
38
- end
39
-
40
- end
41
-
42
- end
43
-
@@ -1,58 +0,0 @@
1
- require 'helper/project'
2
-
3
- module Dongjia
4
-
5
- class SchemeManager
6
-
7
- # 获取主工程的 development team
8
- def self.development_team(ctx)
9
- team = nil
10
- project = ctx.umbrella_targets.first.user_project
11
- return team unless project.is_a?(Xcodeproj::Project)
12
-
13
- target = project.targets.find { |t|
14
- !t.name.include?('企业版') && !t.name.end_with?('Extension')
15
- }
16
- return team unless target.is_a?(Xcodeproj::Project::PBXNativeTarget)
17
-
18
- build_cfg = target.build_configurations.find { |c| c.name == 'Debug' }
19
- return team unless build_cfg.is_a?(Xcodeproj::Project::XCBuildConfiguration)
20
-
21
- team = build_cfg.build_settings['DEVELOPMENT_TEAM']
22
- end
23
-
24
- def self.setup(ctx, params)
25
- visibled_appspecs = params[:visibled_appspecs]
26
- # return if !visibled_appspecs || visibled_appspecs.empty?
27
- sandbox_root = ctx.sandbox_root
28
-
29
- team = development_team(ctx)
30
-
31
- Dir.foreach(sandbox_root).select{|f| f.end_with?('xcodeproj')}.each do |name|
32
- proj = Xcodeproj::Project.open(File.join(sandbox_root, name))
33
- proj.targets.each do | target |
34
- # 确保是 appspec
35
- next unless target.name.include?('-')
36
- # 确保是可执行程序
37
- next unless target.product_type == 'com.apple.product-type.application'
38
-
39
- # 设置签名信息
40
- if team.is_a?(String)
41
- target.build_configurations.first.build_settings['DEVELOPMENT_TEAM'] = team
42
- target.build_configurations.each { |cfg|
43
- cfg.build_settings['DEVELOPMENT_TEAM'] = team
44
- }
45
- end
46
-
47
- if visibled_appspecs.include?(target.name.split('-').first)
48
- # 将 visibled_appspecs 中指定的 target 设为可见状态
49
- proj.set_target_scheme_visible(target, true)
50
- end
51
- end
52
- proj.save if team.is_a?(String)
53
- end
54
- end
55
-
56
- end
57
-
58
- end