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

Unified Diff: tools/gn/ninja_target_writer.h

Issue 21114002: Add initial prototype for the GN meta-buildsystem. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add owners and readme Created 7 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_helper_unittest.cc ('k') | tools/gn/ninja_target_writer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/ninja_target_writer.h
diff --git a/tools/gn/ninja_target_writer.h b/tools/gn/ninja_target_writer.h
new file mode 100644
index 0000000000000000000000000000000000000000..5e6827d550950e990c31fa859537d7b0265edfa1
--- /dev/null
+++ b/tools/gn/ninja_target_writer.h
@@ -0,0 +1,67 @@
+// Copyright (c) 2013 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_NINJA_TARGET_WRITER_H_
+#define TOOLS_GN_NINJA_TARGET_WRITER_H_
+
+#include <iosfwd>
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/files/file_path.h"
+#include "tools/gn/filesystem_utils.h"
+#include "tools/gn/ninja_helper.h"
+#include "tools/gn/path_output.h"
+#include "tools/gn/settings.h"
+
+class Target;
+
+// Generates one target's ".ninja" file. The toplevel "build.ninja" file is
+// generated by the NinjaBuildGenerator.
+class NinjaTargetWriter {
+ public:
+ NinjaTargetWriter(const Target* target, std::ostream& out);
+ ~NinjaTargetWriter();
+
+ void Run();
+
+ static void RunAndWriteFile(const Target* target);
+
+ private:
+ void WriteCopyRules();
+
+ void WriteCustomRules();
+ void WriteCustomArg(const std::string& arg);
+
+ // Writs the rules for compiling each source, writing all output files
+ // to the given vector.
+ //
+ // common_deps is a precomputed string of all ninja files that are common
+ // to each build step. This is added to each one.
+ void WriteCustomSourceRules(const std::string& custom_rule_name,
+ const std::string& common_deps,
+ const SourceDir& script_cd,
+ const std::string& script_cd_to_root,
+ std::vector<OutputFile>* output_files);
+
+ void WriteCompilerVars();
+ void WriteSources(std::vector<OutputFile>* object_files);
+ void WriteLinkerStuff(const std::vector<OutputFile>& object_files);
+
+ // Returns NULL if the source type should not be compiled on this target.
+ const char* GetCommandForSourceType(SourceFileType type) const;
+
+ const char* GetCommandForTargetType() const;
+
+ const Settings* settings_; // Non-owning.
+ const Target* target_; // Non-owning.
+ std::ostream& out_;
+ PathOutput path_output_;
+
+ NinjaHelper helper_;
+
+ DISALLOW_COPY_AND_ASSIGN(NinjaTargetWriter);
+};
+
+#endif // TOOLS_GN_NINJA_TARGET_WRITER_H_
« no previous file with comments | « tools/gn/ninja_helper_unittest.cc ('k') | tools/gn/ninja_target_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698