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

Unified Diff: tools/gn/ninja_build_writer.h

Issue 2152413002: GN: don't write separate files for non-binary targets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: typo Created 4 years, 5 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
« no previous file with comments | « tools/gn/json_project_writer.cc ('k') | tools/gn/ninja_build_writer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/ninja_build_writer.h
diff --git a/tools/gn/ninja_build_writer.h b/tools/gn/ninja_build_writer.h
index 358ecc68aa16070682cb709135bf21570f80c008..cf72852ac7b4392d587d35f017a503bfffe4cf97 100644
--- a/tools/gn/ninja_build_writer.h
+++ b/tools/gn/ninja_build_writer.h
@@ -6,12 +6,13 @@
#define TOOLS_GN_NINJA_BUILD_WRITER_H_
#include <iosfwd>
-#include <set>
+#include <map>
#include <vector>
#include "base/macros.h"
#include "tools/gn/path_output.h"
+class Builder;
class BuildSettings;
class Err;
class Pool;
@@ -24,38 +25,42 @@ class Toolchain;
// build itself.
class NinjaBuildWriter {
public:
- static bool RunAndWriteFile(
+ NinjaBuildWriter(
const BuildSettings* settings,
- const std::vector<const Settings*>& all_settings,
+ const std::map<const Settings*, const Toolchain*>& used_toolchains,
const Toolchain* default_toolchain,
const std::vector<const Target*>& default_toolchain_targets,
- const std::vector<const Pool*>& all_pools,
- Err* err);
-
- NinjaBuildWriter(const BuildSettings* settings,
- const std::vector<const Settings*>& all_settings,
- const Toolchain* default_toolchain,
- const std::vector<const Target*>& default_toolchain_targets,
- const std::vector<const Pool*>& all_pools,
- std::ostream& out,
- std::ostream& dep_out);
+ std::ostream& out,
+ std::ostream& dep_out);
~NinjaBuildWriter();
+ // The design of this class is that this static factory function takes the
+ // Builder, extracts the relevant information, and passes it to the class
+ // constructor. The class itself doesn't depend on the Builder at all which
+ // makes testing much easier (tests integrating various functions along with
+ // the Builder get very complicated).
+ static bool RunAndWriteFile(
+ const BuildSettings* settings,
+ const Builder& builder,
+ Err* err);
+
bool Run(Err* err);
private:
void WriteNinjaRules();
void WriteAllPools();
void WriteSubninjas();
- bool WritePhonyAndAllRules(Err* err);
+ bool WritePhonyAndAllRules(
+ Err* err);
void WritePhonyRule(const Target* target, const std::string& phony_name);
const BuildSettings* build_settings_;
- std::vector<const Settings*> all_settings_;
+
+ const std::map<const Settings*, const Toolchain*>& used_toolchains_;
const Toolchain* default_toolchain_;
- std::vector<const Target*> default_toolchain_targets_;
- std::vector<const Pool*> all_pools_;
+ const std::vector<const Target*>& default_toolchain_targets_;
+
std::ostream& out_;
std::ostream& dep_out_;
PathOutput path_output_;
« no previous file with comments | « tools/gn/json_project_writer.cc ('k') | tools/gn/ninja_build_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698