cocoapods-tdfire-binary 1.0.5 → 1.0.6
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_specification_refactor.rb +79 -77
- data/lib/cocoapods-tdfire-binary/binary_state_store.rb +65 -58
- data/lib/cocoapods-tdfire-binary/binary_url_manager.rb +31 -29
- data/lib/cocoapods-tdfire-binary/command.rb +1 -1
- data/lib/cocoapods-tdfire-binary/command/assemble.rb +1 -1
- data/lib/cocoapods-tdfire-binary/command/lib/create.rb +1 -1
- data/lib/cocoapods-tdfire-binary/command/lint.rb +14 -3
- data/lib/cocoapods-tdfire-binary/command/package.rb +2 -2
- data/lib/cocoapods-tdfire-binary/command/pull.rb +1 -1
- data/lib/cocoapods-tdfire-binary/command/push.rb +1 -1
- data/lib/cocoapods-tdfire-binary/gem_version.rb +1 -1
- data/lib/cocoapods-tdfire-binary/podfile_dsl.rb +4 -4
- data/lib/cocoapods-tdfire-binary/podfile_hook.rb +23 -25
- data/lib/cocoapods-tdfire-binary/specification_dsl.rb +12 -13
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93538d683f5a872ea846131cf45e346f5ca9d754
|
4
|
+
data.tar.gz: 33836f8a6b47157a0e0add735259aa32204b5cdc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b85fef5485aa1a420d921e5e1178e5ff0a9173ff0db2d4812e5d2bd5026108b20378bff6b15f8c2889ab5a053ffe0b6919827d7b5cc0f384c8646c716b36792
|
7
|
+
data.tar.gz: 8cea5c8e40aab3d44fd644713f9ea63f6a0992f6086f30780818ecaf153bc642f2c4459b97b3c92af22ded4b1b38538e44bfc908cfedfffd403e90eb5f5993a8
|
data/Gemfile.lock
CHANGED
@@ -35,89 +35,90 @@ module Pod
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
module
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
def initialize(target_spec)
|
43
|
-
@target_spec = target_spec
|
44
|
-
end
|
38
|
+
module Pod
|
39
|
+
module Tdfire
|
40
|
+
class BinarySpecificationRefactor
|
41
|
+
attr_accessor :target_spec
|
45
42
|
|
46
|
-
|
47
|
-
|
48
|
-
def configure_binary_default_subspec_with_reference_spec(spec)
|
49
|
-
default_subspec = "TdfireBinary"
|
50
|
-
target_spec.subspec default_subspec do |ss|
|
51
|
-
subspec_refactor = BinarySpecificationRefactor.new(ss)
|
52
|
-
subspec_refactor.configure_binary_with_reference_spec(spec)
|
43
|
+
def initialize(target_spec)
|
44
|
+
@target_spec = target_spec
|
53
45
|
end
|
54
46
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
47
|
+
#--------------------------------------------------------------------#
|
48
|
+
# 生成default subspec TdfireBinary ,并将源码依赖时的配置转移到此 subspec 上
|
49
|
+
def configure_binary_default_subspec_with_reference_spec(spec)
|
50
|
+
default_subspec = "TdfireBinary"
|
51
|
+
target_spec.subspec default_subspec do |ss|
|
52
|
+
subspec_refactor = BinarySpecificationRefactor.new(ss)
|
53
|
+
subspec_refactor.configure_binary_with_reference_spec(spec)
|
59
54
|
end
|
60
|
-
end
|
61
55
|
|
62
|
-
|
63
|
-
|
56
|
+
# 创建源码依赖时的 subspec,并且设置所有的 subspec 依赖 default_subspec
|
57
|
+
spec.subspecs.each do |s|
|
58
|
+
target_spec.subspec s.base_name do |ss|
|
59
|
+
ss.dependency "#{target_spec.root.name}/#{default_subspec}"
|
60
|
+
end
|
61
|
+
end
|
64
62
|
|
65
|
-
|
66
|
-
|
63
|
+
target_spec.default_subspec = default_subspec
|
64
|
+
target_spec.default_subspec = default_subspec
|
67
65
|
|
68
|
-
|
69
|
-
# spec 是二进制依赖时的配置
|
70
|
-
def configure_binary_with_reference_spec(spec)
|
71
|
-
# 组件 frameworks 的依赖
|
72
|
-
target_spec.vendored_frameworks = "#{target_spec.root.name}.framework"
|
73
|
-
# target_spec.source_files = "#{target_spec.root.name}.framework/Headers/*"
|
74
|
-
# target_spec.public_header_files = "#{target_spec.root.name}.framework/Headers/*"
|
75
|
-
|
76
|
-
# 保留对 frameworks lib 的依赖
|
77
|
-
%w[frameworks libraries weak_frameworks].each do |name|
|
78
|
-
target_spec.store_array_value_with_attribute_and_reference_spec(name, spec)
|
79
|
-
end
|
80
|
-
|
81
|
-
# 保留对其他组件的依赖
|
82
|
-
target_spec.store_hash_value_with_attribute_and_reference_spec('dependencies', spec) do |name|
|
83
|
-
# 去除对自身子组件的依赖
|
84
|
-
name.split('/').first != target_spec.root.name
|
66
|
+
Pod::UI.message "Tdfire: subspecs for #{target_spec.name}: #{target_spec.subspecs.map(&:name).join(', ')}"
|
85
67
|
end
|
86
68
|
|
87
|
-
|
88
|
-
|
69
|
+
#--------------------------------------------------------------------#
|
70
|
+
# spec 是二进制依赖时的配置
|
71
|
+
def configure_binary_with_reference_spec(spec)
|
72
|
+
# 组件 frameworks 的依赖
|
73
|
+
target_spec.vendored_frameworks = "#{target_spec.root.name}.framework"
|
74
|
+
# target_spec.source_files = "#{target_spec.root.name}.framework/Headers/*"
|
75
|
+
# target_spec.public_header_files = "#{target_spec.root.name}.framework/Headers/*"
|
76
|
+
|
77
|
+
# 保留对 frameworks lib 的依赖
|
78
|
+
%w[frameworks libraries weak_frameworks].each do |name|
|
79
|
+
target_spec.store_array_value_with_attribute_and_reference_spec(name, spec)
|
80
|
+
end
|
89
81
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
resources = spec.all_array_value_for_attribute('resources')
|
96
|
-
resource_bundles = spec.all_hash_value_for_attribute('resource_bundles')
|
97
|
-
source_preserve_paths = source_files + resources + resource_bundles.values.flatten
|
82
|
+
# 保留对其他组件的依赖
|
83
|
+
target_spec.store_hash_value_with_attribute_and_reference_spec('dependencies', spec) do |name|
|
84
|
+
# 去除对自身子组件的依赖
|
85
|
+
name.split('/').first != target_spec.root.name
|
86
|
+
end
|
98
87
|
|
99
|
-
|
100
|
-
|
101
|
-
preserve_paths = source_preserve_paths + framework_preserve_paths
|
88
|
+
Pod::UI.message "Tdfire: dependencies for #{target_spec.name}: #{target_spec.dependencies.map(&:name).join(', ')}"
|
89
|
+
end
|
102
90
|
|
103
|
-
|
104
|
-
|
105
|
-
|
91
|
+
#--------------------------------------------------------------------#
|
92
|
+
# spec 是源码依赖时的配置
|
93
|
+
def set_preserve_paths_with_reference_spec(spec)
|
94
|
+
# 源码、资源文件
|
95
|
+
source_files = spec.all_array_value_for_attribute('source_files')
|
96
|
+
resources = spec.all_array_value_for_attribute('resources')
|
97
|
+
resource_bundles = spec.all_hash_value_for_attribute('resource_bundles')
|
98
|
+
source_preserve_paths = source_files + resources + resource_bundles.values.flatten
|
106
99
|
|
107
|
-
|
108
|
-
|
100
|
+
# 二进制文件
|
101
|
+
framework_preserve_paths = [framework_name]
|
102
|
+
preserve_paths = source_preserve_paths + framework_preserve_paths
|
109
103
|
|
110
|
-
|
104
|
+
# 保留原有的 preserve_paths
|
105
|
+
preserve_paths += target_spec.attributes_hash['preserve_paths'] unless target_spec.attributes_hash['preserve_paths'].nil?
|
106
|
+
target_spec.preserve_paths = preserve_paths.uniq
|
111
107
|
|
112
|
-
|
113
|
-
|
114
|
-
|
108
|
+
Pod::UI.message "Tdfire: preserve paths for #{target_spec.name}: #{preserve_paths.join(', ')}"
|
109
|
+
end
|
110
|
+
|
111
|
+
#--------------------------------------------------------------------#
|
112
|
+
|
113
|
+
def set_use_static_framework
|
114
|
+
target_spec.static_framework = true if target_spec.respond_to?('static_framework')
|
115
|
+
end
|
115
116
|
|
116
|
-
|
117
|
-
|
118
|
-
|
117
|
+
#--------------------------------------------------------------------#
|
118
|
+
def set_framework_download_script
|
119
|
+
download_url = Pod::Tdfire::BinaryUrlManager.pull_url_for_pod_version(target_spec.root.name, target_spec.version)
|
119
120
|
|
120
|
-
|
121
|
+
download_script = <<-EOF
|
121
122
|
#!/bin/sh
|
122
123
|
|
123
124
|
if [[ -d #{framework_name} ]]; then
|
@@ -144,19 +145,20 @@ module Tdfire
|
|
144
145
|
rm -fr tdfire_download_temp
|
145
146
|
|
146
147
|
echo "pod cache path for #{target_spec.root.name}: $(pwd)"
|
147
|
-
|
148
|
+
EOF
|
148
149
|
|
149
|
-
|
150
|
-
|
150
|
+
combined_download_script = %Q[echo '#{download_script}' > download.sh && sh download.sh && rm download.sh]
|
151
|
+
combined_download_script += " && " << target_spec.prepare_command unless target_spec.prepare_command.nil?
|
151
152
|
|
152
|
-
|
153
|
-
|
153
|
+
target_spec.prepare_command = combined_download_script
|
154
|
+
end
|
154
155
|
|
155
|
-
|
156
|
-
|
156
|
+
#--------------------------------------------------------------------#
|
157
|
+
private
|
157
158
|
|
158
|
-
|
159
|
-
|
160
|
-
|
159
|
+
def framework_name
|
160
|
+
"#{target_spec.root.name}.framework"
|
161
|
+
end
|
162
|
+
end
|
161
163
|
end
|
162
|
-
end
|
164
|
+
end
|
@@ -1,59 +1,66 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
1
|
+
|
2
|
+
module Pod
|
3
|
+
module Tdfire
|
4
|
+
class BinaryStateStore
|
5
|
+
public
|
6
|
+
|
7
|
+
class << self
|
8
|
+
# attr_accessor :unpublished_pods
|
9
|
+
attr_accessor :use_source_pods
|
10
|
+
attr_reader :printed_pods
|
11
|
+
attr_accessor :use_frameworks
|
12
|
+
attr_accessor :use_source
|
13
|
+
attr_accessor :lib_lint_binary_pod
|
14
|
+
end
|
15
|
+
|
16
|
+
@use_source_pods = []
|
17
|
+
@use_binary_pods = []
|
18
|
+
@printed_pods = []
|
19
|
+
@use_frameworks = false
|
20
|
+
|
21
|
+
def self.real_use_source_pods
|
22
|
+
(@use_source_pods + unpublished_pods).uniq
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.unpublished_pods
|
26
|
+
String(ENV[UNPBLISHED_PODS]).split('|').uniq
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.unpublished_pods=(pods)
|
30
|
+
ENV[UNPBLISHED_PODS] = Array(pods).uniq.join('|')
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.use_binary?
|
34
|
+
ENV[USE_BINARY_KEY] == USE_SURE_VALUE
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.set_use_binary
|
38
|
+
ENV[USE_BINARY_KEY] = USE_SURE_VALUE
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.force_use_binary?
|
42
|
+
ENV[FORCE_USE_BINARY_KEY] == USE_SURE_VALUE
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.set_force_use_binary
|
46
|
+
ENV[FORCE_USE_BINARY_KEY] = USE_SURE_VALUE
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.unset_force_use_binary
|
50
|
+
ENV[FORCE_USE_BINARY_KEY] = '0'
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.force_use_source?
|
54
|
+
ENV[FORCE_USE_SOURCE_KEY] == USE_SURE_VALUE
|
55
|
+
end
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
UNPBLISHED_PODS = "tdfire_unpublished_pods"
|
60
|
+
FORCE_USE_SOURCE_KEY = 'tdfire_force_use_source'
|
61
|
+
FORCE_USE_BINARY_KEY = 'tdfire_force_use_binary'
|
62
|
+
USE_BINARY_KEY = 'tdfire_use_binary'
|
63
|
+
USE_SURE_VALUE = '1'
|
64
|
+
end
|
65
|
+
end
|
59
66
|
end
|
@@ -1,41 +1,43 @@
|
|
1
|
-
module
|
2
|
-
|
3
|
-
|
1
|
+
module Pod
|
2
|
+
module Tdfire
|
3
|
+
class BinaryUrlManager
|
4
|
+
HOST = "http://iosframeworkserver-shopkeeperclient.cloudapps.2dfire.com"
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
6
|
+
def self.pull_url_for_pod_version(pod, version)
|
7
|
+
HOST + "/getframework/PRODUCTION/#{pod}/#{version}"
|
8
|
+
end
|
8
9
|
|
9
|
-
|
10
|
-
|
10
|
+
def self.get_pull_url_for_pod_version(pod, version)
|
11
|
+
command = "curl #{pull_url_for_pod_version(pod, version)} > #{pod}.framework.zip"
|
11
12
|
|
12
|
-
|
13
|
-
|
13
|
+
run_curl command
|
14
|
+
end
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
16
|
+
def self.push_url
|
17
|
+
HOST + "/upload" #+ param
|
18
|
+
end
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
20
|
+
def self.post_push_url(name, version, path, commit = nil, commit_hash = nil)
|
21
|
+
param = %Q[-F "frameworkName=#{name}" -F "version=#{version}" -F "environment=PRODUCTION" -F "changelog=#{commit}" -F "featureName=#{commit}" -F "framework=@#{path}" -F "commitHash=#{commit_hash}"]
|
22
|
+
command = "curl #{push_url} #{param}"
|
22
23
|
|
23
|
-
|
24
|
-
|
24
|
+
run_curl command
|
25
|
+
end
|
25
26
|
|
26
|
-
|
27
|
-
|
27
|
+
def self.run_curl(command)
|
28
|
+
Pod::UI.message "CURL: \n" + command
|
28
29
|
|
29
|
-
|
30
|
-
|
30
|
+
system command
|
31
|
+
end
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
def self.private_cocoapods_url
|
34
|
+
"git@git.2dfire-inc.com:ios/cocoapods-spec.git"
|
35
|
+
# "git@git.2dfire-inc.com:qingmu/private_cocoapods.git"
|
36
|
+
end
|
36
37
|
|
37
|
-
|
38
|
-
|
38
|
+
def self.template_lib_url
|
39
|
+
"git@git.2dfire-inc.com:ios/binary-pod-template.git"
|
40
|
+
end
|
39
41
|
end
|
40
42
|
end
|
41
|
-
end
|
43
|
+
end
|
@@ -1 +1 @@
|
|
1
|
-
require 'cocoapods-tdfire-binary/command/binary'
|
1
|
+
require 'cocoapods-tdfire-binary/command/binary'
|
@@ -14,12 +14,14 @@ module Pod
|
|
14
14
|
[
|
15
15
|
['--sources', '私有源地址'],
|
16
16
|
['--clean', '执行成功后,删除 zip 文件外的所有生成文件'],
|
17
|
+
['--one-binary', '只让 Lint 的 Pod 进行二进制依赖,其余都用源码'],
|
17
18
|
].concat(super)
|
18
19
|
end
|
19
20
|
|
20
21
|
def initialize(argv)
|
21
22
|
@clean = argv.flag?('clean')
|
22
23
|
@sources = argv.option('sources')
|
24
|
+
@one_binary = argv.flag?('one-binary')
|
23
25
|
@spec_file = first_podspec
|
24
26
|
@spec_name = @spec_file.split('/').last.split('.').first
|
25
27
|
unzip_framework
|
@@ -42,10 +44,14 @@ module Pod
|
|
42
44
|
end
|
43
45
|
|
44
46
|
def run
|
45
|
-
|
47
|
+
if @one_binary
|
48
|
+
Pod::Tdfire::BinaryStateStore.lib_lint_binary_pod = @spec_name
|
49
|
+
else
|
50
|
+
Pod::Tdfire::BinaryStateStore.set_force_use_binary
|
51
|
+
end
|
46
52
|
|
47
53
|
argvs = [
|
48
|
-
"--sources=#{@sources || Tdfire::BinaryUrlManager.private_cocoapods_url}",
|
54
|
+
"--sources=#{@sources || Pod::Tdfire::BinaryUrlManager.private_cocoapods_url}",
|
49
55
|
'--allow-warnings',
|
50
56
|
'--use-libraries',
|
51
57
|
'--verbose'
|
@@ -55,7 +61,12 @@ module Pod
|
|
55
61
|
lint.validate!
|
56
62
|
lint.run
|
57
63
|
|
58
|
-
|
64
|
+
if @one_binary
|
65
|
+
Pod::Tdfire::BinaryStateStore.lib_lint_binary_pod = nil
|
66
|
+
else
|
67
|
+
Pod::Tdfire::BinaryStateStore.unset_force_use_binary
|
68
|
+
end
|
69
|
+
|
59
70
|
system "rm -fr #{@spec_name}.framework " if @clean
|
60
71
|
end
|
61
72
|
end
|
@@ -6,7 +6,7 @@ require 'cocoapods-tdfire-binary/binary_specification_refactor'
|
|
6
6
|
module Pod
|
7
7
|
class Command
|
8
8
|
class Binary < Command
|
9
|
-
class Package < Binary
|
9
|
+
class Package < Binary
|
10
10
|
self.abstract_command = false
|
11
11
|
self.summary = '二进制打包'
|
12
12
|
self.description = <<-DESC
|
@@ -42,7 +42,7 @@ module Pod
|
|
42
42
|
|
43
43
|
def package(spec)
|
44
44
|
UI.section("Tdfire: package #{spec.name} ...") do
|
45
|
-
system "pod package #{spec.name}.podspec --exclude-deps --force --no-mangle --spec-sources=#{@spec_sources || Tdfire::BinaryUrlManager.private_cocoapods_url}"
|
45
|
+
system "pod package #{spec.name}.podspec --exclude-deps --force --no-mangle --spec-sources=#{@spec_sources || Pod::Tdfire::BinaryUrlManager.private_cocoapods_url}"
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
@@ -30,7 +30,7 @@ module Pod
|
|
30
30
|
def run
|
31
31
|
UI.section("Tdfire: start pulling framework zip file ...") do
|
32
32
|
UI.puts "Tdfire: get argvs: name -> #{@name}, version -> #{@version}"
|
33
|
-
|
33
|
+
Pod::Tdfire::BinaryUrlManager.get_pull_url_for_pod_version(@name, @version)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -69,7 +69,7 @@ module Pod
|
|
69
69
|
|
70
70
|
UI.section("Tdfire: start pushing framework zip file ...") do
|
71
71
|
UI.puts "Tdfire: post argvs: name -> #{@name}, version -> #{@version}, path -> #{@path}, commit -> #{commit}, commit hash -> #{hash_log}"
|
72
|
-
Tdfire::BinaryUrlManager.post_push_url(@name, @version, @path, commit, hash_log)
|
72
|
+
Pod::Tdfire::BinaryUrlManager.post_push_url(@name, @version, @path, commit, hash_log)
|
73
73
|
end
|
74
74
|
end
|
75
75
|
end
|
@@ -7,12 +7,12 @@ module Pod
|
|
7
7
|
# 使用源码依赖的pod
|
8
8
|
def tdfire_use_source_pods(pods)
|
9
9
|
Pod::UI.puts "Tdfire: set use source pods: #{Array(pods).join(', ')}"
|
10
|
-
|
10
|
+
Pod::Tdfire::BinaryStateStore.use_source_pods = Array(pods)
|
11
11
|
end
|
12
12
|
|
13
13
|
# 使用二进制依赖
|
14
14
|
def tdfire_use_binary!
|
15
|
-
Tdfire::BinaryStateStore.set_use_binary
|
15
|
+
Pod::Tdfire::BinaryStateStore.set_use_binary
|
16
16
|
end
|
17
17
|
|
18
18
|
# 因为暂时无法将全部组件二进制化,tdfire_use_binary! 默认全部进行二进制依赖不利于渐进测试
|
@@ -22,7 +22,7 @@ module Pod
|
|
22
22
|
# 与 tdfire_use_binary 互斥
|
23
23
|
# def tdfire_use_binary_pods(pods)
|
24
24
|
# Pod::UI.puts "Tdfire: set use binary pods: #{Array(pods).join(', ')}"
|
25
|
-
# Tdfire::BinaryStateStore.use_binary_pods = Array(pods)
|
25
|
+
# Pod::Tdfire::BinaryStateStore.use_binary_pods = Array(pods)
|
26
26
|
# end
|
27
27
|
#
|
28
28
|
# def tdfire_use_source!
|
@@ -30,7 +30,7 @@ module Pod
|
|
30
30
|
|
31
31
|
# 强制使用二进制依赖,忽略未发布和依赖源码设置
|
32
32
|
# def tdfire_force_use_binary!
|
33
|
-
# Tdfire::BinaryStateStore.set_force_use_binary
|
33
|
+
# Pod::Tdfire::BinaryStateStore.set_force_use_binary
|
34
34
|
# end
|
35
35
|
|
36
36
|
# 外源组件依赖
|
@@ -2,8 +2,6 @@ require 'cocoapods-tdfire-binary/binary_state_store'
|
|
2
2
|
require 'cocoapods-tdfire-binary/source_chain_analyzer'
|
3
3
|
|
4
4
|
module CocoapodsTdfireBinary
|
5
|
-
include Tdfire
|
6
|
-
|
7
5
|
Pod::HooksManager.register('cocoapods-tdfire-binary', :pre_install) do |context, _|
|
8
6
|
# 使用 cocoapods package 打包,不使用 carthage 了,不用设置 share schemes
|
9
7
|
# 如果使用 carhtage ,一定要让需要二进制化的 target shared,此 target 不能是 static framework / library ,必须是 dynamic framework.
|
@@ -23,9 +21,9 @@ module CocoapodsTdfireBinary
|
|
23
21
|
# 标明未发布的pod,因为未发布pod没有对应的二进制版本,无法下载
|
24
22
|
# 未发布的pod,一定是源码依赖的
|
25
23
|
Pod::UI.section("Tdfire: auto set unpublished pods") do
|
26
|
-
BinaryStateStore.unpublished_pods = context.podfile.dependencies.select(&:external?).map(&:root_name)
|
24
|
+
Pod::Tdfire::BinaryStateStore.unpublished_pods = context.podfile.dependencies.select(&:external?).map(&:root_name)
|
27
25
|
|
28
|
-
Pod::UI.message "> Tdfire: unpublished pods: #{BinaryStateStore.unpublished_pods.join(', ')}"
|
26
|
+
Pod::UI.message "> Tdfire: unpublished pods: #{Pod::Tdfire::BinaryStateStore.unpublished_pods.join(', ')}"
|
29
27
|
end
|
30
28
|
|
31
29
|
# 使用 static_framework ,不用 dynamic_framework ,不需要关心 dynamic_framework 的依赖链了
|
@@ -47,27 +45,27 @@ module CocoapodsTdfireBinary
|
|
47
45
|
# CocoaPods 1.5.0 修复了此问题
|
48
46
|
#
|
49
47
|
# fix `Shell Script` Build Phase Fails When Input / Output Files List is Too Large
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
48
|
+
# Pod::UI.section('Tdfire: auto clean input and output files') do
|
49
|
+
# context.umbrella_targets.map(&:user_targets).flatten.uniq.each do |t|
|
50
|
+
# phase = t.shell_script_build_phases.find { |p| p.name.include?(Pod::Installer::UserProjectIntegrator::TargetIntegrator::COPY_PODS_RESOURCES_PHASE_NAME) }
|
51
|
+
#
|
52
|
+
# max_input_output_paths = 1000
|
53
|
+
# input_output_paths = phase.input_paths.count + phase.output_paths.count
|
54
|
+
# Pod::UI.message "Tdfire: input paths and output paths count for #{t.name} : #{input_output_paths}"
|
55
|
+
#
|
56
|
+
# if input_output_paths > max_input_output_paths
|
57
|
+
# phase.input_paths.clear
|
58
|
+
# phase.output_paths.clear
|
59
|
+
# end
|
60
|
+
#
|
61
|
+
# end
|
62
|
+
#
|
63
|
+
# context.umbrella_targets.map(&:user_project).each do |project|
|
64
|
+
# project.save
|
65
|
+
# end
|
66
|
+
# end
|
69
67
|
|
70
|
-
Pod::UI.puts "Tdfire: all source dependency pods: #{BinaryStateStore.real_use_source_pods.join(', ')}" if BinaryStateStore.use_binary?
|
71
|
-
Pod::UI.puts "Tdfire: all unpublished pods: #{BinaryStateStore.unpublished_pods.join(', ')}"
|
68
|
+
Pod::UI.puts "Tdfire: all source dependency pods: #{Pod::Tdfire::BinaryStateStore.real_use_source_pods.join(', ')}" if Pod::Tdfire::BinaryStateStore.use_binary?
|
69
|
+
Pod::UI.puts "Tdfire: all unpublished pods: #{Pod::Tdfire::BinaryStateStore.unpublished_pods.join(', ')}"
|
72
70
|
end
|
73
71
|
end
|
@@ -4,10 +4,9 @@ require 'colored2'
|
|
4
4
|
|
5
5
|
module Pod
|
6
6
|
class Specification
|
7
|
-
include Tdfire
|
8
7
|
|
9
8
|
def tdfire_refactor
|
10
|
-
@refactor ||= BinarySpecificationRefactor.new(self)
|
9
|
+
@refactor ||= Pod::Tdfire::BinarySpecificationRefactor.new(self)
|
11
10
|
end
|
12
11
|
|
13
12
|
module DSL
|
@@ -22,9 +21,9 @@ module Pod
|
|
22
21
|
# 源码依赖配置
|
23
22
|
def tdfire_source(configurator)
|
24
23
|
if tdfire_use_source?
|
25
|
-
if !Tdfire::BinaryStateStore.printed_pods.include?(root.name)
|
24
|
+
if !Pod::Tdfire::BinaryStateStore.printed_pods.include?(root.name)
|
26
25
|
UI.message "Source".magenta.bold + " dependecy for " + "#{root.name} #{version}".green.bold
|
27
|
-
Tdfire::BinaryStateStore.printed_pods << root.name
|
26
|
+
Pod::Tdfire::BinaryStateStore.printed_pods << root.name
|
28
27
|
end
|
29
28
|
|
30
29
|
configurator.call self
|
@@ -37,9 +36,9 @@ module Pod
|
|
37
36
|
# 二进制依赖配置
|
38
37
|
def tdfire_binary(configurator, &block)
|
39
38
|
if !tdfire_use_source?
|
40
|
-
if !Tdfire::BinaryStateStore.printed_pods.include?(root.name)
|
41
|
-
UI.message "Binary".cyan.bold + " dependecy for " + "#{root.name} #{version}".green.bold
|
42
|
-
Tdfire::BinaryStateStore.printed_pods << root.name
|
39
|
+
if !Pod::Tdfire::BinaryStateStore.printed_pods.include?(root.name)
|
40
|
+
UI.message "Binary".cyan.bold + " dependecy for " + "#{root.name} #{version}".green.bold
|
41
|
+
Pod::Tdfire::BinaryStateStore.printed_pods << root.name
|
43
42
|
end
|
44
43
|
|
45
44
|
yield self if block_given?
|
@@ -79,15 +78,15 @@ module Pod
|
|
79
78
|
end
|
80
79
|
|
81
80
|
def tdfire_use_source?
|
82
|
-
((!Tdfire::BinaryStateStore.force_use_binary? &&
|
83
|
-
(!Tdfire::BinaryStateStore.use_binary? || Tdfire::BinaryStateStore.real_use_source_pods.include?(root.name))) ||
|
84
|
-
Tdfire::BinaryStateStore.force_use_source?) &&
|
85
|
-
(Tdfire::BinaryStateStore.lib_lint_binary_pod != root.name)
|
81
|
+
((!Pod::Tdfire::BinaryStateStore.force_use_binary? &&
|
82
|
+
(!Pod::Tdfire::BinaryStateStore.use_binary? || Pod::Tdfire::BinaryStateStore.real_use_source_pods.include?(root.name))) ||
|
83
|
+
Pod::Tdfire::BinaryStateStore.force_use_source?) &&
|
84
|
+
(Pod::Tdfire::BinaryStateStore.lib_lint_binary_pod != root.name)
|
86
85
|
end
|
87
86
|
|
88
87
|
def tdfire_should_skip_download?
|
89
|
-
(!Tdfire::BinaryStateStore.force_use_binary? && Tdfire::BinaryStateStore.unpublished_pods.include?(root.name)) ||
|
90
|
-
(Tdfire::BinaryStateStore.lib_lint_binary_pod == root.name)
|
88
|
+
(!Pod::Tdfire::BinaryStateStore.force_use_binary? && Pod::Tdfire::BinaryStateStore.unpublished_pods.include?(root.name)) ||
|
89
|
+
(Pod::Tdfire::BinaryStateStore.lib_lint_binary_pod == root.name)
|
91
90
|
end
|
92
91
|
end
|
93
92
|
end
|