| OLD | NEW |
| 1 # Copyright (c) 2012 Google Inc. All rights reserved. | 1 # Copyright (c) 2012 Google Inc. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import collections | 5 import collections |
| 6 import copy | 6 import copy |
| 7 import ntpath | 7 import ntpath |
| 8 import os | 8 import os |
| 9 import posixpath | 9 import posixpath |
| 10 import re | 10 import re |
| (...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 def _GenerateMSVSProject(project, options, version, generator_flags): | 934 def _GenerateMSVSProject(project, options, version, generator_flags): |
| 935 """Generates a .vcproj file. It may create .rules and .user files too. | 935 """Generates a .vcproj file. It may create .rules and .user files too. |
| 936 | 936 |
| 937 Arguments: | 937 Arguments: |
| 938 project: The project object we will generate the file for. | 938 project: The project object we will generate the file for. |
| 939 options: Global options passed to the generator. | 939 options: Global options passed to the generator. |
| 940 version: The VisualStudioVersion object. | 940 version: The VisualStudioVersion object. |
| 941 generator_flags: dict of generator-specific flags. | 941 generator_flags: dict of generator-specific flags. |
| 942 """ | 942 """ |
| 943 spec = project.spec | 943 spec = project.spec |
| 944 vcproj_dir = os.path.dirname(project.path) | 944 gyp.common.EnsureDirExists(project.path) |
| 945 if vcproj_dir and not os.path.exists(vcproj_dir): | |
| 946 os.makedirs(vcproj_dir) | |
| 947 | 945 |
| 948 platforms = _GetUniquePlatforms(spec) | 946 platforms = _GetUniquePlatforms(spec) |
| 949 p = MSVSProject.Writer(project.path, version, spec['target_name'], | 947 p = MSVSProject.Writer(project.path, version, spec['target_name'], |
| 950 project.guid, platforms) | 948 project.guid, platforms) |
| 951 | 949 |
| 952 # Get directory project file is in. | 950 # Get directory project file is in. |
| 953 project_dir = os.path.split(project.path)[0] | 951 project_dir = os.path.split(project.path)[0] |
| 954 gyp_path = _NormalizedSource(project.build_file) | 952 gyp_path = _NormalizedSource(project.build_file) |
| 955 relative_path_of_gyp_file = gyp.common.RelativePath(gyp_path, project_dir) | 953 relative_path_of_gyp_file = gyp.common.RelativePath(gyp_path, project_dir) |
| 956 | 954 |
| (...skipping 2132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3089 break | 3087 break |
| 3090 group.append(project_ref) | 3088 group.append(project_ref) |
| 3091 references.append(group) | 3089 references.append(group) |
| 3092 return references | 3090 return references |
| 3093 | 3091 |
| 3094 | 3092 |
| 3095 def _GenerateMSBuildProject(project, options, version, generator_flags): | 3093 def _GenerateMSBuildProject(project, options, version, generator_flags): |
| 3096 spec = project.spec | 3094 spec = project.spec |
| 3097 configurations = spec['configurations'] | 3095 configurations = spec['configurations'] |
| 3098 project_dir, project_file_name = os.path.split(project.path) | 3096 project_dir, project_file_name = os.path.split(project.path) |
| 3099 msbuildproj_dir = os.path.dirname(project.path) | 3097 gyp.common.EnsureDirExists(project.path) |
| 3100 if msbuildproj_dir and not os.path.exists(msbuildproj_dir): | |
| 3101 os.makedirs(msbuildproj_dir) | |
| 3102 # Prepare list of sources and excluded sources. | 3098 # Prepare list of sources and excluded sources. |
| 3103 gyp_path = _NormalizedSource(project.build_file) | 3099 gyp_path = _NormalizedSource(project.build_file) |
| 3104 relative_path_of_gyp_file = gyp.common.RelativePath(gyp_path, project_dir) | 3100 relative_path_of_gyp_file = gyp.common.RelativePath(gyp_path, project_dir) |
| 3105 | 3101 |
| 3106 gyp_file = os.path.split(project.build_file)[1] | 3102 gyp_file = os.path.split(project.build_file)[1] |
| 3107 sources, excluded_sources = _PrepareListOfSources(spec, generator_flags, | 3103 sources, excluded_sources = _PrepareListOfSources(spec, generator_flags, |
| 3108 gyp_file) | 3104 gyp_file) |
| 3109 # Add rules. | 3105 # Add rules. |
| 3110 actions_to_add = {} | 3106 actions_to_add = {} |
| 3111 props_files_of_rules = set() | 3107 props_files_of_rules = set() |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3300 action_spec.extend( | 3296 action_spec.extend( |
| 3301 # TODO(jeanluc) 'Document' for all or just if as_sources? | 3297 # TODO(jeanluc) 'Document' for all or just if as_sources? |
| 3302 [['FileType', 'Document'], | 3298 [['FileType', 'Document'], |
| 3303 ['Command', command], | 3299 ['Command', command], |
| 3304 ['Message', description], | 3300 ['Message', description], |
| 3305 ['Outputs', outputs] | 3301 ['Outputs', outputs] |
| 3306 ]) | 3302 ]) |
| 3307 if additional_inputs: | 3303 if additional_inputs: |
| 3308 action_spec.append(['AdditionalInputs', additional_inputs]) | 3304 action_spec.append(['AdditionalInputs', additional_inputs]) |
| 3309 actions_spec.append(action_spec) | 3305 actions_spec.append(action_spec) |
| OLD | NEW |