Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

兼容 cocoapods-generate (2.2.5)、Cocoapods(1.15.2)环境下编译报错的问题 #220

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "rdbg",
"name": "Debug current file with rdbg",
"request": "launch",
"script": "${workspaceFolder}/cocoapods-imy-bin/cocoapods-imy-bin-0.3.1.2",
"cwd": "/Users/denglibing3/HDProject/ITPlayground/Ruby/202407/CocoaPodsDemo/HDPods/HDStaticPod/HDStaticPod", // "program"的工作目录
"args": ["bin","auto"],
"askParameters": false
},
{
"type": "rdbg",
"name": "Attach with rdbg",
"request": "attach"
}
]
}
4 changes: 2 additions & 2 deletions cocoapods-imy-bin/Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SKIP_UNRELEASED_VERSIONS = false
SKIP_UNRELEASED_VERSIONS = true

# Specify your gem's dependencies in cocoapods-imy-bin.gemspec

Expand All @@ -23,7 +23,7 @@ group :development do
cp_gem 'xcodeproj', 'xcodeproj',path: 'Xcodeproj'
cp_gem 'cocoapods-imy-bin', 'cocoapods-imy-bin',path: 'cocoapods-imy-bin'

gem 'cocoapods-generate', '1.6.0'
gem 'cocoapods-generate', '2.2.5'
gem 'mocha'
gem 'bacon'
gem 'mocha-on-bacon'
Expand Down
155 changes: 85 additions & 70 deletions cocoapods-imy-bin/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,116 +1,131 @@
PATH
remote: ../cocoapods
GEM
remote: https://rubygems.org/
specs:
cocoapods (1.8.4)
activesupport (>= 4.0.2, < 5)
CFPropertyList (3.0.7)
base64
nkf
rexml
activesupport (7.1.3.4)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
bacon (1.2.0)
base64 (0.2.0)
bigdecimal (3.1.8)
claide (1.1.0)
cocoapods (1.15.2)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.8.4)
cocoapods-core (= 1.15.2)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 1.2.2, < 2.0)
cocoapods-downloader (>= 2.1, < 3.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-stats (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.4.0, < 2.0)
cocoapods-trunk (>= 1.6.0, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
fourflusher (>= 2.3.0, < 3.0)
gh_inspector (~> 1.0)
molinillo (~> 0.6.6)
molinillo (~> 0.8.0)
nap (~> 1.0)
ruby-macho (~> 1.4)
xcodeproj (>= 1.11.1, < 2.0)

PATH
remote: ../xcodeproj
specs:
xcodeproj (1.15.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.2.6)

PATH
remote: .
specs:
cocoapods-imy-bin (0.2.0)
cocoapods
cocoapods-generate (= 1.6.0)
parallel

GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.2)
activesupport (4.2.11.3)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
algoliasearch (1.27.3)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
bacon (1.2.0)
claide (1.0.3)
cocoapods-core (1.8.4)
activesupport (>= 4.0.2, < 6)
ruby-macho (>= 2.3.0, < 3.0)
xcodeproj (>= 1.23.0, < 2.0)
cocoapods-core (1.15.2)
activesupport (>= 5.0, < 8)
addressable (~> 2.8)
algoliasearch (~> 1.0)
concurrent-ruby (~> 1.1)
fuzzy_match (~> 2.0.4)
nap (~> 1.0)
cocoapods-deintegrate (1.0.4)
cocoapods-disable-podfile-validations (0.1.1)
cocoapods-downloader (1.3.0)
cocoapods-generate (1.6.0)
cocoapods-disable-podfile-validations (~> 0.1.1)
netrc (~> 0.11)
public_suffix (~> 4.0)
typhoeus (~> 1.0)
cocoapods-deintegrate (1.0.5)
cocoapods-disable-podfile-validations (0.2.0)
cocoapods-downloader (2.1)
cocoapods-generate (2.2.5)
cocoapods-disable-podfile-validations (>= 0.1.1, < 0.3.0)
cocoapods-imy-bin (0.3.1.21)
cocoapods
cocoapods-generate
parallel
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.0)
cocoapods-stats (1.1.0)
cocoapods-trunk (1.5.0)
cocoapods-search (1.0.1)
cocoapods-trunk (1.6.0)
nap (>= 0.8, < 2.0)
netrc (~> 0.11)
cocoapods-try (1.2.0)
colored2 (3.1.2)
concurrent-ruby (1.1.6)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
drb (2.2.1)
escape (0.0.4)
ethon (0.16.0)
ffi (>= 1.15.0)
ffi (1.17.0)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
httpclient (2.8.3)
i18n (0.9.5)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
json (2.3.0)
minitest (5.14.1)
json (2.7.2)
minitest (5.24.1)
mocha (1.11.2)
mocha-on-bacon (0.2.3)
mocha (>= 0.13.0)
molinillo (0.6.6)
nanaimo (0.2.6)
molinillo (0.8.0)
mutex_m (0.2.0)
nanaimo (0.3.0)
nap (1.1.0)
netrc (0.11.0)
parallel (1.19.1)
nkf (0.2.0)
parallel (1.26.2)
prettybacon (0.0.2)
bacon (~> 1.2)
ruby-macho (1.4.0)
thread_safe (0.3.6)
tzinfo (1.2.7)
thread_safe (~> 0.1)
public_suffix (4.0.7)
rexml (3.3.5)
strscan
ruby-macho (2.5.1)
strscan (3.1.0)
typhoeus (1.4.1)
ethon (>= 0.9.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
xcodeproj (1.25.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
rexml (>= 3.3.2, < 4.0)

PLATFORMS
ruby

DEPENDENCIES
bacon
cocoapods!
cocoapods-generate (= 1.6.0)
cocoapods-imy-bin!
cocoapods
cocoapods-generate (= 2.2.5)
cocoapods-imy-bin
mocha
mocha-on-bacon
prettybacon
xcodeproj!
xcodeproj

BUNDLED WITH
2.1.4
2 changes: 1 addition & 1 deletion cocoapods-imy-bin/cocoapods-imy-bin.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Gem::Specification.new do |spec|

spec.add_dependency 'parallel'
spec.add_dependency 'cocoapods'
spec.add_dependency "cocoapods-generate",'~>2.0.1'
spec.add_dependency "cocoapods-generate",'2.2.5'

spec.add_development_dependency 'bundler'
spec.add_development_dependency 'rake'
Expand Down
34 changes: 30 additions & 4 deletions cocoapods-imy-bin/lib/cocoapods-imy-bin/command/bin/archive.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,22 @@ def generate_project
argvs = [
"--sources=#{sources_option(@code_dependencies, @sources)}",
"--gen-directory=#{CBin::Config::Builder.instance.gen_dir}",
'--clean',
# '--clean',
*@additional_args
]

# 源码路径
source_dir = [email protected]

# 打包路径(private/var/tmp/imy_release)路径,解决多个电脑源码调试的问题
gen_directory = "#{CBin::Config::Builder.instance.gen_dir}" + "/#{@spec.name}"
FileUtils.cp_r(source_dir, gen_directory)

podfile= File.join(Pathname.pwd, "Podfile")
if File.exist?(podfile)
argvs += ['--use-podfile']
end

argvs << spec_file if spec_file

gen = Pod::Command::Gen.new(CLAide::ARGV.new(argvs))
Expand All @@ -184,12 +191,31 @@ def spec_file
raise Informative, '当前目录下没有找到可用源码 podspec.'
end

spec_file = code_spec_files.first
spec_file
# spec_file = code_spec_files.first
# spec_file
gen_file
end
end
end

def gen_file
spec_file = code_spec_files.first

# {CBin::Config::Builder.instance.gen_dir: /private/var/tmp/imy_release/HDStaticPod-build-temp/bin-archive
# 使用 split 方法分割字符串,并获取分割后的第一个部分
name = spec_file.to_path.split('.').first
# 打包路径(private/var/tmp/imy_release)路径,解决多个电脑源码调试的问题
gen_directory = "#{CBin::Config::Builder.instance.gen_dir}" + "/#{name}"
FileUtils.rm_rf(gen_directory) if File.exist?(gen_directory)
# 确保目标目录存在
FileUtils.mkdir_p(gen_directory)
# 复制目录及其内容
gen_directory = "#{gen_directory}" + "/#{spec_file}"
# 复制目录及其内容
FileUtils.cp_r(spec_file, gen_directory)

gen_directory
end


end
Expand Down
3 changes: 2 additions & 1 deletion cocoapods-imy-bin/lib/cocoapods-imy-bin/command/bin/auto.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def run
source_specs = run_archive

fail_push_specs = []
UI.puts "pod bin auto run"
source_specs.uniq.each do |spec|
begin
fail_push_specs << spec unless CBin::Upload::Helper.new(spec,@code_dependencies,@sources).upload
Expand Down Expand Up @@ -123,7 +124,7 @@ def run_archive
argvs += ["--env=#{@env}"]
end
argvs += ["--configuration=#{@config}"]

archive = Pod::Command::Bin::Archive.new(CLAide::ARGV.new(argvs))
archive.validate!
source_specs = archive.run
Expand Down
10 changes: 9 additions & 1 deletion cocoapods-imy-bin/lib/cocoapods-imy-bin/command/bin/code.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ def download_source(name)
FileUtils.rm_rf(target_path)

find_dependency = find_dependency(name)

# find_dependency.external_source = {:podspec => '/Users/denglibing3/.cocoapods/repos/erduoniba-hdpodrepo/HDStaticPod/0.1.0/HDStaticPod.podspec'}
# find_dependency.requirement.requirements.first[1].version
spec = fetch_external_source(find_dependency, @config.podfile,@config.lockfile, @config.sandbox,true )

download_request = Pod::Downloader::Request.new(:name => name, :spec => spec)
Expand Down Expand Up @@ -118,6 +119,10 @@ def fetch_external_source(dependency ,podfile , lockfile, sandbox,use_lockfile_o
def link(lib_file,target_path,basename)
dir = (`dwarfdump "#{lib_file}" | grep "AT_comp_dir" | head -1 | cut -d \\" -f2 `)
sub_path = "#{basename}/bin-archive/#{basename}"

# 用于 pod bin code 源码调试,找到打包电脑上的编译代码的路径
# 需要去掉 Pods 这个路径
dir = dir.gsub("#{basename}/Pods", "").chomp
dir = dir.gsub(sub_path, "").chomp
# UI.puts "dir = #{dir}"

Expand Down Expand Up @@ -160,6 +165,9 @@ def check(lib_file,dir,basename)
def get_lib_path(name)
dir = Pathname.new(File.join(Pathname.pwd,"Pods",name))
lib_name = "lib#{name}.a"
unless File.exist?(lib_name)
lib_name = "#{name}"
end
lib_path = File.join(dir,lib_name)

unless File.exist?(lib_path)
Expand Down
3 changes: 3 additions & 0 deletions cocoapods-imy-bin/lib/cocoapods-imy-bin/config/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
require 'cocoapods-imy-bin/native/podfile_env'
require 'cocoapods/generate'

# 新增如下一行代码,解决在 pod bin init 初始化提示 Config 错误的问题。
require 'ostruct'

module CBin
class Config
def config_file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,11 @@ def root_dir
@root_dir ||= begin
basename = File.basename(Pod::Config.instance.installation_root)
parent_dir = File.dirname(Pod::Config.instance.installation_root)
root_name = File.join(parent_dir,"#{basename}-build-temp")
private_dir = '/private/var/tmp/imy_release/'
unless File.exist?(private_dir)
FileUtils.mkdir_p(private_dir)
end
root_name = File.join(private_dir,"#{basename}-build-temp")
Dir.mkdir(root_name) unless File.exist?root_name
Pathname.new(root_name)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ def build_static_framework
@@build_defines = builder.build if @isRootSpec
begin
@framework_path = builder.lipo_build(@@build_defines) unless @skip_archive
rescue
rescue => e
puts "An error occurred: #{e.message}"
@skip_archive = true
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def Utils.is_framework(spec)

def Utils.spec_header_dir(spec)

header_dir = "./Headers/Public/#{spec.name}"
header_dir = "./build-arm64/#{spec.name}.framework/Headers"
header_dir = "./Pods/Headers/Public/#{spec.name}" unless File.exist?(header_dir)

unless File.exist?(header_dir)
Expand Down
Loading