pod-pipeline 0.5.6 → 0.5.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7fbd23977836c8304f119e084ffd3cf0f87921d3334da995d64bebf4da292014
4
- data.tar.gz: c16a55398d8dabcd46ea2c84c210d9d94c804f4c01ddc71169de1240932d5737
3
+ metadata.gz: 16980dad637c15796234c1cdb4e559152e1136397d6cf860d9cc9a3d1aaecca9
4
+ data.tar.gz: 1340eb923bc0856d793cecf302e64bc34e2e3fb59dd254b0e93130bc309fa96c
5
5
  SHA512:
6
- metadata.gz: 0542201f03feb3de6cb8719db8c6bd47172343666a29f58c72425323566eb1a0367194c5a5a9f7c55e02edbd5e3b397c8c791a4efdbb7dbd95e09a62a2565e79
7
- data.tar.gz: 5047175beed47d81de9f96f016e70b4acec1bbd60be78b3700c1a17b5cdcda8d122bcec903cd555944eefb2293cb3fbf3f8d42e754a8cafad94edd6daed23f77
6
+ metadata.gz: 1955fd51720cb745dbfcd234dbd983ce0df51a0ebcad4366f8fd61ab8a792f8cf4b51f2ddde773252820378df4347011510d9282bc5917583d94902370649aee
7
+ data.tar.gz: 16ac4680004b7ebab8e0067037d2c67df4d44fc6f0b5ba0c1d08d184a56cd781b2eac5c54d65a5f64c6bb1dcc5fae8ffacf7c720e6a0efc3bae887103dba6104
@@ -4,6 +4,7 @@ require 'pod-pipeline/util/scanner'
4
4
  require 'pod-pipeline/util/xcodebuild'
5
5
  require 'pod-pipeline/util/binary'
6
6
  require 'pod-pipeline/util/bundle'
7
+ require 'pod-pipeline/util/header'
7
8
 
8
9
  require 'pod-pipeline/extension/dir-ppl'
9
10
 
@@ -23,7 +24,9 @@ module PPL
23
24
  ['--configuration=Release', '项目构建的环境。(默认为Release)'],
24
25
  ['--arch=arm64,armv7,x86_64', '项目构建的架构。(默认为 arm64,armv7,x86_64)'],
25
26
  ['--combine=local,pod', '项目构建后合并依赖库的二进制文件,local为本地依赖库,pod为CocoaPods依赖库。(默认为 不合并)'],
26
- ['--combine-ignore=name1,name2', '项目构建后合并依赖库的二进制文件,标注不想合并的内容。'],
27
+ ['--combine-headers=false', '项目构建后合并依赖库的头文件。(默认为 不合并)'],
28
+ ['--combine-include=name1,name2', '项目构建后合并依赖库的二进制文件,标注想合并的内容,执行顺序在exclude前。'],
29
+ ['--combine-exclude=name1,name2', '项目构建后合并依赖库的二进制文件,标注不想合并的内容,执行顺序在include后。'],
27
30
  ['--bundle-merge=merge', '是否合并所有资源包,参数为合并后的资源包名。(默认为 不合并)'],
28
31
  ].concat(super)
29
32
  end
@@ -34,7 +37,9 @@ module PPL
34
37
  @configuration = argv.option('configuration', '').split(',').first
35
38
  @archs = argv.option('arch', '').split(',')
36
39
  @combines = argv.option('combine', '').split(',')
37
- @combine_ignore = argv.option('combine-ignore', '').split(',')
40
+ @combine_headers = argv.option('combine-headers', false)
41
+ @combine_include = argv.option('combine-include', '').split(',')
42
+ @combine_exclude = argv.option('combine-exclude', '').split(',')
38
43
  @bundle_merge = argv.option('bundle-merge', '').split(',').first
39
44
 
40
45
  @projectPath = @path.count.zero? ? Pathname.pwd.to_s : @path.first
@@ -65,9 +70,9 @@ module PPL
65
70
  XCodebuild.build(@workspace.path, @podspec.name, arch, @configuration, @build_path)
66
71
  end
67
72
 
68
- #添加头文件
69
- puts "\n[添加Framework头文件]"
70
- add_headers
73
+ #合并头文件
74
+ puts "\n[合并 #{@combines.join(", ")} 的头文件]"
75
+ combine_headers(@combines.include?('local'), @combines.include?('pod'))
71
76
 
72
77
  #合并二进制文件
73
78
  puts "\n[合并 #{@combines.join(", ")} 的二进制文件]"
@@ -96,31 +101,50 @@ module PPL
96
101
  end
97
102
 
98
103
  def add_headers
99
- header_stands = "#{@output}/Example/Pods/Headers/Public/#{@podspec.name}/*.h"
100
- Dir[header_stands].each do |header_stand|
101
- if File.ftype(header_stand).eql? 'link'
102
- header_file = "#{File.dirname(header_stand)}/#{File.readlink(header_stand)}"
103
- if File.ftype(header_file).eql? 'file'
104
- header_file_basename = File.basename(header_file)
105
- if !(File.exist? "#{@framework_headers_path}/#{header_file_basename}")
106
- puts header_file_basename
107
- FileUtils.cp(header_file, @framework_headers_path)
108
- end
109
- end
110
- end
104
+ # header_stands = "#{@output}/Example/Pods/Headers/Public/#{@podspec.name}/*.h"
105
+ # Dir[header_stands].each do |header_stand|
106
+ # if File.ftype(header_stand).eql? 'link'
107
+ # header_file = "#{File.dirname(header_stand)}/#{File.readlink(header_stand)}"
108
+ # if File.ftype(header_file).eql? 'file'
109
+ # header_file_basename = File.basename(header_file)
110
+ # if !(File.exist? "#{@framework_headers_path}/#{header_file_basename}")
111
+ # puts header_file_basename
112
+ # FileUtils.cp(header_file, @framework_headers_path)
113
+ # end
114
+ # end
115
+ # end
116
+ # end
117
+ # header_files = "#{@build_path}/**/#{@podspec.name}.framework/Headers/*.h"
118
+ # Dir[header_files].each do |header_file|
119
+ # if File.ftype(header_file).eql? 'file'
120
+ # header_file_basename = File.basename(header_file)
121
+ # if !(File.exist? "#{@framework_headers_path}/#{header_file_basename}")
122
+ # puts header_file_basename
123
+ # FileUtils.cp(header_file, @framework_headers_path)
124
+ # end
125
+ # end
126
+ # end
127
+ end
128
+
129
+ def combine_headers(local_dependency, pod_dependency)
130
+ headers = "#{@framework_path}/Headers"
131
+ #添加 构建生成的二进制文件
132
+ inputs = []
133
+ inputs << "#{@build_path}/*/**/#{@podspec.name}.framework"
134
+ if local_dependency
135
+ #添加 本地依赖的二进制文件
136
+ inputs << "#{@output}/#{@podspec.name}/Frameworks/**/*.framework"
111
137
  end
112
- header_files = "#{@build_path}/**/#{@podspec.name}.framework/Headers/*.h"
113
- Dir[header_files].each do |header_file|
114
- if File.ftype(header_file).eql? 'file'
115
- header_file_basename = File.basename(header_file)
116
- if !(File.exist? "#{@framework_headers_path}/#{header_file_basename}")
117
- puts header_file_basename
118
- FileUtils.cp(header_file, @framework_headers_path)
119
- end
120
- end
138
+ if pod_dependency
139
+ #添加 Pod依赖库构建生成的二进制文件
140
+ inputs << "#{@build_path}/*/**/*.framework"
141
+ #添加 Pod依赖库本地依赖的二进制文件
142
+ inputs << "#{@output}/Example/Pods/**/Frameworks/**/*.framework"
121
143
  end
122
- end
123
144
 
145
+ Header.combine(headers, inputs, @combine_include, @combine_exclude)
146
+ end
147
+
124
148
  def combine_binarys(local_dependency, pod_dependency)
125
149
  binary = "#{@framework_path}/#{@podspec.name}"
126
150
  #添加 构建生成的二进制文件
@@ -134,8 +158,8 @@ module PPL
134
158
  end
135
159
  if pod_dependency
136
160
  #添加 Pod依赖库构建生成的二进制文件
137
- inputs << "#{@build_path}/*/**/lib*.a";
138
- inputs << "#{@build_path}/*/**/*.framework/*";
161
+ inputs << "#{@build_path}/*/**/lib*.a"
162
+ inputs << "#{@build_path}/*/**/*.framework/*"
139
163
  #添加 Pod依赖库预先构建的二进制文件
140
164
  inputs << "#{@output}/Example/Pods/**/*SDK/*.framework/*"
141
165
  #添加 Pod依赖库本地依赖的二进制文件
@@ -143,7 +167,7 @@ module PPL
143
167
  inputs << "#{@output}/Example/Pods/**/Frameworks/**/*.framework/*"
144
168
  end
145
169
 
146
- Binary.combine(binary, inputs, @combine_ignore)
170
+ Binary.combine(binary, inputs, @combine_include, @combine_exclude)
147
171
  Binary.thin(binary, @archs)
148
172
  end
149
173
 
@@ -165,7 +189,7 @@ module PPL
165
189
  inputs << "#{@output}/Example/Pods/**/Frameworks/**/*.bundle"
166
190
  end
167
191
 
168
- Bundle.cp(inputs, @build_path, @combine_ignore)
192
+ Bundle.combine(inputs, @build_path, @combine_include, @combine_exclude)
169
193
  end
170
194
 
171
195
  def merge_bundles
@@ -1,6 +1,6 @@
1
1
  module PPL
2
2
  class Binary
3
- def self.combine(output, inputs, ignore_list=[])
3
+ def self.combine(output, inputs, include_list=[], exclude_list=[])
4
4
  puts "\n目标文件:#{output}\n"
5
5
 
6
6
  #获取合并文件的路径序列
@@ -15,17 +15,32 @@ module PPL
15
15
  info_log = `lipo -info "#{input_file}" > /dev/null 2>&1
16
16
  echo result:$?`
17
17
  next unless info_log.include? 'result:0'
18
- #若 input_file 为被忽略标记的文件 则跳过
19
- is_ignore = false
20
- ignore_list.each { |ignore|
21
- input_file_basename = File.basename(input_file)
22
- ignore_basename = File.basename(ignore)
23
- if input_file_basename == ignore_basename || input_file_basename == "lib#{ignore_basename}.a"
24
- is_ignore = true
25
- break
26
- end
27
- }
28
- next if is_ignore
18
+ #若 input_file 非被include标记的文件 则跳过
19
+ unless include_list.empty?
20
+ is_include = false
21
+ include_list.each { |include|
22
+ input_file_basename = File.basename(input_file)
23
+ include_basename = File.basename(include)
24
+ if input_file_basename == include_basename || input_file_basename == "lib#{include_basename}.a"
25
+ is_include = true
26
+ break
27
+ end
28
+ }
29
+ next unless is_include
30
+ end
31
+ #若 input_file 为被exclude标记的文件 则跳过
32
+ unless exclude_list.empty?
33
+ is_exclude = false
34
+ exclude_list.each { |exclude|
35
+ input_file_basename = File.basename(input_file)
36
+ exclude_basename = File.basename(exclude)
37
+ if input_file_basename == exclude_basename || input_file_basename == "lib#{exclude_basename}.a"
38
+ is_exclude = true
39
+ break
40
+ end
41
+ }
42
+ next if is_exclude
43
+ end
29
44
  #若 input_file 为序列中已存在的文件 则跳过
30
45
  next if input_file_queue.include? input_file
31
46
 
@@ -66,7 +81,7 @@ module PPL
66
81
  return
67
82
  end
68
83
  end
69
- File.delete(binary)
84
+ File.delete(binary) if File.exist? binary
70
85
 
71
86
  binary_pieces = "#{binary}-*"
72
87
  combine(binary, [binary_pieces])
@@ -1,6 +1,6 @@
1
1
  module PPL
2
2
  class Bundle
3
- def self.cp(inputs, output, ignore_list=[])
3
+ def self.combine(inputs, output, include_list=[], exclude_list=[])
4
4
  puts "\n目标文件:#{output}\n"
5
5
 
6
6
  #获取合并文件的路径序列
@@ -10,17 +10,32 @@ module PPL
10
10
  Dir[input].each do |input_bundle|;
11
11
  #若 input_bundle 为输出目录 则跳过
12
12
  next if input_bundle.eql? output
13
- #若 input_bundle 为被忽略标记的文件 则跳过
14
- is_ignore = false
15
- ignore_list.each { |ignore|
16
- input_file_basename = File.basename(input_bundle)
17
- ignore_basename = File.basename(ignore)
18
- if input_file_basename == "#{ignore_basename}.bundle"
19
- is_ignore = true
20
- break
21
- end
22
- }
23
- next if is_ignore
13
+ #若 input_file 非被include标记的文件 则跳过
14
+ unless include_list.empty?
15
+ is_include = false
16
+ include_list.each { |include|
17
+ input_file_basename = File.basename(input_bundle)
18
+ include_basename = File.basename(include)
19
+ if input_file_basename == "#{include_basename}.bundle"
20
+ is_include = true
21
+ break
22
+ end
23
+ }
24
+ next unless is_include
25
+ end
26
+ #若 input_file 为被exclude标记的文件 则跳过
27
+ unless exclude_list.empty?
28
+ is_exclude = false
29
+ exclude_list.each { |exclude|
30
+ input_file_basename = File.basename(input_bundle)
31
+ exclude_basename = File.basename(exclude)
32
+ if input_file_basename == "#{exclude_basename}.bundle"
33
+ is_exclude = true
34
+ break
35
+ end
36
+ }
37
+ next if is_exclude
38
+ end
24
39
  #合并
25
40
  puts "合并资源包:" + input_bundle
26
41
  FileUtils.cp_r(input_bundle, output, :preserve => true)
@@ -0,0 +1,58 @@
1
+ module PPL
2
+ # PPL::Header
3
+ class Header
4
+ def self.combine_check(path, pattern_list = [])
5
+ return false if pattern_list.empty?
6
+
7
+ path_basename = File.basename(path)
8
+ pattern_list.each do |pattern|
9
+ pattern_basename = File.basename(pattern)
10
+
11
+ return true if path_basename == "#{pattern_basename}.framework"
12
+ end
13
+
14
+ false
15
+ end
16
+
17
+ def self.combine_check_skip(path, queue, include_list = [], exclude_list = [])
18
+ # 若 path 非目录 则跳过
19
+ return true unless File.directory?(path)
20
+ # 若 path 非被include标记的文件 则跳过
21
+ return true unless combine_check(path, include_list)
22
+ # 若 path 为被exclude标记的文件 则跳过
23
+ return true if combine_check(path, exclude_list)
24
+ # 若 path 为序列中已存在的文件 则跳过
25
+ return true if queue.include? path
26
+
27
+ false
28
+ end
29
+
30
+ def self.combine_collect(inputs, include_list = [], exclude_list = [])
31
+ # 获取合并文件的路径序列
32
+ input_queue = []
33
+ inputs.each do |input|
34
+ puts "\n合并路径:#{input}"
35
+
36
+ Dir[input].each do |input_path|
37
+ next if combine_check_skip(input_path, input_queue, include_list, exclude_list)
38
+
39
+ # 合并
40
+ puts "=> #{input_path}"
41
+ input_queue << input_path
42
+ end
43
+ end
44
+
45
+ input_queue
46
+ end
47
+
48
+ def self.combine(output, inputs, include_list = [], exclude_list = [])
49
+ puts "\n目标文件:#{output}\n"
50
+
51
+ combine_collect(inputs, include_list, exclude_list).each do |input|
52
+ Dir["#{input}/Headers/*.h"].each do |header|
53
+ FileUtils.cp(header, output, 'preserve': true)
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pod-pipeline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6
4
+ version: 0.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - 郑贤达
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-04 00:00:00.000000000 Z
11
+ date: 2023-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods-core
@@ -133,6 +133,7 @@ files:
133
133
  - lib/pod-pipeline/extension/workspace-ppl.rb
134
134
  - lib/pod-pipeline/util/binary.rb
135
135
  - lib/pod-pipeline/util/bundle.rb
136
+ - lib/pod-pipeline/util/header.rb
136
137
  - lib/pod-pipeline/util/scanner.rb
137
138
  - lib/pod-pipeline/util/xcodebuild.rb
138
139
  homepage: https://github.com/TokiGems/pod-pipeline