Commit 09a05954 authored by Marius Rackwitz's avatar Marius Rackwitz

[Refactor] Pluralize name of attribute Target#requires_framework

Same for underlying host_requires_framework
parent f5cd3f12
...@@ -55,7 +55,7 @@ module Pod ...@@ -55,7 +55,7 @@ module Pod
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1', 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
} }
if target.requires_framework? if target.requires_frameworks?
# Framework headers are automatically discoverable by `#import <…>`. # Framework headers are automatically discoverable by `#import <…>`.
header_search_paths = pod_targets.map { |target| "$PODS_FRAMEWORK_BUILD_PATH/#{target.product_name}/Headers" } header_search_paths = pod_targets.map { |target| "$PODS_FRAMEWORK_BUILD_PATH/#{target.product_name}/Headers" }
build_settings = { build_settings = {
...@@ -87,7 +87,7 @@ module Pod ...@@ -87,7 +87,7 @@ module Pod
# Add pod target to list of frameworks / libraries that are # Add pod target to list of frameworks / libraries that are
# linked with the user’s project. # linked with the user’s project.
next unless pod_target.should_build? next unless pod_target.should_build?
if pod_target.requires_framework? if pod_target.requires_frameworks?
@xcconfig.merge!('OTHER_LDFLAGS' => %(-framework "#{pod_target.product_basename}")) @xcconfig.merge!('OTHER_LDFLAGS' => %(-framework "#{pod_target.product_basename}"))
else else
@xcconfig.merge!('OTHER_LDFLAGS' => %(-l "#{pod_target.product_basename}")) @xcconfig.merge!('OTHER_LDFLAGS' => %(-l "#{pod_target.product_basename}"))
......
...@@ -57,7 +57,7 @@ module Pod ...@@ -57,7 +57,7 @@ module Pod
# 'USE_HEADERMAP' => 'NO' # 'USE_HEADERMAP' => 'NO'
} }
if target.requires_framework? if target.requires_frameworks?
dependencies = target.module_dependencies.reject { |dep| dep == target.product_module_name } dependencies = target.module_dependencies.reject { |dep| dep == target.product_module_name }
build_settings = { build_settings = {
'PODS_FRAMEWORK_BUILD_PATH' => target.configuration_build_dir, 'PODS_FRAMEWORK_BUILD_PATH' => target.configuration_build_dir,
......
...@@ -142,7 +142,7 @@ module Pod ...@@ -142,7 +142,7 @@ module Pod
# The xcconfig to edit. # The xcconfig to edit.
# #
def self.add_target_specific_settings(target, xcconfig) def self.add_target_specific_settings(target, xcconfig)
if target.requires_framework? if target.requires_frameworks?
add_code_signing_settings(target, xcconfig) add_code_signing_settings(target, xcconfig)
end end
add_language_specific_settings(target, xcconfig) add_language_specific_settings(target, xcconfig)
......
...@@ -204,7 +204,7 @@ module Pod ...@@ -204,7 +204,7 @@ module Pod
user_project = Xcodeproj::Project.open(project_path) user_project = Xcodeproj::Project.open(project_path)
native_targets = compute_user_project_targets(target_definition, user_project) native_targets = compute_user_project_targets(target_definition, user_project)
target.host_requires_framework |= compute_user_project_targets_require_framework(target_definition, native_targets) target.host_requires_frameworks |= compute_user_project_targets_require_framework(target_definition, native_targets)
target.user_project_path = project_path target.user_project_path = project_path
target.client_root = project_path.dirname target.client_root = project_path.dirname
target.user_target_uuids = native_targets.map(&:uuid) target.user_target_uuids = native_targets.map(&:uuid)
...@@ -258,7 +258,7 @@ module Pod ...@@ -258,7 +258,7 @@ module Pod
def generate_pod_target(target, pod_specs) def generate_pod_target(target, pod_specs)
pod_target = PodTarget.new(pod_specs, target.target_definition, sandbox) pod_target = PodTarget.new(pod_specs, target.target_definition, sandbox)
pod_target.host_requires_framework |= target.host_requires_framework pod_target.host_requires_frameworks |= target.host_requires_frameworks
if config.integrate_targets? if config.integrate_targets?
pod_target.user_build_configurations = target.user_build_configurations pod_target.user_build_configurations = target.user_build_configurations
pod_target.archs = @archs_by_target_def[target.target_definition] pod_target.archs = @archs_by_target_def[target.target_definition]
......
...@@ -60,7 +60,7 @@ module Pod ...@@ -60,7 +60,7 @@ module Pod
settings['PODS_ROOT'] = '$(SRCROOT)' settings['PODS_ROOT'] = '$(SRCROOT)'
end end
if target.requires_framework? if target.requires_frameworks?
settings['PRODUCT_NAME'] = target.product_module_name settings['PRODUCT_NAME'] = target.product_module_name
else else
settings.merge!('OTHER_LDFLAGS' => '', 'OTHER_LIBTOOLFLAGS' => '') settings.merge!('OTHER_LDFLAGS' => '', 'OTHER_LIBTOOLFLAGS' => '')
......
...@@ -14,7 +14,7 @@ module Pod ...@@ -14,7 +14,7 @@ module Pod
create_support_files_dir create_support_files_dir
create_support_files_group create_support_files_group
create_xcconfig_file create_xcconfig_file
if target.requires_framework? if target.requires_frameworks?
create_info_plist_file create_info_plist_file
create_module_map create_module_map
create_umbrella_header create_umbrella_header
......
...@@ -20,7 +20,7 @@ module Pod ...@@ -20,7 +20,7 @@ module Pod
add_files_to_build_phases add_files_to_build_phases
add_resources_bundle_targets add_resources_bundle_targets
create_xcconfig_file create_xcconfig_file
if target.requires_framework? if target.requires_frameworks?
create_info_plist_file create_info_plist_file
create_module_map create_module_map
create_umbrella_header do |generator| create_umbrella_header do |generator|
...@@ -65,7 +65,7 @@ module Pod ...@@ -65,7 +65,7 @@ module Pod
header_file_refs = headers.map { |sf| project.reference_for_path(sf) } header_file_refs = headers.map { |sf| project.reference_for_path(sf) }
native_target.add_file_references(header_file_refs) do |build_file| native_target.add_file_references(header_file_refs) do |build_file|
# Set added headers as public if needed # Set added headers as public if needed
if target.requires_framework? if target.requires_frameworks?
if public_headers.include?(build_file.file_ref.real_path) if public_headers.include?(build_file.file_ref.real_path)
build_file.settings ||= {} build_file.settings ||= {}
build_file.settings['ATTRIBUTES'] = ['Public'] build_file.settings['ATTRIBUTES'] = ['Public']
......
...@@ -33,7 +33,7 @@ module Pod ...@@ -33,7 +33,7 @@ module Pod
update_to_cocoapods_0_34, update_to_cocoapods_0_34,
unless native_targets_to_integrate.empty? unless native_targets_to_integrate.empty?
add_pods_library add_pods_library
add_embed_frameworks_script_phase if target.requires_framework? add_embed_frameworks_script_phase if target.requires_frameworks?
add_copy_resources_script_phase add_copy_resources_script_phase
add_check_manifest_lock_script_phase add_check_manifest_lock_script_phase
true true
...@@ -105,7 +105,7 @@ module Pod ...@@ -105,7 +105,7 @@ module Pod
build_phase = native_target.frameworks_build_phase build_phase = native_target.frameworks_build_phase
# Find and delete possible reference for the other product type # Find and delete possible reference for the other product type
old_product_name = target.requires_framework? ? target.static_library_name : target.framework_name old_product_name = target.requires_frameworks? ? target.static_library_name : target.framework_name
old_product_ref = frameworks.files.find { |f| f.path == old_product_name } old_product_ref = frameworks.files.find { |f| f.path == old_product_name }
if old_product_ref.present? if old_product_ref.present?
UI.message("Remove old Pod product reference #{old_product_name} from project.") UI.message("Remove old Pod product reference #{old_product_name} from project.")
...@@ -120,7 +120,7 @@ module Pod ...@@ -120,7 +120,7 @@ module Pod
unless build_file = build_phase.build_file(new_product_ref) unless build_file = build_phase.build_file(new_product_ref)
build_file = build_phase.add_file_reference(new_product_ref) build_file = build_phase.add_file_reference(new_product_ref)
end end
if target.requires_framework? if target.requires_frameworks?
build_file.settings ||= {} build_file.settings ||= {}
build_file.settings['ATTRIBUTES'] = ['Weak'] build_file.settings['ATTRIBUTES'] = ['Weak']
end end
......
...@@ -18,8 +18,8 @@ module Pod ...@@ -18,8 +18,8 @@ module Pod
# @return [Boolean] Whether the target needs to be implemented as a framework. # @return [Boolean] Whether the target needs to be implemented as a framework.
# Computed by analyzer. # Computed by analyzer.
# #
attr_accessor :host_requires_framework attr_accessor :host_requires_frameworks
alias_method :host_requires_framework?, :host_requires_framework alias_method :host_requires_frameworks?, :host_requires_frameworks
# @return [String] the name of the library. # @return [String] the name of the library.
# #
...@@ -30,7 +30,7 @@ module Pod ...@@ -30,7 +30,7 @@ module Pod
# @return [String] the name of the product. # @return [String] the name of the product.
# #
def product_name def product_name
if requires_framework? if requires_frameworks?
framework_name framework_name
else else
static_library_name static_library_name
...@@ -38,11 +38,11 @@ module Pod ...@@ -38,11 +38,11 @@ module Pod
end end
# @return [String] the name of the product excluding the file extension or # @return [String] the name of the product excluding the file extension or
# a product type specific prefix, depends on #requires_framework? # a product type specific prefix, depends on #requires_frameworks?
# and #product_module_name or #label. # and #product_module_name or #label.
# #
def product_basename def product_basename
if requires_framework? if requires_frameworks?
product_module_name product_module_name
else else
label label
...@@ -51,7 +51,7 @@ module Pod ...@@ -51,7 +51,7 @@ module Pod
# @return [String] the name of the framework, depends on #label. # @return [String] the name of the framework, depends on #label.
# #
# @note This may not depend on #requires_framework? indirectly as it is # @note This may not depend on #requires_frameworks? indirectly as it is
# used for migration. # used for migration.
# #
def framework_name def framework_name
...@@ -60,7 +60,7 @@ module Pod ...@@ -60,7 +60,7 @@ module Pod
# @return [String] the name of the library, depends on #label. # @return [String] the name of the library, depends on #label.
# #
# @note This may not depend on #requires_framework? indirectly as it is # @note This may not depend on #requires_frameworks? indirectly as it is
# used for migration. # used for migration.
# #
def static_library_name def static_library_name
...@@ -68,10 +68,10 @@ module Pod ...@@ -68,10 +68,10 @@ module Pod
end end
# @return [Symbol] either :framework or :static_library, depends on # @return [Symbol] either :framework or :static_library, depends on
# #requires_framework?. # #requires_frameworks?.
# #
def product_type def product_type
requires_framework? ? :framework : :static_library requires_frameworks? ? :framework : :static_library
end end
# @return [String] the XCConfig namespaced prefix. # @return [String] the XCConfig namespaced prefix.
...@@ -96,8 +96,8 @@ module Pod ...@@ -96,8 +96,8 @@ module Pod
# dependents, which can only be checked after the specs were been # dependents, which can only be checked after the specs were been
# fetched. # fetched.
# #
def requires_framework? def requires_frameworks?
host_requires_framework? || uses_swift? host_requires_frameworks? || uses_swift?
end end
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
......
...@@ -151,7 +151,7 @@ module Pod ...@@ -151,7 +151,7 @@ module Pod
describe 'Host requires frameworks' do describe 'Host requires frameworks' do
before do before do
@target.host_requires_framework = true @target.host_requires_frameworks = true
end end
it 'returns the product name' do it 'returns the product name' do
...@@ -171,7 +171,7 @@ module Pod ...@@ -171,7 +171,7 @@ module Pod
end end
it 'returns that it requires being built as framework' do it 'returns that it requires being built as framework' do
@target.requires_framework?.should == true @target.requires_frameworks?.should == true
end end
end end
...@@ -193,7 +193,7 @@ module Pod ...@@ -193,7 +193,7 @@ module Pod
end end
it 'returns that it does not require being built as framework' do it 'returns that it does not require being built as framework' do
@target.requires_framework?.should == false @target.requires_frameworks?.should == false
end end
end end
end end
...@@ -230,7 +230,7 @@ module Pod ...@@ -230,7 +230,7 @@ module Pod
end end
it 'returns that it requires being built as framework' do it 'returns that it requires being built as framework' do
@target.requires_framework?.should == true @target.requires_frameworks?.should == true
end end
end end
end end
......
...@@ -129,7 +129,7 @@ module Pod ...@@ -129,7 +129,7 @@ module Pod
describe 'Host requires frameworks' do describe 'Host requires frameworks' do
before do before do
@pod_target.host_requires_framework = true @pod_target.host_requires_frameworks = true
end end
it 'returns the product name' do it 'returns the product name' do
...@@ -149,7 +149,7 @@ module Pod ...@@ -149,7 +149,7 @@ module Pod
end end
it 'returns that it requires being built as framework' do it 'returns that it requires being built as framework' do
@pod_target.requires_framework?.should == true @pod_target.requires_frameworks?.should == true
end end
end end
...@@ -171,7 +171,7 @@ module Pod ...@@ -171,7 +171,7 @@ module Pod
end end
it 'returns that it does not require being built as framework' do it 'returns that it does not require being built as framework' do
@pod_target.requires_framework?.should == false @pod_target.requires_frameworks?.should == false
end end
end end
end end
...@@ -206,7 +206,7 @@ module Pod ...@@ -206,7 +206,7 @@ module Pod
end end
it 'returns that it requires being built as framework' do it 'returns that it requires being built as framework' do
@pod_target.requires_framework?.should == true @pod_target.requires_frameworks?.should == true
end end
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment