cocoapods-bb-xcframework 0.2.7.2 → 0.2.7.4
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 +49 -4
- data/lib/cocoapods-xcframework/frameworker.rb +5 -2
- data/lib/cocoapods-xcframework/gem_version.rb +1 -1
- data/lib/cocoapods-xcframework/local_build.rb +73 -13
- data/lib/cocoapods-xcframework/xbuilder/xcode_xbuild.rb +5 -1
- data/lib/cocoapods-xcframework/xbuilder.rb +21 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 38ad04aeb3bf21be774455008ca4b7b8deee2dfe72bf100dc2e8515524230e27
|
|
4
|
+
data.tar.gz: 0d81a1c7cd3e9d517d95e5503c0247faa1776ee7cb2ade624371061df02b6cbb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9b0c9c5b7c125458c4a8288e4c57d031b701dc634b0276d07d0b65cc3f97d2a2064849a95313a353834157c4010e94c31e26f63523df0eacb16e08ea745505f7
|
|
7
|
+
data.tar.gz: cf3f3c94e37e0e56ae413652edc59aa2380b56f695309b1ee4b9194f023e8e756db112832c893e92b6a5b5c7c6aeaba98f381ec1e0281e87b739dce05b82cdd1
|
|
@@ -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
|
|
@@ -37,7 +38,8 @@ module Pod
|
|
|
37
38
|
['--no-symbols', 'package not use symbols'], # 符号表
|
|
38
39
|
['--no-support-maccatalyst', 'package support generate MacCatalyst'], # 是否支持MacCatalyst方式支持iOS应用在mac平台运行库生成
|
|
39
40
|
['--no-support-dynamic', 'package support Mach-O dynamically linked shared library'], # 是否支持动态库生成
|
|
40
|
-
['--no-archive-export', 'xcodebuild archive export'] # 是否支持本地导出,导出dylib动态库
|
|
41
|
+
['--no-archive-export', 'xcodebuild archive export'], # 是否支持本地导出,导出dylib动态库
|
|
42
|
+
['--workspace', 'xcodebuild archive workspace'], # 工程目录
|
|
41
43
|
].concat super
|
|
42
44
|
end
|
|
43
45
|
|
|
@@ -56,6 +58,7 @@ module Pod
|
|
|
56
58
|
@support_maccatalyst = argv.flag?('support-maccatalyst',true)
|
|
57
59
|
@support_dynamic = argv.flag?('support-dynamic',false)
|
|
58
60
|
@archive_export = argv.flag?('archive-export',true)
|
|
61
|
+
@workspace = argv.option('workspace')
|
|
59
62
|
config.static_library_enable = @use_static_library
|
|
60
63
|
super
|
|
61
64
|
end
|
|
@@ -66,17 +69,59 @@ module Pod
|
|
|
66
69
|
end
|
|
67
70
|
|
|
68
71
|
def run
|
|
69
|
-
UI.puts "argvs @name:#{@name} @source:#{@source} @spec_sources:#{@spec_sources} @subspecs:#{@subspecs} @archive_export:#{@archive_export}"
|
|
72
|
+
UI.puts "argvs @name:#{@name} @source:#{@source} @spec_sources:#{@spec_sources} @subspecs:#{@subspecs} @archive_export:#{@archive_export} @workspace:#{@workspace}"
|
|
73
|
+
# @archive_export = false # 测试入口
|
|
70
74
|
if @archive_export
|
|
75
|
+
# 生成二进制资源xcodebuild archive,验证过使用xcodebuild archive无法导出macos架构
|
|
71
76
|
puts "local builder xcframework"
|
|
72
|
-
frameworker = LocalBuilder.new(@name, @source, @spec_sources, @subspecs, @configuration, @force, @use_modular_headers, @enable_bitcode, @symbols, @support_maccatalyst, @support_dynamic, Dir.pwd)
|
|
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)
|
|
73
78
|
frameworker.build
|
|
74
79
|
else
|
|
75
80
|
puts "remote builder xcframework"
|
|
76
|
-
frameworker = Frameworker.new(@name, @source, @spec_sources, @subspecs, @configuration, @force, @use_modular_headers, @enable_bitcode, @symbols, @support_maccatalyst, @support_dynamic)
|
|
81
|
+
frameworker = Frameworker.new(@name, @source, @spec_sources, @subspecs, @configuration, @force, @use_modular_headers, @enable_bitcode, @symbols, @support_maccatalyst, support_macos, @support_dynamic, @workspace)
|
|
77
82
|
frameworker.run
|
|
78
83
|
end
|
|
79
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
|
+
|
|
80
125
|
end
|
|
81
126
|
end
|
|
82
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)
|
|
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,7 +14,9 @@ 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
|
|
19
|
+
@workspace = workspace
|
|
18
20
|
end
|
|
19
21
|
|
|
20
22
|
def run
|
|
@@ -65,7 +67,8 @@ module Pod
|
|
|
65
67
|
spec,
|
|
66
68
|
@configuration,
|
|
67
69
|
@symbols,
|
|
68
|
-
@support_maccatalyst
|
|
70
|
+
@support_maccatalyst,
|
|
71
|
+
@support_macos
|
|
69
72
|
)
|
|
70
73
|
builder.build
|
|
71
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)
|
|
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,9 +15,11 @@ 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
|
|
22
|
+
@workspace = workspace
|
|
21
23
|
end
|
|
22
24
|
|
|
23
25
|
def run
|
|
@@ -54,18 +56,38 @@ module Pod
|
|
|
54
56
|
spec = spec_with_path @name
|
|
55
57
|
spec ||= spec_with_name @name
|
|
56
58
|
|
|
59
|
+
workspace_path = @workspace
|
|
57
60
|
scheme_name = @spec&.name
|
|
58
61
|
configuration = @configuration
|
|
59
62
|
skip_install = 'NO'
|
|
60
63
|
plat_name = platform.to_s.gsub(/\s+/, '_')
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
target_name = "#{scheme_name}-#{plat_name}"
|
|
65
|
+
archivePath = "#{archive_path}/#{target_name}.xcarchive"
|
|
66
|
+
UI.puts "scheme_name=#{scheme_name} plat_name=#{plat_name} destination=#{destination} archs=#{archs} workspace_path=#{workspace_path}"
|
|
63
67
|
if scheme_name.nil?
|
|
64
68
|
UI.puts("❌ archive 构建缺少 scheme,请在调用 xcode_xbuild 时显式传入 scheme").red
|
|
65
69
|
Process.exit 1
|
|
66
70
|
end
|
|
71
|
+
|
|
72
|
+
workspace_arg = if workspace_path && !workspace_path.to_s.strip.empty?
|
|
73
|
+
"-workspace '#{workspace_path}' "
|
|
74
|
+
else
|
|
75
|
+
""
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
scheme_arg = if workspace_path && !workspace_path.to_s.strip.empty?
|
|
79
|
+
if platform == "iOS" or platform == "Simulator" or platform == "MacCatalyst"
|
|
80
|
+
"#{scheme_name}-iOS"
|
|
81
|
+
else
|
|
82
|
+
"#{scheme_name}-macOS"
|
|
83
|
+
end
|
|
84
|
+
else
|
|
85
|
+
scheme_name
|
|
86
|
+
end
|
|
87
|
+
|
|
67
88
|
command = "xcodebuild archive " \
|
|
68
|
-
"
|
|
89
|
+
"#{workspace_arg}" \
|
|
90
|
+
"-scheme '#{scheme_arg}' " \
|
|
69
91
|
"-archivePath '#{archivePath}' " \
|
|
70
92
|
"-destination '#{destination}' " \
|
|
71
93
|
"-configuration #{configuration} " \
|
|
@@ -73,7 +95,9 @@ module Pod
|
|
|
73
95
|
"SKIP_INSTALL=#{skip_install} " \
|
|
74
96
|
"#{defines} " \
|
|
75
97
|
"SWIFT_OPTIMIZATION_LEVEL=-Onone DEBUG_INFORMATION_FORMAT=dwarf-with-dsym " \
|
|
76
|
-
"BUILD_LIBRARY_FOR_DISTRIBUTION=YES
|
|
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}"
|
|
77
101
|
|
|
78
102
|
# --- enhanced logging & reliable failure surfacing ---
|
|
79
103
|
log_dir = File.join(archivePath, 'logs')
|
|
@@ -83,21 +107,45 @@ module Pod
|
|
|
83
107
|
# Allow disabling xcpretty via env
|
|
84
108
|
use_pretty = ENV['XBUILDER_NOPRETTY'] != '1'
|
|
85
109
|
wrapped = if use_pretty
|
|
86
|
-
"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"
|
|
87
112
|
else
|
|
88
113
|
# no pretty: just tee to log and console
|
|
89
114
|
"set -o pipefail; #{command} | tee '#{log_raw}'"
|
|
90
115
|
end
|
|
116
|
+
# UI.puts "XBuilder command wrapped: #{wrapped}"
|
|
91
117
|
UI.puts "XBuilder command: #{command}"
|
|
118
|
+
UI.puts "Available schemes:"
|
|
119
|
+
schemes = `xcodebuild -list 2>/dev/null`
|
|
120
|
+
UI.puts schemes
|
|
121
|
+
|
|
92
122
|
success = system('bash', '-lc', wrapped)
|
|
93
123
|
unless success
|
|
94
|
-
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
|
|
95
135
|
if File.exist?(log_raw)
|
|
96
|
-
|
|
136
|
+
UI.puts ""
|
|
137
|
+
UI.puts "===== LAST 300 LINES ====="
|
|
138
|
+
tail = `tail -n 300 "#{log_raw}"`
|
|
97
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"
|
|
98
146
|
end
|
|
99
|
-
|
|
100
|
-
|
|
147
|
+
raise Informative,
|
|
148
|
+
"xcodebuild failed. see log: #{log_raw}"
|
|
101
149
|
end
|
|
102
150
|
end
|
|
103
151
|
|
|
@@ -105,7 +153,19 @@ module Pod
|
|
|
105
153
|
# build general first because simulator will exchange SDKROOT to simulat sdk
|
|
106
154
|
build_general_device defines, build_dir, archive_path
|
|
107
155
|
build_simulator_device defines, build_dir, archive_path
|
|
108
|
-
|
|
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
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
def build_mac_device defines, build_dir, archive_path
|
|
165
|
+
UI.puts("--- Building framework #{@spec} with general device")
|
|
166
|
+
destination = 'generic/platform=macOS'
|
|
167
|
+
archs = 'arm64'
|
|
168
|
+
xcode_xbuild(destination, archs, "macOS", defines, build_dir, archive_path)
|
|
109
169
|
end
|
|
110
170
|
|
|
111
171
|
def build_general_device defines, build_dir, archive_path
|
|
@@ -160,7 +220,7 @@ module Pod
|
|
|
160
220
|
end
|
|
161
221
|
|
|
162
222
|
if framework_args.empty?
|
|
163
|
-
UI.puts
|
|
223
|
+
UI.puts "❌ 未找到任何可用 Framework,xcframework 生成失败".red
|
|
164
224
|
Process.exit 1
|
|
165
225
|
end
|
|
166
226
|
|
|
@@ -174,7 +234,7 @@ module Pod
|
|
|
174
234
|
"-output '#{xcframework_path}'"
|
|
175
235
|
].join(' ')
|
|
176
236
|
|
|
177
|
-
UI.puts "� Creating XCFramework
|
|
237
|
+
UI.puts "� Creating XCFramework:#{command}"
|
|
178
238
|
UI.puts command.cyan
|
|
179
239
|
|
|
180
240
|
success = system(command)
|
|
@@ -30,6 +30,7 @@ module Pod
|
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def xcode_xbuild(defines, configuration, work_dir, build_dir = 'export', platform = 'iOS', project = nil, scheme = nil, skip_install = false)
|
|
33
|
+
puts "xcode_xbuild defines:#{defines} configuration:#{configuration} work_dir:#{work_dir} build_dir:#{build_dir} project:#{project} scheme:#{scheme}"
|
|
33
34
|
if defined?(Pod::DONT_CODESIGN)
|
|
34
35
|
defines = "#{defines} CODE_SIGN_IDENTITY=\"\" CODE_SIGNING_REQUIRED=NO"
|
|
35
36
|
end
|
|
@@ -38,9 +39,12 @@ module Pod
|
|
|
38
39
|
# 判断当前Xcode版本是否大于14
|
|
39
40
|
above_ver_14 = compare_xcode_14_version
|
|
40
41
|
|
|
41
|
-
if platform == '
|
|
42
|
+
if platform == 'MacCatalyst'
|
|
42
43
|
destination = 'generic/platform=macOS,variant=Mac Catalyst,name=Any Mac'
|
|
43
44
|
archs = 'x86_64 arm64'
|
|
45
|
+
elsif platform == 'macOS'
|
|
46
|
+
destination = 'generic/platform=macOS'
|
|
47
|
+
archs = 'arm64'
|
|
44
48
|
elsif platform == 'iOS Simulator'
|
|
45
49
|
destination = 'generic/platform=iOS Simulator'
|
|
46
50
|
if above_ver_14 # 14以后不支持32位设备
|
|
@@ -6,7 +6,7 @@ module Pod
|
|
|
6
6
|
include XcodeProjHelper
|
|
7
7
|
include PodUtil
|
|
8
8
|
include Config::Mixin
|
|
9
|
-
def initialize(installer, source_dir, sandbox_root, spec, configuration, symbols=true, support_maccatalyst=true)
|
|
9
|
+
def initialize(installer, source_dir, sandbox_root, spec, configuration, symbols=true, support_maccatalyst=true, support_macos=false)
|
|
10
10
|
# def initialize(platform, installer, source_dir, sandbox_root, spec, config)
|
|
11
11
|
# @platform = platform
|
|
12
12
|
@installer = installer
|
|
@@ -21,6 +21,7 @@ module Pod
|
|
|
21
21
|
@outputs = Hash.new
|
|
22
22
|
@symbols = symbols
|
|
23
23
|
@support_maccatalyst = support_maccatalyst
|
|
24
|
+
@support_macos = support_macos
|
|
24
25
|
end
|
|
25
26
|
|
|
26
27
|
def build
|
|
@@ -138,7 +139,12 @@ module Pod
|
|
|
138
139
|
# build general first because simulator will exchange SDKROOT to simulat sdk
|
|
139
140
|
build_general_device defines
|
|
140
141
|
build_simulator_device defines
|
|
141
|
-
|
|
142
|
+
# macos\MacCatalyst互斥
|
|
143
|
+
if @support_macos
|
|
144
|
+
build_MacOS_device defines
|
|
145
|
+
else
|
|
146
|
+
build_MacCatalyst_device defines if @support_maccatalyst
|
|
147
|
+
end
|
|
142
148
|
end
|
|
143
149
|
|
|
144
150
|
def build_general_device defines
|
|
@@ -164,6 +170,19 @@ module Pod
|
|
|
164
170
|
|
|
165
171
|
def build_MacCatalyst_device defines
|
|
166
172
|
UI.puts("--- Building framework #{@spec} with MacCatalyst device")
|
|
173
|
+
xcode_xbuild(
|
|
174
|
+
defines,
|
|
175
|
+
@configuration,
|
|
176
|
+
@sandbox_root,
|
|
177
|
+
'export', # build_dir
|
|
178
|
+
'MacCatalyst', # platform
|
|
179
|
+
"#{@sandbox_root}/Pods.xcodeproj", # project
|
|
180
|
+
"#{@spec.name}" # scheme
|
|
181
|
+
)
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
def build_MacOS_device defines
|
|
185
|
+
UI.puts("--- Building framework #{@spec} with macOS device")
|
|
167
186
|
xcode_xbuild(
|
|
168
187
|
defines,
|
|
169
188
|
@configuration,
|