Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Side by Side Diff: pylib/gyp/generator/xcode.py

Issue 6592088: Add mac_framework_private_headers key to specify which headers should be copi... (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 # Copyright (c) 2010 Google Inc. All rights reserved. 3 # Copyright (c) 2010 Google Inc. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 import filecmp 7 import filecmp
8 import gyp.common 8 import gyp.common
9 import gyp.xcodeproj_file 9 import gyp.xcodeproj_file
10 import errno 10 import errno
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 'RULE_INPUT_NAME': '$(INPUT_FILE_NAME)', 52 'RULE_INPUT_NAME': '$(INPUT_FILE_NAME)',
53 'RULE_INPUT_PATH': '$(INPUT_FILE_PATH)', 53 'RULE_INPUT_PATH': '$(INPUT_FILE_PATH)',
54 'SHARED_INTERMEDIATE_DIR': '$(%s)' % _shared_intermediate_var, 54 'SHARED_INTERMEDIATE_DIR': '$(%s)' % _shared_intermediate_var,
55 'CONFIGURATION_NAME': '$(CONFIGURATION)', 55 'CONFIGURATION_NAME': '$(CONFIGURATION)',
56 } 56 }
57 57
58 # The Xcode-specific sections that hold paths. 58 # The Xcode-specific sections that hold paths.
59 generator_additional_path_sections = [ 59 generator_additional_path_sections = [
60 'mac_bundle_resources', 60 'mac_bundle_resources',
61 'mac_framework_headers', 61 'mac_framework_headers',
62 'mac_framework_private_headers',
62 # 'mac_framework_dirs', input already handles _dirs endings. 63 # 'mac_framework_dirs', input already handles _dirs endings.
63 ] 64 ]
64 65
65 # The Xcode-specific keys that exist on targets and aren't moved down to 66 # The Xcode-specific keys that exist on targets and aren't moved down to
66 # configurations. 67 # configurations.
67 generator_additional_non_configuration_keys = [ 68 generator_additional_non_configuration_keys = [
68 'mac_bundle', 69 'mac_bundle',
69 'mac_bundle_resources', 70 'mac_bundle_resources',
70 'mac_framework_headers', 71 'mac_framework_headers',
72 'mac_framework_private_headers',
71 'xcode_create_dependents_test_runner', 73 'xcode_create_dependents_test_runner',
72 ] 74 ]
73 75
74 # We want to let any rules apply to files that are resources also. 76 # We want to let any rules apply to files that are resources also.
75 generator_extra_sources_for_rules = [ 77 generator_extra_sources_for_rules = [
76 'mac_bundle_resources', 78 'mac_bundle_resources',
77 'mac_framework_headers', 79 'mac_framework_headers',
80 'mac_framework_private_headers',
78 ] 81 ]
79 82
80 83
81 def CreateXCConfigurationList(configuration_names): 84 def CreateXCConfigurationList(configuration_names):
82 xccl = gyp.xcodeproj_file.XCConfigurationList({'buildConfigurations': []}) 85 xccl = gyp.xcodeproj_file.XCConfigurationList({'buildConfigurations': []})
83 if len(configuration_names) == 0: 86 if len(configuration_names) == 0:
84 configuration_names = ['Default'] 87 configuration_names = ['Default']
85 for configuration_name in configuration_names: 88 for configuration_name in configuration_names:
86 xcbc = gyp.xcodeproj_file.XCBuildConfiguration({ 89 xcbc = gyp.xcodeproj_file.XCBuildConfiguration({
87 'name': configuration_name}) 90 'name': configuration_name})
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 # go into the project file, just not as part of a build phase. 531 # go into the project file, just not as part of a build phase.
529 pbxp.AddOrGetFileInRootGroup(source) 532 pbxp.AddOrGetFileInRootGroup(source)
530 533
531 534
532 def AddResourceToTarget(resource, pbxp, xct): 535 def AddResourceToTarget(resource, pbxp, xct):
533 # TODO(mark): Combine with AddSourceToTarget above? Or just inline this call 536 # TODO(mark): Combine with AddSourceToTarget above? Or just inline this call
534 # where it's used. 537 # where it's used.
535 xct.ResourcesPhase().AddFile(resource) 538 xct.ResourcesPhase().AddFile(resource)
536 539
537 540
538 def AddHeaderToTarget(header, pbxp, xct): 541 def AddPublicHeaderToTarget(header, pbxp, xct):
TVL 2011/03/02 02:07:15 Maybe extend this to take another arg to control p
539 # TODO(mark): Combine with AddSourceToTarget above? Or just inline this call 542 # TODO(mark): Combine with AddSourceToTarget above? Or just inline this call
540 # where it's used. 543 # where it's used.
541 xct.HeadersPhase().AddFile(header, '{ATTRIBUTES = (Public, ); }') 544 xct.HeadersPhase().AddFile(header, '{ATTRIBUTES = (Public, ); }')
542 545
543 546
547 def AddPrivateHeaderToTarget(header, pbxp, xct):
548 xct.HeadersPhase().AddFile(header, '{ATTRIBUTES = (Private, ); }')
549
550
544 _xcode_variable_re = re.compile('(\$\((.*?)\))') 551 _xcode_variable_re = re.compile('(\$\((.*?)\))')
545 def ExpandXcodeVariables(string, expansions): 552 def ExpandXcodeVariables(string, expansions):
546 """Expands Xcode-style $(VARIABLES) in string per the expansions dict. 553 """Expands Xcode-style $(VARIABLES) in string per the expansions dict.
547 554
548 In some rare cases, it is appropriate to expand Xcode variables when a 555 In some rare cases, it is appropriate to expand Xcode variables when a
549 project file is generated. For any substring $(VAR) in string, if VAR is a 556 project file is generated. For any substring $(VAR) in string, if VAR is a
550 key in the expansions dict, $(VAR) will be replaced with expansions[VAR]. 557 key in the expansions dict, $(VAR) will be replaced with expansions[VAR].
551 Any $(VAR) substring in string for which VAR is not a key in the expansions 558 Any $(VAR) substring in string for which VAR is not a key in the expansions
552 dict will remain in the returned string. 559 dict will remain in the returned string.
553 """ 560 """
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 # Add "sources". 1052 # Add "sources".
1046 for source in spec.get('sources', []): 1053 for source in spec.get('sources', []):
1047 (source_root, source_extension) = posixpath.splitext(source) 1054 (source_root, source_extension) = posixpath.splitext(source)
1048 if source_extension[1:] not in rules_by_ext: 1055 if source_extension[1:] not in rules_by_ext:
1049 # AddSourceToTarget will add the file to a root group if it's not 1056 # AddSourceToTarget will add the file to a root group if it's not
1050 # already there. 1057 # already there.
1051 AddSourceToTarget(source, pbxp, xct) 1058 AddSourceToTarget(source, pbxp, xct)
1052 else: 1059 else:
1053 pbxp.AddOrGetFileInRootGroup(source) 1060 pbxp.AddOrGetFileInRootGroup(source)
1054 1061
1055 # Add "mac_bundle_resources" and "mac_framework_headers" if it's a bundle 1062 # Add "mac_bundle_resources", "mac_framework_headers", and
1056 # of any type. 1063 # "mac_framework_private_headers" if it's a bundle of any type.
1057 if is_bundle: 1064 if is_bundle:
1058 for resource in tgt_mac_bundle_resources: 1065 for resource in tgt_mac_bundle_resources:
1059 (resource_root, resource_extension) = posixpath.splitext(resource) 1066 (resource_root, resource_extension) = posixpath.splitext(resource)
1060 if resource_extension[1:] not in rules_by_ext: 1067 if resource_extension[1:] not in rules_by_ext:
1061 AddResourceToTarget(resource, pbxp, xct) 1068 AddResourceToTarget(resource, pbxp, xct)
1062 else: 1069 else:
1063 pbxp.AddOrGetFileInRootGroup(resource) 1070 pbxp.AddOrGetFileInRootGroup(resource)
1064 1071
1065 for header in spec.get('mac_framework_headers', []): 1072 for header in spec.get('mac_framework_headers', []):
1066 AddHeaderToTarget(header, pbxp, xct) 1073 AddPublicHeaderToTarget(header, pbxp, xct)
1074
1075 for header in spec.get('mac_framework_private_headers', []):
1076 AddPrivateHeaderToTarget(header, pbxp, xct)
1067 1077
1068 # Add "copies". 1078 # Add "copies".
1069 for copy_group in spec.get('copies', []): 1079 for copy_group in spec.get('copies', []):
1070 pbxcp = gyp.xcodeproj_file.PBXCopyFilesBuildPhase({ 1080 pbxcp = gyp.xcodeproj_file.PBXCopyFilesBuildPhase({
1071 'name': 'Copy to ' + copy_group['destination'] 1081 'name': 'Copy to ' + copy_group['destination']
1072 }, 1082 },
1073 parent=xct) 1083 parent=xct)
1074 dest = copy_group['destination'] 1084 dest = copy_group['destination']
1075 if dest[0] not in ('/', '$'): 1085 if dest[0] not in ('/', '$'):
1076 # Relative paths are relative to $(SRCROOT). 1086 # Relative paths are relative to $(SRCROOT).
1077 dest = '$(SRCROOT)/' + dest 1087 dest = '$(SRCROOT)/' + dest
1078 pbxcp.SetDestination(dest) 1088 pbxcp.SetDestination(dest)
1079 1089
1080 # TODO(mark): The usual comment about this knowing too much about 1090 # TODO(mark): The usual comment about this knowing too much about
1081 # gyp.xcodeproj_file internals applies. 1091 # gyp.xcodeproj_file internals applies.
1082 xct._properties['buildPhases'].insert(prebuild_index, pbxcp) 1092 xct._properties['buildPhases'].insert(prebuild_index, pbxcp)
1083 1093
1084 for file in copy_group['files']: 1094 for file in copy_group['files']:
1085 pbxcp.AddFile(file) 1095 pbxcp.AddFile(file)
1086 1096
1087 # Excluded files can also go into the project file. 1097 # Excluded files can also go into the project file.
1088 if not skip_excluded_files: 1098 if not skip_excluded_files:
1089 for key in ['sources', 'mac_bundle_resources', 'mac_framework_headers']: 1099 for key in ['sources', 'mac_bundle_resources', 'mac_framework_headers',
1100 'mac_framework_private_headers']:
1090 excluded_key = key + '_excluded' 1101 excluded_key = key + '_excluded'
1091 for item in spec.get(excluded_key, []): 1102 for item in spec.get(excluded_key, []):
1092 pbxp.AddOrGetFileInRootGroup(item) 1103 pbxp.AddOrGetFileInRootGroup(item)
1093 1104
1094 # So can "inputs" and "outputs" sections of "actions" groups. 1105 # So can "inputs" and "outputs" sections of "actions" groups.
1095 groups = ['inputs', 'inputs_excluded', 'outputs', 'outputs_excluded'] 1106 groups = ['inputs', 'inputs_excluded', 'outputs', 'outputs_excluded']
1096 if skip_excluded_files: 1107 if skip_excluded_files:
1097 groups = [x for x in groups if not x.endswith('_excluded')] 1108 groups = [x for x in groups if not x.endswith('_excluded')]
1098 for action in spec.get('actions', []): 1109 for action in spec.get('actions', []):
1099 for group in groups: 1110 for group in groups:
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1180 1191
1181 for build_file in build_files: 1192 for build_file in build_files:
1182 xcode_projects[build_file].Finalize1(xcode_targets, serialize_all_tests) 1193 xcode_projects[build_file].Finalize1(xcode_targets, serialize_all_tests)
1183 1194
1184 for build_file in build_files: 1195 for build_file in build_files:
1185 xcode_projects[build_file].Finalize2(xcode_targets, 1196 xcode_projects[build_file].Finalize2(xcode_targets,
1186 xcode_target_to_target_dict) 1197 xcode_target_to_target_dict)
1187 1198
1188 for build_file in build_files: 1199 for build_file in build_files:
1189 xcode_projects[build_file].Write() 1200 xcode_projects[build_file].Write()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698