cocoapods-bb-xcframework 0.2.7.3 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 597321612f6169b2c9f34b33ebbf775b50c23174c2059465953b94db815e7bc2
4
- data.tar.gz: 9bda96e9b80a82a706c83b64b0d4b35d94cc27ab88742b63835b2dce0bb3a869
3
+ metadata.gz: 38ad04aeb3bf21be774455008ca4b7b8deee2dfe72bf100dc2e8515524230e27
4
+ data.tar.gz: 0d81a1c7cd3e9d517d95e5503c0247faa1776ee7cb2ade624371061df02b6cbb
5
5
  SHA512:
6
- metadata.gz: 641d7d1659254d9c84e47df9e2edec74dd75a4592dab26aefd40d104fad2db87fcee9ee563c613c10f60385a84ba339c3ddb635e0bf014d0b35fc18645516209
7
- data.tar.gz: 0b85260117e10d861e9e95d39e972a78820c6097cb509f8e5726d4298fd80837094a53c4fe6c02e31f9c6610150fd0d8faba063f541e76b1296a47aaaeb3c359
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module CocoapodsXCFramework
2
- VERSION = "0.2.7.3"
2
+ VERSION = "0.2.7.4"
3
3
  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, 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
116
+ # UI.puts "XBuilder command wrapped: #{wrapped}"
132
117
  UI.puts "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 "\n** xcodebuild failed — showing last 200 lines of raw log: #{log_raw}".red
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
- tail = `tail -n 200 '#{log_raw}'`
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
- Pod::ErrorUtil.error_report(command, []) if defined?(Pod::ErrorUtil)
141
- Process.exit $?.exitstatus.nonzero? || 1
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
- # build_MacCatalyst_device defines, build_dir, archive_path if @support_maccatalyst
150
- build_mac_device defines, build_dir, archive_path if support_macos
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
@@ -209,7 +220,7 @@ module Pod
209
220
  end
210
221
 
211
222
  if framework_args.empty?
212
- UI.puts("❌ 未找到任何可用 Framework,xcframework 生成失败").red
223
+ UI.puts "❌ 未找到任何可用 Framework,xcframework 生成失败".red
213
224
  Process.exit 1
214
225
  end
215
226
 
@@ -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
- build_MacCatalyst_device defines if @support_maccatalyst
143
- build_MacOS_device defines if @support_macos
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.3
4
+ version: 0.2.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - humin