cocoapods-ppbuild 0.0.3 → 0.0.4

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: cdb6eea00fe407b9d03e07a467e994d7dd4a59121b48c20b313fc60998440d73
4
- data.tar.gz: e4c6bab172b8eec9691595d99e2d63e04d0823d1dea2f1156c30fbcb06f3a565
3
+ metadata.gz: 7a60801b88a3a65f9772965dbb9f3902abb9359af6d13f22417f14b7e8473843
4
+ data.tar.gz: cccc9a3f322b92e85832435a7b3deae1a79afc36d5651c9bdc48e174bd3453fc
5
5
  SHA512:
6
- metadata.gz: 557ad1a8434a62ac16cbc9a1ca75bea951b949185023572d6285be90916afaf3c2b67c4ea71257c85d8eda8ebac8578bb32b286d079d26b13bdf01d5fc7549e3
7
- data.tar.gz: f6d10243bf7567a4488e54dea8e141786779d0b06011471cfdca24962c9de3ea24dcd146ed30105892531e7a409ccbb71efd0a7604b00d448046437db45e6ed3
6
+ metadata.gz: ed89338e7ec4b7a6695b2679c6ebe092550c51ad89b9c56b8b99bdfe6638f510ae58feb3528f8ff14c0ea5c02c3a3a559d746e9108f0b0eab1020f96a91c7e57
7
+ data.tar.gz: 3722e1443ad0cdf5e0aebf029c3fd1cdd4cac946e5d8f17dc81fdbac16af96deef2f02ff9f067a1f5cd87e4140e76e8a7b0dedc5ed24ccded17b191b0481343c
@@ -79,6 +79,7 @@ module Pod
79
79
 
80
80
  walk(real_file_folder) do |child|
81
81
  source = child
82
+
82
83
  # only make symlink to file and `.framework` folder
83
84
  if child.directory?
84
85
  if [".framework"].include? child.extname
@@ -87,6 +88,9 @@ module Pod
87
88
  elsif [".dSYM"].include? child.extname
88
89
  mirror_with_symlink(source, real_file_folder, target_folder, false)
89
90
  next false # return false means don't go deeper
91
+ elsif [".bundle"].include? child.extname
92
+ mirror_with_symlink(source, real_file_folder, target_folder, false)
93
+ next false
90
94
  else
91
95
  next true
92
96
  end
@@ -105,6 +109,8 @@ module Pod
105
109
  if path_objects != nil
106
110
  path_objects.each do |object|
107
111
  if object.real_file_path != nil
112
+ real_path = Pathname.new(object.target_file_path)
113
+ real_path.rmtree if real_path.exist?
108
114
  make_link(object.real_file_path, object.target_file_path, false)
109
115
  end
110
116
  end
@@ -25,6 +25,10 @@ module Pod
25
25
  DSL.dont_remove_source_code = true
26
26
  end
27
27
 
28
+ def remove_source_code_for_prebuilt_frameworks!
29
+ DSL.dont_remove_source_code = false
30
+ end
31
+
28
32
  # Enable bitcode for prebuilt frameworks
29
33
  def enable_bitcode_for_prebuilt_frameworks!
30
34
  DSL.bitcode_enabled = true
@@ -150,10 +150,10 @@ module Pod
150
150
  real_bundle_path = path.gsub('${PODS_ROOT}', sandbox_path.to_s) if path.start_with? '${PODS_ROOT}'
151
151
  real_bundle_path = path.gsub('${PODS_CONFIGURATION_BUILD_DIR}', sandbox_path.to_s) if path.start_with? '${PODS_CONFIGURATION_BUILD_DIR}'
152
152
  real_origin_path = Pathname.new(real_bundle_path)
153
+ real_file_path_obj = Pathname.new(object.real_file_path)
153
154
  if real_origin_path.exist?
154
- temp_path = Pathname.new(object.real_file_path)
155
- temp_path.parent.mkpath unless temp_path.parent.exist?
156
- FileUtils.cp_r(real_origin_path, temp_path, :remove_destination => true)
155
+ real_file_path_obj.parent.mkpath unless real_file_path_obj.parent.exist?
156
+ FileUtils.cp_r(real_origin_path, real_file_path_obj, :remove_destination => true)
157
157
  end
158
158
  end
159
159
  object.target_file_path = path.gsub('${PODS_ROOT}', standard_sandbox_path.to_s) if path.start_with? '${PODS_ROOT}'
@@ -1,215 +1,43 @@
1
1
  module Pod
2
2
  class Command
3
+ # This is an example of a cocoapods plugin adding a top-level subcommand
4
+ # to the 'pod' command.
5
+ #
6
+ # You can also create subcommands of existing or new commands. Say you
7
+ # wanted to add a subcommand to `list` to show newly deprecated pods,
8
+ # (e.g. `pod list deprecated`), there are a few things that would need
9
+ # to change.
10
+ #
11
+ # - move this file to `lib/pod/command/list/deprecated.rb` and update
12
+ # the class to exist in the the Pod::Command::List namespace
13
+ # - change this class to extend from `List` instead of `Command`. This
14
+ # tells the plugin system that it is a subcommand of `list`.
15
+ # - edit `lib/cocoapods_plugins.rb` to require this file
16
+ #
17
+ # @todo Create a PR to add your plugin to CocoaPods/cocoapods.org
18
+ # in the `plugins.json` file, once your plugin is released.
3
19
  #
4
20
  class Ppbuild < Command
5
- self.summary = '通过将二进制对应源码放置在临时目录中,让二进制出现断点时可以跳到对应的源码,方便调试。'
21
+ self.summary = 'Short description of cocoapods-Ppbuild.'
6
22
 
7
23
  self.description = <<-DESC
8
- 通过将二进制对应源码放置在临时目录中,让二进制出现断点时可以跳到对应的源码,方便调试。
9
- 在不删除二进制的情况下为某个组件添加源码调试能力,多个组件名称用空格分隔
24
+ Longer description of cocoapods-Ppbuild.
10
25
  DESC
11
26
 
12
- self.arguments = [
13
- CLAide::Argument.new('NAME', false)
14
- ]
15
- def self.options
16
- [
17
- ['--all-clean', '删除所有已经下载的源码'],
18
- ['--clean', '删除所有指定下载的源码'],
19
- ['--list', '展示所有一级下载的源码以及其大小'],
20
- ['--source', '源码路径,本地路径,会去自动链接本地源码']
21
- ]
22
- end
27
+ # self.arguments = 'NAME'
23
28
 
24
29
  def initialize(argv)
25
- @codeSource = argv.option('source') || nil
26
- @names = argv.arguments! unless argv.arguments.empty?
27
- @list = argv.flag?('list', false )
28
- @all_clean = argv.flag?('all-clean', false )
29
- @clean = argv.flag?('clean', false )
30
- @config = Pod::Config.instance
31
- @analyzer = nil
32
- @podfile_dependency_cache = Pod::Installer::Analyzer::PodfileDependencyCache.from_podfile(@config.podfile)
30
+ @name = argv.shift_argument
33
31
  super
34
32
  end
35
33
 
36
-
37
- def run
38
- podfile_lock = File.join(Pathname.pwd,"Podfile.lock")
39
- raise "podfile.lock,不存在,请先pod install/update" unless File.exist?(podfile_lock)
40
- @lockfile ||= Lockfile.from_file(Pathname.new(podfile_lock) )
41
-
42
- if @list
43
- list
44
- elsif @clean
45
- clean
46
- elsif @all_clean
47
- all_clean
48
- elsif @names
49
- add
50
- end
51
-
52
- if @list && @clean && @names
53
- raise "请选择您要执行的命令。"
54
- end
55
- end
56
-
57
- #==========================begin add ==============
58
-
59
- def add
60
- if @names == nil
61
- raise "请输入要调试组件名,多个组件名称用空格分隔"
62
- end
63
- @names.each do |name|
64
- lib_file = get_lib_path(name)
65
- unless File.exist?(lib_file)
66
- raise "找不到 #{lib_file}"
67
- end
68
- UI.puts "#{lib_file}"
69
-
70
- target_path = @codeSource || download_source(name)
71
-
72
- link(lib_file,target_path,name)
73
- end
74
- end
75
-
76
- #下载源码到本地
77
- def download_source(name)
78
- target_path = File.join(source_root, name)
79
- UI.puts target_path
80
- FileUtils.rm_rf(target_path)
81
- find_dependency = find_dependency(name)
82
- spec = fetch_external_source(find_dependency, @config.podfile,@config.lockfile, @config.sandbox,true )
83
-
84
- download_request = Pod::Downloader::Request.new(:name => name, :spec => spec)
85
- Downloader.download(download_request, Pathname.new(target_path), :can_cache => true)
86
-
87
- target_path
88
- end
89
-
90
- #找出依赖
91
- def find_dependency (name)
92
- find_dependency = nil
93
-
94
- @config.podfile.dependencies.each do |dependency|
95
- if dependency.root_name.downcase == name.downcase
96
- find_dependency = dependency
97
- break
98
- end
99
- end
100
- if find_dependency.external_source.nil?
101
-
102
- end
103
- find_dependency
104
- end
105
-
106
- # 获取external_source 下的仓库
107
- # @return spec
108
- def fetch_external_source(dependency ,podfile , lockfile, sandbox,use_lockfile_options)
109
- checkout_options = lockfile.checkout_options_for_pod_named(dependency.root_name)
110
- source = if use_lockfile_options && lockfile && checkout_options
111
- ExternalSources.from_params(checkout_options, dependency, podfile.defined_in_file, podfile.installation_options.clean?)
112
- else
113
- ExternalSources.from_dependency(dependency, podfile.defined_in_file, podfile.installation_options.clean?)
114
- end
115
- source.fetch(sandbox)
116
- end
117
-
118
-
119
- #==========================link begin ==============
120
-
121
- #链接,.a文件位置, 源码目录
122
- def link(lib_file,target_path,basename)
123
- check(lib_file,dir,basename)
124
- end
125
-
126
- def check(lib_file,dir,basename)
127
- file = `dwarfdump "#{lib_file}" | grep -E "DW_AT_decl_file.*#{basename}.*\\.m|\\.c" | head -1 | cut -d \\" -f2`
128
- if File.exist?(file)
129
- raise "#{file} 不存在 请检测代码源是否正确~"
130
- end
131
- UI.puts "link successfully!"
132
- UI.puts "view linked source at path: #{dir}"
133
- end
134
-
135
- def get_lib_path(name)
136
- dir = Pathname.new(File.join(Pathname.pwd,"Pods",name))
137
- dir = get_framework_path(dir, name)
138
- if !Dir.exist?(dir)
139
- raise "找不到组件:#{name}, 请输入正确名称!! 者将组件名在git上提issues"
140
- end
141
- lib_path = File.join(dir, name)
142
- lib_path
143
- end
144
-
145
- def get_framework_path(basepath, name)
146
- dir = Pathname.new(File.join(basepath, "#{name}.framework"))
147
- if !Dir.exist?(dir)
148
- dir = dir.children.first
149
- if Dir.exist?(dir)
150
- return get_framework_path(dir, name)
151
- end
152
- end
153
- return dir
154
- end
155
-
156
-
157
- #源码地址
158
- # def get_gitlib_iOS_path(name)
159
- # "git@gitlab.xxx.com:iOS/#{name}.git"
160
- # end
161
- #要转换的地址,Github-iOS默认都是静态库
162
- # def git_gitlib_iOS_path
163
- # 'git@gitlab.xxx.com:Github-iOS/'
164
- # end
165
-
166
-
167
- #要转换的地址,Github-iOS默认都是静态库
168
- # def http_gitlib_GitHub_iOS_path
169
- # 'https://gitlab.xxx.com/Github-iOS/'
170
- # end
171
-
172
- #要转换的地址,iOS默认都是静态库
173
- # def http_gitlib_iOS_path
174
- # 'https://gitlab.xxx.com/iOS/'
175
- # end
176
-
177
- #==========================list begin ==============
178
-
179
- def list
180
- Dir.entries(source_root).each do |sub|
181
- UI.puts "- #{sub}" unless sub.include?('.')
182
- end
183
- UI.puts "加载完成"
184
- end
185
-
186
-
187
- #==========================clean begin ==============
188
- def all_clean
189
- FileUtils.rm_rf(source_root) if File.directory?(source_root)
190
- UI.puts "清理完成 #{source_root}"
191
- end
192
-
193
- def clean
194
- raise "请输入要删除的组件库" if @names.nil?
195
- @names.each do |name|
196
- full_path = File.join(source_root,name)
197
- if File.directory?(full_path)
198
- FileUtils.rm_rf(full_path)
199
- else
200
- UI.puts "找不到 #{full_path}".yellow
201
- end
202
- end
203
- UI.puts "清理完成 #{@names.to_s}"
34
+ def validate!
35
+ super
36
+ help! 'A Pod name is required.' unless @name
204
37
  end
205
38
 
206
- private
207
-
208
- def source_root
209
- dir = File.join(@config.cache_root,"Source")
210
- FileUtils.mkdir_p(dir) unless File.exist? dir
211
- UI.puts "缓存目录 #{dir}"
212
- dir
39
+ def run
40
+ UI.puts "Add your implementation for the cocoapods-Ppbuild plugin in #{__FILE__}"
213
41
  end
214
42
  end
215
43
  end
@@ -1,3 +1,3 @@
1
1
  module CocoapodsPpbuild
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-ppbuild
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - 彭懂