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

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 AddHeaderToTarget(header, pbxp, xct, is_public):
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 settings = '{ATTRIBUTES = (Private, ); }'
Mark Mentovai 2011/03/03 17:02:21 I’m going to make a small change here when I check
545 if is_public:
546 settings = '{ATTRIBUTES = (Public, ); }'
547 xct.HeadersPhase().AddFile(header, settings)
542 548
543 549
544 _xcode_variable_re = re.compile('(\$\((.*?)\))') 550 _xcode_variable_re = re.compile('(\$\((.*?)\))')
545 def ExpandXcodeVariables(string, expansions): 551 def ExpandXcodeVariables(string, expansions):
546 """Expands Xcode-style $(VARIABLES) in string per the expansions dict. 552 """Expands Xcode-style $(VARIABLES) in string per the expansions dict.
547 553
548 In some rare cases, it is appropriate to expand Xcode variables when a 554 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 555 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]. 556 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 557 Any $(VAR) substring in string for which VAR is not a key in the expansions
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 # Add "sources". 1051 # Add "sources".
1046 for source in spec.get('sources', []): 1052 for source in spec.get('sources', []):
1047 (source_root, source_extension) = posixpath.splitext(source) 1053 (source_root, source_extension) = posixpath.splitext(source)
1048 if source_extension[1:] not in rules_by_ext: 1054 if source_extension[1:] not in rules_by_ext:
1049 # AddSourceToTarget will add the file to a root group if it's not 1055 # AddSourceToTarget will add the file to a root group if it's not
1050 # already there. 1056 # already there.
1051 AddSourceToTarget(source, pbxp, xct) 1057 AddSourceToTarget(source, pbxp, xct)
1052 else: 1058 else:
1053 pbxp.AddOrGetFileInRootGroup(source) 1059 pbxp.AddOrGetFileInRootGroup(source)
1054 1060
1055 # Add "mac_bundle_resources" and "mac_framework_headers" if it's a bundle 1061 # Add "mac_bundle_resources", "mac_framework_headers", and
1056 # of any type. 1062 # "mac_framework_private_headers" if it's a bundle of any type.
1057 if is_bundle: 1063 if is_bundle:
1058 for resource in tgt_mac_bundle_resources: 1064 for resource in tgt_mac_bundle_resources:
1059 (resource_root, resource_extension) = posixpath.splitext(resource) 1065 (resource_root, resource_extension) = posixpath.splitext(resource)
1060 if resource_extension[1:] not in rules_by_ext: 1066 if resource_extension[1:] not in rules_by_ext:
1061 AddResourceToTarget(resource, pbxp, xct) 1067 AddResourceToTarget(resource, pbxp, xct)
1062 else: 1068 else:
1063 pbxp.AddOrGetFileInRootGroup(resource) 1069 pbxp.AddOrGetFileInRootGroup(resource)
1064 1070
1065 for header in spec.get('mac_framework_headers', []): 1071 for header in spec.get('mac_framework_headers', []):
1066 AddHeaderToTarget(header, pbxp, xct) 1072 AddHeaderToTarget(header, pbxp, xct, True)
1073
1074 for header in spec.get('mac_framework_private_headers', []):
1075 AddHeaderToTarget(header, pbxp, xct, False)
1067 1076
1068 # Add "copies". 1077 # Add "copies".
1069 for copy_group in spec.get('copies', []): 1078 for copy_group in spec.get('copies', []):
1070 pbxcp = gyp.xcodeproj_file.PBXCopyFilesBuildPhase({ 1079 pbxcp = gyp.xcodeproj_file.PBXCopyFilesBuildPhase({
1071 'name': 'Copy to ' + copy_group['destination'] 1080 'name': 'Copy to ' + copy_group['destination']
1072 }, 1081 },
1073 parent=xct) 1082 parent=xct)
1074 dest = copy_group['destination'] 1083 dest = copy_group['destination']
1075 if dest[0] not in ('/', '$'): 1084 if dest[0] not in ('/', '$'):
1076 # Relative paths are relative to $(SRCROOT). 1085 # Relative paths are relative to $(SRCROOT).
1077 dest = '$(SRCROOT)/' + dest 1086 dest = '$(SRCROOT)/' + dest
1078 pbxcp.SetDestination(dest) 1087 pbxcp.SetDestination(dest)
1079 1088
1080 # TODO(mark): The usual comment about this knowing too much about 1089 # TODO(mark): The usual comment about this knowing too much about
1081 # gyp.xcodeproj_file internals applies. 1090 # gyp.xcodeproj_file internals applies.
1082 xct._properties['buildPhases'].insert(prebuild_index, pbxcp) 1091 xct._properties['buildPhases'].insert(prebuild_index, pbxcp)
1083 1092
1084 for file in copy_group['files']: 1093 for file in copy_group['files']:
1085 pbxcp.AddFile(file) 1094 pbxcp.AddFile(file)
1086 1095
1087 # Excluded files can also go into the project file. 1096 # Excluded files can also go into the project file.
1088 if not skip_excluded_files: 1097 if not skip_excluded_files:
1089 for key in ['sources', 'mac_bundle_resources', 'mac_framework_headers']: 1098 for key in ['sources', 'mac_bundle_resources', 'mac_framework_headers',
1099 'mac_framework_private_headers']:
1090 excluded_key = key + '_excluded' 1100 excluded_key = key + '_excluded'
1091 for item in spec.get(excluded_key, []): 1101 for item in spec.get(excluded_key, []):
1092 pbxp.AddOrGetFileInRootGroup(item) 1102 pbxp.AddOrGetFileInRootGroup(item)
1093 1103
1094 # So can "inputs" and "outputs" sections of "actions" groups. 1104 # So can "inputs" and "outputs" sections of "actions" groups.
1095 groups = ['inputs', 'inputs_excluded', 'outputs', 'outputs_excluded'] 1105 groups = ['inputs', 'inputs_excluded', 'outputs', 'outputs_excluded']
1096 if skip_excluded_files: 1106 if skip_excluded_files:
1097 groups = [x for x in groups if not x.endswith('_excluded')] 1107 groups = [x for x in groups if not x.endswith('_excluded')]
1098 for action in spec.get('actions', []): 1108 for action in spec.get('actions', []):
1099 for group in groups: 1109 for group in groups:
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1180 1190
1181 for build_file in build_files: 1191 for build_file in build_files:
1182 xcode_projects[build_file].Finalize1(xcode_targets, serialize_all_tests) 1192 xcode_projects[build_file].Finalize1(xcode_targets, serialize_all_tests)
1183 1193
1184 for build_file in build_files: 1194 for build_file in build_files:
1185 xcode_projects[build_file].Finalize2(xcode_targets, 1195 xcode_projects[build_file].Finalize2(xcode_targets,
1186 xcode_target_to_target_dict) 1196 xcode_target_to_target_dict)
1187 1197
1188 for build_file in build_files: 1198 for build_file in build_files:
1189 xcode_projects[build_file].Write() 1199 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