Class: Pod::Installer::TargetInstaller
- Inherits:
-
Object
- Object
- Pod::Installer::TargetInstaller
show all
- Includes:
- Config::Mixin, Shared
- Defined in:
- lib/cocoapods/installer.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Shared
#build_specifications, #dependent_specification_sets, #download_only_specifications
#config
Constructor Details
#initialize(podfile, project, definition) ⇒ TargetInstaller
Returns a new instance of TargetInstaller.
55
56
57
|
# File 'lib/cocoapods/installer.rb', line 55
def initialize(podfile, project, definition)
@podfile, @project, @definition = podfile, project, definition
end
|
Instance Attribute Details
#target ⇒ Object
Returns the value of attribute target.
53
54
55
|
# File 'lib/cocoapods/installer.rb', line 53
def target
@target
end
|
Instance Method Details
#bridge_support_filename ⇒ Object
92
93
94
|
# File 'lib/cocoapods/installer.rb', line 92
def bridge_support_filename
"#{@definition.lib_name}.bridgesupport"
end
|
#bridge_support_generator ⇒ Object
84
85
86
87
88
89
90
|
# File 'lib/cocoapods/installer.rb', line 84
def bridge_support_generator
BridgeSupportGenerator.new(build_specifications.map do |spec|
spec..map do ||
config.project_pods_root +
end
end.flatten)
end
|
#copy_resources_filename ⇒ Object
80
81
82
|
# File 'lib/cocoapods/installer.rb', line 80
def copy_resources_filename
"#{@definition.lib_name}-resources.sh"
end
|
#copy_resources_script ⇒ Object
74
75
76
77
78
|
# File 'lib/cocoapods/installer.rb', line 74
def copy_resources_script
@copy_resources_script ||= CopyResourcesScript.new(build_specifications.map do |spec|
spec.expanded_resources
end.flatten)
end
|
#create_files_in(root) ⇒ Object
150
151
152
153
154
155
156
157
158
|
# File 'lib/cocoapods/installer.rb', line 150
def create_files_in(root)
xcconfig.save_as(root + xcconfig_filename)
if @podfile.generate_bridge_support?
bridge_support_generator.save_as(root + bridge_support_filename)
copy_resources_script.resources << bridge_support_filename
end
(root + )
copy_resources_script.save_as(root + copy_resources_filename)
end
|
#install! ⇒ Object
TODO move xcconfig related code into the xcconfig method, like copy_resources_script and generate_bridge_support.
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
# File 'lib/cocoapods/installer.rb', line 110
def install!
@target = @project.targets.new_static_library(@definition.lib_name)
= []
build_specifications.each do |spec|
xcconfig.merge!(spec.xcconfig)
spec.implementation_files.each do |file|
@target.add_source_file(file, nil, spec.compiler_flags)
end
spec..each do |, files|
copy_phase = @target.copy_files_build_phases.new_pod_dir(spec.name, )
files.each do |file|
@target.add_source_file(file, copy_phase)
end
end
.concat(spec.)
end
xcconfig.merge!('USER_HEADER_SEARCH_PATHS' => .sort.uniq.join(" "))
support_files_group = @project.groups.find do |group|
group.name == "Targets Support Files"
end.groups.new("name" => @definition.lib_name)
support_files_group.files.new('path' => copy_resources_filename)
prefix_file = support_files_group.files.new('path' => )
xcconfig_file = support_files_group.files.new("path" => xcconfig_filename)
@target.buildConfigurations.each do |config|
config.baseConfiguration = xcconfig_file
config.buildSettings['OTHER_LDFLAGS'] = ''
config.buildSettings['GCC_PREFIX_HEADER'] =
end
end
|
105
106
107
|
# File 'lib/cocoapods/installer.rb', line 105
def
"#{@definition.lib_name}-prefix.pch"
end
|
97
98
99
100
101
102
103
|
# File 'lib/cocoapods/installer.rb', line 97
def (pathname)
pathname.open('w') do ||
.puts "#ifdef __OBJC__"
.puts "#import #{@podfile.platform == :ios ? '<UIKit/UIKit.h>' : '<Cocoa/Cocoa.h>'}"
.puts "#endif"
end
end
|
#xcconfig ⇒ Object
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/cocoapods/installer.rb', line 59
def xcconfig
@xcconfig ||= Xcodeproj::Config.new({
'USER_HEADER_SEARCH_PATHS' => '"$(BUILT_PRODUCTS_DIR)/Pods"',
'ALWAYS_SEARCH_USER_PATHS' => 'YES',
'OTHER_LDFLAGS' => '-ObjC -all_load',
})
end
|
#xcconfig_filename ⇒ Object
70
71
72
|
# File 'lib/cocoapods/installer.rb', line 70
def xcconfig_filename
"#{@definition.lib_name}.xcconfig"
end
|