Commit 48422ac3 authored by Marius Rackwitz's avatar Marius Rackwitz

Ensure that the PRODUCT_NAME is a C99ext identifier

parent ef4dfb29
......@@ -51,6 +51,10 @@ module Pod
settings['ARCHS'] = target.archs
end
if target.requires_framework?
settings['PRODUCT_NAME'] = target.product_module_name
end
@native_target.build_configurations.each do |configuration|
configuration.build_settings.merge!(settings)
end
......
......@@ -113,7 +113,7 @@ module Pod
end
# Find or create and add a reference for the current product type
target_basename = target.label
target_basename = target.product_basename
new_product_ref = frameworks.files.find { |f| f.path == target.product_name } ||
frameworks.new_product_ref_for_target(target_basename, target.product_type)
unless build_phase.files_references.include?(new_product_ref)
......
......@@ -37,10 +37,16 @@ module Pod
end
end
# @return [String] the name of the product excluding the file extension.
# @return [String] the name of the product excluding the file extension or
# a product type specific prefix, depends on #requires_framework?
# and #product_module_name or #label.
#
def product_basename
label
if requires_framework?
product_module_name
else
label
end
end
# @return [String] the name of the framework, depends on #product_basename.
......
......@@ -20,6 +20,14 @@ module Pod
target_definition.label.to_s
end
# @return [String] the name to use for the source code module constructed
# for this target, and which will be used to import the module in
# implementation source files.
#
def product_module_name
c99ext_identifier(label)
end
# @return [Pathname] the folder where the client is stored used for
# computing the relative paths. If integrating it should be the
# folder where the user project is stored, otherwise it should
......
......@@ -30,6 +30,14 @@ module Pod
"#{target_definition.label}-#{root_spec.name}"
end
# @return [String] The name to use for the source code module constructed
# for this target, and which will be used to import the module in
# implementation source files.
#
def product_module_name
c99ext_identifier(pod_name)
end
# @return [Array<Sandbox::FileAccessor>] the file accessors for the
# specifications of this target.
#
......
......@@ -188,12 +188,16 @@ module Pod
@target.uses_swift?.should == true
end
it 'returns the product module name' do
@target.product_module_name.should == 'Pods_iOS_Example'
end
it 'returns the product name' do
@target.product_name.should == 'Pods-iOS Example.framework'
@target.product_name.should == 'Pods_iOS_Example.framework'
end
it 'returns the framework name' do
@target.framework_name.should == 'Pods-iOS Example.framework'
@target.framework_name.should == 'Pods_iOS_Example.framework'
end
it 'returns the library name' do
......
......@@ -124,11 +124,11 @@ module Pod
end
it 'returns the product name' do
@pod_target.product_name.should == 'Pods-BananaLib.framework'
@pod_target.product_name.should == 'BananaLib.framework'
end
it 'returns the framework name' do
@pod_target.framework_name.should == 'Pods-BananaLib.framework'
@pod_target.framework_name.should == 'BananaLib.framework'
end
it 'returns the library name' do
......@@ -150,7 +150,7 @@ module Pod
end
it 'returns the framework name' do
@pod_target.framework_name.should == 'Pods-BananaLib.framework'
@pod_target.framework_name.should == 'BananaLib.framework'
end
it 'returns the library name' do
......@@ -176,12 +176,16 @@ module Pod
@pod_target.uses_swift?.should == true
end
it 'returns the product module name' do
@pod_target.product_module_name.should == 'OrangeFramework'
end
it 'returns the product name' do
@pod_target.product_name.should == 'Pods-OrangeFramework.framework'
@pod_target.product_name.should == 'OrangeFramework.framework'
end
it 'returns the framework name' do
@pod_target.framework_name.should == 'Pods-OrangeFramework.framework'
@pod_target.framework_name.should == 'OrangeFramework.framework'
end
it 'returns the library name' do
......
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