Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Commit

Permalink
[ttmodule] Properly check for duplicate LDFLAGS.
Browse files Browse the repository at this point in the history
Xcode annoyingly reformats the LDFLAGS if there is a space in them.
  • Loading branch information
jverkoey committed Oct 22, 2010
1 parent 7724473 commit abbc702
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/scripts/Pbxproj.py
Expand Up @@ -373,19 +373,28 @@ def add_build_setting(self, configuration, setting_name, value):
match = re.search(re.escape(setting_name)+' = ((?:.|\n)+?);', build_settings)

if not match:
# Add a brand new build setting. No checking for existing settings necessary.
settingtext = '\t\t\t\t'+setting_name+' = '+value+';\n'

project_data = project_data[:settings_start] + settingtext + project_data[settings_start:]
else:
# Build settings already exist. Is there one or many?
(search_paths,) = match.groups()
if re.search('\(\n', search_paths):
# Many
match = re.search(re.escape(value), search_paths)
if not match:
match = re.search(re.escape(setting_name)+' = \(\n', build_settings)

build_settings = build_settings[:match.end()] + '\t\t\t\t\t'+value+',\n' + build_settings[match.end():]
project_data = project_data[:settings_start] + build_settings + project_data[settings_end:]
# If value has any spaces in it, Xcode will split it up into
# multiple entries.
escaped_value = re.escape(value).replace(' ', '",\n[ \t]+"')
match = re.search(escaped_value, search_paths)
if not match:
match = re.search(re.escape(setting_name)+' = \(\n', build_settings)

build_settings = build_settings[:match.end()] + '\t\t\t\t\t'+value+',\n' + build_settings[match.end():]
project_data = project_data[:settings_start] + build_settings + project_data[settings_end:]
else:
# One
if search_paths != value:
existing_path = search_paths
path_set = '(\n\t\t\t\t\t'+value+',\n\t\t\t\t\t'+existing_path+'\n\t\t\t\t)'
Expand Down Expand Up @@ -649,9 +658,9 @@ def add_dependency(self, dep):
if match:
logging.info("This product group already exists.")
(children, ) = match.groups()
match = re.search('([A-Z0-9]+) \/\* '+dep._product_name+' \*\/', children)
match = re.search('([A-Z0-9]+) \/\* '+re.escape(dep._product_name)+' \*\/', children)
if not match:
logging.error("No product found.")
logging.error("No product found")
return False
# TODO: Add this product.
else:
Expand Down Expand Up @@ -727,7 +736,7 @@ def add_dependency(self, dep):
if not referenceExists:
match = re.search('\/\* Begin PBXReferenceProxy section \*\/\n', project_data)

referenceproxytext = "\t\t"+lib_hash+" /* "+dep._product_name+" */ = {\n\t\t\tisa = PBXReferenceProxy;\n\t\t\tfileType = archive.ar;\n\t\t\tpath = "+dep._product_name+";\n\t\t\tremoteRef = "+targetproduct_hash+" /* PBXContainerItemProxy */;\n\t\t\tsourceTree = BUILT_PRODUCTS_DIR;\n\t\t};\n"
referenceproxytext = "\t\t"+lib_hash+" /* "+dep._product_name+" */ = {\n\t\t\tisa = PBXReferenceProxy;\n\t\t\tfileType = archive.ar;\n\t\t\tpath = \""+dep._product_name+"\";\n\t\t\tremoteRef = "+targetproduct_hash+" /* PBXContainerItemProxy */;\n\t\t\tsourceTree = BUILT_PRODUCTS_DIR;\n\t\t};\n"
project_data = project_data[:match.end()] + referenceproxytext + project_data[match.end():]

logging.info("Done: Created reference proxy.")
Expand Down

0 comments on commit abbc702

Please sign in to comment.