cocoapods-dongjia 1.1.0 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/cocoapods-dongjia/command.rb +1 -0
- data/lib/cocoapods-dongjia/command/release.rb +40 -0
- data/lib/cocoapods-dongjia/command/strip.rb +38 -21
- data/lib/cocoapods-dongjia/gem_version.rb +2 -5
- data/lib/cocoapods_plugin.rb +3 -6
- data/lib/dongjia_pods_iterator.rb +50 -22
- data/lib/dongjia_router.rb +6 -1
- data/lib/helper/Core/podfile/dsl.rb +16 -0
- data/lib/helper/podfile.rb +60 -0
- metadata +21 -9
- data/lib/helper/podfile_local_importer.rb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5b4528303fd0cec1f74fc6cf438693b70f6fb791ff0f4f02cabd5d7a74fa461
|
4
|
+
data.tar.gz: 50a77d0e54c9a2ebdad88a59c8a58f9d06ba35f924852ffec73d867679eb35f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f203e960ce068e3e3a6a852ae8614faae63d481b50c458743b4be8ebeb4b033f76b2c36c51ee0766f8e4a97cce40fb94603cccbd42327e21f76b07c66474f8f2
|
7
|
+
data.tar.gz: 38da2b3d06573fb9f582f3725b45c77926432fa0e2c67240f8f7667200ed34c8d17b1bfd8ee074ff4c5783cb4462dd12c7c53c87e3ab3054bcc725a8dfea21c5
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'cocoapods'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
|
5
|
+
class Podfile
|
6
|
+
@@is_release_mode = false
|
7
|
+
def self.set_is_release_mode(mode)
|
8
|
+
@@is_release_mode = mode
|
9
|
+
end
|
10
|
+
def self.is_release_mode?
|
11
|
+
@@is_release_mode
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class Command
|
16
|
+
|
17
|
+
class Release < Command
|
18
|
+
|
19
|
+
self.summary = '以 release 模式集成 pods'
|
20
|
+
|
21
|
+
self.description = <<-DESC
|
22
|
+
|
23
|
+
以 release 模式集成 Pods
|
24
|
+
|
25
|
+
可以在 Podfile 中通过 @@debug_only_pods = [pod_name] 的方式指定 debug 模式下的 Pod
|
26
|
+
|
27
|
+
当执行 pod release 时,会自动剔除 @@debug_only_pods 内所定义的 Pod
|
28
|
+
|
29
|
+
DESC
|
30
|
+
|
31
|
+
def run
|
32
|
+
Pod::Podfile::set_is_release_mode(true)
|
33
|
+
installer_for_config.install!
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'cocoapods'
|
2
2
|
require 'set'
|
3
|
-
require 'pry'
|
4
3
|
|
5
4
|
module Pod
|
6
5
|
|
@@ -105,17 +104,18 @@ module Pod
|
|
105
104
|
def get_images
|
106
105
|
images = Set[]
|
107
106
|
except_dirs = [
|
108
|
-
'QYResource.bundle',
|
109
|
-
'DJMate',
|
110
|
-
'IQKeyboardManager',
|
111
|
-
'EnterpriseEditionImages.xcassets',
|
107
|
+
'QYResource.bundle',
|
108
|
+
'DJMate',
|
109
|
+
'IQKeyboardManager',
|
112
110
|
'MJRefresh.bundle',
|
113
111
|
'AlipaySDK.bundle',
|
114
112
|
'AppIcon.appiconset',
|
115
|
-
'KPCameraImages.xcassets'
|
113
|
+
'KPCameraImages.xcassets',
|
114
|
+
'UMSocialSDKResources.bundle',
|
115
|
+
'LaunchResource'
|
116
116
|
]
|
117
117
|
except_files = [
|
118
|
-
'image_placeholder',
|
118
|
+
'image_placeholder',
|
119
119
|
'register_add_avatar'
|
120
120
|
]
|
121
121
|
bk = Proc.new do |dir, name, ext|
|
@@ -128,20 +128,32 @@ module Pod
|
|
128
128
|
|
129
129
|
# 分析
|
130
130
|
def analyze(source_files, images)
|
131
|
-
source_files.map { |x|
|
131
|
+
source_file_paths = source_files.map { |x|
|
132
|
+
x.file_ref.real_path
|
133
|
+
}
|
134
|
+
.select { |x|
|
135
|
+
File.exist?(x)
|
136
|
+
}
|
137
|
+
count = source_file_paths.count
|
138
|
+
source_file_paths.each_index do | index |
|
139
|
+
percent = index.to_f / count.to_f * 100
|
140
|
+
print "\r" if index != 0
|
141
|
+
print "#{format("%.2f", percent)}%"
|
142
|
+
path = source_file_paths[index]
|
132
143
|
File.open(path, 'r') do |f|
|
133
144
|
image_using = []
|
134
145
|
f.each_line do |line|
|
135
146
|
next unless line.include?('"')
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
if
|
143
|
-
|
144
|
-
|
147
|
+
['"', '/'].each do |prefix|
|
148
|
+
images.each do |img|
|
149
|
+
if line.include?(prefix + img.name)
|
150
|
+
image_using << img
|
151
|
+
else
|
152
|
+
# 根据下划线分割剔除最后一项,再尝试匹配
|
153
|
+
if !img.fuzzy_name.empty?
|
154
|
+
['%', '"'].each do |suffix|
|
155
|
+
image_using << img if line.include?(prefix + img.fuzzy_name + suffix)
|
156
|
+
end
|
145
157
|
end
|
146
158
|
end
|
147
159
|
end
|
@@ -150,15 +162,20 @@ module Pod
|
|
150
162
|
images = images - image_using
|
151
163
|
end
|
152
164
|
end
|
165
|
+
print "\r"
|
153
166
|
images
|
154
167
|
end
|
155
168
|
|
156
169
|
def run
|
157
170
|
images = analyze(get_source_files, get_images)
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
puts "
|
171
|
+
if images.empty?
|
172
|
+
puts "未找到无效资源"
|
173
|
+
else
|
174
|
+
puts "无效资源文件:"
|
175
|
+
images.each do |img|
|
176
|
+
path = Pathname.new(img.fullpath).relative_path_from(Dir.pwd).to_s
|
177
|
+
puts " #{path}"
|
178
|
+
end
|
162
179
|
end
|
163
180
|
end
|
164
181
|
|
data/lib/cocoapods_plugin.rb
CHANGED
@@ -6,9 +6,10 @@ require_relative 'dongjia_pods_iterator'
|
|
6
6
|
require_relative 'dongjia_router'
|
7
7
|
require_relative 'dongjia_scheme_manager'
|
8
8
|
|
9
|
-
require_relative 'helper/
|
9
|
+
require_relative 'helper/podfile'
|
10
10
|
require_relative 'helper/podfile_options'
|
11
11
|
require_relative 'helper/podfile_warnings'
|
12
|
+
require_relative 'helper/Core/podfile/dsl'
|
12
13
|
|
13
14
|
module Dongjia
|
14
15
|
|
@@ -33,11 +34,7 @@ module Dongjia
|
|
33
34
|
PodsIterator.iterate(params, ctx.sandbox_root)
|
34
35
|
|
35
36
|
# 处理 appspec 配置
|
36
|
-
SchemeManager.setup(ctx, params)
|
37
|
-
|
38
|
-
# 企业版文件引用校验
|
39
|
-
files = EnterpriseInspector.inspect()
|
40
|
-
Pod::UI.warn "文件未加入企业版:#{files}" if files.count > 0
|
37
|
+
# SchemeManager.setup(ctx, params)
|
41
38
|
|
42
39
|
# 抓取所有路由汇总至
|
43
40
|
router = Router.new
|
@@ -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
|
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
|
24
|
+
changed ||= update_build_setting(config, 'CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF', "NO")
|
14
25
|
|
15
26
|
# 不检测已废弃的方法
|
16
|
-
config
|
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
|
30
|
+
changed ||= update_build_setting(config, 'CLANG_WARN_DOCUMENTATION_COMMENTS', "NO")
|
23
31
|
|
24
|
-
#
|
25
|
-
config.build_settings['
|
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
|
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
|
-
|
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 版本为
|
54
|
-
if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f <
|
55
|
-
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = "
|
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
|
-
|
95
|
+
if changed
|
96
|
+
proj.save
|
97
|
+
end
|
70
98
|
|
71
99
|
end
|
72
100
|
|
data/lib/dongjia_router.rb
CHANGED
@@ -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
|
|
@@ -39,7 +41,10 @@ EOS
|
|
39
41
|
end
|
40
42
|
|
41
43
|
if @prefix != nil
|
42
|
-
|
44
|
+
end_index = @defining_line.index(',') || @defining_line.index(')')
|
45
|
+
if !end_index.nil?
|
46
|
+
@redirect_type = @defining_line[prefix_len, end_index - prefix_len]
|
47
|
+
end
|
43
48
|
end
|
44
49
|
end
|
45
50
|
|
@@ -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
|
@@ -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.
|
4
|
+
version: 1.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jiangzhuoyi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.13.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.13.0
|
55
69
|
description: A short description of cocoapods-dongjia.
|
56
70
|
email:
|
57
71
|
- jiangzhuoyi@idongjia.cn
|
@@ -65,6 +79,7 @@ files:
|
|
65
79
|
- lib/cocoapods-dongjia/command/install.rb
|
66
80
|
- lib/cocoapods-dongjia/command/open.rb
|
67
81
|
- lib/cocoapods-dongjia/command/reinstall.rb
|
82
|
+
- lib/cocoapods-dongjia/command/release.rb
|
68
83
|
- lib/cocoapods-dongjia/command/strip.rb
|
69
84
|
- lib/cocoapods-dongjia/gem_version.rb
|
70
85
|
- lib/cocoapods_plugin.rb
|
@@ -75,9 +90,10 @@ files:
|
|
75
90
|
- lib/dongjia_router.rb
|
76
91
|
- lib/dongjia_scheme_manager.rb
|
77
92
|
- lib/dongjia_source.rb
|
93
|
+
- lib/helper/Core/podfile/dsl.rb
|
78
94
|
- lib/helper/dongjia_version_checker.rb
|
79
95
|
- lib/helper/pod.rb
|
80
|
-
- lib/helper/
|
96
|
+
- lib/helper/podfile.rb
|
81
97
|
- lib/helper/podfile_options.rb
|
82
98
|
- lib/helper/podfile_warnings.rb
|
83
99
|
- lib/helper/project.rb
|
@@ -85,11 +101,7 @@ homepage: https://github.com/EXAMPLE/cocoapods-dongjia
|
|
85
101
|
licenses:
|
86
102
|
- MIT
|
87
103
|
metadata:
|
88
|
-
update_desc:
|
89
|
-
- 增加 pod open 指令,用于快速打开工程
|
90
|
-
- 增加 pod strip 指令,用于查找无用资源
|
91
|
-
- 增加 LTO 开关
|
92
|
-
- 兼容新版 DJRouter 定义
|
104
|
+
update_desc: " - 优化 post_install 行为,避免 install 后导致全量编译\n"
|
93
105
|
post_install_message:
|
94
106
|
rdoc_options: []
|
95
107
|
require_paths:
|
@@ -105,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
117
|
- !ruby/object:Gem::Version
|
106
118
|
version: '0'
|
107
119
|
requirements: []
|
108
|
-
rubygems_version: 3.
|
120
|
+
rubygems_version: 3.0.3
|
109
121
|
signing_key:
|
110
122
|
specification_version: 4
|
111
123
|
summary: A longer description of cocoapods-dongjia.
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require_relative 'pod'
|
2
|
-
|
3
|
-
module Pod
|
4
|
-
|
5
|
-
class Podfile
|
6
|
-
|
7
|
-
# 导入工程目录下相对位置的 pod
|
8
|
-
@local_spec_importing = false
|
9
|
-
@local_spec_path = nil
|
10
|
-
def import_relative_in(path = './')
|
11
|
-
@local_spec_importing = true
|
12
|
-
@local_spec_path = path
|
13
|
-
yield if block_given?
|
14
|
-
@local_spec_path = nil
|
15
|
-
@local_spec_importing = false
|
16
|
-
end
|
17
|
-
|
18
|
-
original_pod = instance_method(:pod)
|
19
|
-
define_method(:pod) do |name = nil, *requirements|
|
20
|
-
if @local_spec_importing
|
21
|
-
path_cfg = { :path => "#{@local_spec_path}/#{Pod::repo_name(name)}" }
|
22
|
-
if requirements.length == 0
|
23
|
-
requirements = [path_cfg]
|
24
|
-
else
|
25
|
-
cfg = requirements.first
|
26
|
-
cfg.merge!(path_cfg) unless cfg.has_key?(:path)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
original_pod.bind(self).(name, *requirements)
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|