Revert 214325 "Revert 214254 "Add initial prototype for the GN m..."
The issue was already fixed :)
> Revert 214254 "Add initial prototype for the GN meta-buildsystem."
>
> It broke the check_licenses step on Android (see http://build.chromium.org/p/chromium.linux/builders/Android%20Builder%20%28dbg%29/builds/39904/steps/check_licenses/logs/stdio):
>
> @@@BUILD_STEP check_licenses@@@
> > /b/build/slave/Android_Builder__dbg_/build/src/android_webview/tools/webview_licenses.py scan
> Got LicenseError "missing README.chromium or licenses.py SPECIAL_CASES entry" while scanning tools/gn/secondary/base/third_party/dynamic_annotations
> Got LicenseError "missing README.chromium or licenses.py SPECIAL_CASES entry" while scanning tools/gn/secondary/third_party/modp_b64
> < /b/build/slave/Android_Builder__dbg_/build/src/android_webview/tools/webview_licenses.py scan
> ERROR: process exited with code 2
> @@@STEP_FAILURE@@@
>
>
> > Add initial prototype for the GN meta-buildsystem.
> >
> > This is currently not hooked into the build. To build, add a reference to the
> > gn.gyp file to build/all.gyp
> >
> > [email protected], [email protected]
> >
> > Review URL: https://codereview.chromium.org/21114002
>
> [email protected]
>
> Review URL: https://codereview.chromium.org/21084010
[email protected]
Review URL: https://codereview.chromium.org/21204003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214333 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/tools/gn/ninja_target_writer.h b/tools/gn/ninja_target_writer.h
new file mode 100644
index 0000000..5e6827d
--- /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_