一、 针对取消组件更新、发布流程验证中的构建步骤
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.X.X/lib/cocoapods/validator.rb : line 405
或者:
/usr/local/lib/ruby/gems/3.0.0/gems/cocoapods-1.X.X/lib/cocoapods/validator.rb
valid = platforms.send(fail_fast ? :all? : :each) do |platform|
UI.message "\n\n#{spec} - Analyzing on #{platform} platform.".green.reversed
@consumer = spec.consumer(platform)
setup_validation_environment
begin
create_app_project
download_pod
check_file_patterns
install_pod
validate_swift_version
add_app_project_import
validate_vendored_dynamic_frameworks
# 禁止cocoapods执行组件编译,默认编译成功
# build_pod
test_pod unless skip_tests
ensure
tear_down_validation_environment
end
validated?
end
二、针对组件并行发布,打包机加入提交 repo 仓库时的本地锁
必须首先保证此目录下有此文件夹
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.X.X/lib/cocoapods/command/repo/push.rb : line 77 开始
def run
open_editor if @commit_message && @message.nil?
check_if_push_allowed
validate_podspec_files
add_git_lock # 增加本地文件锁
check_repo_status
update_repo
add_specs_to_repo
push_repo unless @local_only
delete_git_lock # 移除本地文件锁
end
#---------------------------------------------------------------------#
$lock_path = "/Users/ziroom/.cocoapods/locks/" # 文件锁路径
def add_git_lock
puts "加锁: #{@repo}"
begin
unless File::exist?($lock_path+"#{@repo}")
File.new($lock_path+"#{@repo}", "w")
else
puts "锁定中..."
sleep 5
add_git_lock
end
rescue
puts "加锁失败,重试中"
sleep 5
retry
end
end
def delete_git_lock
begin
puts "开锁..."
File.delete($lock_path+"#{@repo}")
rescue => e
puts "解锁失败,重试中"
sleep 5
retry
end
end
179-185行去掉lint检查:
三、针对打包二进制的时候,cocoapod查找framework里的静态资源的路径问题
cocoapods-{version}/lib/cocoapods/target/aggregate_target.rb
注释掉如下代码(309-322}
if pod_target.build_as_static_framework?
built_product_dir = Pathname.new(pod_target.build_product_path('${BUILT_PRODUCTS_DIR}'))
resource_paths = resource_paths.map do |resource_path|
extname = File.extname(resource_path)
if self.class.resource_extension_compilable?(extname)
output_extname = self.class.output_extension_for_resource(extname)
output_path_components = Pathname(resource_path).each_filename.select { |component| File.extname(component) == '.lproj' }
output_path_components << File.basename(resource_path)
built_product_dir.join(*output_path_components).sub_ext(output_extname).to_s
else
resource_path
end
end
end