Replace command buffer FlushSync with WaitForTokenInRange and WaitForGetOffsetInRange
[chromium-blink-merge.git] / tools / gn / copy_target_generator.cc
blobb1b907642880c9697ec260e77ca8c2d32df6bfdd
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "tools/gn/copy_target_generator.h"
7 #include "tools/gn/build_settings.h"
8 #include "tools/gn/filesystem_utils.h"
9 #include "tools/gn/parse_tree.h"
10 #include "tools/gn/scope.h"
11 #include "tools/gn/value.h"
13 CopyTargetGenerator::CopyTargetGenerator(Target* target,
14 Scope* scope,
15 const FunctionCallNode* function_call,
16 Err* err)
17 : TargetGenerator(target, scope, function_call, err) {
20 CopyTargetGenerator::~CopyTargetGenerator() {
23 void CopyTargetGenerator::DoRun() {
24 target_->set_output_type(Target::COPY_FILES);
26 FillExternal();
27 if (err_->has_error())
28 return;
29 FillSources();
30 if (err_->has_error())
31 return;
32 FillOutputs();
33 if (err_->has_error())
34 return;
36 if (target_->sources().empty()) {
37 *err_ = Err(function_call_, "Empty sources for copy command.",
38 "You have to specify at least one file to copy in the \"sources\".");
39 return;
41 if (target_->script_values().outputs().size() != 1) {
42 *err_ = Err(function_call_, "Copy command must have exactly one output.",
43 "You must specify exactly one value in the \"outputs\" array for the "
44 "destination of the copy\n(see \"gn help copy\"). If there are "
45 "multiple sources to copy, use source expansion\n(see \"gn help "
46 "source_expansion\").");
47 return;