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

Unified Diff: tools/gn/ninja_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/ninja_toolchain_writer_unittest.cc ('k') | tools/gn/ninja_writer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/ninja_writer.h
diff --git a/tools/gn/ninja_writer.h b/tools/gn/ninja_writer.h
index ea8fc4718838409f99ce2c02bef3eff8515e2141..4bcbf3662003b2dc2f783fc50a44a30658cbd4e4 100644
--- a/tools/gn/ninja_writer.h
+++ b/tools/gn/ninja_writer.h
@@ -5,6 +5,7 @@
#ifndef TOOLS_GN_NINJA_WRITER_H_
#define TOOLS_GN_NINJA_WRITER_H_
+#include <map>
#include <set>
#include <string>
#include <vector>
@@ -17,37 +18,34 @@ class Err;
class Pool;
class Settings;
class Target;
+class Toolchain;
class NinjaWriter {
public:
- // On failure will populate |err| and will return false.
- static bool RunAndWriteFiles(const BuildSettings* build_settings,
- Builder* builder,
- Err* err);
-
- // Writes only the toolchain.ninja files, skipping the root buildfile. The
- // settings for the files written will be added to the vector.
- static bool RunAndWriteToolchainFiles(
+ // Combines a target and the computed build rule for it.
+ using TargetRulePair = std::pair<const Target*, std::string>;
+
+ // Associates the build rules with each toolchain.
+ using PerToolchainRules =
+ std::map<const Toolchain*, std::vector<TargetRulePair>>;
+
+ // On failure will populate |err| and will return false. The map contains
+ // the per-toolchain set of rules collected to write to the toolchain build
+ // files.
+ static bool RunAndWriteFiles(
const BuildSettings* build_settings,
- Builder* builder,
- std::vector<const Settings*>* all_settings,
+ const Builder& builder,
+ const PerToolchainRules& per_toolchain_rules,
Err* err);
private:
- NinjaWriter(const BuildSettings* build_settings, Builder* builder);
+ NinjaWriter(const Builder& builder);
~NinjaWriter();
- bool WriteToolchains(std::vector<const Settings*>* all_settings,
- std::vector<const Target*>* default_targets,
- std::vector<const Pool*>* all_pools,
+ bool WriteToolchains(const PerToolchainRules& per_toolchain_rules,
Err* err);
- bool WriteRootBuildfiles(const std::vector<const Settings*>& all_settings,
- const std::vector<const Target*>& default_targets,
- const std::vector<const Pool*>& all_pools,
- Err* err);
- const BuildSettings* build_settings_;
- Builder* builder_;
+ const Builder& builder_;
DISALLOW_COPY_AND_ASSIGN(NinjaWriter);
};
« no previous file with comments | « tools/gn/ninja_toolchain_writer_unittest.cc ('k') | tools/gn/ninja_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698