Generate the filters file. This file is used by Visual Studio to organize the presentation of source files into folders. Arguments: filters_path: The path of the file to be created. source_files: The hierarchical structure of all the sources. extension_to_rule_n
(
filters_path,
source_files,
rule_dependencies,
extension_to_rule_name,
platforms,
toolset,
)
| 2167 | |
| 2168 | |
| 2169 | def _GenerateMSBuildFiltersFile( |
| 2170 | filters_path, |
| 2171 | source_files, |
| 2172 | rule_dependencies, |
| 2173 | extension_to_rule_name, |
| 2174 | platforms, |
| 2175 | toolset, |
| 2176 | ): |
| 2177 | """Generate the filters file. |
| 2178 | |
| 2179 | This file is used by Visual Studio to organize the presentation of source |
| 2180 | files into folders. |
| 2181 | |
| 2182 | Arguments: |
| 2183 | filters_path: The path of the file to be created. |
| 2184 | source_files: The hierarchical structure of all the sources. |
| 2185 | extension_to_rule_name: A dictionary mapping file extensions to rules. |
| 2186 | """ |
| 2187 | filter_group = [] |
| 2188 | source_group = [] |
| 2189 | _AppendFiltersForMSBuild( |
| 2190 | "", |
| 2191 | source_files, |
| 2192 | rule_dependencies, |
| 2193 | extension_to_rule_name, |
| 2194 | platforms, |
| 2195 | toolset, |
| 2196 | filter_group, |
| 2197 | source_group, |
| 2198 | ) |
| 2199 | if filter_group: |
| 2200 | content = [ |
| 2201 | "Project", |
| 2202 | { |
| 2203 | "ToolsVersion": "4.0", |
| 2204 | "xmlns": "http://schemas.microsoft.com/developer/msbuild/2003", |
| 2205 | }, |
| 2206 | ["ItemGroup"] + filter_group, |
| 2207 | ["ItemGroup"] + source_group, |
| 2208 | ] |
| 2209 | easy_xml.WriteXmlIfChanged(content, filters_path, pretty=True, win32=True) |
| 2210 | elif os.path.exists(filters_path): |
| 2211 | # We don't need this filter anymore. Delete the old filter file. |
| 2212 | os.unlink(filters_path) |
| 2213 | |
| 2214 | |
| 2215 | def _AppendFiltersForMSBuild( |
no test coverage detected