(project, options, version, generator_flags, spec)
| 3667 | |
| 3668 | |
| 3669 | def _GenerateMSBuildProject(project, options, version, generator_flags, spec): |
| 3670 | spec = project.spec |
| 3671 | configurations = spec["configurations"] |
| 3672 | toolset = spec["toolset"] |
| 3673 | project_dir, project_file_name = os.path.split(project.path) |
| 3674 | gyp.common.EnsureDirExists(project.path) |
| 3675 | # Prepare list of sources and excluded sources. |
| 3676 | |
| 3677 | gyp_file = os.path.split(project.build_file)[1] |
| 3678 | sources, excluded_sources = _PrepareListOfSources(spec, generator_flags, gyp_file) |
| 3679 | # Add rules. |
| 3680 | actions_to_add = {} |
| 3681 | props_files_of_rules = set() |
| 3682 | targets_files_of_rules = set() |
| 3683 | rule_dependencies = set() |
| 3684 | extension_to_rule_name = {} |
| 3685 | list_excluded = generator_flags.get("msvs_list_excluded_files", True) |
| 3686 | platforms = _GetUniquePlatforms(spec) |
| 3687 | |
| 3688 | # Don't generate rules if we are using an external builder like ninja. |
| 3689 | if not spec.get("msvs_external_builder"): |
| 3690 | _GenerateRulesForMSBuild( |
| 3691 | project_dir, |
| 3692 | options, |
| 3693 | spec, |
| 3694 | sources, |
| 3695 | excluded_sources, |
| 3696 | props_files_of_rules, |
| 3697 | targets_files_of_rules, |
| 3698 | actions_to_add, |
| 3699 | rule_dependencies, |
| 3700 | extension_to_rule_name, |
| 3701 | ) |
| 3702 | else: |
| 3703 | rules = spec.get("rules", []) |
| 3704 | _AdjustSourcesForRules(rules, sources, excluded_sources, True) |
| 3705 | |
| 3706 | sources, excluded_sources, excluded_idl = _AdjustSourcesAndConvertToFilterHierarchy( |
| 3707 | spec, options, project_dir, sources, excluded_sources, list_excluded, version |
| 3708 | ) |
| 3709 | |
| 3710 | # Don't add actions if we are using an external builder like ninja. |
| 3711 | if not spec.get("msvs_external_builder"): |
| 3712 | _AddActions(actions_to_add, spec, project.build_file) |
| 3713 | _AddCopies(actions_to_add, spec) |
| 3714 | |
| 3715 | # NOTE: this stanza must appear after all actions have been decided. |
| 3716 | # Don't excluded sources with actions attached, or they won't run. |
| 3717 | excluded_sources = _FilterActionsFromExcluded(excluded_sources, actions_to_add) |
| 3718 | |
| 3719 | exclusions = _GetExcludedFilesFromBuild(spec, excluded_sources, excluded_idl) |
| 3720 | actions_spec, sources_handled_by_action = _GenerateActionsForMSBuild( |
| 3721 | spec, actions_to_add |
| 3722 | ) |
| 3723 | |
| 3724 | _GenerateMSBuildFiltersFile( |
| 3725 | project.path + ".filters", |
| 3726 | sources, |
no test coverage detected