summaryrefslogtreecommitdiffstats
path: root/tools/gn/copy_target_generator.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-13 17:10:56 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-13 17:10:56 +0000
commitc0822d7f9288ed13dce228ae3c3ed080e9712e3f (patch)
tree0bd24ec61541fa5013a1e4a2ba935279fe63779d /tools/gn/copy_target_generator.cc
parentf661bb53f2baf0f52c83e5c3f82efab6b9fc053b (diff)
downloadchromium_src-c0822d7f9288ed13dce228ae3c3ed080e9712e3f.zip
chromium_src-c0822d7f9288ed13dce228ae3c3ed080e9712e3f.tar.gz
chromium_src-c0822d7f9288ed13dce228ae3c3ed080e9712e3f.tar.bz2
Split apart various target type code.
This splits apart the "generators" that fill the Target objects from script, and the "writers" that write the .ninja files. These now have different objects and files for the basic target types. The result is that it looks like much more stuff due to the extra files, but it should be easier to follow what's happening and to make additions in the future. Remove some extra loadable module stuff I missed in the previous removal. Adds more support for the Linux build. Not everything is working yet, but most of base compiles. This actually writes .ninja files and targets for "group" types, and removes the "none" target type which this mapped to before. This way you can make a target group and actually compile that set of stuff by typing its name. BUG= R=scottmg@chromium.org Review URL: https://codereview.chromium.org/22488015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@217279 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/gn/copy_target_generator.cc')
-rw-r--r--tools/gn/copy_target_generator.cc47
1 files changed, 47 insertions, 0 deletions
diff --git a/tools/gn/copy_target_generator.cc b/tools/gn/copy_target_generator.cc
new file mode 100644
index 0000000..6347ca2
--- /dev/null
+++ b/tools/gn/copy_target_generator.cc
@@ -0,0 +1,47 @@
+// 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/copy_target_generator.h"
+
+#include "tools/gn/build_settings.h"
+#include "tools/gn/filesystem_utils.h"
+#include "tools/gn/scope.h"
+#include "tools/gn/value.h"
+
+CopyTargetGenerator::CopyTargetGenerator(Target* target,
+ Scope* scope,
+ const Token& function_token,
+ Err* err)
+ : TargetGenerator(target, scope, function_token, err) {
+}
+
+CopyTargetGenerator::~CopyTargetGenerator() {
+}
+
+void CopyTargetGenerator::DoRun() {
+ target_->set_output_type(Target::COPY_FILES);
+
+ FillSources();
+ FillDestDir();
+
+ SetToolchainDependency();
+}
+
+void CopyTargetGenerator::FillDestDir() {
+ // Destdir is required for all targets that use it.
+ const Value* value = scope_->GetValue("destdir", true);
+ if (!value) {
+ *err_ = Err(function_token_, "This target type requires a \"destdir\".");
+ return;
+ }
+ if (!value->VerifyTypeIs(Value::STRING, err_))
+ return;
+
+ if (!EnsureStringIsInOutputDir(
+ GetBuildSettings()->build_dir(),
+ value->string_value(), *value, err_))
+ return;
+ target_->set_destdir(SourceDir(value->string_value()));
+}
+