pod-pipeline 0.5.6 → 0.5.8

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
  SHA256:
3
- metadata.gz: 7fbd23977836c8304f119e084ffd3cf0f87921d3334da995d64bebf4da292014
4
- data.tar.gz: c16a55398d8dabcd46ea2c84c210d9d94c804f4c01ddc71169de1240932d5737
3
+ metadata.gz: b21a6b46fe8b53d7f5a67e42925ce3cb650cb0add13f345370b3536d4d0bc57e
4
+ data.tar.gz: 47f60f1813e7a0f59e90165917489522e1ba4a69586721cb611f491fcc1d8392
5
5
  SHA512:
6
- metadata.gz: 0542201f03feb3de6cb8719db8c6bd47172343666a29f58c72425323566eb1a0367194c5a5a9f7c55e02edbd5e3b397c8c791a4efdbb7dbd95e09a62a2565e79
7
- data.tar.gz: 5047175beed47d81de9f96f016e70b4acec1bbd60be78b3700c1a17b5cdcda8d122bcec903cd555944eefb2293cb3fbf3f8d42e754a8cafad94edd6daed23f77
6
+ metadata.gz: 5be551fc3105d8309f3802fb33ef106e13557be4d11f8c621417e628771d8ea3ef9472ea13062587941cef03bff3eb07d6e100a49e7484b572845549d7a2a61a
7
+ data.tar.gz: 9d63c3428036d8f96b36f882ba6b5a27a08e58e8cdcab014530a197b97903357638c7a1affc05a2982045bdc8e96f1ae4167c233c2f2d52c1d7b96c9c8619fb4
@@ -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(", ")} 的二进制文件]"
@@ -121,6 +126,26 @@ module PPL
121
126
  end
122
127
  end
123
128
 
129
+ def combine_headers(local_dependency, pod_dependency)
130
+ headers = "#{@framework_path}/Headers"
131
+ #添加 构建生成的二进制文件
132
+ inputs = []
133
+ if local_dependency
134
+ #添加 本地依赖的二进制文件
135
+ inputs << "#{@output}/#{@podspec.name}/Frameworks/**/*.framework"
136
+ end
137
+ if pod_dependency
138
+ #添加 Pod依赖库构建生成的二进制文件
139
+ inputs << "#{@build_path}/*/**/*.framework"
140
+ #添加 Pod依赖库本地依赖的二进制文件
141
+ inputs << "#{@output}/Example/Pods/**/Frameworks/**/*.framework"
142
+ end
143
+
144
+ Header.combine(headers, inputs, @combine_include, @combine_exclude)
145
+
146
+ add_headers
147
+ end
148
+
124
149
  def combine_binarys(local_dependency, pod_dependency)
125
150
  binary = "#{@framework_path}/#{@podspec.name}"
126
151
  #添加 构建生成的二进制文件
@@ -134,8 +159,8 @@ module PPL
134
159
  end
135
160
  if pod_dependency
136
161
  #添加 Pod依赖库构建生成的二进制文件
137
- inputs << "#{@build_path}/*/**/lib*.a";
138
- inputs << "#{@build_path}/*/**/*.framework/*";
162
+ inputs << "#{@build_path}/*/**/lib*.a"
163
+ inputs << "#{@build_path}/*/**/*.framework/*"
139
164
  #添加 Pod依赖库预先构建的二进制文件
140
165
  inputs << "#{@output}/Example/Pods/**/*SDK/*.framework/*"
141
166
  #添加 Pod依赖库本地依赖的二进制文件
@@ -143,7 +168,7 @@ module PPL
143
168
  inputs << "#{@output}/Example/Pods/**/Frameworks/**/*.framework/*"
144
169
  end
145
170
 
146
- Binary.combine(binary, inputs, @combine_ignore)
171
+ Binary.combine(binary, inputs, @combine_include, @combine_exclude)
147
172
  Binary.thin(binary, @archs)
148
173
  end
149
174
 
@@ -165,7 +190,7 @@ module PPL
165
190
  inputs << "#{@output}/Example/Pods/**/Frameworks/**/*.bundle"
166
191
  end
167
192
 
168
- Bundle.cp(inputs, @build_path, @combine_ignore)
193
+ Bundle.combine(inputs, @build_path, @combine_include, @combine_exclude)
169
194
  end
170
195
 
171
196
  def merge_bundles
@@ -0,0 +1,36 @@
1
+ require 'pod-pipeline/util/scanner'
2
+
3
+ module PPL
4
+ class Command
5
+ class Scan < Command
6
+ class Depend < Scan
7
+ self.summary = '输出 Pod 配置信息'
8
+
9
+ self.description = <<-DESC
10
+ 输出 Pod 配置信息。
11
+ DESC
12
+
13
+ self.arguments = [
14
+ CLAide::Argument.new('项目根目录(默认使用当前目录)', false),
15
+ ]
16
+ def self.options
17
+ [].concat(super)
18
+ end
19
+
20
+ def initialize(argv)
21
+ @path = argv.arguments!
22
+
23
+ @projectPath = @path.count.zero? ? Pathname.pwd.to_s : @path.first
24
+
25
+ super
26
+ end
27
+
28
+ def run
29
+ PPL::Scanner.new(@projectPath, ['depend']).run
30
+
31
+ puts "#{PPL::Scanner.depend}" if PPL::Scanner.depend
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -1,5 +1,6 @@
1
1
  require 'pod-pipeline/command/scan/name'
2
2
  require 'pod-pipeline/command/scan/version'
3
+ require 'pod-pipeline/command/scan/depend'
3
4
  require 'pod-pipeline/command/scan/remote'
4
5
  require 'pod-pipeline/command/scan/branch'
5
6
  require 'pod-pipeline/command/scan/workspace'
@@ -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
@@ -10,6 +10,7 @@ module PPL
10
10
  @@linter = nil
11
11
  @@name = nil
12
12
  @@version = nil
13
+ @@depend = nil
13
14
  @@git = nil
14
15
  @@remote = nil
15
16
  @@branch = nil
@@ -30,6 +31,7 @@ module PPL
30
31
  @@linter = scan_pod @projectPath
31
32
  @@name = @@linter.spec.name
32
33
  @@version = @@linter.spec.version
34
+ @@depend = @@linter.spec.dependencies
33
35
  @@git = scan_git @projectPath
34
36
  @@remote = @@git.remote
35
37
  @@branch = @@git.branches.current.first
@@ -40,6 +42,9 @@ module PPL
40
42
  when "version"
41
43
  @@linter = scan_pod @projectPath
42
44
  @@version = @@linter.spec.version
45
+ when "depend"
46
+ @@linter = scan_pod @projectPath
47
+ @@depend = @@linter.spec.dependencies.map{ |depend| depend.name }.join(',')
43
48
  when "remote"
44
49
  @@git = scan_git @projectPath
45
50
  @@remote = @@git.remote
@@ -68,6 +73,10 @@ module PPL
68
73
  @@version
69
74
  end
70
75
 
76
+ def self.depend
77
+ @@depend
78
+ end
79
+
71
80
  def self.git
72
81
  @@git
73
82
  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.8
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-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods-core
@@ -120,6 +120,7 @@ files:
120
120
  - lib/pod-pipeline/command/scan.rb
121
121
  - lib/pod-pipeline/command/scan/all.rb
122
122
  - lib/pod-pipeline/command/scan/branch.rb
123
+ - lib/pod-pipeline/command/scan/depend.rb
123
124
  - lib/pod-pipeline/command/scan/name.rb
124
125
  - lib/pod-pipeline/command/scan/remote.rb
125
126
  - lib/pod-pipeline/command/scan/version.rb
@@ -133,6 +134,7 @@ files:
133
134
  - lib/pod-pipeline/extension/workspace-ppl.rb
134
135
  - lib/pod-pipeline/util/binary.rb
135
136
  - lib/pod-pipeline/util/bundle.rb
137
+ - lib/pod-pipeline/util/header.rb
136
138
  - lib/pod-pipeline/util/scanner.rb
137
139
  - lib/pod-pipeline/util/xcodebuild.rb
138
140
  homepage: https://github.com/TokiGems/pod-pipeline