Skip to content

Commit

Permalink
[Refactor] Extract XCConfigHelper.add_settings_for_file_accessors_of_…
Browse files Browse the repository at this point in the history
…target

Contains the duplicated logic from AggregateXCConfig#generate and PublicPodXCConfig#generate.
  • Loading branch information
mrackwitz committed Nov 16, 2014
1 parent f1a88a4 commit eaef33b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 18 deletions.
10 changes: 1 addition & 9 deletions lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb
Expand Up @@ -82,15 +82,7 @@ def generate
XCConfigHelper.add_target_specific_settings(target, @xcconfig)

pod_targets.each do |pod_target|
pod_target.file_accessors.each do |file_accessor|
XCConfigHelper.add_spec_build_settings_to_xcconfig(file_accessor.spec_consumer, @xcconfig)
file_accessor.vendored_frameworks.each do |vendored_framework|
XCConfigHelper.add_framework_build_settings(vendored_framework, @xcconfig, target.sandbox.root)
end
file_accessor.vendored_libraries.each do |vendored_library|
XCConfigHelper.add_library_build_settings(vendored_library, @xcconfig, target.sandbox.root)
end
end
XCConfigHelper.add_settings_for_file_accessors_of_target(pod_target, @xcconfig)

# Add pod framework to list of frameworks / libraries that are
# linked with the user’s project.
Expand Down
10 changes: 1 addition & 9 deletions lib/cocoapods/generator/xcconfig/public_pod_xcconfig.rb
Expand Up @@ -40,15 +40,7 @@ def save_as(path)
#
def generate
@xcconfig = Xcodeproj::Config.new
target.file_accessors.each do |file_accessor|
XCConfigHelper.add_spec_build_settings_to_xcconfig(file_accessor.spec_consumer, @xcconfig)
file_accessor.vendored_frameworks.each do |vendored_framework|
XCConfigHelper.add_framework_build_settings(vendored_framework, @xcconfig, target.sandbox.root)
end
file_accessor.vendored_libraries.each do |vendored_library|
XCConfigHelper.add_library_build_settings(vendored_library, @xcconfig, target.sandbox.root)
end
end
XCConfigHelper.add_settings_for_file_accessors_of_target(target, @xcconfig)
@xcconfig
end

Expand Down
20 changes: 20 additions & 0 deletions lib/cocoapods/generator/xcconfig/xcconfig_helper.rb
Expand Up @@ -33,6 +33,26 @@ def self.default_ld_flags(target)
ld_flags
end

# Configures the given Xcconfig
#
# @param [PodTarget] pod_target
# The pod target, which holds the list of +Spec::FileAccessor+.
#
# @param [Xcodeproj::Config] xcconfig
# The xcconfig to edit.
#
def self.add_settings_for_file_accessors_of_target(target, xcconfig)
target.file_accessors.each do |file_accessor|
XCConfigHelper.add_spec_build_settings_to_xcconfig(file_accessor.spec_consumer, xcconfig)
file_accessor.vendored_frameworks.each do |vendored_framework|
XCConfigHelper.add_framework_build_settings(vendored_framework, xcconfig, target.sandbox.root)
end
file_accessor.vendored_libraries.each do |vendored_library|
XCConfigHelper.add_library_build_settings(vendored_library, xcconfig, target.sandbox.root)
end
end
end

# Configures the given Xcconfig according to the build settings of the
# given Specification.
#
Expand Down

0 comments on commit eaef33b

Please sign in to comment.