cocoapods-dongjia 1.0.8 → 1.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '09ee5f3903da98865392df97577a07edeb689c257ff99366254ae5a4372a32b8'
4
- data.tar.gz: ca00ddd8cca267b055156c7b201dc4a96358eb7b2e214ae65ccab3992e94f133
3
+ metadata.gz: 19bfbd3d41dff99206d19c1e1a0ebc05dd3670a1fda433819997a65d4a3056e7
4
+ data.tar.gz: 2efb8d3a2756146053879dde844087c78a6ecad2731520dd9b67046f22d24b6b
5
5
  SHA512:
6
- metadata.gz: c8e295e3c6c8d7f309ed6329268b8876fd8ee576fcb90af7b01e868a73776608d363b422b221c6b6ea094ebade9824718d4dac67ae8956cc99e9d7776dc570e4
7
- data.tar.gz: aa1d10dda525fb3d28c1e2f8fd27a36666d6111f22b6c411b55a9411dcc4efe4b60ff672787e8a1db44a7a74c6a4ca05e5d70c21bb4856a46ae26dded88bfbda
6
+ metadata.gz: b815fc7ebf07f4bb4ae6cabfbd9e612ebfb72947a65462e23f92f47f949b6e977651ff501dc2472220bc42ec3ae919af108182f5c91a5f852f4ec91371582f8c
7
+ data.tar.gz: 85ecf4879e0be71ca0c17060799c2d90f7381de6863ff955c5d83b5e3b615bed07cbeb247ce773c612ec3c663ff0639ab584e9ad11f0ebf47efc0f81c50d3df5
@@ -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,9 +1,7 @@
1
1
  module CocoapodsDongjia
2
- VERSION = "1.0.8"
2
+ VERSION = "1.1.3"
3
3
  UPDATE_DESC = <<-EOS
4
- - 修复本地 pod 添加属性出错
5
- - 添加 demo 指令
6
- - 更为高效的 repo 更新机制
7
- - 优化版本检测和路由抓取触发逻辑
4
+ - 兼容 Xcode 12 工程设置
5
+ - 增加 release 命令
8
6
  EOS
9
7
  end
@@ -2,11 +2,11 @@ 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
12
 
@@ -29,11 +29,8 @@ module Dongjia
29
29
 
30
30
  Pod::HooksManager.register('cocoapods-dongjia', :post_install) do |ctx, params|
31
31
 
32
- # 关闭工程内的一些警告
33
- WarningManager.turn_off_warnings(
34
- params[:turn_off_warnings],
35
- ctx.sandbox_root
36
- )
32
+ # 关闭警告 / 检查 LTO
33
+ PodsIterator.iterate(params, ctx.sandbox_root)
37
34
 
38
35
  # 处理 appspec 配置
39
36
  SchemeManager.setup(ctx, params)
@@ -0,0 +1,77 @@
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
+ end
35
+
36
+ # 打开 LTO
37
+ def self.enable_lto(config)
38
+ config.build_settings['LLVM_LTO'] = 'YES_THIN' if config.name == 'Release'
39
+ end
40
+
41
+ # 遍历所有 Pod 工程配置
42
+ def self.iterate(params, sandbox_root)
43
+ turn_off_warnings = params[:turn_off_warnings]
44
+ lto_enabled = params[:lto_enabled]
45
+ return if (turn_off_warnings != true) && (lto_enabled != true)
46
+
47
+ Dir.foreach(sandbox_root).select{|f| f.end_with?('xcodeproj')}.each do |name|
48
+
49
+ proj = Xcodeproj::Project.open(File.join(sandbox_root, name))
50
+
51
+ if name != 'Pods.xcodeproj'
52
+ proj.build_configurations.each do | config |
53
+ # 强制设置 deployment 版本为 9.0
54
+ if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 9.0
55
+ config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = "9.0"
56
+ end
57
+ end
58
+ end
59
+
60
+ # project 的每个 target 配置
61
+ proj.targets.select {|t| !t.name.start_with?('Pods')}.each do | target |
62
+ next if target.name.start_with?('Pods')
63
+ target.build_configurations.each do | config |
64
+ disable_warnings(config, target.name) if turn_off_warnings
65
+ enable_lto(config) if lto_enabled
66
+ end
67
+ end
68
+
69
+ proj.save
70
+
71
+ end
72
+
73
+ end
74
+
75
+ end
76
+
77
+ end
@@ -30,16 +30,19 @@ EOS
30
30
  @body = ''
31
31
  @prefix = nil
32
32
  prefix_len = 0
33
- if @defining_line.start_with?('@redirectObj(')
34
- @prefix = 'redirectObj'
33
+ if @defining_line.start_with?('@RedirectObj(') || @defining_line.start_with?('@redirectObj(')
34
+ @prefix = 'RedirectObj'
35
35
  prefix_len = @prefix.length + 2
36
- elsif @defining_line.start_with?('@redirect(')
37
- @prefix = 'redirect'
36
+ elsif @defining_line.start_with?('@Redirect(') || @defining_line.start_with?('@redirect(')
37
+ @prefix = 'Redirect'
38
38
  prefix_len = @prefix.length + 2
39
39
  end
40
40
 
41
41
  if @prefix != nil
42
- @redirect_type = @defining_line[prefix_len, @defining_line.index(',') - prefix_len]
42
+ end_index = @defining_line.index(',') || @defining_line.index(')')
43
+ if !end_index.nil?
44
+ @redirect_type = @defining_line[prefix_len, end_index - prefix_len]
45
+ end
43
46
  end
44
47
  end
45
48
 
@@ -69,7 +72,7 @@ EOS
69
72
  pre_line = nil
70
73
  file.each_line do |line|
71
74
  is_start = false
72
- if line.start_with?('@redirect')
75
+ if line.start_with?('@Redirect') || line.start_with?('@redirect')
73
76
  # 路由定义开始
74
77
  item = RouterItem.new(line)
75
78
  item.pre_line = pre_line
@@ -4,10 +4,30 @@ module Dongjia
4
4
 
5
5
  class SchemeManager
6
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
+
7
24
  def self.setup(ctx, params)
8
25
  visibled_appspecs = params[:visibled_appspecs]
9
- return if !visibled_appspecs || visibled_appspecs.empty?
26
+ # return if !visibled_appspecs || visibled_appspecs.empty?
10
27
  sandbox_root = ctx.sandbox_root
28
+
29
+ team = development_team(ctx)
30
+
11
31
  Dir.foreach(sandbox_root).select{|f| f.end_with?('xcodeproj')}.each do |name|
12
32
  proj = Xcodeproj::Project.open(File.join(sandbox_root, name))
13
33
  proj.targets.each do | target |
@@ -15,11 +35,21 @@ module Dongjia
15
35
  next unless target.name.include?('-')
16
36
  # 确保是可执行程序
17
37
  next unless target.product_type == 'com.apple.product-type.application'
18
- pod_name = target.name.split('-').first
19
- if visibled_appspecs.include?(pod_name)
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 设为可见状态
20
49
  proj.set_target_scheme_visible(target, true)
21
50
  end
22
51
  end
52
+ proj.save if team.is_a?(String)
23
53
  end
24
54
  end
25
55
 
@@ -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"
@@ -22,9 +22,13 @@ module Pod
22
22
  end
23
23
  if local_path
24
24
  cfg = requirements.pop
25
- cfg.reject! { |key, value|
26
- [:git, :branch, :tag, :commit, :podspec].include?(key)
27
- }
25
+ if cfg.is_a?(Hash)
26
+ cfg.reject! { |key, value|
27
+ [:git, :branch, :tag, :commit, :podspec].include?(key)
28
+ }
29
+ else
30
+ cfg = {:path => local_path}
31
+ end
28
32
  cfg.merge!({:path => local_path})
29
33
  requirements.push(cfg)
30
34
  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.0.8
4
+ version: 1.1.3
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-07-17 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,22 @@ 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
76
93
  - lib/helper/dongjia_version_checker.rb
77
94
  - lib/helper/pod.rb
78
- - lib/helper/podfile_local_importer.rb
95
+ - lib/helper/podfile.rb
79
96
  - lib/helper/podfile_options.rb
80
97
  - lib/helper/podfile_warnings.rb
81
98
  - lib/helper/project.rb
@@ -84,10 +101,8 @@ licenses:
84
101
  - MIT
85
102
  metadata:
86
103
  update_desc: |2
87
- - 修复本地 pod 添加属性出错
88
- - 添加 demo 指令
89
- - 更为高效的 repo 更新机制
90
- - 优化版本检测和路由抓取触发逻辑
104
+ - 兼容 Xcode 12 工程设置
105
+ - 增加 release 命令
91
106
  post_install_message:
92
107
  rdoc_options: []
93
108
  require_paths:
@@ -103,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
118
  - !ruby/object:Gem::Version
104
119
  version: '0'
105
120
  requirements: []
106
- rubygems_version: 3.0.4
121
+ rubygems_version: 3.1.2
107
122
  signing_key:
108
123
  specification_version: 4
109
124
  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