cocoapods-packager-ext 0.0.22 → 0.0.23

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: 9d1533e3a81379cabda6ffb6cf8a0ec7ac1e044d42af7f41e94344cd480bd38f
4
- data.tar.gz: 53da1e28b909db61fa9cdabf3cb242307d2eea126da42dd0381ce481c2e07bea
3
+ metadata.gz: 84c499b900fb1168ebcbf8f5b71cacc402e4a29e6204357b99655df721d1d4dd
4
+ data.tar.gz: c2832c442bfc7d0650563b4b512457ba6fb018a5604b9ca9a9cb4f0bf2b8bba3
5
5
  SHA512:
6
- metadata.gz: 4ba30867ac2e65c3e0540e9897cbcf06306493786233333b8a90c5ca593c277f7bec718b054c47bd68f79417da06a600a15e46a880280d4905885b5516c74093
7
- data.tar.gz: 247481474b4035c2c7bbe819edf2080e05f9af133a0c4fea4800b880eb34b44031582290ef0d22e018487e0a37d3ce2f87eca052f891ae42ae856ce9a7880f4e
6
+ metadata.gz: 9ba741c09f68fb3a4712f2375ec87ea6fea71f87bbb343e8f416cbc7b38c09a558e20cb336280d117d4c7cec944bb860654edcd0d55638562c7a6c9a766590b5
7
+ data.tar.gz: 83b0a5513f8f18973fd663c7dc25b5a243055a89b16070a4fc8558683a95851a59cea473ffb0f41e84327779ebf4d0c8acf6d72ff9989bdcfdbf9f99a7692154
@@ -65,16 +65,24 @@ module Pod
65
65
  begin
66
66
  perform_build(platform, static_sandbox, dynamic_sandbox, static_installer)
67
67
  ensure # in case the build fails; see Builder#xcodebuild.
68
- if ENV['ENABLE_BACKUP_WORKSPACE']
69
- target_dir = "#{@source_dir}/#{@spec.name}-#{@spec.version}/workspace_#{platform}"
70
- Dir.mkdir target_dir
71
- `mv "#{Dir.pwd}" "#{target_dir}"`
68
+ if not ENV['ENABLE_BACKUP_WORKSPACE']
69
+ Pathname.new(config.sandbox_root).rmtree
70
+ FileUtils.rm_f('Podfile.lock')
72
71
  end
73
- Pathname.new(config.sandbox_root).rmtree
74
- FileUtils.rm_f('Podfile.lock')
75
72
  end
76
73
  end
77
74
 
75
+ def spec_library(platform)
76
+ spec = <<RB
77
+ s.#{platform.name}.deployment_target = '#{platform.deployment_target}'
78
+ s.#{platform.name}.vendored_libraries = ['#{platform}/*.a']
79
+ s.#{platform.name}.public_header_files = ['#{platform}/Headers/*.{h}']
80
+ s.#{platform.name}.source_files = ['#{platform}/Headers/*.{h}']
81
+ s.#{platform.name}.resource = ['#{platform}/Resources/*.bundle']
82
+ s.#{platform.name}.module_map = "#{platform}/Modules/module.modulemap"
83
+ RB
84
+ end
85
+
78
86
  alias build_package_t build_package
79
87
  def build_package
80
88
  if @platform == ''
@@ -87,7 +95,13 @@ module Pod
87
95
  if @platform.include?(platform.name.to_s)
88
96
  UI.puts 'build package platform:'+platform.name.to_s
89
97
  build_in_sandbox(platform)
90
- newspec += builder.spec_platform(platform)
98
+ if @library
99
+ newspec += spec_library(platform)
100
+ else
101
+ newspec += builder.spec_platform(platform)
102
+ end
103
+
104
+
91
105
  else
92
106
  UI.puts 'jump build platforms:'+platform.to_s
93
107
  end
@@ -2,7 +2,22 @@ require "fileutils"
2
2
 
3
3
  module Pod
4
4
  class Builder
5
-
5
+
6
+ alias build_static_library_t build_static_library
7
+ def build_static_library
8
+ build_static_library_t
9
+ platform_path = Pathname.new(@platform.name.to_s)
10
+ header_path = platform_path+'Headers'
11
+ header_path.mkpath unless header_path.exist?
12
+
13
+ module_map_path = platform_path+'Modules'
14
+ module_map_path.mkpath unless module_map_path.exist?
15
+ copy_headers_to_target header_path,module_map_path
16
+
17
+ resources_path = platform_path+'Resources'
18
+ resources_path.mkpath unless resources_path.exist?
19
+ copy_resources_to_target resources_path
20
+ end
6
21
  alias build_static_library_for_ios_t build_static_library_for_ios
7
22
  def build_static_library_for_ios(output)
8
23
  if @exclude_dep_items.length > 0
@@ -92,12 +107,20 @@ module Pod
92
107
  return ios_architectures_t
93
108
  end
94
109
  end
110
+
95
111
  alias copy_headers_t copy_headers
96
112
  def copy_headers
113
+ copy_headers_to_target @fwk.headers_path
114
+ end
115
+
116
+ def copy_headers_to_target(headers_target_path,module_map_target_path)
117
+ headers_target_path = @fwk.headers_path if headers_target_path.nil?
118
+ module_map_target_path = @fwk.module_map_path if module_map_target_path.nil?
119
+
97
120
  headers_source_root = "#{@public_headers_root}/#{@spec.name}"
98
121
 
99
122
  Dir.glob("#{headers_source_root}/**/*.h").
100
- each { |h| `ditto #{h} #{@fwk.headers_path}/#{h.sub(headers_source_root, '')}` }
123
+ each { |h| `ditto #{h} #{headers_target_path}/#{h.sub(headers_source_root, '')}` }
101
124
 
102
125
  # If custom 'module_map' is specified add it to the framework distribution
103
126
  # otherwise check if a header exists that is equal to 'spec.name', if so
@@ -116,10 +139,10 @@ framework module #{@spec.name} {
116
139
  MAP
117
140
  else
118
141
 
119
- f = File.new(File.join("#{@fwk.headers_path}","#{@spec.name}.h"), "w+")
142
+ f = File.new(File.join("#{headers_target_path}","#{@spec.name}.h"), "w+")
120
143
  f.puts("#import <UIKit/UIKit.h>")
121
144
  f.puts("#import <Foundation/Foundation.h>")
122
- Dir.foreach(@fwk.headers_path) do |filename|
145
+ Dir.foreach(headers_target_path) do |filename|
123
146
  if filename != "." and filename != ".."
124
147
  f.puts("#import \"#{filename}\"")
125
148
  end
@@ -137,13 +160,17 @@ MAP
137
160
  end
138
161
 
139
162
  unless module_map.nil?
140
- @fwk.module_map_path.mkpath unless @fwk.module_map_path.exist?
141
- File.write("#{@fwk.module_map_path}/module.modulemap", module_map)
163
+ module_map_target_path.mkpath unless module_map_target_path.exist?
164
+ File.write("#{module_map_target_path}/module.modulemap", module_map)
142
165
  end
143
166
  end
144
167
 
145
168
  alias copy_resources_t copy_resources
146
169
  def copy_resources
170
+ copy_resources_to_target @fwk.resources_path
171
+ end
172
+ def copy_resources_to_target(resources_target_path)
173
+ resources_target_path = @fwk.resources_path if resources_target_path.nil?
147
174
  if @exclude_deps
148
175
  bundles = @static_installer.pod_targets.flat_map(&:file_accessors).flat_map{|item|item.resources}
149
176
  else
@@ -154,14 +181,20 @@ MAP
154
181
  bundles.tap{|path| FileUtils.cp_r path,resources_path}
155
182
  `cp -rp #{@static_sandbox_root}/build/*.bundle #{resources_path} 2>&1`
156
183
  else
157
- `cp -rp #{@static_sandbox_root}/build/*.bundle #{@fwk.resources_path} 2>&1`
184
+ `cp -rp #{@static_sandbox_root}/build/*.bundle #{resources_path} 2>&1`
158
185
  resources = expand_paths(@spec.consumer(@platform).resources)
159
186
  if resources.count == 0 && bundles.count == 0
160
- @fwk.delete_resources
187
+ if @fwk
188
+ @fwk.delete_resources
189
+ else
190
+ if resources_target_path.exist?
191
+ FileUtils.rm_rf resources_target_path
192
+ end
193
+ end
161
194
  return
162
195
  end
163
196
  if resources.count > 0
164
- `cp -rp #{resources.join(' ')} #{@fwk.resources_path}`
197
+ `cp -rp #{resources.join(' ')} #{resources_target_path}`
165
198
  end
166
199
  end
167
200
  end
@@ -1,3 +1,3 @@
1
1
  module CocoapodsPackagerExt
2
- VERSION = "0.0.22"
2
+ VERSION = "0.0.23"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-packager-ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.22
4
+ version: 0.0.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - kyle.zhou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-14 00:00:00.000000000 Z
11
+ date: 2021-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler