cocoapods-tdfire-binary 0.1.2 → 0.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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/cocoapods-tdfire-binary/binary_state_store.rb +31 -12
- data/lib/cocoapods-tdfire-binary/gem_version.rb +1 -1
- data/lib/cocoapods-tdfire-binary/podfile_dsl.rb +19 -8
- data/lib/cocoapods-tdfire-binary/podfile_hook.rb +10 -7
- data/lib/cocoapods-tdfire-binary/specification_dsl.rb +18 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1283821d7be8c8aebc0b55802ae00628f6a543ff
|
4
|
+
data.tar.gz: a25824ad9fb8669a90cd9321bc0d18e66883b957
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be01bc1a1fbd715a4abdea2119afdf294c807cf515454a125e4cfc3e55285399eaaeaff9530bd7688d83c846753c0ab643dbf81f36917f8d24d6826bf446bb9d
|
7
|
+
data.tar.gz: 9b0798ed207d7de84d54d2d6a7afd879ca0255aab144dcf39b734f6533cb3a4ab61c93a5e51e7efdd1838c47eb241ed99a309b5fb0648c0a46a9c1e90d8c9ff7
|
data/Gemfile.lock
CHANGED
@@ -2,30 +2,49 @@ module Tdfire
|
|
2
2
|
class BinaryStateStore
|
3
3
|
public
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
class << self
|
6
|
+
attr_accessor :unpublished_pods
|
7
|
+
attr_writer :use_source_pods
|
8
|
+
attr_reader :printed_pods
|
7
9
|
end
|
10
|
+
@unpublished_pods = []
|
11
|
+
@use_source_pods = []
|
12
|
+
@printed_pods = []
|
8
13
|
|
9
14
|
def self.use_source_pods
|
10
|
-
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.use_source_pods=(pods)
|
14
|
-
ENV[USE_SOURCE_PODS_KEY] = Array(pods).join('|')
|
15
|
+
(@use_source_pods + @unpublished_pods).uniq
|
15
16
|
end
|
16
17
|
|
17
18
|
def self.use_binary?
|
18
|
-
ENV[USE_BINARY_KEY] ==
|
19
|
+
ENV[USE_BINARY_KEY] == USE_SURE_VALUE
|
19
20
|
end
|
20
21
|
|
21
22
|
def self.set_use_binary
|
22
|
-
ENV[USE_BINARY_KEY] =
|
23
|
+
ENV[USE_BINARY_KEY] = USE_SURE_VALUE
|
23
24
|
end
|
24
25
|
|
25
|
-
|
26
|
+
def self.force_use_binary?
|
27
|
+
ENV[FORCE_USE_BINARY_KEY] == USE_SURE_VALUE
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.force_use_source?
|
31
|
+
ENV[FORCE_USE_SOURCE_KEY] == USE_SURE_VALUE
|
32
|
+
end
|
26
33
|
|
27
|
-
|
34
|
+
def self.auto_set_default_unpublished_pod?
|
35
|
+
ENV[AUTO_SET_DEFAULT_UNPUBLISHED_POD_KEY] == USE_SURE_VALUE
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.set_auto_set_default_unpublished_pod
|
39
|
+
ENV[AUTO_SET_DEFAULT_UNPUBLISHED_POD_KEY] = USE_SURE_VALUE
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
AUTO_SET_DEFAULT_UNPUBLISHED_POD_KEY = 'auto_set_default_unpublished_pod'
|
45
|
+
FORCE_USE_SOURCE_KEY = 'tdfire_force_use_source'
|
46
|
+
FORCE_USE_BINARY_KEY = 'tdfire_force_use_binary'
|
28
47
|
USE_BINARY_KEY = 'tdfire_use_binary'
|
29
|
-
|
48
|
+
USE_SURE_VALUE = '1'
|
30
49
|
end
|
31
50
|
end
|
@@ -6,10 +6,15 @@ module Pod
|
|
6
6
|
module DSL
|
7
7
|
# 使用源码依赖的pod
|
8
8
|
def tdfire_use_source_pods(pods)
|
9
|
-
|
10
|
-
|
9
|
+
Pod::UI.puts "Tdfire: set use source pods: #{Array(pods).join(', ')}"
|
10
|
+
Tdfire::BinaryStateStore.use_source_pods = Array(pods)
|
11
|
+
end
|
11
12
|
|
12
|
-
|
13
|
+
# 标明未发布的pod,因为未发布pod没有对应的二进制版本,无法下载
|
14
|
+
# 未发布的pod,一定是源码依赖的
|
15
|
+
def tdfire_unpublished_pods(pods)
|
16
|
+
Pod::UI.puts "Tdfire: set unpublished pods: #{Array(pods).join(', ')}"
|
17
|
+
Tdfire::BinaryStateStore.unpublished_pods = Array(pods)
|
13
18
|
end
|
14
19
|
|
15
20
|
# 使用二进制依赖
|
@@ -17,6 +22,10 @@ module Pod
|
|
17
22
|
Tdfire::BinaryStateStore.set_use_binary
|
18
23
|
end
|
19
24
|
|
25
|
+
def tdfire_auto_set_default_unpublished_pod!
|
26
|
+
Tdfire::BinaryStateStore.set_auto_set_default_unpublished_pod
|
27
|
+
end
|
28
|
+
|
20
29
|
# 外源组件依赖
|
21
30
|
def tdfire_external_pods(pods, *rest)
|
22
31
|
argvs = rest.last || {}
|
@@ -25,9 +34,9 @@ module Pod
|
|
25
34
|
输入参数错误.
|
26
35
|
|
27
36
|
Example:
|
28
|
-
tdfire_external_pods ['TDFCore'] source:'git' group:'ios' branch:'develop'
|
29
|
-
tdfire_external_pods 'TDFCore' source:'git' group:'ios' branch:'develop'
|
30
|
-
tdfire_external_pods ['TDFCore'] group:'cocoapods'
|
37
|
+
tdfire_external_pods ['TDFCore'], source:'git', group:'ios', branch:'develop'
|
38
|
+
tdfire_external_pods 'TDFCore', source:'git', group:'ios', branch:'develop'
|
39
|
+
tdfire_external_pods ['TDFCore'], group:'cocoapods'
|
31
40
|
...
|
32
41
|
|
33
42
|
默认值:
|
@@ -66,8 +75,10 @@ EOF
|
|
66
75
|
else
|
67
76
|
end
|
68
77
|
|
69
|
-
#
|
70
|
-
Tdfire::BinaryStateStore.
|
78
|
+
# 除了依赖私有源正式版本的组件,其余组件一律视为未发布组件,进行源码依赖
|
79
|
+
Tdfire::BinaryStateStore.unpublished_pods += Array(pods)
|
80
|
+
|
81
|
+
# Tdfire::BinaryStateStore.use_source_pods = Array(pods) + Tdfire::BinaryStateStore.use_source_pods
|
71
82
|
end
|
72
83
|
end
|
73
84
|
end
|
@@ -7,15 +7,16 @@ module CocoapodsTdfireBinary
|
|
7
7
|
first_target_definition = context.podfile.target_definition_list.select{ |d| d.name != 'Pods' }.first
|
8
8
|
development_pod = first_target_definition.name.split('_').first unless first_target_definition.nil?
|
9
9
|
|
10
|
-
Pod::UI.section("Tdfire: set share scheme for development pod: \'#{development_pod}\'") do
|
10
|
+
Pod::UI.section("Tdfire: auto set share scheme for development pod: \'#{development_pod}\'") do
|
11
11
|
# carthage 需要 shared scheme 构建 framework
|
12
12
|
context.podfile.install!('cocoapods', :share_schemes_for_development_pods => [development_pod])
|
13
13
|
end unless development_pod.nil?
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
# 在采用二进制依赖,并且不是强制二进制依赖的情况下,当前打成 framework 的开发 Pod 需要源码依赖
|
16
|
+
if Tdfire::BinaryStateStore.use_binary? && Tdfire::BinaryStateStore.auto_set_default_unpublished_pod?
|
17
|
+
Pod::UI.section("Tdfire: auto set unpublished for development pod: \'#{development_pod}\'") do
|
18
|
+
# 开发 Pod 默认设置为未发布状态
|
19
|
+
Tdfire::BinaryStateStore.unpublished_pods << development_pod
|
19
20
|
end unless development_pod.nil?
|
20
21
|
tdfire_default_development_pod = development_pod
|
21
22
|
end
|
@@ -23,7 +24,7 @@ module CocoapodsTdfireBinary
|
|
23
24
|
|
24
25
|
#fix `Shell Script` Build Phase Fails When Input / Output Files List is Too Large
|
25
26
|
Pod::HooksManager.register('cocoapods-tdfire-binary', :post_install) do |context, _|
|
26
|
-
Pod::UI.section('Tdfire: clean input and output files') do
|
27
|
+
Pod::UI.section('Tdfire: auto clean input and output files') do
|
27
28
|
context.umbrella_targets.map(&:user_targets).flatten.uniq.each do |t|
|
28
29
|
phase = t.shell_script_build_phases.find { |p| p.name.include?(Pod::Installer::UserProjectIntegrator::TargetIntegrator::COPY_PODS_RESOURCES_PHASE_NAME) }
|
29
30
|
|
@@ -43,12 +44,14 @@ module CocoapodsTdfireBinary
|
|
43
44
|
end
|
44
45
|
end
|
45
46
|
|
47
|
+
# 在采用二进制依赖,并且不是强制二进制依赖的情况下,提示当前工程的未发布的 Pods
|
46
48
|
if Tdfire::BinaryStateStore.use_binary?
|
47
49
|
all_development_pods = context.sandbox.development_pods.keys - Array(tdfire_default_development_pod) - Tdfire::BinaryStateStore.use_source_pods
|
48
50
|
all_development_pods_displayed_text = all_development_pods.map { |p| "'#{p}'" }.join(',')
|
49
|
-
Pod::UI.puts "Tdfire: You should add following code to your `Podfile`, and then run `pod install or pod update` again. \n\
|
51
|
+
Pod::UI.puts "Tdfire: You should add following code to your `Podfile`, and then run `pod install or pod update` again. \n\ntdfire_unpublished_pods [#{all_development_pods_displayed_text}]\n".cyan unless all_development_pods.empty?
|
50
52
|
end
|
51
53
|
|
52
54
|
Pod::UI.puts "Tdfire: all source dependency pods: #{Tdfire::BinaryStateStore.use_source_pods.join(', ')}"
|
55
|
+
Pod::UI.puts "Tdfire: all unpublished pods: #{Tdfire::BinaryStateStore.unpublished_pods.join(', ')}"
|
53
56
|
end
|
54
57
|
end
|
@@ -5,11 +5,19 @@ module Pod
|
|
5
5
|
class Specification
|
6
6
|
module DSL
|
7
7
|
|
8
|
+
private
|
9
|
+
|
10
|
+
def use_source?
|
11
|
+
(!Tdfire::BinaryStateStore.force_use_binary? &&
|
12
|
+
(!Tdfire::BinaryStateStore.use_binary? || Tdfire::BinaryStateStore.use_source_pods.include?(name))) ||
|
13
|
+
Tdfire::BinaryStateStore.force_use_source?
|
14
|
+
end
|
15
|
+
|
8
16
|
public
|
9
17
|
|
10
18
|
# 源码依赖配置
|
11
19
|
def tdfire_source(&block)
|
12
|
-
if
|
20
|
+
if use_source?
|
13
21
|
if !Tdfire::BinaryStateStore.printed_pods.include?(name)
|
14
22
|
UI.puts "Source".magenta.bold + " dependecy for " + "#{name} #{version}".light_blue
|
15
23
|
Tdfire::BinaryStateStore.printed_pods << name
|
@@ -21,7 +29,7 @@ module Pod
|
|
21
29
|
|
22
30
|
# 二进制依赖配置
|
23
31
|
def tdfire_binary(&block)
|
24
|
-
if
|
32
|
+
if !use_source?
|
25
33
|
if !Tdfire::BinaryStateStore.printed_pods.include?(name)
|
26
34
|
UI.puts "Binary".cyan.bold + " dependecy for " + "#{name} #{version}".light_blue
|
27
35
|
Tdfire::BinaryStateStore.printed_pods << name
|
@@ -33,6 +41,10 @@ module Pod
|
|
33
41
|
|
34
42
|
# 配置二进制文件下载、cache 住解压好的 framework
|
35
43
|
def tdfire_set_binary_download_configurations_at_last(download_url = nil)
|
44
|
+
|
45
|
+
# 没有发布的pod,没有二进制版本,不进行下载配置
|
46
|
+
return if !Tdfire::BinaryStateStore.force_use_binary? && Tdfire::BinaryStateStore.unpublished_pods.include?(name)
|
47
|
+
|
36
48
|
raise Pod::Informative, "You must invoke the method after setting name and version" if name.nil? || version.nil?
|
37
49
|
|
38
50
|
set_framework_preserve_paths
|
@@ -49,8 +61,11 @@ module Pod
|
|
49
61
|
framework_preserve_paths = ["#{name}.framework"]
|
50
62
|
framework_preserve_paths += consumer(Platform.ios).preserve_paths unless consumer(Platform.ios).preserve_paths.nil?
|
51
63
|
|
64
|
+
# 规避 preserve_paths don't match any files 错误
|
65
|
+
source_preserve_paths = ["#{name}/**/**/*", "Classes/**/*"]
|
66
|
+
|
52
67
|
# preserve_paths = xxx 无法不会将值设置进去,不明白其原理
|
53
|
-
store_attribute('preserve_paths', framework_preserve_paths)
|
68
|
+
store_attribute('preserve_paths', framework_preserve_paths + source_preserve_paths)
|
54
69
|
end
|
55
70
|
|
56
71
|
def set_framework_download_script(download_url)
|
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: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tripleCC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|