| OLD | NEW |
| 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 11 matching lines...) Expand all Loading... |
| 22 class Err; | 22 class Err; |
| 23 class Target; | 23 class Target; |
| 24 | 24 |
| 25 class VisualStudioWriter { | 25 class VisualStudioWriter { |
| 26 public: | 26 public: |
| 27 enum Version { | 27 enum Version { |
| 28 Vs2013 = 1, // Visual Studio 2013 | 28 Vs2013 = 1, // Visual Studio 2013 |
| 29 Vs2015 // Visual Studio 2015 | 29 Vs2015 // Visual Studio 2015 |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 // On failure will populate |err| and will return false. | 32 // Writes Visual Studio project and solution files. |sln_name| is the optional |
| 33 // solution file name ("all" is used if not specified). |dir_filters| is |
| 34 // optional semicolon-separated list of label patterns used to limit the set |
| 35 // of generated projects. Only matching targets will be included to the |
| 36 // solution. On failure will populate |err| and will return false. |
| 33 static bool RunAndWriteFiles(const BuildSettings* build_settings, | 37 static bool RunAndWriteFiles(const BuildSettings* build_settings, |
| 34 Builder* builder, | 38 Builder* builder, |
| 35 Version version, | 39 Version version, |
| 40 const std::string& sln_name, |
| 41 const std::string& dir_filters, |
| 36 Err* err); | 42 Err* err); |
| 37 | 43 |
| 38 private: | 44 private: |
| 39 FRIEND_TEST_ALL_PREFIXES(VisualStudioWriterTest, ResolveSolutionFolders); | 45 FRIEND_TEST_ALL_PREFIXES(VisualStudioWriterTest, ResolveSolutionFolders); |
| 40 FRIEND_TEST_ALL_PREFIXES(VisualStudioWriterTest, | 46 FRIEND_TEST_ALL_PREFIXES(VisualStudioWriterTest, |
| 41 ResolveSolutionFolders_AbsPath); | 47 ResolveSolutionFolders_AbsPath); |
| 42 | 48 |
| 43 // Solution project or folder. | 49 // Solution project or folder. |
| 44 struct SolutionEntry { | 50 struct SolutionEntry { |
| 45 SolutionEntry(const std::string& name, | 51 SolutionEntry(const std::string& name, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 67 | 73 |
| 68 // Absolute label dir path. | 74 // Absolute label dir path. |
| 69 std::string label_dir_path; | 75 std::string label_dir_path; |
| 70 // Configuration platform. May be different than solution config platform. | 76 // Configuration platform. May be different than solution config platform. |
| 71 std::string config_platform; | 77 std::string config_platform; |
| 72 }; | 78 }; |
| 73 | 79 |
| 74 using SolutionProjects = std::vector<SolutionProject*>; | 80 using SolutionProjects = std::vector<SolutionProject*>; |
| 75 using SolutionFolders = std::vector<SolutionEntry*>; | 81 using SolutionFolders = std::vector<SolutionEntry*>; |
| 76 | 82 |
| 77 explicit VisualStudioWriter(const BuildSettings* build_settings, | 83 VisualStudioWriter(const BuildSettings* build_settings, |
| 78 const char* config_platform, | 84 const char* config_platform, |
| 79 Version version); | 85 Version version); |
| 80 ~VisualStudioWriter(); | 86 ~VisualStudioWriter(); |
| 81 | 87 |
| 82 bool WriteProjectFiles(const Target* target, Err* err); | 88 bool WriteProjectFiles(const Target* target, Err* err); |
| 83 bool WriteProjectFileContents(std::ostream& out, | 89 bool WriteProjectFileContents(std::ostream& out, |
| 84 const SolutionProject& solution_project, | 90 const SolutionProject& solution_project, |
| 85 const Target* target, | 91 const Target* target, |
| 86 Err* err); | 92 Err* err); |
| 87 void WriteFiltersFileContents(std::ostream& out, const Target* target); | 93 void WriteFiltersFileContents(std::ostream& out, const Target* target); |
| 88 bool WriteSolutionFile(Err* err); | 94 bool WriteSolutionFile(const std::string& sln_name, Err* err); |
| 89 void WriteSolutionFileContents(std::ostream& out, | 95 void WriteSolutionFileContents(std::ostream& out, |
| 90 const base::FilePath& solution_dir_path); | 96 const base::FilePath& solution_dir_path); |
| 91 | 97 |
| 92 // Resolves all solution folders (parent folders for projects) into |folders_| | 98 // Resolves all solution folders (parent folders for projects) into |folders_| |
| 93 // and updates |root_folder_dir_|. Also sets |parent_folder| for |projects_|. | 99 // and updates |root_folder_dir_|. Also sets |parent_folder| for |projects_|. |
| 94 void ResolveSolutionFolders(); | 100 void ResolveSolutionFolders(); |
| 95 | 101 |
| 96 std::string GetNinjaTarget(const Target* target); | 102 std::string GetNinjaTarget(const Target* target); |
| 97 | 103 |
| 98 const BuildSettings* build_settings_; | 104 const BuildSettings* build_settings_; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 122 // Semicolon-separated Windows SDK include directories. | 128 // Semicolon-separated Windows SDK include directories. |
| 123 std::string windows_kits_include_dirs_; | 129 std::string windows_kits_include_dirs_; |
| 124 | 130 |
| 125 // Path formatter for ninja targets. | 131 // Path formatter for ninja targets. |
| 126 PathOutput ninja_path_output_; | 132 PathOutput ninja_path_output_; |
| 127 | 133 |
| 128 DISALLOW_COPY_AND_ASSIGN(VisualStudioWriter); | 134 DISALLOW_COPY_AND_ASSIGN(VisualStudioWriter); |
| 129 }; | 135 }; |
| 130 | 136 |
| 131 #endif // TOOLS_GN_VISUAL_STUDIO_WRITER_H_ | 137 #endif // TOOLS_GN_VISUAL_STUDIO_WRITER_H_ |
| OLD | NEW |