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

Side by Side Diff: tools/gn/visual_studio_writer.h

Issue 1718093006: Limit the set of Visual Studio projects generated by GN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix filter path correction Created 4 years, 10 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. 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 #ifndef TOOLS_GN_VISUAL_STUDIO_WRITER_H_ 5 #ifndef TOOLS_GN_VISUAL_STUDIO_WRITER_H_
6 #define TOOLS_GN_VISUAL_STUDIO_WRITER_H_ 6 #define TOOLS_GN_VISUAL_STUDIO_WRITER_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 10 matching lines...) Expand all
21 class Err; 21 class Err;
22 class Target; 22 class Target;
23 23
24 class VisualStudioWriter { 24 class VisualStudioWriter {
25 public: 25 public:
26 enum Version { 26 enum Version {
27 Vs2013 = 1, // Visual Studio 2013 27 Vs2013 = 1, // Visual Studio 2013
28 Vs2015 // Visual Studio 2015 28 Vs2015 // Visual Studio 2015
29 }; 29 };
30 30
31 // Writes Visual Studio project and solution files. |sln_name| is the optional
32 // solution file name ("all" is used if not specified). |dir_filters| is
33 // optional semicolon-separated list of path prefixes used to limit the set of
34 // generated projects. Only targets whose directory paths start with one of
35 // specified prefixes will be included to the solution.
31 // On failure will populate |err| and will return false. 36 // On failure will populate |err| and will return false.
32 static bool RunAndWriteFiles(const BuildSettings* build_settings, 37 static bool RunAndWriteFiles(const BuildSettings* build_settings,
33 Builder* builder, 38 Builder* builder,
34 Version version, 39 Version version,
40 const std::string& sln_name,
41 const std::string& dir_filters,
35 Err* err); 42 Err* err);
36 43
37 private: 44 private:
38 FRIEND_TEST_ALL_PREFIXES(VisualStudioWriterTest, ResolveSolutionFolders); 45 FRIEND_TEST_ALL_PREFIXES(VisualStudioWriterTest, ResolveSolutionFolders);
39 FRIEND_TEST_ALL_PREFIXES(VisualStudioWriterTest, 46 FRIEND_TEST_ALL_PREFIXES(VisualStudioWriterTest,
40 ResolveSolutionFolders_AbsPath); 47 ResolveSolutionFolders_AbsPath);
41 48
42 // Solution project or folder. 49 // Solution project or folder.
43 struct SolutionEntry { 50 struct SolutionEntry {
44 SolutionEntry(const std::string& name, 51 SolutionEntry(const std::string& name,
(...skipping 21 matching lines...) Expand all
66 73
67 // Absolute label dir path. 74 // Absolute label dir path.
68 std::string label_dir_path; 75 std::string label_dir_path;
69 // Configuration platform. May be different than solution config platform. 76 // Configuration platform. May be different than solution config platform.
70 std::string config_platform; 77 std::string config_platform;
71 }; 78 };
72 79
73 using SolutionProjects = std::vector<SolutionProject*>; 80 using SolutionProjects = std::vector<SolutionProject*>;
74 using SolutionFolders = std::vector<SolutionEntry*>; 81 using SolutionFolders = std::vector<SolutionEntry*>;
75 82
76 explicit VisualStudioWriter(const BuildSettings* build_settings, 83 VisualStudioWriter(const BuildSettings* build_settings, Version version);
77 Version version);
78 ~VisualStudioWriter(); 84 ~VisualStudioWriter();
79 85
80 bool WriteProjectFiles(const Target* target, Err* err); 86 bool WriteProjectFiles(const Target* target, Err* err);
81 bool WriteProjectFileContents(std::ostream& out, 87 bool WriteProjectFileContents(std::ostream& out,
82 const SolutionProject& solution_project, 88 const SolutionProject& solution_project,
83 const Target* target, 89 const Target* target,
84 Err* err); 90 Err* err);
85 void WriteFiltersFileContents(std::ostream& out, const Target* target); 91 void WriteFiltersFileContents(std::ostream& out, const Target* target);
86 bool WriteSolutionFile(Err* err); 92 bool WriteSolutionFile(const std::string& sln_name, Err* err);
87 void WriteSolutionFileContents(std::ostream& out, 93 void WriteSolutionFileContents(std::ostream& out,
88 const base::FilePath& solution_dir_path); 94 const base::FilePath& solution_dir_path);
89 95
90 // Resolves all solution folders (parent folders for projects) into |folders_| 96 // Resolves all solution folders (parent folders for projects) into |folders_|
91 // and updates |root_folder_dir_|. Also sets |parent_folder| for |projects_|. 97 // and updates |root_folder_dir_|. Also sets |parent_folder| for |projects_|.
92 void ResolveSolutionFolders(); 98 void ResolveSolutionFolders();
93 99
94 const BuildSettings* build_settings_; 100 const BuildSettings* build_settings_;
95 101
96 // Toolset version. 102 // Toolset version.
(...skipping 21 matching lines...) Expand all
118 // Folders for all solution projects. 124 // Folders for all solution projects.
119 SolutionFolders folders_; 125 SolutionFolders folders_;
120 126
121 // Semicolon-separated Windows SDK include directories. 127 // Semicolon-separated Windows SDK include directories.
122 std::string windows_kits_include_dirs_; 128 std::string windows_kits_include_dirs_;
123 129
124 DISALLOW_COPY_AND_ASSIGN(VisualStudioWriter); 130 DISALLOW_COPY_AND_ASSIGN(VisualStudioWriter);
125 }; 131 };
126 132
127 #endif // TOOLS_GN_VISUAL_STUDIO_WRITER_H_ 133 #endif // TOOLS_GN_VISUAL_STUDIO_WRITER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698