cocoapods-bb-PodAssistant 0.1.9.2 → 0.2.0
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-bb-PodAssistant/babybus/helpers/babybus_info_plist_helper.rb +27 -1
- data/lib/cocoapods-bb-PodAssistant/babybus/installer/post_install_hooks.rb +46 -48
- data/lib/cocoapods-bb-PodAssistant/command/stable/push.rb +93 -0
- data/lib/cocoapods-bb-PodAssistant/command/stable/sync.rb +1 -1
- data/lib/cocoapods-bb-PodAssistant/command/stable/update.rb +8 -2
- data/lib/cocoapods-bb-PodAssistant/command/stable.rb +4 -8
- data/lib/cocoapods-bb-PodAssistant/config/cache_path.rb +2 -2
- data/lib/cocoapods-bb-PodAssistant/config/source_manager.rb +76 -9
- data/lib/cocoapods-bb-PodAssistant/gem_version.rb +1 -1
- data/lib/cocoapods-bb-PodAssistant/helpers/pod_module_helper.rb +20 -5
- data/lib/cocoapods-bb-PodAssistant/helpers/stable_env_helper.rb +22 -14
- data/lib/cocoapods-bb-PodAssistant/helpers/stable_manager_helper.rb +5 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d20d9d58e270471cf2c4f2c67680ac357bfe3a9bc98bfff584365aa7c7880ccc
|
4
|
+
data.tar.gz: b9ae69a6fe68492eb9e60a9fd8f18bd128a983c05f2652f5bd4e256434965b2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdb0cbecbf00a7e12b86a39f912516361edf310c261508a494b6126c9122ab79e737c6ee5c821b3ae2fd871bbbc2309c0aa664b0c8a94fa489588e13e0cea645
|
7
|
+
data.tar.gz: 6d2727972ff6356bca684ff3e7a9b6339d43e9e2fcf2952daada97c668712a9308cb37eb08e55bc38f7ad769aaeb7d4150241c12df3bc363c053839129ce58c9
|
@@ -91,9 +91,35 @@ def isPinyinAppp
|
|
91
91
|
return bundleId === "com.sinyee.babybus.voicerecognition" || bundleId === "com.sinyee.babybus.read.ios" || bundleId === "com.sinyee.babybus.stroke"
|
92
92
|
end
|
93
93
|
|
94
|
+
# 是否科学产品
|
95
|
+
def isCourseApp
|
96
|
+
bundleId = getProjectBundleIdentifier()
|
97
|
+
return bundleId === "com.ailiyong.world.course"
|
98
|
+
end
|
99
|
+
|
100
|
+
# 是否思维产品
|
101
|
+
def isMathApp
|
102
|
+
bundleId = getProjectBundleIdentifier()
|
103
|
+
return bundleId === "com.sinyee.babybus.mathIII"
|
104
|
+
end
|
105
|
+
|
106
|
+
# 是否abc产品
|
107
|
+
def isABCApp
|
108
|
+
bundleId = getProjectBundleIdentifier()
|
109
|
+
return bundleId === "com.sinyee.babybus.abc"
|
110
|
+
end
|
111
|
+
|
112
|
+
# 是否城市产品
|
113
|
+
def isCityApp
|
114
|
+
bundleId = getProjectBundleIdentifier()
|
115
|
+
return bundleId === "com.sinyee.babybus.city"
|
116
|
+
end
|
117
|
+
|
94
118
|
# 是否矩阵产品
|
95
119
|
def isMatrixApp
|
96
|
-
|
120
|
+
bundleId = getProjectBundleIdentifier()
|
121
|
+
puts "###bundleId:#{bundleId}###".red
|
122
|
+
if (isHanZiApp || isQMWApp || isPinyinAppp || isCourseApp || isMathApp || isABCApp || isCityApp) then
|
97
123
|
return false
|
98
124
|
end
|
99
125
|
return true
|
@@ -9,9 +9,8 @@ require 'cocoapods-bb-PodAssistant/helpers/pod_utils'
|
|
9
9
|
class PodPostInstaller
|
10
10
|
def initialize(lib, deployment_target=nil)
|
11
11
|
@lib = lib
|
12
|
-
puts "====isUnity3DApp:#{isUnity3DApp}".red
|
13
12
|
if deployment_target.nil?
|
14
|
-
@deployment_target = isUnity3DApp ? "12.0" : "11.0" # Unity2022引擎最低支持iOS12.0
|
13
|
+
@deployment_target = isUnity3DApp ? "12.0" : "11.0" # Unity2022引擎最低支持iOS12.0、unity2d iOS11 、cocos iOS10、超A产品 iOS11 (968广告厂商升级最低支持iOS11)
|
15
14
|
else
|
16
15
|
@deployment_target = deployment_target
|
17
16
|
end
|
@@ -26,7 +25,7 @@ class PodPostInstaller
|
|
26
25
|
env.createCocosResource
|
27
26
|
end
|
28
27
|
ios_deployment_target = @deployment_target
|
29
|
-
puts "
|
28
|
+
puts "pod组件配置工程最低支持iOS系统 ===> #{ios_deployment_target.to_s.send(:red)}".green
|
30
29
|
@lib.aggregate_targets.first.user_project.save # 解决Xcode13 pod update操作出现failed to save pods.xcodeproj问题 by hm 21/11/8
|
31
30
|
project = Xcodeproj::Project.open(BB::PodUtils.getXcodeprojPath)
|
32
31
|
project.targets.each do |target|
|
@@ -64,51 +63,50 @@ class PodPostInstaller
|
|
64
63
|
# project.targets.config
|
65
64
|
@lib.pod_target_subprojects.flat_map { |p| p.targets }.each do |target|
|
66
65
|
target.build_configurations.each do |config|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
66
|
+
# pod 1.13.0兼容故去除,避免
|
67
|
+
# 适配xcode 15 动态库报错: Error 'DT_TOOLCHAIN_DIR cannot be used to evaluate LIBRARY_SEARCH_PATHS, use TOOLCHAIN_DIR instead'
|
68
|
+
# if (is_xcode15 == true) then
|
69
|
+
# xcconfig_path = config.base_configuration_reference.real_path
|
70
|
+
# xcconfig = File.read(xcconfig_path)
|
71
|
+
# xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR")
|
72
|
+
# File.open(xcconfig_path, "w") { |file| file << xcconfig_mod }
|
73
|
+
# end
|
74
|
+
|
75
|
+
config.build_settings['DEAD_CODE_STRIPPING'] = 'YES'
|
76
|
+
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = ios_deployment_target
|
77
|
+
if (isUnityProject) then
|
78
|
+
config.build_settings['ARCHS'] = 'arm64'
|
79
|
+
else
|
80
|
+
config.build_settings['ARCHS'] = '$(ARCHS_STANDARD)'
|
81
|
+
end
|
82
|
+
# fix xcode14手动签名问题 https://github.com/CocoaPods/CocoaPods/issues/11402
|
83
|
+
# config.build_settings["DEVELOPMENT_TEAM"] = "#{teamid}"
|
84
|
+
# Fix Xcode14 bundle need sign
|
85
|
+
# https://github.com/CocoaPods/CocoaPods/issues/11402#issuecomment-1201464693
|
86
|
+
if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
|
87
|
+
config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
|
88
|
+
end
|
89
|
+
# 编译器优化
|
90
|
+
config.build_settings['WARNING_CFLAGS'] = '-Wno-documentation -Wno-nullability-completeness -Wno-macro-redefined -Wno-property-attribute-mismatch -Wno-strict-prototypes -Wno-incompatible-pointer-types'
|
91
|
+
config.build_settings['ASSETCATALOG_COMPILER_OPTIMIZATION'] = 'space'
|
92
|
+
config.build_settings['ENABLE_BITCODE'] = 'NO'
|
93
|
+
config.build_settings['DEAD_CODE_STRIPPING'] = 'YES'
|
94
|
+
if config.name.include? 'Debug'
|
95
|
+
config.build_settings['SWIFT_COMPILATION_MODE'] = 'Incremental'
|
96
|
+
config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] = '-Onone'
|
97
|
+
config.build_settings['GCC_OPTIMIZATION_LEVEL'] = '0'
|
98
|
+
else
|
99
|
+
config.build_settings['SWIFT_COMPILATION_MODE'] = 'wholemodule'
|
100
|
+
config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] = '-Osize'
|
101
|
+
config.build_settings['GCC_OPTIMIZATION_LEVEL'] = 'z'
|
102
|
+
end
|
103
|
+
# C++支持@import (工程中带mm类需要进行控制)
|
104
|
+
if (target.name.include? 'matrix-wechat') || (target.name.include? 'Sentry')
|
105
|
+
# 三方库不支持modulemap
|
106
|
+
config.build_settings['OTHER_CPLUSPLUSFLAGS'] = "$(inherited) $(OTHER_CFLAGS)"
|
107
|
+
else
|
108
|
+
config.build_settings['OTHER_CPLUSPLUSFLAGS'] = "$(inherited) $(OTHER_CFLAGS) -fmodules -fcxx-modules"
|
109
|
+
end
|
112
110
|
end
|
113
111
|
# 修复警告 Run script build phase '[CP] Copy Pods Resources' will be run during every build because it does not specify any outputs
|
114
112
|
fix_phases = target.shell_script_build_phases.find { |x| x.name == '[CP] Copy XCFrameworks' || 'Create Symlinks to Header Folders' }
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'cocoapods-bb-PodAssistant/config/source_manager'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Command
|
5
|
+
class Stable < Command
|
6
|
+
class Push < Stable
|
7
|
+
self.summary = '[更新stable组件稳定版本] Update outdated project dependencies and create new ' \
|
8
|
+
'Podfile.lock'
|
9
|
+
|
10
|
+
self.description = <<-DESC
|
11
|
+
常用命令如下:\n
|
12
|
+
更新所有公共组件: `pod stable push`\n
|
13
|
+
更新指定公共组件: `pod stable push 组件名称`\n
|
14
|
+
更新指定公共组件/移除组件: `pod stable push 组件名称 --remove=组件名称` #多个移除名称带`,`\n
|
15
|
+
更新指定公共组件/带依赖关系: `pod stable push 组件名称 --dependencies=组件名称` #多个依赖名称带`,`\n
|
16
|
+
更新指定公共组件/带依赖关系/移除组件: `pod stable push 组件名称 --dependencies=组件名称 --remove=组件名称` #多个依赖名称带`,`\n
|
17
|
+
参数说明:--dependencies 依赖组件 --remove 需要移除组件 --update-matrix 更新矩阵产品公共业务线
|
18
|
+
DESC
|
19
|
+
|
20
|
+
self.arguments = [
|
21
|
+
CLAide::Argument.new('POD_NAMES', false, true),
|
22
|
+
]
|
23
|
+
|
24
|
+
def self.options
|
25
|
+
[
|
26
|
+
['--dependencies', '依赖组件名称,多个使用`,`隔开'],
|
27
|
+
['--remove', '移除公共组件名称,多个使用`,`隔开'],
|
28
|
+
['--update-matrix', '更新矩阵产品公共业务线'],
|
29
|
+
].concat(super)
|
30
|
+
end
|
31
|
+
|
32
|
+
def initialize(argv)
|
33
|
+
@pods = argv.arguments!
|
34
|
+
@dependencies = argv.option('dependencies', nil)&.split(',')
|
35
|
+
@remove = argv.option('remove', nil)&.split(',')
|
36
|
+
@is_matrix = argv.flag?('update-matrix', false)
|
37
|
+
super
|
38
|
+
end
|
39
|
+
|
40
|
+
def run
|
41
|
+
puts "[PodAssistant] 开始执行 $ pod stable push".yellow
|
42
|
+
source_manager = BB::SourceManager.new(false)
|
43
|
+
cachePath = source_manager.cache_path
|
44
|
+
puts "stable cache git=>#{cachePath}"
|
45
|
+
Dir.chdir(File.join(cachePath)) {
|
46
|
+
# puts "pwd:#{`pwd`}".green
|
47
|
+
path = @is_matrix ? matrix_stable_path : common_stable_path
|
48
|
+
Dir.chdir(File.join(path)) {
|
49
|
+
if @pods.any?
|
50
|
+
if (@pods.length > 1) && (@dependencies)
|
51
|
+
puts "❌ 无效指令,不能处理多个组件#{@pods}依赖,更新组件仅支持单组件".red
|
52
|
+
puts "举例:pod stable push <单组件> --dependencies=<多组件>".green
|
53
|
+
puts "详见 pod stable push --help".green
|
54
|
+
system "pod stable push --help"
|
55
|
+
exit
|
56
|
+
elsif (@pods.length == 1) && (@dependencies || @remove)
|
57
|
+
pod_name=@pods.first
|
58
|
+
dependencies_hash = {}
|
59
|
+
if @dependencies
|
60
|
+
dependencies_hash[pod_name] = @dependencies
|
61
|
+
end
|
62
|
+
if @is_matrix
|
63
|
+
source_manager.update_business_dependencies_and_remove_data(dependencies_hash, @remove)
|
64
|
+
else
|
65
|
+
source_manager.update_common_dependencies_and_remove_data(dependencies_hash, @remove)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
pods_str = @pods.join(" ")
|
69
|
+
system "pod stable update #{pods_str}"
|
70
|
+
else
|
71
|
+
if (@dependencies) || (@remove)
|
72
|
+
puts "❌ 无效指令,没有制定组件名称 详见 pod stable push --help".red
|
73
|
+
system "pod stable push --help"
|
74
|
+
exit
|
75
|
+
end
|
76
|
+
system "pod stable update"
|
77
|
+
end
|
78
|
+
}
|
79
|
+
}
|
80
|
+
end
|
81
|
+
|
82
|
+
# 公共stable目录
|
83
|
+
private def common_stable_path
|
84
|
+
return File.join(Dir.pwd, 'Common_Stable')
|
85
|
+
end
|
86
|
+
# 全线矩阵产品公共stable目录
|
87
|
+
private def matrix_stable_path
|
88
|
+
return File.join(Dir.pwd, 'Matrix_Common_Stable')
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -8,7 +8,7 @@ module Pod
|
|
8
8
|
class Stable < Command
|
9
9
|
class Sync < Stable
|
10
10
|
|
11
|
-
self.summary = '[同步远端yml
|
11
|
+
self.summary = '[同步远端yml配置,更新所有公共组件标签库版本] sync a Stable yml config file'
|
12
12
|
|
13
13
|
self.description = <<-DESC
|
14
14
|
同步远端stable yml配置文件,并对本地文件进行合并操作
|
@@ -4,7 +4,7 @@ module Pod
|
|
4
4
|
class Command
|
5
5
|
class Stable < Command
|
6
6
|
class Update < Stable
|
7
|
-
self.summary = '[命令同执行`pod update
|
7
|
+
self.summary = '[命令同执行`pod update操作`,同步更新stable组件标签版本到最新] Update outdated project dependencies and create new ' \
|
8
8
|
'Podfile.lock'
|
9
9
|
|
10
10
|
self.description = <<-DESC
|
@@ -27,7 +27,7 @@ module Pod
|
|
27
27
|
|
28
28
|
def initialize(argv)
|
29
29
|
@pods = argv.arguments!
|
30
|
-
@sync = argv.flag?('sync')
|
30
|
+
@sync = argv.flag?('sync', true)
|
31
31
|
super
|
32
32
|
end
|
33
33
|
|
@@ -41,6 +41,7 @@ module Pod
|
|
41
41
|
source_manager.merge_stable_data(@pods)
|
42
42
|
end
|
43
43
|
podStartTime = Time.new
|
44
|
+
update_spec
|
44
45
|
if @pods.any?
|
45
46
|
pods_str = @pods.join(" ")
|
46
47
|
system "pod update #{pods_str}"
|
@@ -55,6 +56,11 @@ module Pod
|
|
55
56
|
source_manager.update_local_stable_from_podmodules(@pods)
|
56
57
|
puts "[PodAssistant] `pod stable update` complete!".green
|
57
58
|
end
|
59
|
+
def update_spec
|
60
|
+
system "pod repo update babybus-babybus-ios-specs-babybus-specs"
|
61
|
+
system "pod repo update babybus-babybus-ios-specs-sourcev2-specs"
|
62
|
+
system "pod repo update babybus-babybus-ios-specs-dylib-specs"
|
63
|
+
end
|
58
64
|
end
|
59
65
|
end
|
60
66
|
end
|
@@ -6,6 +6,7 @@ require 'cocoapods-bb-PodAssistant/command/stable/init'
|
|
6
6
|
require 'cocoapods-bb-PodAssistant/command/stable/install'
|
7
7
|
require 'cocoapods-bb-PodAssistant/command/stable/update'
|
8
8
|
require 'cocoapods-bb-PodAssistant/command/stable/sync'
|
9
|
+
require 'cocoapods-bb-PodAssistant/command/stable/push'
|
9
10
|
|
10
11
|
module Pod
|
11
12
|
|
@@ -29,21 +30,16 @@ module Pod
|
|
29
30
|
拉取稳定lock配置插件。利用版本比对进行更新配置实现对组件版本控制管理。
|
30
31
|
DESC
|
31
32
|
|
32
|
-
self.default_subcommand = 'init'
|
33
|
+
# self.default_subcommand = 'init'
|
33
34
|
|
34
35
|
#-----------------------------------------------------------------------#
|
35
36
|
|
36
37
|
extend Executable
|
37
38
|
executable :git
|
38
39
|
|
39
|
-
def
|
40
|
+
def initialize(argv)
|
40
41
|
super
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
def run
|
45
|
-
puts "[PodAssistant] `pod stable` 帮助文档请查看�".yellow
|
46
|
-
# banner!
|
42
|
+
puts "cocoapods-bb-PodAssistant (#{CocoapodsBbPodassistant::VERSION})"
|
47
43
|
end
|
48
44
|
|
49
45
|
end
|
@@ -3,12 +3,12 @@ require 'cocoapods-bb-PodAssistant/helpers/pod_utils'
|
|
3
3
|
|
4
4
|
module BB
|
5
5
|
class Cache
|
6
|
-
def initialize(stable_source = nil)
|
6
|
+
def initialize(stable_source = nil, verify_stable_env=true)
|
7
7
|
if stable_source.nil?
|
8
8
|
stable_source = StableSource.stable_default_source
|
9
9
|
end
|
10
10
|
@stable_source = stable_source
|
11
|
-
if File.exist?(File.join(Pathname.pwd, "Podfile"))
|
11
|
+
if verify_stable_env && File.exist?(File.join(Pathname.pwd, "Podfile"))
|
12
12
|
@bundleId = BB::PodUtils.getProjectBundleIdentifier
|
13
13
|
end
|
14
14
|
if @bundleId.nil?
|
@@ -7,13 +7,16 @@ require 'cocoapods-bb-PodAssistant/helpers/stable_env_helper'
|
|
7
7
|
# 数据源管理
|
8
8
|
module BB
|
9
9
|
class SourceManager
|
10
|
-
def initialize()
|
11
|
-
env = BB::StableEnv.new()
|
12
|
-
|
13
|
-
@
|
14
|
-
@stableMgr = BB::StableManager.new(env)
|
10
|
+
def initialize(verify_stable_env=true)
|
11
|
+
@env = BB::StableEnv.new(verify_stable_env)
|
12
|
+
@businessSpecName = @env.business_stable
|
13
|
+
@stableMgr = BB::StableManager.new(@env, verify_stable_env)
|
15
14
|
end
|
16
15
|
|
16
|
+
def cache_path
|
17
|
+
return @env.cache_path
|
18
|
+
end
|
19
|
+
|
17
20
|
# 公共源路径(远端)
|
18
21
|
def public_stable_yaml
|
19
22
|
return @stableMgr.public_stable_yaml
|
@@ -29,6 +32,18 @@ module BB
|
|
29
32
|
return @stableMgr.local_stable_yaml
|
30
33
|
end
|
31
34
|
|
35
|
+
def get_stable_datas(yml)
|
36
|
+
spec = BB::StableSpecs.new()
|
37
|
+
return spec.readData(yml)
|
38
|
+
end
|
39
|
+
# 通用-公共lock数据
|
40
|
+
def common_stable_datas
|
41
|
+
return get_stable_datas(public_stable_yaml)
|
42
|
+
end
|
43
|
+
# 业务线-公共lock数据
|
44
|
+
def business_stable_datas
|
45
|
+
return get_stable_datas(business_stable_yaml)
|
46
|
+
end
|
32
47
|
# 产品线本地lock数据
|
33
48
|
def fetch_local_stable_datas
|
34
49
|
localSpec = BB::StableSpecs.new()
|
@@ -37,7 +52,7 @@ module BB
|
|
37
52
|
puts "yml配置文件不存在,执行自动初始化项目yml配置文件".green
|
38
53
|
generate_localStable
|
39
54
|
end
|
40
|
-
return
|
55
|
+
return get_stable_datas(yml)
|
41
56
|
end
|
42
57
|
|
43
58
|
# 远端公共lock数据
|
@@ -90,8 +105,19 @@ module BB
|
|
90
105
|
|
91
106
|
# 更新本地lock数据
|
92
107
|
def update_localstable_datas(stable_lock)
|
93
|
-
|
94
|
-
|
108
|
+
update_stable_lock(local_stable_yaml, stable_lock)
|
109
|
+
end
|
110
|
+
# podfile 更新配置文件使用(通用)
|
111
|
+
def update_common_stable_lock(stable_lock)
|
112
|
+
update_stable_lock(public_stable_yaml, stable_lock)
|
113
|
+
end
|
114
|
+
# podfile 更新配置文件使用(业务线)
|
115
|
+
def update_business_stable_lock(stable_lock)
|
116
|
+
update_stable_lock(business_stable_yaml, stable_lock)
|
117
|
+
end
|
118
|
+
def update_stable_lock(stable_yaml, stable_lock)
|
119
|
+
stableSpec = BB::StableSpecs.new()
|
120
|
+
stableSpec.writeData(stable_yaml, stable_lock)
|
95
121
|
end
|
96
122
|
|
97
123
|
# 合并stable数据,参数,支持传入更新某几个数据
|
@@ -122,7 +148,48 @@ module BB
|
|
122
148
|
end
|
123
149
|
return result
|
124
150
|
end
|
125
|
-
|
151
|
+
# 更新依赖/移除数据
|
152
|
+
def update_dependencies_and_remove_data(stable_yaml, stable_specs, dependencies_pods, remove_pods)
|
153
|
+
if dependencies_pods || remove_pods
|
154
|
+
listdata = stable_specs[YAML_CONFIG_LIST_KEY]
|
155
|
+
removedata = stable_specs[YAML_CONFIG_REMOVE_KEY]
|
156
|
+
dependenciesdata = stable_specs[YAML_CONFIG_DEPENDENCIES_KEY]
|
157
|
+
if remove_pods
|
158
|
+
remove_pods.each do |name|
|
159
|
+
name = name.to_s
|
160
|
+
if listdata[name].nil?
|
161
|
+
puts "❌ 移除未知公共组件【#{name}】,请确认名称是否正确!!! 传入参数list:#{remove_pods}".red
|
162
|
+
exit
|
163
|
+
end
|
164
|
+
if !removedata.include?(name)
|
165
|
+
removedata.push(name)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
if dependencies_pods
|
170
|
+
dependencies_pods.each do |name, array|
|
171
|
+
if array.length > 0
|
172
|
+
array.each do |pod_name|
|
173
|
+
if listdata[pod_name].nil?
|
174
|
+
puts "❌ 依赖未知公共组件【#{name}】,请确认名称是否正确!!! 传入参数list:#{array}".red
|
175
|
+
exit
|
176
|
+
end
|
177
|
+
end
|
178
|
+
dependenciesdata[name] = array
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
stable_specs[YAML_CONFIG_REMOVE_KEY] = removedata
|
183
|
+
stable_specs[YAML_CONFIG_DEPENDENCIES_KEY] = dependenciesdata
|
184
|
+
update_stable_lock(stable_yaml, stable_specs)
|
185
|
+
end
|
186
|
+
end
|
187
|
+
def update_common_dependencies_and_remove_data(dependencies_pods, remove_pods)
|
188
|
+
update_dependencies_and_remove_data(public_stable_yaml, common_stable_datas, dependencies_pods, remove_pods)
|
189
|
+
end
|
190
|
+
def update_business_dependencies_and_remove_data(dependencies_pods, remove_pods)
|
191
|
+
update_dependencies_and_remove_data(business_stable_yaml, business_stable_datas, dependencies_pods, remove_pods)
|
192
|
+
end
|
126
193
|
# compare specs 参数1:本地,参数2:远端,参数3:指定更新pod库
|
127
194
|
def compare_specs(local_specs, common_specs, update_pods=[])
|
128
195
|
added_projects = []
|
@@ -111,6 +111,7 @@ module BB
|
|
111
111
|
commit = pod[:commit]
|
112
112
|
linkages = pod[:linkages]
|
113
113
|
linkage = pod[:linkage]
|
114
|
+
remove = pod[:remove]
|
114
115
|
if (names.is_a? Array) && !names.empty?
|
115
116
|
data = {}
|
116
117
|
if version
|
@@ -141,6 +142,10 @@ module BB
|
|
141
142
|
if linkage
|
142
143
|
data[:linkage] = linkage
|
143
144
|
end
|
145
|
+
if remove
|
146
|
+
data[:remove] = remove
|
147
|
+
puts "###业务方配置需要移除插件####names:[#{names}] pod:#{pod}".red
|
148
|
+
end
|
144
149
|
names.each do |pod_name|
|
145
150
|
podfile_hash[pod_name] = data
|
146
151
|
end
|
@@ -159,7 +164,7 @@ module BB
|
|
159
164
|
stable_hash = local_stable_data
|
160
165
|
podfile_hash.each do |podName,podfile_pod|
|
161
166
|
if podfile_pod.count == 0
|
162
|
-
puts "❌ podfile
|
167
|
+
puts "❌ podfile组件[#{podName}]配置异常,请确认:method => REMOTE_VERSION是否配置\n组件信息如下:\n#{podName} => #{podfile_pod}".red
|
163
168
|
exit
|
164
169
|
end
|
165
170
|
podCoreName = @source_manager.subspec_podname(podName)
|
@@ -168,10 +173,6 @@ module BB
|
|
168
173
|
if pod.nil? # stbale没有受版本控制
|
169
174
|
need_update_pod_data[podName] = podfile_pod
|
170
175
|
else
|
171
|
-
# if podCoreName == 'BBGameModule'
|
172
|
-
# succ = (pod == podfile_pod) ? true : false
|
173
|
-
# puts "[stable]podCoreName:#{podCoreName}(#{pod}) VS [podfile] podName:#{podName}(#{podfile_pod}) succ:#{succ}".green
|
174
|
-
# end
|
175
176
|
if pod == podfile_pod
|
176
177
|
if podName != podCoreName
|
177
178
|
need_update_pod_data[podName] = podfile_pod
|
@@ -183,6 +184,12 @@ module BB
|
|
183
184
|
git = podfile_pod[:git_format]
|
184
185
|
end
|
185
186
|
version = podfile_pod[:version]
|
187
|
+
remove = podfile_pod[:remove]
|
188
|
+
if remove
|
189
|
+
puts "[PodAssistant] 过滤组件数据 #{podName} #{podfile_pod}".red
|
190
|
+
stable_hash.delete(podCoreName)
|
191
|
+
next
|
192
|
+
end
|
186
193
|
if (branch && !branch.empty?) || (git && !git.empty?)
|
187
194
|
# 项目配置指向分支数据,以本项目为主
|
188
195
|
puts "[PodAssistant] #{podName} 指向分支数据 => #{podfile_pod}"
|
@@ -256,6 +263,14 @@ module BB
|
|
256
263
|
# puts "need_update_pod_data:#{need_update_pod_data}".green
|
257
264
|
# 规避指向分支/远端版本替换yml配置所有组件,避免pod指向指向多个源
|
258
265
|
need_update_pod_data.each do |podName,pod|
|
266
|
+
if pod.is_a? Hash
|
267
|
+
remove = pod[:remove]
|
268
|
+
if remove
|
269
|
+
puts "[PodAssistant] 过滤组件数据 #{podName} #{pod} remove:#{remove}".red
|
270
|
+
stable_hash.delete(podName)
|
271
|
+
next
|
272
|
+
end
|
273
|
+
end
|
259
274
|
stable_hash[podName] = pod
|
260
275
|
puts "[PodAssistant] merge pod #{podName} #{pod}"
|
261
276
|
end
|
@@ -2,16 +2,17 @@ require 'cocoapods-bb-PodAssistant/config/stable_source'
|
|
2
2
|
|
3
3
|
module BB
|
4
4
|
class StableEnv
|
5
|
-
def initialize()
|
6
|
-
@cache = BB::Cache.new()
|
5
|
+
def initialize(verify_stable_env=true)
|
6
|
+
@cache = BB::Cache.new(nil, verify_stable_env)
|
7
7
|
configGitPath(@cache.cachePath)
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
if verify_stable_env
|
9
|
+
# 自动加载stable环境
|
10
|
+
loadStaleEnv
|
11
|
+
if verify_stable_env_exists == false
|
12
|
+
puts "[PodAssistant] ❌工程没有配置stable环境".red
|
13
|
+
end
|
14
14
|
end
|
15
|
+
fetch_stale_git # 自动拉取远端git仓库数据
|
15
16
|
end
|
16
17
|
|
17
18
|
# stable 环境,执行pod stable
|
@@ -40,27 +41,28 @@ module BB
|
|
40
41
|
# 拉取stable仓库代码 hook开发环境,执行pod install/update
|
41
42
|
def system_clone_stable_git
|
42
43
|
cachePath = @cache.cachePath
|
43
|
-
puts "
|
44
|
+
puts "fetch stable git=>#{cachePath}"
|
44
45
|
if !Dir.exist?(File.join(cachePath))
|
46
|
+
puts "git clone=>#{stable_source}"
|
45
47
|
clonePath = File.dirname(cachePath)
|
46
48
|
FileUtils.mkdir_p clonePath
|
47
|
-
system "git clone #{
|
49
|
+
system "git clone #{stable_source} #{cachePath}"
|
48
50
|
end
|
49
51
|
if verify_branch_exists
|
50
52
|
if stable_tag || stable_branch
|
51
53
|
if stable_branch
|
52
|
-
system "cd #{cachePath}; git checkout #{stable_branch}; git reset --hard origin/#{stable_branch}
|
54
|
+
system "cd #{cachePath}; git pull --all; git checkout #{stable_branch}; git reset --hard origin/#{stable_branch}"
|
53
55
|
end
|
54
56
|
if stable_tag
|
55
|
-
system "cd #{cachePath}; git checkout #{stable_tag};"
|
57
|
+
system "cd #{cachePath}; git pull --all; git checkout #{stable_tag};"
|
56
58
|
end
|
57
59
|
else
|
58
60
|
result =`git symbolic-ref refs/remotes/origin/HEAD`
|
59
61
|
protechBranch = result.split("/").last.strip || default_branch
|
60
|
-
system "cd #{cachePath}; git checkout #{protechBranch}; git reset --hard origin/#{protechBranch}
|
62
|
+
system "cd #{cachePath}; git pull --all; git checkout #{protechBranch}; git reset --hard origin/#{protechBranch}"
|
61
63
|
end
|
62
64
|
else
|
63
|
-
puts "❌ stable配置无效分支信息source:#{
|
65
|
+
puts "❌ stable配置无效分支信息source:#{stable_source} branch:#{stable_branch}".red
|
64
66
|
exit
|
65
67
|
end
|
66
68
|
end
|
@@ -81,6 +83,9 @@ module BB
|
|
81
83
|
end
|
82
84
|
|
83
85
|
def stable_source
|
86
|
+
if @stable_source.nil?
|
87
|
+
@stable_source = StableSource.stable_default_source
|
88
|
+
end
|
84
89
|
return @stable_source
|
85
90
|
end
|
86
91
|
def default_branch
|
@@ -129,5 +134,8 @@ module BB
|
|
129
134
|
end
|
130
135
|
return false
|
131
136
|
end
|
137
|
+
def cache_path
|
138
|
+
return @cache.cachePath
|
139
|
+
end
|
132
140
|
end
|
133
141
|
end
|
@@ -4,8 +4,9 @@ require 'cocoapods-bb-PodAssistant/helpers/stable_env_helper'
|
|
4
4
|
|
5
5
|
module BB
|
6
6
|
class StableManager
|
7
|
-
def initialize(env = nil)
|
7
|
+
def initialize(env = nil, verify_stable_env=true)
|
8
8
|
@env = env
|
9
|
+
@verify_stable_env = verify_stable_env
|
9
10
|
end
|
10
11
|
|
11
12
|
# podfile 更新配置文件使用(通用)
|
@@ -32,7 +33,7 @@ module BB
|
|
32
33
|
# 仓库缓存目录
|
33
34
|
def cachePath
|
34
35
|
if @cache.nil?
|
35
|
-
@cache = BB::Cache.new()
|
36
|
+
@cache = BB::Cache.new(nil, @verify_stable_env)
|
36
37
|
end
|
37
38
|
return @cache.cachePath
|
38
39
|
end
|
@@ -61,7 +62,8 @@ module BB
|
|
61
62
|
stableSpec.update_stable_lock(yml_path, pod_targets)
|
62
63
|
# step.2 提交修改后代码
|
63
64
|
yml_name = File.basename(yml_path)
|
64
|
-
`cd #{cachePath}; git pull --all; git add #{yml_name}; git commit -m "[update] 更新stable配置文件#{yml_name}"; git push; git pull --all;`
|
65
|
+
# `cd #{cachePath}; git pull --all; git add #{yml_name}; git commit -m "[update] 更新stable配置文件#{yml_name}"; git push; git pull --all;`
|
66
|
+
`cd #{cachePath}; git pull --all; git add * ; git commit -m "[update] 更新stable配置文件#{yml_name}"; git push; git pull --all;`
|
65
67
|
end
|
66
68
|
private def update_local_stable_lock(yml_path, pod_targets)
|
67
69
|
# step.1 更新yaml配置文件
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-bb-PodAssistant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- humin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-10-
|
11
|
+
date: 2023-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cocoapods-core
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- lib/cocoapods-bb-PodAssistant/command/stable.rb
|
89
89
|
- lib/cocoapods-bb-PodAssistant/command/stable/init.rb
|
90
90
|
- lib/cocoapods-bb-PodAssistant/command/stable/install.rb
|
91
|
+
- lib/cocoapods-bb-PodAssistant/command/stable/push.rb
|
91
92
|
- lib/cocoapods-bb-PodAssistant/command/stable/sync.rb
|
92
93
|
- lib/cocoapods-bb-PodAssistant/command/stable/update.rb
|
93
94
|
- lib/cocoapods-bb-PodAssistant/config/cache_path.rb
|