cocoapods-bb-xcframework 0.2.7.3 → 0.2.7.5
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/lib/cocoapods-xcframework/command/xcframework.rb +45 -2
- data/lib/cocoapods-xcframework/frameworker.rb +3 -21
- data/lib/cocoapods-xcframework/gem_version.rb +1 -1
- data/lib/cocoapods-xcframework/local_build.rb +60 -32
- data/lib/cocoapods-xcframework/xbuilder/xcode_xbuild.rb +1 -1
- data/lib/cocoapods-xcframework/xbuilder.rb +6 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1a5093941ce0cd361019450a4aab44a66023c314c63fd0e982caa6590b912a2a
|
|
4
|
+
data.tar.gz: ea809e44a928f2d2f29fc5f0f06dd06ac9f69566ca24c8142b5f02b06b8c9863
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c7b19ee700da2639e1d6a92db3c44648d1f4df251fb3f9a00b2141cf8d41f14b60d4a90314b65bc60184badfd6449b3de1d6bf1191c4c32d5607e8ba58362fda
|
|
7
|
+
data.tar.gz: 6c52a57a57a25040551819e30ba22f66d4cc04c476bd66951f32c006baadddbaeb4967fd14ecd63ece14b0dcb1af8e12f2a03f6a2639f6de82157e9beb2f48ee
|
|
@@ -23,6 +23,7 @@ module Pod
|
|
|
23
23
|
CLAide::Argument.new('NAME', true),
|
|
24
24
|
CLAide::Argument.new('SOURCE', false)
|
|
25
25
|
]
|
|
26
|
+
include PodUtil
|
|
26
27
|
include Config::Mixin
|
|
27
28
|
|
|
28
29
|
def self.options
|
|
@@ -69,16 +70,58 @@ module Pod
|
|
|
69
70
|
|
|
70
71
|
def run
|
|
71
72
|
UI.puts "argvs @name:#{@name} @source:#{@source} @spec_sources:#{@spec_sources} @subspecs:#{@subspecs} @archive_export:#{@archive_export} @workspace:#{@workspace}"
|
|
73
|
+
# @archive_export = false # 测试入口
|
|
72
74
|
if @archive_export
|
|
75
|
+
# 生成二进制资源xcodebuild archive,验证过使用xcodebuild archive无法导出macos架构
|
|
73
76
|
puts "local builder xcframework"
|
|
74
|
-
frameworker = LocalBuilder.new(@name, @source, @spec_sources, @subspecs, @configuration, @force, @use_modular_headers, @enable_bitcode, @symbols, @support_maccatalyst, @support_dynamic, Dir.pwd, @workspace)
|
|
77
|
+
frameworker = LocalBuilder.new(@name, @source, @spec_sources, @subspecs, @configuration, @force, @use_modular_headers, @enable_bitcode, @symbols, @support_maccatalyst, support_macos, @support_dynamic, Dir.pwd, @workspace)
|
|
75
78
|
frameworker.build
|
|
76
79
|
else
|
|
77
80
|
puts "remote builder xcframework"
|
|
78
|
-
frameworker = Frameworker.new(@name, @source, @spec_sources, @subspecs, @configuration, @force, @use_modular_headers, @enable_bitcode, @symbols, @support_maccatalyst, @support_dynamic, @workspace)
|
|
81
|
+
frameworker = Frameworker.new(@name, @source, @spec_sources, @subspecs, @configuration, @force, @use_modular_headers, @enable_bitcode, @symbols, @support_maccatalyst, support_macos, @support_dynamic, @workspace)
|
|
79
82
|
frameworker.run
|
|
80
83
|
end
|
|
81
84
|
end
|
|
85
|
+
|
|
86
|
+
# 是否包含资源文件(bundle/resources/resource_bundles)
|
|
87
|
+
def support_bundle_res
|
|
88
|
+
spec = spec_with_path(@name)
|
|
89
|
+
begin
|
|
90
|
+
spec_hash = spec.to_hash
|
|
91
|
+
has_resources = false
|
|
92
|
+
resources = spec_hash['resources']
|
|
93
|
+
resource_bundles = spec_hash['resource_bundles']
|
|
94
|
+
vendored_resources = spec_hash['vendored_resources']
|
|
95
|
+
has_resources ||= resources && !resources.empty?
|
|
96
|
+
has_resources ||= resource_bundles && !resource_bundles.empty?
|
|
97
|
+
has_resources ||= vendored_resources && !vendored_resources.empty?
|
|
98
|
+
UI.puts "#{spec.name}(#{spec.version}) resources=#{!resources.nil?} resource_bundles=#{!resource_bundles.nil?} vendored_resources=#{!vendored_resources.nil?} support_bundle_res=#{has_resources}".yellow
|
|
99
|
+
return has_resources
|
|
100
|
+
rescue => e
|
|
101
|
+
UI.puts "check bundle resource failed: #{e}".red
|
|
102
|
+
return false
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# 是否支持macos架构
|
|
107
|
+
def support_macos
|
|
108
|
+
spec = spec_with_path @name
|
|
109
|
+
platforms = []
|
|
110
|
+
begin
|
|
111
|
+
spec_hash = spec.to_hash
|
|
112
|
+
if spec_hash['platforms']
|
|
113
|
+
platforms = spec_hash['platforms'].keys.map(&:to_s)
|
|
114
|
+
elsif spec.platform
|
|
115
|
+
platforms = [spec.platform.name.to_s]
|
|
116
|
+
end
|
|
117
|
+
rescue => e
|
|
118
|
+
UI.puts "read platforms failed: #{e}".red
|
|
119
|
+
end
|
|
120
|
+
support_macos = platforms.include?('osx') || platforms.include?('macos')
|
|
121
|
+
UI.puts "#{spec.name}(#{spec.version}) platforms=#{platforms} support_macos=#{support_macos}".yellow
|
|
122
|
+
return support_macos
|
|
123
|
+
end
|
|
124
|
+
|
|
82
125
|
end
|
|
83
126
|
end
|
|
84
127
|
end
|
|
@@ -3,7 +3,7 @@ module Pod
|
|
|
3
3
|
include PodUtil
|
|
4
4
|
include DirUtil
|
|
5
5
|
include Config::Mixin
|
|
6
|
-
def initialize(name, source, spec_sources, subspecs, configuration, force, use_modular_headers=true, enable_bitcode=false, symbols=true, support_maccatalyst=true, support_dynamic=false, workspace=nil)
|
|
6
|
+
def initialize(name, source, spec_sources, subspecs, configuration, force, use_modular_headers=true, enable_bitcode=false, symbols=true, support_maccatalyst=true, support_macos=false, support_dynamic=false, workspace=nil)
|
|
7
7
|
@name = name
|
|
8
8
|
@source = source
|
|
9
9
|
@spec_sources = spec_sources
|
|
@@ -14,29 +14,11 @@ module Pod
|
|
|
14
14
|
@enable_bitcode = enable_bitcode
|
|
15
15
|
@symbols = symbols
|
|
16
16
|
@support_maccatalyst = support_maccatalyst
|
|
17
|
+
@support_macos = support_macos
|
|
17
18
|
@support_dynamic = support_dynamic
|
|
18
19
|
@workspace = workspace
|
|
19
20
|
end
|
|
20
21
|
|
|
21
|
-
# 是否支持macos架构
|
|
22
|
-
def support_macos
|
|
23
|
-
spec = spec_with_path @name
|
|
24
|
-
platforms = []
|
|
25
|
-
begin
|
|
26
|
-
spec_hash = spec.to_hash
|
|
27
|
-
if spec_hash['platforms']
|
|
28
|
-
platforms = spec_hash['platforms'].keys.map(&:to_s)
|
|
29
|
-
elsif spec.platform
|
|
30
|
-
platforms = [spec.platform.name.to_s]
|
|
31
|
-
end
|
|
32
|
-
rescue => e
|
|
33
|
-
UI.puts "read platforms failed: #{e}".red
|
|
34
|
-
end
|
|
35
|
-
support_macos = platforms.include?('osx') || platforms.include?('macos')
|
|
36
|
-
UI.puts "#{spec.name}(#{spec.version}) platforms=#{platforms} support_macos=#{support_macos}".yellow
|
|
37
|
-
return support_macos
|
|
38
|
-
end
|
|
39
|
-
|
|
40
22
|
def run
|
|
41
23
|
spec = spec_with_path @name
|
|
42
24
|
UI.puts "正在生成XCFramework #{spec.name}(#{spec.version})".yellow
|
|
@@ -86,7 +68,7 @@ module Pod
|
|
|
86
68
|
@configuration,
|
|
87
69
|
@symbols,
|
|
88
70
|
@support_maccatalyst,
|
|
89
|
-
support_macos
|
|
71
|
+
@support_macos
|
|
90
72
|
)
|
|
91
73
|
builder.build
|
|
92
74
|
builder.outputs target_dir
|
|
@@ -3,7 +3,7 @@ module Pod
|
|
|
3
3
|
include PodUtil
|
|
4
4
|
include DirUtil
|
|
5
5
|
include Config::Mixin
|
|
6
|
-
def initialize(name, source, spec_sources, subspecs, configuration, force, use_modular_headers=true, enable_bitcode=false, symbols=true, support_maccatalyst=true, support_dynamic=false, source_dir=Dir.pwd, workspace=nil)
|
|
6
|
+
def initialize(name, source, spec_sources, subspecs, configuration, force, use_modular_headers=true, enable_bitcode=false, symbols=true, support_maccatalyst=true, support_macos=false, support_dynamic=false, source_dir=Dir.pwd, workspace=nil)
|
|
7
7
|
@name = name
|
|
8
8
|
@source = source
|
|
9
9
|
@spec_sources = spec_sources
|
|
@@ -15,6 +15,7 @@ module Pod
|
|
|
15
15
|
@symbols = symbols
|
|
16
16
|
@support_maccatalyst = support_maccatalyst
|
|
17
17
|
@support_dynamic = support_dynamic
|
|
18
|
+
@support_macos = support_macos
|
|
18
19
|
@spec = spec_with_path @name
|
|
19
20
|
@source_dir = source_dir
|
|
20
21
|
@outputs = Hash.new
|
|
@@ -50,25 +51,6 @@ module Pod
|
|
|
50
51
|
outputs(target_dir)
|
|
51
52
|
end
|
|
52
53
|
|
|
53
|
-
# 是否支持macos架构
|
|
54
|
-
def support_macos
|
|
55
|
-
spec = spec_with_path @name
|
|
56
|
-
platforms = []
|
|
57
|
-
begin
|
|
58
|
-
spec_hash = spec.to_hash
|
|
59
|
-
if spec_hash['platforms']
|
|
60
|
-
platforms = spec_hash['platforms'].keys.map(&:to_s)
|
|
61
|
-
elsif spec.platform
|
|
62
|
-
platforms = [spec.platform.name.to_s]
|
|
63
|
-
end
|
|
64
|
-
rescue => e
|
|
65
|
-
UI.puts "read platforms failed: #{e}".red
|
|
66
|
-
end
|
|
67
|
-
support_macos = platforms.include?('osx') || platforms.include?('macos')
|
|
68
|
-
UI.puts "#{spec.name}(#{spec.version}) platforms=#{platforms} support_macos=#{support_macos}".yellow
|
|
69
|
-
return support_macos
|
|
70
|
-
end
|
|
71
|
-
|
|
72
54
|
def xcode_xbuild(destination, archs, platform, defines, build_dir, archive_path)
|
|
73
55
|
# xcodebuild archive requires -scheme when -archivePath is specified
|
|
74
56
|
spec = spec_with_path @name
|
|
@@ -81,7 +63,7 @@ module Pod
|
|
|
81
63
|
plat_name = platform.to_s.gsub(/\s+/, '_')
|
|
82
64
|
target_name = "#{scheme_name}-#{plat_name}"
|
|
83
65
|
archivePath = "#{archive_path}/#{target_name}.xcarchive"
|
|
84
|
-
UI.puts "plat_name=#{plat_name} destination=#{destination} archs=#{archs} workspace_path=#{workspace_path}"
|
|
66
|
+
UI.puts "scheme_name=#{scheme_name} plat_name=#{plat_name} destination=#{destination} archs=#{archs} workspace_path=#{workspace_path}"
|
|
85
67
|
if scheme_name.nil?
|
|
86
68
|
UI.puts("❌ archive 构建缺少 scheme,请在调用 xcode_xbuild 时显式传入 scheme").red
|
|
87
69
|
Process.exit 1
|
|
@@ -108,13 +90,14 @@ module Pod
|
|
|
108
90
|
"-scheme '#{scheme_arg}' " \
|
|
109
91
|
"-archivePath '#{archivePath}' " \
|
|
110
92
|
"-destination '#{destination}' " \
|
|
111
|
-
"-alltargets " \
|
|
112
93
|
"-configuration #{configuration} " \
|
|
113
94
|
"ARCHS='#{archs}' " \
|
|
114
95
|
"SKIP_INSTALL=#{skip_install} " \
|
|
115
96
|
"#{defines} " \
|
|
116
97
|
"SWIFT_OPTIMIZATION_LEVEL=-Onone DEBUG_INFORMATION_FORMAT=dwarf-with-dsym " \
|
|
117
|
-
"BUILD_LIBRARY_FOR_DISTRIBUTION=YES clean build"
|
|
98
|
+
"BUILD_LIBRARY_FOR_DISTRIBUTION=YES clean build "
|
|
99
|
+
|
|
100
|
+
# command = "xcodebuild archive #{workspace_arg} -scheme '#{scheme_arg}' -archivePath '#{archivePath}' #{defines} BUILD_LIBRARY_FOR_DISTRIBUTION=YES clean build -configuration #{configuration} -destination '#{destination}' ARCHS='#{archs}' SKIP_INSTALL=#{skip_install}"
|
|
118
101
|
|
|
119
102
|
# --- enhanced logging & reliable failure surfacing ---
|
|
120
103
|
log_dir = File.join(archivePath, 'logs')
|
|
@@ -124,21 +107,45 @@ module Pod
|
|
|
124
107
|
# Allow disabling xcpretty via env
|
|
125
108
|
use_pretty = ENV['XBUILDER_NOPRETTY'] != '1'
|
|
126
109
|
wrapped = if use_pretty
|
|
127
|
-
"set -o pipefail; #{command} | tee '#{log_raw}' | xcpretty"
|
|
110
|
+
"set -o pipefail; #{command} 2>&1 | tee '#{log_raw}' | xcpretty"
|
|
111
|
+
# "set -o pipefail; #{command} | tee '#{log_raw}' | xcpretty"
|
|
128
112
|
else
|
|
129
113
|
# no pretty: just tee to log and console
|
|
130
114
|
"set -o pipefail; #{command} | tee '#{log_raw}'"
|
|
131
115
|
end
|
|
132
|
-
UI.puts "XBuilder command: #{
|
|
116
|
+
# UI.puts "XBuilder command wrapped: #{wrapped}"
|
|
117
|
+
UI.puts "Loal XBuilder command: #{command}"
|
|
118
|
+
UI.puts "Available schemes:"
|
|
119
|
+
schemes = `xcodebuild -list 2>/dev/null`
|
|
120
|
+
UI.puts schemes
|
|
121
|
+
|
|
133
122
|
success = system('bash', '-lc', wrapped)
|
|
134
123
|
unless success
|
|
135
|
-
UI.puts "
|
|
124
|
+
UI.puts ""
|
|
125
|
+
UI.puts "========== XCODEBUILD FAILED =========="
|
|
126
|
+
UI.puts "platform=#{platform}"
|
|
127
|
+
UI.puts "scheme=#{scheme_name}"
|
|
128
|
+
UI.puts "destination=#{destination}"
|
|
129
|
+
UI.puts "log=#{log_raw}"
|
|
130
|
+
if platform == 'macOS'
|
|
131
|
+
UI.puts "Available schemes:"
|
|
132
|
+
schemes = `xcodebuild -list 2>/dev/null`
|
|
133
|
+
UI.puts schemes
|
|
134
|
+
end
|
|
136
135
|
if File.exist?(log_raw)
|
|
137
|
-
|
|
136
|
+
UI.puts ""
|
|
137
|
+
UI.puts "===== LAST 300 LINES ====="
|
|
138
|
+
tail = `tail -n 300 "#{log_raw}"`
|
|
138
139
|
UI.puts tail
|
|
140
|
+
UI.puts ""
|
|
141
|
+
UI.puts "===== ERROR LINES ====="
|
|
142
|
+
errors = `grep -nE "error:|fatal error:|Undefined symbols|Command Compile|Command SwiftCompile|Command Ld" "#{log_raw}"`
|
|
143
|
+
UI.puts(errors.empty? ? "No error lines found." : errors)
|
|
144
|
+
else
|
|
145
|
+
UI.puts "raw log not found"
|
|
139
146
|
end
|
|
140
|
-
|
|
141
|
-
|
|
147
|
+
raise Informative,
|
|
148
|
+
"xcodebuild failed. see log: #{log_raw}"
|
|
142
149
|
end
|
|
143
150
|
end
|
|
144
151
|
|
|
@@ -146,8 +153,12 @@ module Pod
|
|
|
146
153
|
# build general first because simulator will exchange SDKROOT to simulat sdk
|
|
147
154
|
build_general_device defines, build_dir, archive_path
|
|
148
155
|
build_simulator_device defines, build_dir, archive_path
|
|
149
|
-
#
|
|
150
|
-
|
|
156
|
+
# macos\MacCatalyst互斥
|
|
157
|
+
if @support_macos
|
|
158
|
+
build_mac_device defines, build_dir, archive_path
|
|
159
|
+
else
|
|
160
|
+
build_MacCatalyst_device defines, build_dir, archive_path if @support_maccatalyst
|
|
161
|
+
end
|
|
151
162
|
end
|
|
152
163
|
|
|
153
164
|
def build_mac_device defines, build_dir, archive_path
|
|
@@ -193,6 +204,7 @@ module Pod
|
|
|
193
204
|
framework_args = []
|
|
194
205
|
|
|
195
206
|
archives.each do |archive|
|
|
207
|
+
# 二进制库
|
|
196
208
|
framework_path = File.join(
|
|
197
209
|
archive,
|
|
198
210
|
'Products',
|
|
@@ -200,16 +212,32 @@ module Pod
|
|
|
200
212
|
'Frameworks',
|
|
201
213
|
"#{framework_name}.framework"
|
|
202
214
|
)
|
|
215
|
+
# 符号表
|
|
216
|
+
dsym_path = File.join(
|
|
217
|
+
archive,
|
|
218
|
+
'dSYMs',
|
|
219
|
+
"#{framework_name}.framework.dSYM"
|
|
220
|
+
)
|
|
203
221
|
if File.exist?(framework_path)
|
|
204
222
|
framework_args << "-framework '#{framework_path}'"
|
|
205
223
|
UI.puts "� Found framework: #{framework_path}".green
|
|
224
|
+
# 仅真机导出符号表,如果需要全部,把开关去除
|
|
225
|
+
archive_name = File.basename(archive, '.xcarchive')
|
|
226
|
+
if archive_name == "#{framework_name}-iOS"
|
|
227
|
+
if File.exist?(dsym_path)
|
|
228
|
+
framework_args << "-debug-symbols '#{dsym_path}'"
|
|
229
|
+
UI.puts "� Found framework.dSYM: #{dsym_path}".green
|
|
230
|
+
else
|
|
231
|
+
UI.puts "⚠️ 未在 #{archive} 中找到 #{dsym_path}.framework.dSYM,已跳过".yellow
|
|
232
|
+
end
|
|
233
|
+
end
|
|
206
234
|
else
|
|
207
235
|
UI.puts "⚠️ 未在 #{archive} 中找到 #{framework_name}.framework,已跳过".yellow
|
|
208
236
|
end
|
|
209
237
|
end
|
|
210
238
|
|
|
211
239
|
if framework_args.empty?
|
|
212
|
-
UI.puts
|
|
240
|
+
UI.puts "❌ 未找到任何可用 Framework,xcframework 生成失败".red
|
|
213
241
|
Process.exit 1
|
|
214
242
|
end
|
|
215
243
|
|
|
@@ -100,7 +100,7 @@ module Pod
|
|
|
100
100
|
# no pretty: just tee to log and console
|
|
101
101
|
"set -o pipefail; #{command} | tee '#{log_raw}'"
|
|
102
102
|
end
|
|
103
|
-
UI.puts "XBuilder command: #{command}"
|
|
103
|
+
UI.puts "Xcode XBuilder command: #{command}"
|
|
104
104
|
UI.puts "Available schemes:"
|
|
105
105
|
schemes = `xcodebuild -list 2>/dev/null`
|
|
106
106
|
UI.puts schemes
|
|
@@ -139,8 +139,12 @@ module Pod
|
|
|
139
139
|
# build general first because simulator will exchange SDKROOT to simulat sdk
|
|
140
140
|
build_general_device defines
|
|
141
141
|
build_simulator_device defines
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
# macos\MacCatalyst互斥
|
|
143
|
+
if @support_macos
|
|
144
|
+
build_MacOS_device defines
|
|
145
|
+
else
|
|
146
|
+
build_MacCatalyst_device defines if @support_maccatalyst
|
|
147
|
+
end
|
|
144
148
|
end
|
|
145
149
|
|
|
146
150
|
def build_general_device defines
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cocoapods-bb-xcframework
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.7.
|
|
4
|
+
version: 0.2.7.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- humin
|
|
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
105
105
|
- !ruby/object:Gem::Version
|
|
106
106
|
version: '0'
|
|
107
107
|
requirements: []
|
|
108
|
-
rubygems_version: 4.0.
|
|
108
|
+
rubygems_version: 4.0.19
|
|
109
109
|
specification_version: 4
|
|
110
110
|
summary: 把podspec打包成xcframework的小工具。packager pod to a xcframework
|
|
111
111
|
test_files:
|