cocoapods-tdfire-binary 1.2.0 → 1.2.1

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
  SHA1:
3
- metadata.gz: 4327aaa2c7f9aa393126b8b39558ee07d1910f67
4
- data.tar.gz: e5bb43d5aa8db3c817660b5c1b81667a47d2fedb
3
+ metadata.gz: 7915044a0d73ec21c492c83bb27b87d7d9ea834f
4
+ data.tar.gz: 5f76e87ee1c80a862f0bffb5093d20637b6f07e9
5
5
  SHA512:
6
- metadata.gz: 8ab2e1648f66e17a55511cf41dd7233ae440d9f07609672735b90c4deabc12a1dc0d8baec70a81e25c337154cc387122d849aa49041223c434867f2a71e70fb9
7
- data.tar.gz: 47a447746ea39b6658746e2f15b6d6a92504ed51153520f504d31fffaddd0bd612f25a2ee971cab6b62be5e63e49a83b0af5934de9c91f419259e609ac1f1717
6
+ metadata.gz: dac999ec5ab4483d7c64f80f819efefaec0e20e6088e11d47f26f26bd457e43e62603c16aab92f45d9755efe08891077299e2c1223d5e7036c1174240936c362
7
+ data.tar.gz: d9807ae59b68239a08854b8db1cc54f3cfcaab446588420574bbfc7d96c6e93513ab1b4d01d5231f928112fc0ad83f4fd9ce59952d57b6aace8ec44cb072edc5
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cocoapods-tdfire-binary (1.2.0)
5
- cocoapods (~> 1.2.1)
4
+ cocoapods-tdfire-binary (1.2.1)
5
+ cocoapods (~> 1.2)
6
6
  cocoapods-packager (~> 1.5.0)
7
7
 
8
8
  GEM
data/README.md CHANGED
@@ -2,12 +2,113 @@
2
2
 
3
3
  <a href="https://travis-ci.org/tripleCC/cocoapods-tdfire-binary"><img src="https://img.shields.io/travis/tripleCC/cocoapods-tdfire-binary/master.svg"></a>
4
4
 
5
- ## Installation
5
+ ## 安装
6
6
 
7
7
  $ gem install cocoapods-tdfire-binary
8
-
9
8
 
10
- ## Usage
9
+
10
+
11
+ ## 插件目标
12
+
13
+
14
+
15
+ 1. 通过提前将组件打包成 static-framework,减少主 App 打包时间
16
+
17
+ 2. 提供源码和二进制依赖切换功能,方便开发调试
18
+
19
+ 3. 尽量减少二进制化的工作量,以及对原发布流程的影响
20
+
21
+ 4. 规避维护两套 podspec 和对应的 tag
22
+
23
+ 5. 体验尽量贴近 CocoaPods 原生 DSL
24
+
25
+
26
+
27
+ ## 二进制化策略
28
+
29
+ ### 二进制依赖方式
30
+
31
+
32
+
33
+ 先了解下 podspec 的 source 字段,它接收一个 Hash,这个 Hash 对象指定了组件的储存地址。我们可以使用 keys 如下:
34
+
35
+
36
+
37
+ ```ruby
38
+ :git => :tag, :branch, :commit, :submodules
39
+ :svn => :folder, :tag, :revision
40
+ :hg => :revision
41
+ :http => :flatten, :type, :sha256, :sha1
42
+ ```
43
+
44
+ 其中值得注意的有两个 key ,:git 不多说,这里说下 :http。 podspec 允许通过 HTTP 去下载组件代码压缩包,支持 zip, tgz, bz2, txz 和 tar 格式 :
45
+
46
+
47
+
48
+ ```ruby
49
+ spec.source = { :http => 'http://dev.wechatapp.com/download/sdk/WeChat_SDK_iOS_en.zip' }
50
+ ```
51
+
52
+ 结合上面对 source 字段的了解,可以解决一个比较关键的问题:二进制文件存在哪。这里的选择不多,“常规”无非两种:
53
+
54
+
55
+
56
+ 1. 和源码一样,存在 tag 中
57
+ 2. 起一个独立的二进制文件服务器
58
+
59
+ 为什么说 “常规”,因为还有一种“非常规”的选择一一把源码和二进制一起打成 zip ,存在文件服务器上,通过指定 source 为 :http 去下载。当然,由于和 GitLab 本身的 tag 作用冲突,这种方式并不推荐。
60
+
61
+ 接下来比较下“常规”的两种方式。
62
+
63
+ 首先是实现起来较简单第一种,在把 framework 加入 tag 后,只需对 podspec 做如下更改:
64
+
65
+
66
+
67
+ ```ruby
68
+ ...
69
+ s.source = { :git => 'git 地址',
70
+ :tag => s.version.to_s }
71
+ if ENV['use_binary']
72
+ s.vendored_frameworks = 'framework 的相对路径'
73
+ else
74
+ s.source_files = '源码文件路径'
75
+ s.public_header_files = '需要暴露的头文件路径'
76
+ end
77
+ ...
78
+ ```
79
+
80
+
81
+
82
+ 但是考虑到后期产生过多的二进制版本,势必会导致 GitLab 库急剧变大,所以暂时不考虑第一种方式。
83
+
84
+ 第二种,我们可以通过编写如下样式的 podspec 实现:
85
+
86
+
87
+
88
+ ```ruby
89
+ ...
90
+ if ENV['use_binary']
91
+ spec.source = { :git => 'git url',
92
+ :tag => s.version.to_s }
93
+ else
94
+ spec.source = { :http => 'binary server url' }
95
+ end
96
+ ...
97
+ ```
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+ ## 插件说明
106
+
107
+
108
+
109
+ ## 使用
110
+
111
+
11
112
 
12
113
  ```
13
114
 
@@ -112,8 +213,8 @@ end
112
213
  end
113
214
  end
114
215
  end
115
- ```
116
-
216
+ ```
217
+
117
218
  - tdfire_set_binary_download_configurations
118
219
  - 强制设置 static_framework 为 true,规避使用 use_frameworks! 时,动态库依赖链(动态库依赖静态库问题)、影响启动时间问题
119
220
  - 设置 preserve_paths,让 cache 保留源码、资源、二进制全部文件
@@ -20,6 +20,6 @@ Gem::Specification.new do |spec|
20
20
  spec.add_development_dependency 'bundler', '~> 1.3'
21
21
  spec.add_development_dependency 'rake', '~> 12.0'
22
22
 
23
- spec.add_runtime_dependency 'cocoapods', '~> 1.2.1'
23
+ spec.add_runtime_dependency 'cocoapods', '~> 1.2'
24
24
  spec.add_runtime_dependency 'cocoapods-packager', '~> 1.5.0'
25
25
  end
@@ -35,12 +35,15 @@ module Pod
35
35
  def clean!
36
36
  # 判断有效组件的 cache 中是否有二进制,没有的话,删除组件缓存
37
37
  specs = use_binary_specs - no_binary_specs
38
- specs.each do |s|
39
- # 处理 cache
40
- clean_pod_cache(s)
41
-
42
- # 处理 Pods
43
- clean_local_cache(s)
38
+
39
+ UI.section 'Tdfire: 处理没有二进制版本的组件' do
40
+ specs.each do |s|
41
+ # 处理 cache
42
+ clean_pod_cache(s)
43
+
44
+ # 处理 Pods
45
+ clean_local_cache(s)
46
+ end
44
47
  end
45
48
  end
46
49
 
@@ -68,7 +71,7 @@ module Pod
68
71
  pod_dir = Config.instance.sandbox.pod_dir(spec.root.name)
69
72
  framework_file = pod_dir + "#{spec.root.name}.framework"
70
73
  if pod_dir.exist? && !framework_file.exist?
71
- UI.message "Tdfire: 删除缺少二进制的组件 #{spec.root.name}".yellow
74
+ UI.message "Tdfire: 删除本地 Pods 目录下缺少二进制的组件 #{spec.root.name}"
72
75
 
73
76
  # 设置沙盒变动标记,去 cache 中拿
74
77
  # 只有 :changed 、:added 两种状态才会重新去 cache 中拿
@@ -92,7 +95,7 @@ module Pod
92
95
  slug = d[:slug].dirname + "#{spec.version}-#{spec.checksum[0, 5]}"
93
96
  framework_file = slug + "#{spec.root.name}.framework"
94
97
  unless (framework_file.exist?)
95
- UI.message "Tdfire: 删除缺少二进制的Cache #{spec.root.name}".magenta
98
+ UI.message "Tdfire: 删除缺少二进制的 Cache #{spec.root.name}"
96
99
  begin
97
100
  FileUtils.rm(descriptor[:spec_file])
98
101
  FileUtils.rm_rf(descriptor[:slug])
@@ -1,3 +1,3 @@
1
1
  module CocoapodsTdfireBinary
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-tdfire-binary
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - tripleCC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-11 00:00:00.000000000 Z
11
+ date: 2018-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.2.1
47
+ version: '1.2'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.2.1
54
+ version: '1.2'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: cocoapods-packager
57
57
  requirement: !ruby/object:Gem::Requirement