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

Unified Diff: tools/gn/visual_studio_writer.h

Issue 1570113002: Visual Studio generators for GN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests failing on non-Windows platforms Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: tools/gn/visual_studio_writer.h
diff --git a/tools/gn/visual_studio_writer.h b/tools/gn/visual_studio_writer.h
new file mode 100644
index 0000000000000000000000000000000000000000..5f54b3f5aa47be77d4ab3d66560ed550832316e3
--- /dev/null
+++ b/tools/gn/visual_studio_writer.h
@@ -0,0 +1,98 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef TOOLS_GN_VISUAL_STUDIO_WRITER_H_
+#define TOOLS_GN_VISUAL_STUDIO_WRITER_H_
+
+#include <iosfwd>
+#include <string>
+#include <vector>
+
+#include "base/gtest_prod_util.h"
+#include "base/macros.h"
+
+namespace base {
+class FilePath;
+}
+
+class Builder;
+class BuildSettings;
+class Err;
+class Target;
+
+class VisualStudioWriter {
+ public:
+ // On failure will populate |err| and will return false.
+ static bool RunAndWriteFiles(const BuildSettings* build_settings,
+ Builder* builder,
+ Err* err);
+
+ private:
+ FRIEND_TEST_ALL_PREFIXES(VisualStudioWriterTest, ResolveSolutionFolders);
+ FRIEND_TEST_ALL_PREFIXES(VisualStudioWriterTest,
+ ResolveSolutionFolders_AbsPath);
+
+ // Solution project or folder.
+ struct SolutionEntry {
+ SolutionEntry(const std::string& name,
+ const std::string& path,
+ const std::string& guid);
+
+ ~SolutionEntry();
+
+ // Entry name. For projects must be unique in the solution.
+ std::string name;
+ // Absolute project file or folder directory path.
+ std::string path;
+ // Absolute label dir path (only for projects).
+ std::string label_dir_path;
+ // GUID-like string.
+ std::string guid;
+ // Pointer to parent folder. nullptr if entry has no parent.
+ SolutionEntry* parent_folder;
+ };
+
+ using SolutionEntries = std::vector<SolutionEntry*>;
+
+ explicit VisualStudioWriter(const BuildSettings* build_settings);
+ ~VisualStudioWriter();
+
+ bool WriteProjectFiles(const Target* target, Err* err);
+ bool WriteProjectFileContents(std::ostream& out,
+ const SolutionEntry& solution_project,
+ const Target* target,
+ Err* err);
+ void WriteFiltersFileContents(std::ostream& out, const Target* target);
+ bool WriteSolutionFile(Err* err);
+ void WriteSolutionFileContents(std::ostream& out,
+ const base::FilePath& solution_dir_path);
+
+ // Resolves all solution folders (parent folders for projects) into |folders_|
+ // and updates |root_folder_dir_|. Also sets |parent_folder| for |projects_|.
+ void ResolveSolutionFolders();
+
+ const BuildSettings* build_settings_;
+
+ // Indicates if project files are generated for Debug mode configuration.
+ bool is_debug_config_;
+
+ // Platform for projects configuration (Win32, x64).
+ std::string config_platform_;
+
+ // All projects contained by solution.
+ SolutionEntries projects_;
+
+ // Absolute root solution folder path.
+ std::string root_folder_path_;
+
+ // Folders for all solution projects.
+ SolutionEntries folders_;
+
+ // Semicolon-separated Windows SDK include directories.
+ std::string windows_kits_include_dirs_;
+
+ DISALLOW_COPY_AND_ASSIGN(VisualStudioWriter);
+};
+
+#endif // TOOLS_GN_VISUAL_STUDIO_WRITER_H_

Powered by Google App Engine
This is Rietveld 408576698