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/gyp_target_writer.cc

Issue 80463004: GN generator for GYP actions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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/gyp_target_writer.h ('k') | tools/gn/ninja_target_writer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/gyp_target_writer.cc
diff --git a/tools/gn/gyp_target_writer.cc b/tools/gn/gyp_target_writer.cc
index 1c0de5f073aadd1a895d8e19396f45aee6c73d95..725dbdc7cd18afda791aa2b0684cb8d10cebdda2 100644
--- a/tools/gn/gyp_target_writer.cc
+++ b/tools/gn/gyp_target_writer.cc
@@ -12,14 +12,20 @@
#include "tools/gn/builder_record.h"
#include "tools/gn/filesystem_utils.h"
#include "tools/gn/gyp_binary_target_writer.h"
+#include "tools/gn/gyp_script_target_writer.h"
#include "tools/gn/scheduler.h"
#include "tools/gn/settings.h"
#include "tools/gn/target.h"
-GypTargetWriter::GypTargetWriter(const Target* target, std::ostream& out)
+GypTargetWriter::GypTargetWriter(const Target* target,
+ const SourceDir& gyp_dir,
+ std::ostream& out)
: settings_(target->settings()),
target_(target),
- out_(out) {
+ gyp_dir_(gyp_dir),
+ out_(out),
+ // All GYP paths are relative to GYP file.
+ path_output_(gyp_dir, ESCAPE_JSON, false) {
}
GypTargetWriter::~GypTargetWriter() {
@@ -61,14 +67,19 @@ void GypTargetWriter::WriteFile(const SourceFile& gyp_file,
const Target* cur = targets[i].debug->item()->AsTarget();
switch (cur->output_type()) {
case Target::COPY_FILES:
- case Target::CUSTOM:
+ break; // TODO(brettw)
+ case Target::CUSTOM: {
+ GypScriptTargetWriter writer(targets[i], gyp_file.GetDir(), file);
+ writer.Run();
+ break;
+ }
case Target::GROUP:
break; // TODO(brettw)
case Target::EXECUTABLE:
case Target::STATIC_LIBRARY:
case Target::SHARED_LIBRARY:
case Target::SOURCE_SET: {
- GypBinaryTargetWriter writer(targets[i], file);
+ GypBinaryTargetWriter writer(targets[i], gyp_file.GetDir(), file);
writer.Run();
break;
}
@@ -84,3 +95,16 @@ void GypTargetWriter::WriteFile(const SourceFile& gyp_file,
static_cast<int>(contents.size()));
}
+std::ostream& GypTargetWriter::Indent(int spaces) {
+ return Indent(out_, spaces);
+}
+
+// static
+std::ostream& GypTargetWriter::Indent(std::ostream& out, int spaces) {
+ const char kSpaces[81] =
+ " "
+ " ";
+ CHECK(static_cast<size_t>(spaces) <= arraysize(kSpaces) - 1);
+ out.write(kSpaces, spaces);
+ return out;
+}
« no previous file with comments | « tools/gn/gyp_target_writer.h ('k') | tools/gn/ninja_target_writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698