cocoapods-imy-bin 0.2.9.1 → 0.3.0.11
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 +5 -5
- data/lib/cocoapods-imy-bin/command/bin/archive.rb +41 -4
- data/lib/cocoapods-imy-bin/command/bin/auto.rb +7 -5
- data/lib/cocoapods-imy-bin/command/bin/local.rb +16 -7
- data/lib/cocoapods-imy-bin/config/config_builder.rb +39 -2
- data/lib/cocoapods-imy-bin/gem_version.rb +1 -1
- data/lib/cocoapods-imy-bin/helpers.rb +1 -0
- data/lib/cocoapods-imy-bin/helpers/Info.plist +0 -0
- data/lib/cocoapods-imy-bin/helpers/build_helper.rb +15 -7
- data/lib/cocoapods-imy-bin/helpers/build_utils.rb +63 -0
- data/lib/cocoapods-imy-bin/helpers/framework.rb +25 -2
- data/lib/cocoapods-imy-bin/helpers/framework_builder.rb +145 -44
- data/lib/cocoapods-imy-bin/helpers/local/local_build_helper.rb +38 -6
- data/lib/cocoapods-imy-bin/helpers/local/local_framework.rb +20 -0
- data/lib/cocoapods-imy-bin/helpers/local/local_framework_builder.rb +91 -38
- data/lib/cocoapods-imy-bin/helpers/spec_source_creator.rb +65 -8
- data/lib/cocoapods-imy-bin/helpers/upload_helper.rb +8 -3
- data/lib/cocoapods-imy-bin/native.rb +4 -0
- data/lib/cocoapods-imy-bin/native/analyzer.rb +2 -0
- data/lib/cocoapods-imy-bin/native/file_accessor.rb +28 -0
- data/lib/cocoapods-imy-bin/native/pod_target_installer.rb +94 -0
- data/lib/cocoapods-imy-bin/native/podfile_generator.rb +11 -2
- data/lib/cocoapods-imy-bin/native/target_validator.rb +41 -0
- data/lib/cocoapods-imy-bin/native/validator.rb +1 -38
- metadata +9 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 053c2971deff73611963c8a4382c4bd1291ddc13
|
4
|
+
data.tar.gz: 4026e712a30ad0a92cc5f2b77638362cf183c688
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1aa193c1293ffceaa47ef0a926db26749e182771a86bad1bcd1be7a9227d7e7b601ea0efce9cfd71454c1796c2ec1ffb4fae8ab8c475b11b7269f67fe1644ca6
|
7
|
+
data.tar.gz: e5cff6c4998c8ca5bf56bd1c4b85802af2a465fb5f28e9cad9968998f9588948559332401da006724db91524abdae7dfce767837f43742ad2af5b8a374669181
|
@@ -7,6 +7,7 @@ require 'cocoapods-imy-bin/helpers/build_helper'
|
|
7
7
|
require 'cocoapods-imy-bin/helpers/spec_source_creator'
|
8
8
|
require 'cocoapods-imy-bin/config/config_builder'
|
9
9
|
require 'cocoapods-imy-bin/command/bin/lib/lint'
|
10
|
+
require 'xcodeproj'
|
10
11
|
|
11
12
|
module Pod
|
12
13
|
class Command
|
@@ -62,13 +63,14 @@ module Pod
|
|
62
63
|
end
|
63
64
|
|
64
65
|
def run
|
65
|
-
|
66
|
-
|
67
|
-
FileUtils.rm_rf(zip_dir) if File.exist?(zip_dir)
|
66
|
+
# 清除之前的缓存
|
67
|
+
CBin::Config::Builder.instance.clean
|
68
68
|
|
69
69
|
@spec = Specification.from_file(spec_file)
|
70
70
|
generate_project
|
71
71
|
|
72
|
+
swift_pods_buildsetting
|
73
|
+
|
72
74
|
build_root_spec
|
73
75
|
|
74
76
|
sources_sepc = Array.new
|
@@ -155,10 +157,18 @@ module Pod
|
|
155
157
|
"--sources=#{sources_option(@code_dependencies, @sources)}",
|
156
158
|
"--gen-directory=#{CBin::Config::Builder.instance.gen_dir}",
|
157
159
|
'--clean',
|
158
|
-
|
160
|
+
"--verbose",
|
159
161
|
*@additional_args
|
160
162
|
]
|
161
163
|
|
164
|
+
if File.exist?(Pod::Config.instance.podfile_path)
|
165
|
+
argvs += ['--use-podfile']
|
166
|
+
end
|
167
|
+
|
168
|
+
unless CBin::Build::Utils.uses_frameworks?
|
169
|
+
argvs += ['--use-libraries']
|
170
|
+
end
|
171
|
+
|
162
172
|
argvs << spec_file if spec_file
|
163
173
|
|
164
174
|
gen = Pod::Command::Gen.new(CLAide::ARGV.new(argvs))
|
@@ -168,6 +178,33 @@ module Pod
|
|
168
178
|
end
|
169
179
|
end
|
170
180
|
|
181
|
+
def swift_pods_buildsetting
|
182
|
+
# swift_project_link_header
|
183
|
+
worksppace_path = File.expand_path("#{CBin::Config::Builder.instance.gen_dir}/#{@spec.name}")
|
184
|
+
path = File.join(worksppace_path, "Pods.xcodeproj")
|
185
|
+
path = File.join(worksppace_path, "Pods/Pods.xcodeproj") unless File.exist?(path)
|
186
|
+
raise Informative, "#{path} File no exist, please check" unless File.exist?(path)
|
187
|
+
project = Xcodeproj::Project.open(path)
|
188
|
+
project.build_configurations.each do |x|
|
189
|
+
x.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = true #设置生成swift inter
|
190
|
+
end
|
191
|
+
project.save
|
192
|
+
end
|
193
|
+
|
194
|
+
# def swift_project_link_header
|
195
|
+
# worksppace_path = Pod::Config.instance.installation_root
|
196
|
+
# Dir.chdir(worksppace_path) do
|
197
|
+
# shell_script = <<-'SH'.strip_heredoc
|
198
|
+
# ditto "${DERIVED_SOURCES_DIR}/${PRODUCT_MODULE_NAME}-Swift.h" "${CBin::Config::Builder.instance.gen_dir}"
|
199
|
+
# SH
|
200
|
+
# shell_script
|
201
|
+
#
|
202
|
+
# # project = Xcodeproj::Project.open(Dir.glob('*.xcodeproj').first)
|
203
|
+
# # project.build_configurations.each do |x|
|
204
|
+
# # x.build_settings['DERIVED_SOURCES_DIR']
|
205
|
+
# # end
|
206
|
+
# end
|
207
|
+
# end
|
171
208
|
|
172
209
|
def spec_file
|
173
210
|
@spec_file ||= begin
|
@@ -21,7 +21,7 @@ module Pod
|
|
21
21
|
['--all-make', '对该组件的依赖库,全部制作为二进制组件'],
|
22
22
|
['--configuration', 'Build the specified configuration (e.g. Release ). Defaults to Debug'],
|
23
23
|
['--env', "该组件上传的环境 %w[dev debug_iphoneos release_iphoneos]"]
|
24
|
-
]
|
24
|
+
].concat(Pod::Command::Gen.options).concat(super).uniq
|
25
25
|
end
|
26
26
|
|
27
27
|
def initialize(argv)
|
@@ -41,6 +41,7 @@ module Pod
|
|
41
41
|
@verbose = argv.flag?('verbose',true)
|
42
42
|
|
43
43
|
@config = argv.option('configuration', 'Debug')
|
44
|
+
@additional_args = argv.remainder!
|
44
45
|
|
45
46
|
super
|
46
47
|
end
|
@@ -56,7 +57,8 @@ module Pod
|
|
56
57
|
sources_sepc.uniq.each do |spec|
|
57
58
|
begin
|
58
59
|
fail_push_specs << spec unless CBin::Upload::Helper.new(spec,@code_dependencies,@sources).upload
|
59
|
-
rescue
|
60
|
+
rescue Object => exception
|
61
|
+
UI.puts exception
|
60
62
|
fail_push_specs << spec
|
61
63
|
end
|
62
64
|
end
|
@@ -86,15 +88,15 @@ module Pod
|
|
86
88
|
end
|
87
89
|
|
88
90
|
#制作二进制包
|
89
|
-
|
91
|
+
|
90
92
|
def run_archive
|
91
93
|
argvs = [
|
92
94
|
"--sources=#{sources_option(@code_dependencies, @sources)},https:\/\/cdn.cocoapods.org",
|
93
|
-
|
94
|
-
"--verbose"
|
95
|
+
@additional_args
|
95
96
|
]
|
96
97
|
|
97
98
|
argvs << spec_file if spec_file
|
99
|
+
argvs.delete(Array.new)
|
98
100
|
|
99
101
|
unless @clean
|
100
102
|
argvs += ['--no-clean']
|
@@ -61,11 +61,11 @@ module Pod
|
|
61
61
|
|
62
62
|
def run
|
63
63
|
# 清除之前的缓存
|
64
|
-
temp = File.join(@local_build_dir, @platform.to_s)
|
65
|
-
FileUtils.rm_r(temp) if File.exist? temp
|
66
|
-
if File.exist?(CBin::Config::Builder.instance.zip_dir)
|
67
|
-
|
68
|
-
end
|
64
|
+
# temp = File.join(@local_build_dir, @platform.to_s)
|
65
|
+
# FileUtils.rm_r(temp) if File.exist? temp
|
66
|
+
# if File.exist?(CBin::Config::Builder.instance.zip_dir)
|
67
|
+
# FileUtils.rm_rf(Dir.glob("#{CBin::Config::Builder.instance.zip_dir}/*"))
|
68
|
+
# end
|
69
69
|
|
70
70
|
sources_spec = []
|
71
71
|
Dir.chdir(CBin::Config::Builder.instance.local_psec_dir) do
|
@@ -107,6 +107,7 @@ module Pod
|
|
107
107
|
# 获取没有制作二进制版本的spec集合
|
108
108
|
sources_sepc << spec
|
109
109
|
end
|
110
|
+
|
110
111
|
fail_build_specs = []
|
111
112
|
sources_sepc.uniq.each do |spec|
|
112
113
|
begin
|
@@ -146,9 +147,17 @@ module Pod
|
|
146
147
|
private
|
147
148
|
|
148
149
|
def library_exist(spec)
|
149
|
-
File.exist?(File.join(@local_build_dir, "lib#{spec.name}.a"))
|
150
|
+
File.exist?(File.join(@local_build_dir, "lib#{spec.name}.a")) || is_framework(spec)
|
151
|
+
end
|
152
|
+
# 使用了user_framework 会有#{@spec.name}.framework
|
153
|
+
# 未使用的 需要判断文件
|
154
|
+
def is_framework(spec)
|
155
|
+
res = File.exist?(File.join(@local_build_dir, "#{spec.name}.framework"))
|
156
|
+
unless res
|
157
|
+
res = File.exist?(File.join(CBin::Config::Builder.instance.xcode_BuildProductsPath_dir, "#{spec.name}","Swift Compatibility Header"))
|
158
|
+
end
|
159
|
+
res
|
150
160
|
end
|
151
|
-
|
152
161
|
|
153
162
|
end
|
154
163
|
end
|
@@ -12,6 +12,7 @@ module CBin
|
|
12
12
|
|
13
13
|
def initialize
|
14
14
|
load_build_config
|
15
|
+
# clean
|
15
16
|
end
|
16
17
|
|
17
18
|
# 加载配置项
|
@@ -35,6 +36,13 @@ module CBin
|
|
35
36
|
|
36
37
|
end
|
37
38
|
|
39
|
+
def clean
|
40
|
+
#清除之前的缓存
|
41
|
+
FileUtils.rm_rf(Dir.glob("#{zip_dir}/*")) if File.exist?(zip_dir)
|
42
|
+
FileUtils.rm_rf(Dir.glob("#{binary_json_dir}/*")) if File.exist?(binary_json_dir)
|
43
|
+
FileUtils.rm_rf(Dir.glob("#{local_psec_dir}/*")) if File.exist?(local_psec_dir)
|
44
|
+
end
|
45
|
+
|
38
46
|
# 制作二进制打包 工程目录
|
39
47
|
def gen_name
|
40
48
|
'bin-archive'
|
@@ -49,10 +57,19 @@ module CBin
|
|
49
57
|
end
|
50
58
|
end
|
51
59
|
|
60
|
+
|
52
61
|
def framework_name(spec)
|
53
62
|
"#{spec.name}.framework"
|
54
63
|
end
|
55
64
|
|
65
|
+
def framework_name_version(spec)
|
66
|
+
"#{spec.name}.framework_#{spec.version}"
|
67
|
+
end
|
68
|
+
|
69
|
+
def framework_zip_file(spec)
|
70
|
+
File.join(zip_dir_name, framework_name_version(spec))
|
71
|
+
end
|
72
|
+
|
56
73
|
def framework_file(spec)
|
57
74
|
File.join(zip_dir_name, framework_name(spec))
|
58
75
|
end
|
@@ -110,7 +127,8 @@ module CBin
|
|
110
127
|
#编译target名,如 seeyou
|
111
128
|
def target_name
|
112
129
|
@target_name ||= begin
|
113
|
-
Pod::Config.instance.podfile.root_target_definitions.first.children.first.to_s
|
130
|
+
target_name_str = Pod::Config.instance.podfile.root_target_definitions.first.children.first.to_s
|
131
|
+
target_name_str[5,target_name_str.length]
|
114
132
|
end
|
115
133
|
end
|
116
134
|
|
@@ -129,6 +147,7 @@ module CBin
|
|
129
147
|
if @xcode_build_name.nil? || Dir.exist?(@xcode_build_name)
|
130
148
|
@xcode_build_name = "xcode-build/Build/Intermediates.noindex/ArchiveIntermediates/#{target_name}/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/"
|
131
149
|
end
|
150
|
+
puts @xcode_build_name
|
132
151
|
@xcode_build_name
|
133
152
|
end
|
134
153
|
end
|
@@ -146,7 +165,25 @@ module CBin
|
|
146
165
|
end
|
147
166
|
end
|
148
167
|
end
|
149
|
-
|
168
|
+
#完整的xcodebuild BuildProductsPath输出路径,
|
169
|
+
def xcode_BuildProductsPath_dir
|
170
|
+
@xcode_BuildProductsPath_dir ||= begin
|
171
|
+
temp_xcode_BuildProductsPath_dir = "xcode-build/Build/Intermediates.noindex/ArchiveIntermediates/#{target_name}/BuildProductsPath/"
|
172
|
+
full_path = File.join(root_dir, temp_xcode_BuildProductsPath_dir)
|
173
|
+
|
174
|
+
if (File.exist?(full_path))
|
175
|
+
Dir.chdir(full_path) do
|
176
|
+
iphoneos = Dir.glob('*-iphoneos')
|
177
|
+
if iphoneos.length > 0
|
178
|
+
full_path = File.join(full_path,iphoneos.first)
|
179
|
+
else
|
180
|
+
UI.warn "====== 找不到 *-iphoneos @xcode_BuildProductsPath_dir = #{@xcode_BuildProductsPath_dir}"
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
Pathname.new(full_path)
|
185
|
+
end
|
186
|
+
end
|
150
187
|
|
151
188
|
|
152
189
|
#处理编译产物后存储根目录,会存放spec、 json、zip的父目录,默认是工程的同级目录下,"#{basename}-build-temp"
|
Binary file
|
@@ -38,9 +38,12 @@ module CBin
|
|
38
38
|
|
39
39
|
build_static_framework
|
40
40
|
unless @skip_archive
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
unless CBin::Build::Utils.is_framework(@spec)
|
42
|
+
build_static_library
|
43
|
+
zip_static_library
|
44
|
+
else
|
45
|
+
zip_static_framework
|
46
|
+
end
|
44
47
|
end
|
45
48
|
|
46
49
|
end
|
@@ -71,15 +74,15 @@ module CBin
|
|
71
74
|
end
|
72
75
|
|
73
76
|
def zip_static_framework
|
74
|
-
Dir.chdir(
|
75
|
-
output_name =
|
77
|
+
Dir.chdir(File.join(workspace_directory,@framework_path.root_path)) do
|
78
|
+
output_name = File.join(zip_dir, framework_name_zip)
|
76
79
|
unless File.exist?(framework_name)
|
77
|
-
|
80
|
+
UI.puts "没有需要压缩的 framework 文件:#{framework_name}"
|
81
|
+
return
|
78
82
|
end
|
79
83
|
|
80
84
|
UI.puts "Compressing #{framework_name} into #{output_name}"
|
81
85
|
`zip --symlinks -r #{output_name} #{framework_name}`
|
82
|
-
|
83
86
|
end
|
84
87
|
end
|
85
88
|
|
@@ -114,6 +117,10 @@ module CBin
|
|
114
117
|
CBin::Config::Builder.instance.framework_name(@spec)
|
115
118
|
end
|
116
119
|
|
120
|
+
def framework_name_zip
|
121
|
+
CBin::Config::Builder.instance.framework_name_version(@spec) + ".zip"
|
122
|
+
end
|
123
|
+
|
117
124
|
def library_name
|
118
125
|
CBin::Config::Builder.instance.library_name(@spec)
|
119
126
|
end
|
@@ -130,6 +137,7 @@ module CBin
|
|
130
137
|
CBin::Config::Builder.instance.gen_dir
|
131
138
|
end
|
132
139
|
|
140
|
+
|
133
141
|
def spec_file
|
134
142
|
@spec_file ||= begin
|
135
143
|
if @podspec
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'cocoapods-imy-bin/config/config'
|
3
|
+
|
4
|
+
module CBin
|
5
|
+
class Build
|
6
|
+
|
7
|
+
class Utils
|
8
|
+
|
9
|
+
def Utils.is_framework(spec)
|
10
|
+
if Utils.uses_frameworks?
|
11
|
+
return true
|
12
|
+
end
|
13
|
+
|
14
|
+
return Utils.is_swift_module(spec)
|
15
|
+
end
|
16
|
+
|
17
|
+
def Utils.is_swift_module(spec)
|
18
|
+
|
19
|
+
is_framework = false
|
20
|
+
dir = File.join(CBin::Config::Builder.instance.gen_dir, CBin::Config::Builder.instance.target_name)
|
21
|
+
#auto 走这里
|
22
|
+
if File.exist?(dir)
|
23
|
+
Dir.chdir(dir) do
|
24
|
+
public_headers = Array.new
|
25
|
+
spec_header_dir = "./Headers/Public/#{spec.name}"
|
26
|
+
|
27
|
+
unless File.exist?(spec_header_dir)
|
28
|
+
spec_header_dir = "./Pods/Headers/Public/#{spec.name}"
|
29
|
+
end
|
30
|
+
return false unless File.exist?(spec_header_dir)
|
31
|
+
|
32
|
+
is_framework = File.exist?(File.join(spec_header_dir, "#{spec.name}-umbrella.h"))
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
if $ARGV[1] == "local"
|
37
|
+
is_framework = File.exist?(File.join(CBin::Config::Builder.instance.xcode_build_dir, "#{spec.name}.framework"))
|
38
|
+
unless is_framework
|
39
|
+
is_framework = File.exist?(File.join(CBin::Config::Builder.instance.xcode_BuildProductsPath_dir, "#{spec.name}","Swift Compatibility Header"))
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
is_framework
|
44
|
+
end
|
45
|
+
|
46
|
+
def Utils.uses_frameworks?
|
47
|
+
uses_frameworks = false
|
48
|
+
Pod::Config.instance.podfile.target_definitions.each do |key,value|
|
49
|
+
if key != "Pods"
|
50
|
+
uses_frameworks = value.uses_frameworks?
|
51
|
+
if uses_frameworks
|
52
|
+
break ;
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
return uses_frameworks
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
@@ -7,6 +7,8 @@ module CBin
|
|
7
7
|
attr_reader :resources_path
|
8
8
|
attr_reader :root_path
|
9
9
|
attr_reader :versions_path
|
10
|
+
attr_reader :swift_module_path
|
11
|
+
attr_reader :fwk_path
|
10
12
|
|
11
13
|
def initialize(name, platform)
|
12
14
|
@name = name
|
@@ -22,8 +24,24 @@ module CBin
|
|
22
24
|
end
|
23
25
|
|
24
26
|
def delete_resources
|
25
|
-
Pathname.new(@resources_path).rmtree
|
26
|
-
(Pathname.new(@fwk_path) + Pathname.new('Resources')).delete
|
27
|
+
Pathname.new(@resources_path).rmtree if File.exist? (@resources_path)
|
28
|
+
(Pathname.new(@fwk_path) + Pathname.new('Resources')).delete if File.exist?(Pathname.new(@fwk_path) + Pathname.new('Resources'))
|
29
|
+
end
|
30
|
+
|
31
|
+
def remove_current_version
|
32
|
+
FileUtils.rm_f(File.join(@fwk_path,@name))
|
33
|
+
FileUtils.rm_f(File.join(@fwk_path,"Headers"))
|
34
|
+
FileUtils.rm_f(File.join(@fwk_path,"Resources"))
|
35
|
+
|
36
|
+
FileUtils.cp_r("#{@versions_path}/.", @fwk_path)
|
37
|
+
# FileUtils.remove_dir(@versions_path)
|
38
|
+
FileUtils.remove_dir("#{@fwk_path}/Versions")
|
39
|
+
|
40
|
+
# current_version_path = @versions_path + Pathname.new('../Current')
|
41
|
+
# `ln -sf A #{current_version_path}`
|
42
|
+
# `ln -sf Versions/Current/Headers #{@fwk_path}/`
|
43
|
+
# `ln -sf Versions/Current/Resources #{@fwk_path}/`
|
44
|
+
# `ln -sf Versions/Current/#{@name} #{@fwk_path}/`
|
27
45
|
end
|
28
46
|
|
29
47
|
private
|
@@ -36,11 +54,16 @@ module CBin
|
|
36
54
|
`ln -sf Versions/Current/#{@name} #{@fwk_path}/`
|
37
55
|
end
|
38
56
|
|
57
|
+
|
58
|
+
|
39
59
|
def make_framework
|
40
60
|
@fwk_path = @root_path + Pathname.new(@name + '.framework')
|
41
61
|
@fwk_path.mkdir unless @fwk_path.exist?
|
42
62
|
|
43
63
|
@module_map_path = @fwk_path + Pathname.new('Modules')
|
64
|
+
@swift_module_path = @module_map_path + Pathname.new(@name + '.swiftmodule')
|
65
|
+
|
66
|
+
|
44
67
|
@versions_path = @fwk_path + Pathname.new('Versions/A')
|
45
68
|
end
|
46
69
|
|