cocoapods-bb-PodAssistant 0.3.16.8 → 0.3.16.10

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: a4088855ba536056a694f3df4343768b8b6613a1000014e5b1e86d11188e3200
4
- data.tar.gz: df9e641a54b8eeb4181df5fec530c24e164245e053f96f4ca9cb6e02f937811b
3
+ metadata.gz: c0414aee53cb5ee338b5814ffb924c88ee3d74af9460d9b8d49aec24856563c4
4
+ data.tar.gz: 93063e44081f8b210bed3cff45022680fdc5a57e8aaee39d9d01f33674c80c82
5
5
  SHA512:
6
- metadata.gz: 81e30f10794cb18fa92eeaf043dae86247e6d1421d600467aa249347869699af7603fdf6f6ff0f305c04f85b89e5b5c66eb0b9dc716456d8396b76acc82e1232
7
- data.tar.gz: 8b095a352774edd065cfc2e6d40d17f004188a600da6ac97bb8991c075a6dc07c50dd6c9c489e61592502da3f729715ba0c515291265a62d2832a032c1cf0140
6
+ metadata.gz: b7ad2426baf093fb38885fb68051c3a7db00285b9c242c84ed3ea7754a3b0914bba79000ca1652984cdc105b8249ee46448c3b681054e69d00a5c2a302cc9df7
7
+ data.tar.gz: 10c8dbfcfddb0befbe382dd05bbe5cc10412690e2953945dc73fae6c06a408cdf7aec6058f627382b30c82057cfcd6601c23be3b1c4a9962f2c5f526a8b15bdc
@@ -2,6 +2,7 @@
2
2
  # Author = Min Hu
3
3
 
4
4
  require 'cocoapods-bb-PodAssistant/babybus/helpers/babybus_info_plist_helper'
5
+ require 'fileutils'
5
6
 
6
7
  class BabybusInstallEnv
7
8
  #https://v3.bbcloud.babybus.com/team/184/wiki/11667
@@ -54,40 +55,64 @@ class BabybusInstallEnv
54
55
  puts "===拷贝3D产物文件操作===>".yellow
55
56
  rootPath = getProjectRootPath
56
57
  bundleIdentifier = getProjectBundleIdentifier
57
- path = File.join(rootPath, "Configs", "#{bundleIdentifier}/UnityFramework.framework")
58
- puts "查找UnityFramework产物1:#{path}"
59
- if !File.directory?(path) #不是文件夹 或不存在该文件夹
60
- path = File.join(rootPath, "Configs/UnityFramework", "#{bundleIdentifier}/UnityFramework.framework")
61
- puts "查找UnityFramework产物2:#{path}"
62
- if !File.directory?(path)
63
- path = File.join(rootPath, "Configs/UnityFramework", "#{bundleIdentifier}_UnityFramework.framework")
64
- puts "查找UnityFramework产物3:#{path}"
65
- if !File.directory?(path)
66
- path = File.join(rootPath, "Configs/UnityFramework", "UnityFramework.framework")
67
- puts "查找UnityFramework产物4:#{path}"
58
+ formats = %w[xcframework framework]
59
+ locations = [
60
+ [File.join(rootPath, 'Configs', bundleIdentifier), 'UnityFramework'],
61
+ [File.join(rootPath, 'Configs/UnityFramework', bundleIdentifier), 'UnityFramework'],
62
+ [File.join(rootPath, 'Configs/UnityFramework'), "#{bundleIdentifier}_UnityFramework"],
63
+ [File.join(rootPath, 'Configs/UnityFramework'), 'UnityFramework']
64
+ ]
65
+ path = nil
66
+ locations.each do |directory, name|
67
+ formats.each do |format|
68
+ candidate = File.join(directory, "#{name}.#{format}")
69
+ puts "查找UnityFramework产物:#{candidate}"
70
+ if File.directory?(candidate)
71
+ path = candidate
72
+ break
68
73
  end
69
74
  end
75
+ break if path
70
76
  end
71
- if File.directory?(path)
72
- replaceFilePath = "./Pods/BBUnityFramework/UnityFramework.framework"
73
- # step.1 获取原目录下没有资源
74
- system "cp -af #{replaceFilePath}/Info.plist #{path}/Info.plist"
75
- oldModules = "#{replaceFilePath}/Modules"
76
- newModules = "#{path}/Modules"
77
- if !File.directory?(newModules)
78
- system "cp -af #{oldModules} #{newModules}"
77
+ unless path
78
+ puts "找不到UnityFramework产物文件,替换失败".red
79
+ return
80
+ end
81
+
82
+ format = File.extname(path)
83
+ podsPath = File.join("./", 'Pods/BBUnityFramework')
84
+ # podsPath = File.join(rootPath, 'Pods/BBUnityFramework')
85
+ replaceFilePath = File.join(podsPath, "UnityFramework#{format}")
86
+ unless File.directory?(replaceFilePath)
87
+ raise "UnityFramework产物格式与Pod依赖不匹配: #{path} -> #{replaceFilePath},请检查BBUnityFramework的vendored_frameworks配置"
88
+ end
89
+
90
+ require 'tmpdir'
91
+ Dir.mktmpdir('unity-replacement-', podsPath) do |tempPath|
92
+ stagedPath = File.join(tempPath, "UnityFramework#{format}")
93
+ FileUtils.cp_r(path, stagedPath, preserve: true)
94
+ if format == '.framework'
95
+ FileUtils.cp(File.join(replaceFilePath, 'Info.plist'), File.join(stagedPath, 'Info.plist'), preserve: true)
96
+ %w[Modules Headers].each do |name|
97
+ oldPath = File.join(replaceFilePath, name)
98
+ newPath = File.join(stagedPath, name)
99
+ FileUtils.cp_r(oldPath, newPath, preserve: true) if !File.exist?(newPath) && File.directory?(oldPath)
100
+ end
101
+ else
102
+ unless File.file?(File.join(stagedPath, 'Info.plist'))
103
+ raise "XCFramework缺少Info.plist: #{path}"
104
+ end
79
105
  end
80
- oldheaders = "#{replaceFilePath}/Headers"
81
- newHeaders = "#{path}/Headers"
82
- if !File.directory?(newHeaders)
83
- system "cp -af #{oldheaders} #{newHeaders}"
106
+ backupPath = File.join(tempPath, 'backup')
107
+ File.rename(replaceFilePath, backupPath)
108
+ begin
109
+ File.rename(stagedPath, replaceFilePath)
110
+ rescue StandardError
111
+ File.rename(backupPath, replaceFilePath)
112
+ raise
84
113
  end
85
- system "chmod 755 #{replaceFilePath}"
86
- system "rm -rf #{replaceFilePath}; cp -af #{path} #{replaceFilePath}"
87
- puts "替换UnityFramework文件成功".yellow
88
- else
89
- puts "找不到UnityFramework产物文件,替换失败".red
90
114
  end
115
+ puts "替换UnityFramework文件成功:#{replaceFilePath}".yellow
91
116
  end
92
117
  # 2D母包替换
93
118
  def copyCocosPackage
@@ -73,6 +73,17 @@ install_framework()
73
73
  new_code = <<~'SH'
74
74
  install_framework()
75
75
  {
76
+ echo "========== [CP] install_framework Build Info =========="
77
+ echo "Framework: $1"
78
+ echo "CONFIGURATION: ${CONFIGURATION:-<unset>}"
79
+ echo "PLATFORM_NAME: ${PLATFORM_NAME:-<unset>}"
80
+ echo "EFFECTIVE_PLATFORM_NAME: ${EFFECTIVE_PLATFORM_NAME:-<unset>}"
81
+ echo "ARCHS: ${ARCHS:-<unset>}"
82
+ echo "CURRENT_ARCH: ${CURRENT_ARCH:-<unset>}"
83
+ echo "SDKROOT: ${SDKROOT:-<unset>}"
84
+ echo "BUILT_PRODUCTS_DIR: ${BUILT_PRODUCTS_DIR:-<unset>}"
85
+ echo "PODS_XCFRAMEWORKS_BUILD_DIR: ${PODS_XCFRAMEWORKS_BUILD_DIR:-<unset>}"
86
+ echo "========================================================"
76
87
  local source=""
77
88
 
78
89
  if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
@@ -83,6 +94,8 @@ install_framework()
83
94
  source="$1"
84
95
  fi
85
96
 
97
+ echo "[CP] Framework resolved source: ${source:-<not found>}"
98
+
86
99
  if [ -z "$source" ]; then
87
100
  if [[ "$PLATFORM_NAME" == *"simulator"* || "${EFFECTIVE_PLATFORM_NAME-}" == *"simulator"* ]]; then
88
101
  echo "warning: [CP] $(basename "$1"): Skip missing unsupported Simulator framework: $1"
@@ -291,6 +304,12 @@ install_framework()
291
304
  # 组件配置
292
305
  @lib.pod_target_subprojects.flat_map { |p| p.targets }.each do |target|
293
306
  target.build_configurations.each do |config|
307
+ # Release+模拟器,cpu架构使用arm64、x86_64,sdk不包含x86_64导致编译失败
308
+ # 指令验证pod工程cpu架构,ARCHS_STANDARD = arm64 x86_64
309
+ # xcodebuild -project Pods/BBUnityFramework.xcodeproj -configuration Release -sdk iphonesimulator -showBuildSettings | grep -E 'ARCHS =|ARCHS_STANDARD =|ONLY_ACTIVE_ARCH =|EXCLUDED_ARCHS ='
310
+ if config.name.include?('Release') && ['BBUnityFramework', 'cocos2dx'].include?(target.name)
311
+ config.build_settings['ARCHS[sdk=iphonesimulator*]'] = 'arm64'
312
+ end
294
313
  # pod 1.13.0兼容故去除,避免
295
314
  # 适配xcode 15 动态库报错: Error 'DT_TOOLCHAIN_DIR cannot be used to evaluate LIBRARY_SEARCH_PATHS, use TOOLCHAIN_DIR instead'
296
315
  # if (is_above_xcode15 == true) then
@@ -360,5 +379,34 @@ install_framework()
360
379
  project.save if should_save
361
380
  # 修正Xcode16不能po问题
362
381
  # fix_above_xcode16_no_po() # xcode27不需要
382
+ # Xcode 原生加固
383
+ apply_security_hardening(@lib)
384
+ end
385
+
386
+ # Xcode 原生加固
387
+ def apply_security_hardening(installer)
388
+ projects = ([installer.pods_project] + installer.pod_target_subprojects + installer.aggregate_targets.map(&:user_project)).compact.uniq
389
+ projects.flat_map(&:targets).uniq.each do |target|
390
+ target.build_configurations.each do |config|
391
+ # 仅跳过 Debug 类构建配置,其余配置统一执行安全加固
392
+ next if config.name.downcase.include?('debug')
393
+ settings = config.build_settings
394
+ # 删除无用代码
395
+ settings['DEAD_CODE_STRIPPING'] = 'YES'
396
+ # 禁止测试能力
397
+ settings['ENABLE_TESTABILITY'] = 'NO'
398
+ # 禁止生产环境断言
399
+ settings['ENABLE_NS_ASSERTIONS'] = 'NO'
400
+ # 保留崩溃分析能力
401
+ settings['DEBUG_INFORMATION_FORMAT'] = 'dwarf-with-dsym'
402
+ # 栈溢出保护
403
+ flags = Array(settings['OTHER_CFLAGS'] || '$(inherited)')
404
+ unless flags.include?('-fstack-protector-strong')
405
+ flags << '-fstack-protector-strong'
406
+ end
407
+ settings['OTHER_CFLAGS'] = flags
408
+ end
409
+ end
410
+ installer.aggregate_targets.map(&:user_project).compact.uniq.each(&:save)
363
411
  end
364
412
  end
@@ -1,3 +1,3 @@
1
1
  module CocoapodsBbPodassistant
2
- VERSION = "0.3.16.8"
2
+ VERSION = "0.3.16.10"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-bb-PodAssistant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.16.8
4
+ version: 0.3.16.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - humin
@@ -220,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
220
220
  - !ruby/object:Gem::Version
221
221
  version: '0'
222
222
  requirements: []
223
- rubygems_version: 4.0.20
223
+ rubygems_version: 4.0.21
224
224
  specification_version: 4
225
225
  summary: A longer description of cocoapods-bb-PodAssistant.
226
226
  test_files: []