cocoapods-dongjia 1.0.9 → 1.1.4

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: 7fe1262bed9c25b306334ca2209ed82ab194d6ae2acffa2ce1fbb5909cb9fffc
4
- data.tar.gz: e6a19a4bfa5c3ba0ce4e96d6589e059b125d661ce03780b3503b62c1de8bbf93
3
+ metadata.gz: 2eadc1f8b16a2465ed7d8f1991550f1e0ab0ff0bbb450a26ea78b1eb3b839898
4
+ data.tar.gz: f7a945dc66e7f2473659f8fb5b65dc6b6dceccd3dce099b3ecc4cd2b3fe1ef58
5
5
  SHA512:
6
- metadata.gz: da01ddfcb389cf6540e7d33ccc37d4fbd8ebbc3b56d3620a7aa79736fa681d6938f5a306a1e8371616e48ffde8faaabba455cc9ad2fc9f7cd32aea8e12bdb234
7
- data.tar.gz: be71f22d99add9e089c327dd3db70cfd437432af40628b36d9de22b6e404ab0886e93613c0ea8a1424b0522f131099c1f113609f15e6ec21f8f63bdf3889f1fb
6
+ metadata.gz: 384450efd470d1e94ef3f6f6f8bce82f6d8dd1290ddc24b1a58f14dbfc537be27bb7d3aae79e9377cedc3487a75e17de8e63f1be184ec55cb647c1e638e39d62
7
+ data.tar.gz: 5ec1a4520caf8488b6ed8e4e400d3094d3fd53251b54fb28eb8aea151011215c62c01856eaffc221d465512ad5728493809552f85ac47bbc8ffdc0033f070382
@@ -1,3 +1,6 @@
1
1
  require 'cocoapods-dongjia/command/reinstall'
2
2
  require 'cocoapods-dongjia/command/install'
3
- require 'cocoapods-dongjia/command/demo'
3
+ require 'cocoapods-dongjia/command/release'
4
+ require 'cocoapods-dongjia/command/demo'
5
+ require 'cocoapods-dongjia/command/strip'
6
+ require 'cocoapods-dongjia/command/open'
@@ -0,0 +1,32 @@
1
+ require 'cocoapods'
2
+
3
+ module Pod
4
+
5
+ class Command
6
+
7
+ class Open < Command
8
+
9
+ self.summary = '快速打开项目的 .xcworkspace'
10
+
11
+ self.description = <<-DESC
12
+ 快速打开项目的 .xcworkspace
13
+ DESC
14
+
15
+ def validate!
16
+ super
17
+
18
+ workspace_list = Pathname.glob('*.xcworkspace')
19
+ @workspace_path = workspace_list.first if workspace_list.size == 1
20
+
21
+ help! '没有找到 xcworkspace' unless @workspace_path.exist?
22
+ end
23
+
24
+ def run
25
+ `open #{@workspace_path}`
26
+ end
27
+
28
+ end
29
+
30
+ end
31
+
32
+ end
@@ -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
@@ -0,0 +1,186 @@
1
+ require 'cocoapods'
2
+ require 'set'
3
+
4
+ module Pod
5
+
6
+ class Image
7
+ attr_accessor :dir
8
+ attr_accessor :name
9
+ attr_accessor :fuzzy_name
10
+ def initialize(dir, name)
11
+ @dir = dir
12
+ if name.end_with?('@2x') || name.end_with?('@3x')
13
+ name = name[0, name.length-3]
14
+ end
15
+ @name = name
16
+
17
+ # 只处理最后一段为数字,或分了三段及以上的命名形式
18
+ comps = name.split('_')
19
+ last = comps.last
20
+ if last.to_i > 0 || last.start_with?('0') || comps.count >= 3
21
+ @fuzzy_name = name[0, name.length - last.length]
22
+ else
23
+ @fuzzy_name = ''
24
+ end
25
+ end
26
+
27
+ def eql?(other)
28
+ @dir == other.dir && @name == other.name
29
+ end
30
+
31
+ def hash
32
+ [@dir, @name].hash
33
+ end
34
+
35
+ def fullpath
36
+ File.join(@dir, @name)
37
+ end
38
+ end
39
+
40
+ class Command
41
+
42
+ class Strip < Command
43
+
44
+ self.summary = '查找工程内所有无效资源'
45
+
46
+ self.description = <<-DESC
47
+ 查找工程内所有无效资源
48
+ DESC
49
+
50
+ def validate!
51
+ super
52
+
53
+ @img_exts = ['.png', '.jpg', '.jpeg', '.webp', '.gif']
54
+
55
+ @proj_paths = []
56
+ @proj_paths |= Pathname.glob('*.xcodeproj')
57
+ @proj_paths |= Pathname.glob('Pods/*.xcodeproj')
58
+
59
+ help! '未发现任何工程' unless @proj_paths.count > 0
60
+ end
61
+
62
+ # 遍历目录找出所有图片
63
+ def traverse(path, except_dirs, bk = nil)
64
+ dir = File.dirname(path)
65
+ ext = File.extname(path)
66
+ name = File.basename(path, ext)
67
+ basename = File.basename(path)
68
+ if except_dirs.include?(basename)
69
+ return
70
+ end
71
+ if File.directory?(path)
72
+ if ext == '.imageset'
73
+ # imageset 直接返回
74
+ bk.call(dir, name, ext)
75
+ else
76
+ Dir.foreach(path) do |name|
77
+ unless name.start_with?('.') || name.end_with?('.launchimage')
78
+ traverse(File.join(path, name), except_dirs, bk)
79
+ end
80
+ end
81
+ end
82
+ else
83
+ bk.call(dir, name, ext) if @img_exts.include?(ext)
84
+ end
85
+ end
86
+
87
+ # 获取源文件
88
+ def get_source_files
89
+ source_files = []
90
+ @proj_paths.each do |path|
91
+ proj = Xcodeproj::Project.open(path)
92
+ proj.targets.each do |target|
93
+ target.build_phases.each do |phase|
94
+ if phase.is_a?(Xcodeproj::Project::PBXSourcesBuildPhase)
95
+ source_files |= phase.files
96
+ end
97
+ end
98
+ end
99
+ end
100
+ source_files
101
+ end
102
+
103
+ # 获取所有图片资源
104
+ def get_images
105
+ images = Set[]
106
+ except_dirs = [
107
+ 'QYResource.bundle',
108
+ 'DJMate',
109
+ 'IQKeyboardManager',
110
+ 'MJRefresh.bundle',
111
+ 'AlipaySDK.bundle',
112
+ 'AppIcon.appiconset',
113
+ 'KPCameraImages.xcassets',
114
+ 'UMSocialSDKResources.bundle',
115
+ 'LaunchResource'
116
+ ]
117
+ except_files = [
118
+ 'image_placeholder',
119
+ 'register_add_avatar'
120
+ ]
121
+ bk = Proc.new do |dir, name, ext|
122
+ next if except_files.include?(name)
123
+ images << Image.new(dir, name)
124
+ end
125
+ traverse(Dir.pwd, except_dirs, bk)
126
+ images
127
+ end
128
+
129
+ # 分析
130
+ def analyze(source_files, images)
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]
143
+ File.open(path, 'r') do |f|
144
+ image_using = []
145
+ f.each_line do |line|
146
+ next unless line.include?('"')
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
157
+ end
158
+ end
159
+ end
160
+ end
161
+ end
162
+ images = images - image_using
163
+ end
164
+ end
165
+ print "\r"
166
+ images
167
+ end
168
+
169
+ def run
170
+ images = analyze(get_source_files, get_images)
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
179
+ end
180
+ end
181
+
182
+ end
183
+
184
+ end
185
+
186
+ end
@@ -1,7 +1,8 @@
1
1
  module CocoapodsDongjia
2
- VERSION = "1.0.9"
2
+ VERSION = "1.1.4"
3
3
  UPDATE_DESC = <<-EOS
4
- - 修复 lpod 指令可能的出错
5
- - 自动处理 appspecs 的签名
4
+ - 优化 install! 方法参数兼容性
5
+ - 关闭 incomplete-umbrella 警告
6
+ - 将 umbrella 导出的头文件改为尖括号形式
6
7
  EOS
7
8
  end
@@ -2,13 +2,14 @@ require 'cocoapods-dongjia/command'
2
2
  require_relative 'dongjia_source'
3
3
  require_relative 'dongjia_branch_inspector'
4
4
  require_relative 'dongjia_enterprise_inspector'
5
- require_relative 'dongjia_warning_manager'
5
+ require_relative 'dongjia_pods_iterator'
6
6
  require_relative 'dongjia_router'
7
7
  require_relative 'dongjia_scheme_manager'
8
8
 
9
- require_relative 'helper/podfile_local_importer'
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
 
@@ -29,11 +30,8 @@ module Dongjia
29
30
 
30
31
  Pod::HooksManager.register('cocoapods-dongjia', :post_install) do |ctx, params|
31
32
 
32
- # 关闭工程内的一些警告
33
- WarningManager.turn_off_warnings(
34
- params[:turn_off_warnings],
35
- ctx.sandbox_root
36
- )
33
+ # 关闭警告 / 检查 LTO
34
+ PodsIterator.iterate(params, ctx.sandbox_root)
37
35
 
38
36
  # 处理 appspec 配置
39
37
  SchemeManager.setup(ctx, params)
@@ -0,0 +1,95 @@
1
+ require 'xcodeproj'
2
+
3
+ module Dongjia
4
+
5
+ class PodsIterator
6
+
7
+ # 关闭警告
8
+ def self.disable_warnings(config, target_name)
9
+ # 禁用非 DJ 开头 Pod 的警告
10
+ config.build_settings['GCC_WARN_INHIBIT_ALL_WARNINGS'] = "YES" unless target_name.start_with?('DJ')
11
+
12
+ # 不检测 block 中的隐式 self 调用
13
+ config.build_settings['CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF'] = "NO"
14
+
15
+ # 不检测已废弃的方法
16
+ config.build_settings['GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS'] = "NO"
17
+
18
+ # 允许 objc_msgSend
19
+ config.build_settings['ENABLE_STRICT_OBJC_MSGSEND'] = "NO"
20
+
21
+ # 不检测注释
22
+ config.build_settings['CLANG_WARN_DOCUMENTATION_COMMENTS'] = "NO"
23
+
24
+ # 不严格的原型校验
25
+ config.build_settings['CLANG_WARN_STRICT_PROTOTYPES'] = "NO"
26
+
27
+ # 强制设置 deployment 版本为 9.0
28
+ if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 9.0
29
+ config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = "9.0"
30
+ end
31
+
32
+ # 关闭 bitcode
33
+ config.build_settings['ENABLE_BITCODE'] = "NO"
34
+
35
+ # 忽略 incomplete-umbrella 警告
36
+ config.build_settings['OTHER_CFLAGS'] ||= ['$(inherited)']
37
+ config.build_settings['OTHER_CFLAGS'] << '"-Wno-incomplete-umbrella"'
38
+ end
39
+
40
+ # 打开 LTO
41
+ def self.enable_lto(config)
42
+ config.build_settings['LLVM_LTO'] = 'YES_THIN' if config.name == 'Release'
43
+ end
44
+
45
+ # 将 umbrella 导出的头文件改为尖括号形式
46
+ def self.convert_umbrella_header_import(pod_name)
47
+ umbrella_path = "./Pods/Target Support Files/#{pod_name}/#{pod_name}-umbrella.h"
48
+ return unless File.exist?(umbrella_path)
49
+ File.open(umbrella_path, 'r+') do |f|
50
+ x = f.read
51
+ begin x.gsub!("#import \"#{pod_name}/", "#import <#{pod_name}/").gsub!('.h"', '.h>') rescue nil end
52
+ begin x.gsub!('#import "', "#import <#{pod_name}/").gsub!('.h"', '.h>') rescue nil end
53
+ f.rewind
54
+ f.write(x)
55
+ end
56
+ end
57
+
58
+ # 遍历所有 Pod 工程配置
59
+ def self.iterate(params, sandbox_root)
60
+ turn_off_warnings = params[:turn_off_warnings]
61
+ lto_enabled = params[:lto_enabled]
62
+ return if (turn_off_warnings != true) && (lto_enabled != true)
63
+
64
+ Dir.foreach(sandbox_root).select{|f| f.end_with?('xcodeproj')}.each do |name|
65
+
66
+ proj = Xcodeproj::Project.open(File.join(sandbox_root, name))
67
+
68
+ if name != 'Pods.xcodeproj'
69
+ proj.build_configurations.each do | config |
70
+ # 强制设置 deployment 版本为 9.0
71
+ if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 9.0
72
+ config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = "9.0"
73
+ end
74
+ end
75
+ end
76
+
77
+ # project 的每个 target 配置
78
+ proj.targets.select {|t| !t.name.start_with?('Pods')}.each do | target |
79
+ next if target.name.start_with?('Pods')
80
+ target.build_configurations.each do | config |
81
+ disable_warnings(config, target.name) if turn_off_warnings
82
+ enable_lto(config) if lto_enabled
83
+ convert_umbrella_header_import(target.name)
84
+ end
85
+ end
86
+
87
+ proj.save
88
+
89
+ end
90
+
91
+ end
92
+
93
+ end
94
+
95
+ end
@@ -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
 
@@ -30,16 +32,19 @@ EOS
30
32
  @body = ''
31
33
  @prefix = nil
32
34
  prefix_len = 0
33
- if @defining_line.start_with?('@redirectObj(')
34
- @prefix = 'redirectObj'
35
+ if @defining_line.start_with?('@RedirectObj(') || @defining_line.start_with?('@redirectObj(')
36
+ @prefix = 'RedirectObj'
35
37
  prefix_len = @prefix.length + 2
36
- elsif @defining_line.start_with?('@redirect(')
37
- @prefix = 'redirect'
38
+ elsif @defining_line.start_with?('@Redirect(') || @defining_line.start_with?('@redirect(')
39
+ @prefix = 'Redirect'
38
40
  prefix_len = @prefix.length + 2
39
41
  end
40
42
 
41
43
  if @prefix != nil
42
- @redirect_type = @defining_line[prefix_len, @defining_line.index(',') - prefix_len]
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
 
@@ -69,7 +74,7 @@ EOS
69
74
  pre_line = nil
70
75
  file.each_line do |line|
71
76
  is_start = false
72
- if line.start_with?('@redirect')
77
+ if line.start_with?('@Redirect') || line.start_with?('@redirect')
73
78
  # 路由定义开始
74
79
  item = RouterItem.new(line)
75
80
  item.pre_line = pre_line
@@ -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
@@ -18,7 +18,7 @@ module Dongjia
18
18
  latest_version = info['version']
19
19
  v = CocoapodsDongjia::VERSION
20
20
 
21
- if v < latest_version
21
+ if Gem::Version.new(v) < Gem::Version.new(latest_version)
22
22
  update_desc = info['metadata']['update_desc']
23
23
  warnings = "cocoapods-dongjia #{latest_version} is available.\n\n"
24
24
  warnings << update_desc.rstrip << "\n\n"
@@ -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.0.9
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - jiangzhuoyi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-29 00:00:00.000000000 Z
11
+ date: 2020-08-07 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
@@ -63,19 +77,23 @@ files:
63
77
  - lib/cocoapods-dongjia/command.rb
64
78
  - lib/cocoapods-dongjia/command/demo.rb
65
79
  - lib/cocoapods-dongjia/command/install.rb
80
+ - lib/cocoapods-dongjia/command/open.rb
66
81
  - lib/cocoapods-dongjia/command/reinstall.rb
82
+ - lib/cocoapods-dongjia/command/release.rb
83
+ - lib/cocoapods-dongjia/command/strip.rb
67
84
  - lib/cocoapods-dongjia/gem_version.rb
68
85
  - lib/cocoapods_plugin.rb
69
86
  - lib/dongjia_branch_inspector.rb
70
87
  - lib/dongjia_config.rb
71
88
  - lib/dongjia_enterprise_inspector.rb
89
+ - lib/dongjia_pods_iterator.rb
72
90
  - lib/dongjia_router.rb
73
91
  - lib/dongjia_scheme_manager.rb
74
92
  - lib/dongjia_source.rb
75
- - lib/dongjia_warning_manager.rb
93
+ - lib/helper/Core/podfile/dsl.rb
76
94
  - lib/helper/dongjia_version_checker.rb
77
95
  - lib/helper/pod.rb
78
- - lib/helper/podfile_local_importer.rb
96
+ - lib/helper/podfile.rb
79
97
  - lib/helper/podfile_options.rb
80
98
  - lib/helper/podfile_warnings.rb
81
99
  - lib/helper/project.rb
@@ -84,8 +102,9 @@ licenses:
84
102
  - MIT
85
103
  metadata:
86
104
  update_desc: |2
87
- - 修复 lpod 指令可能的出错
88
- - 自动处理 appspecs 的签名
105
+ - 优化 install! 方法参数兼容性
106
+ - 关闭 incomplete-umbrella 警告
107
+ - 将 umbrella 导出的头文件改为尖括号形式
89
108
  post_install_message:
90
109
  rdoc_options: []
91
110
  require_paths:
@@ -101,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
120
  - !ruby/object:Gem::Version
102
121
  version: '0'
103
122
  requirements: []
104
- rubygems_version: 3.0.4
123
+ rubygems_version: 3.1.2
105
124
  signing_key:
106
125
  specification_version: 4
107
126
  summary: A longer description of cocoapods-dongjia.
@@ -1,68 +0,0 @@
1
- require 'xcodeproj'
2
-
3
- module Dongjia
4
-
5
- class WarningManager
6
-
7
- def self.turn_off_warnings(turn_off, sandbox_root)
8
-
9
- return if (turn_off != true)
10
-
11
- Dir.foreach(sandbox_root).select{|f| f.end_with?('xcodeproj')}.each do |name|
12
-
13
- proj = Xcodeproj::Project.open(File.join(sandbox_root, name))
14
-
15
- if name != 'Pods.xcodeproj'
16
- proj.build_configurations.each do | config |
17
- # 强制设置 deployment 版本为 8.0
18
- if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 8.0
19
- config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = "8.0"
20
- end
21
- end
22
- end
23
-
24
- # project 的每个 target 配置
25
- proj.targets.each do | target |
26
-
27
- next if target.name.start_with?('Pods')
28
-
29
- target.build_configurations.each do | config |
30
-
31
- # 禁用非 DJ 开头 Pod 的警告
32
- config.build_settings['GCC_WARN_INHIBIT_ALL_WARNINGS'] = "YES" unless target.name.start_with?('DJ')
33
-
34
- # 不检测 block 中的隐式 self 调用
35
- config.build_settings['CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF'] = "NO"
36
-
37
- # 不检测已废弃的方法
38
- config.build_settings['GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS'] = "NO"
39
-
40
- # 允许 objc_msgSend
41
- config.build_settings['ENABLE_STRICT_OBJC_MSGSEND'] = "NO"
42
-
43
- # 不检测注释
44
- config.build_settings['CLANG_WARN_DOCUMENTATION_COMMENTS'] = "NO"
45
-
46
- # 不严格的原型校验
47
- config.build_settings['CLANG_WARN_STRICT_PROTOTYPES'] = "NO"
48
-
49
- # 强制设置 deployment 版本为 8.0
50
- if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 8.0
51
- config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = "8.0"
52
- end
53
-
54
- # 关闭 bitcode
55
- config.build_settings['ENABLE_BITCODE'] = "NO"
56
- end
57
-
58
- end
59
-
60
- proj.save
61
-
62
- end
63
-
64
- end
65
-
66
- end
67
-
68
- end
@@ -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