OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef TOOLS_GN_VISUAL_STUDIO_WRITER_H_ | |
6 #define TOOLS_GN_VISUAL_STUDIO_WRITER_H_ | |
7 | |
8 #include <ostream> | |
brettw
2016/01/28 23:24:46
Use <iosfwd> instead, I think <ostream> introduces
Tomasz Moniuszko
2016/01/29 12:29:35
Done.
| |
9 #include <string> | |
10 #include <vector> | |
11 | |
12 #include "base/gtest_prod_util.h" | |
13 #include "base/macros.h" | |
14 | |
15 namespace base { | |
16 class FilePath; | |
17 } | |
18 | |
19 class Builder; | |
20 class BuildSettings; | |
21 class Err; | |
22 class Target; | |
23 | |
24 class VisualStudioWriter { | |
25 public: | |
26 // On failure will populate |err| and will return false. | |
27 static bool RunAndWriteFiles(const BuildSettings* build_settings, | |
28 Builder* builder, | |
29 Err* err); | |
30 | |
31 private: | |
32 FRIEND_TEST_ALL_PREFIXES(VisualStudioWriterTest, ResolveSolutionFolders); | |
33 FRIEND_TEST_ALL_PREFIXES(VisualStudioWriterTest, | |
34 ResolveSolutionFolders_AbsPath); | |
35 | |
36 // Solution project or folder. | |
37 struct SolutionEntry { | |
38 SolutionEntry(const std::string& name, | |
39 const std::string& path, | |
40 const std::string& guid); | |
pkotwicz
2016/01/29 02:10:48
When I patched your CL locally, the clang compiler
Tomasz Moniuszko
2016/01/29 12:29:35
No warnings on Windows. I added some ctors/dtors.
| |
41 | |
42 // Entry name. For projects must be unique in the solution. | |
43 std::string name; | |
44 // Absolute project file or folder directory path. | |
45 std::string path; | |
46 // Absolute label dir path (only for projects). | |
47 std::string label_dir_path; | |
48 // GUID-like string. | |
49 std::string guid; | |
50 // Pointer to parent folder. nullptr if entry has no parent. | |
51 SolutionEntry* parent_folder; | |
52 }; | |
53 | |
54 using SolutionEntries = std::vector<SolutionEntry*>; | |
55 | |
56 explicit VisualStudioWriter(const BuildSettings* build_settings); | |
57 ~VisualStudioWriter(); | |
58 | |
59 bool WriteProjectFiles(const Target* target, Err* err); | |
60 bool WriteProjectFileContents(std::ostream& out, | |
61 const SolutionEntry& solution_project, | |
62 const Target* target, | |
63 Err* err); | |
64 void WriteFiltersFileContents(std::ostream& out, const Target* target); | |
65 bool WriteSolutionFile(Err* err); | |
66 void WriteSolutionFileContents(std::ostream& out, | |
67 const base::FilePath& solution_dir_path); | |
68 | |
69 // Resolves all solution folders (parent folders for projects) into |folders_| | |
70 // and updates |root_folder_dir_|. Also sets |parent_folder| for |projects_|. | |
71 void ResolveSolutionFolders(); | |
72 | |
73 const BuildSettings* build_settings_; | |
74 | |
75 // Indicates if project files are generated for Debug mode configuration. | |
76 bool is_debug_config_; | |
77 | |
78 // Platform for projects configuration (Win32, x64). | |
79 std::string config_platform_; | |
80 | |
81 // All projects contained by solution. | |
82 SolutionEntries projects_; | |
83 | |
84 // Absolute root solution folder path. | |
85 std::string root_folder_path_; | |
86 | |
87 // Folders for all solution projects. | |
88 SolutionEntries folders_; | |
89 | |
90 // Semicolon-separated Windows SDK include directories. | |
91 std::string windows_kits_include_dirs_; | |
92 | |
93 DISALLOW_COPY_AND_ASSIGN(VisualStudioWriter); | |
94 }; | |
95 | |
96 #endif // TOOLS_GN_VISUAL_STUDIO_WRITER_H_ | |
OLD | NEW |