Class: Pod::Installer::PostInstallHooksContext

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-xlbuild/Reference/reference_source_code.rb

Instance Method Summary collapse

Instance Method Details

#adjust_dynamic_framework_dsymObject



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/cocoapods-xlbuild/Reference/reference_source_code.rb', line 25

def adjust_dynamic_framework_dsym
	sandbox_path = Pathname.new(sandbox.root).to_s
	pre_sandbox = Pod::PrebuildSandbox.from_standard_sandbox(sandbox)
	exsited_framework_pod_names = pre_sandbox.exsited_framework_pod_names || []

	exsited_framework_pod_names.each do |target_name|
		input_xcfilelist = sandbox_path + "/Target Support Files/" + target_name + "/#{target_name}-copy-dsyms-input-files.xcfilelist"
		output_xcfilelist = sandbox_path + "/Target Support Files/" + target_name + "/#{target_name}-copy-dsyms-output-files.xcfilelist"
		remove_duplicated_bcsymbolmap_lines(input_xcfilelist)
		remove_duplicated_bcsymbolmap_lines(output_xcfilelist)
	end
end

#refrence_source_codeObject

将源码引入主工程,方便源码调试



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/cocoapods-xlbuild/Reference/reference_source_code.rb', line 10

def refrence_source_code
	sandbox_path = Pathname.new(sandbox.root)
	pre_sandbox = Pod::PrebuildSandbox.from_standard_sandbox(sandbox)

	exsited_framework_pod_names = pre_sandbox.exsited_framework_pod_names || []
	proj_path = sandbox_path + get_project_name("Pods")
	project = Xcodeproj::Project.open(proj_path)
	exsited_framework_pod_names.each do |target_name|
		real_reference("_Prebuild/#{target_name}", project, target_name)
	end
	project.save;
end

#remove_duplicated_bcsymbolmap_lines(path) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/cocoapods-xlbuild/Reference/reference_source_code.rb', line 39

def remove_duplicated_bcsymbolmap_lines(path)
	if File.exist?path
		top_lines = []
		bcsymbolmap_lines = []
		for line in File.readlines(path).map { |line| line.strip }
			if line.include? ".bcsymbolmap"
				bcsymbolmap_lines.append(line)
			else
				#去重
				if not top_lines.include?line
					top_lines.append(line)
				end
			end
		end

		final_lines = top_lines + bcsymbolmap_lines.uniq
		File.open(path, "w+") do |f|
			f.puts(final_lines)
		end
	end
end