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

Unified Diff: trunk/src/tools/gn/ninja_toolchain_writer.cc

Issue 21084010: Revert 214254 "Add initial prototype for the GN meta-buildsystem." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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 | « trunk/src/tools/gn/ninja_toolchain_writer.h ('k') | trunk/src/tools/gn/ninja_writer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/tools/gn/ninja_toolchain_writer.cc
===================================================================
--- trunk/src/tools/gn/ninja_toolchain_writer.cc (revision 214322)
+++ trunk/src/tools/gn/ninja_toolchain_writer.cc (working copy)
@@ -1,94 +0,0 @@
-// 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.
-
-#include "tools/gn/ninja_toolchain_writer.h"
-
-#include <fstream>
-
-#include "base/file_util.h"
-#include "base/strings/stringize_macros.h"
-#include "tools/gn/build_settings.h"
-#include "tools/gn/settings.h"
-#include "tools/gn/target.h"
-#include "tools/gn/toolchain.h"
-
-NinjaToolchainWriter::NinjaToolchainWriter(
- const Settings* settings,
- const std::vector<const Target*>& targets,
- std::ostream& out)
- : settings_(settings),
- targets_(targets),
- out_(out),
- path_output_(settings_->build_settings()->build_dir(),
- ESCAPE_NINJA, true),
- helper_(settings->build_settings()) {
-}
-
-NinjaToolchainWriter::~NinjaToolchainWriter() {
-}
-
-void NinjaToolchainWriter::Run() {
- WriteRules();
- WriteSubninjas();
-}
-
-// static
-bool NinjaToolchainWriter::RunAndWriteFile(
- const Settings* settings,
- const std::vector<const Target*>& targets) {
- NinjaHelper helper(settings->build_settings());
- base::FilePath ninja_file(settings->build_settings()->GetFullPath(
- helper.GetNinjaFileForToolchain(settings).GetSourceFile(
- settings->build_settings())));
- file_util::CreateDirectory(ninja_file.DirName());
-
- std::ofstream file;
- file.open(FilePathToUTF8(ninja_file).c_str(),
- std::ios_base::out | std::ios_base::binary);
- if (file.fail())
- return false;
-
- NinjaToolchainWriter gen(settings, targets, file);
- gen.Run();
- return true;
-}
-
-void NinjaToolchainWriter::WriteRules() {
- const Toolchain* tc = settings_->toolchain();
- std::string indent(" ");
-
- for (int i = Toolchain::TYPE_NONE + 1; i < Toolchain::TYPE_NUMTYPES; i++) {
- Toolchain::ToolType tool_type = static_cast<Toolchain::ToolType>(i);
- const Toolchain::Tool& tool = tc->GetTool(tool_type);
- if (tool.empty())
- continue;
-
- out_ << "rule " << Toolchain::ToolTypeToName(tool_type) << std::endl;
-
- #define WRITE_ARG(name) \
- if (!tool.name.empty()) \
- out_ << indent << " " STRINGIZE(name) " = " << tool.name << std::endl;
- WRITE_ARG(command);
- WRITE_ARG(depfile);
- WRITE_ARG(deps);
- WRITE_ARG(description);
- WRITE_ARG(pool);
- WRITE_ARG(restat);
- WRITE_ARG(rspfile);
- WRITE_ARG(rspfile_content);
- #undef WRITE_ARG
- }
- out_ << std::endl;
-}
-
-void NinjaToolchainWriter::WriteSubninjas() {
- for (size_t i = 0; i < targets_.size(); i++) {
- if (targets_[i]->output_type() != Target::NONE) {
- out_ << "subninja ";
- path_output_.WriteFile(out_, helper_.GetNinjaFileForTarget(targets_[i]));
- out_ << std::endl;
- }
- }
- out_ << std::endl;
-}
« no previous file with comments | « trunk/src/tools/gn/ninja_toolchain_writer.h ('k') | trunk/src/tools/gn/ninja_writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698