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

Side by Side Diff: tools/gn/copy_target_generator.cc

Issue 1606553002: Add support for Mac/iOS application bundles to GN tool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unit tests & support for bundle_data_filter Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "tools/gn/copy_target_generator.h" 5 #include "tools/gn/copy_target_generator.h"
6 6
7 #include "tools/gn/build_settings.h" 7 #include "tools/gn/build_settings.h"
8 #include "tools/gn/filesystem_utils.h" 8 #include "tools/gn/filesystem_utils.h"
9 #include "tools/gn/parse_tree.h" 9 #include "tools/gn/parse_tree.h"
10 #include "tools/gn/scope.h" 10 #include "tools/gn/scope.h"
11 #include "tools/gn/value.h" 11 #include "tools/gn/value.h"
12 12
13 CopyTargetGenerator::CopyTargetGenerator(Target* target, 13 CopyTargetGenerator::CopyTargetGenerator(Target* target,
14 Scope* scope, 14 Scope* scope,
15 const FunctionCallNode* function_call, 15 const FunctionCallNode* function_call,
16 Target::OutputType output_type,
16 Err* err) 17 Err* err)
17 : TargetGenerator(target, scope, function_call, err) { 18 : TargetGenerator(target, scope, function_call, err),
18 } 19 output_type_(output_type) {}
19 20
20 CopyTargetGenerator::~CopyTargetGenerator() { 21 CopyTargetGenerator::~CopyTargetGenerator() {
21 } 22 }
22 23
23 void CopyTargetGenerator::DoRun() { 24 void CopyTargetGenerator::DoRun() {
24 target_->set_output_type(Target::COPY_FILES); 25 target_->set_output_type(output_type_);
25 26
26 if (!FillSources()) 27 if (output_type_ == Target::COPY_FILES) {
27 return; 28 if (!FillSources())
29 return;
30
31 if (target_->sources().empty()) {
32 *err_ = Err(
33 function_call_, "Empty sources for copy command.",
34 "You have to specify at least one file to copy in the \"sources\".");
35 return;
36 }
37 }
38
39 if (output_type_ == Target::COPY_BUNDLE_DATA) {
40 if (!FillBundleDataFilter())
41 return;
42 }
43
28 if (!FillOutputs(true)) 44 if (!FillOutputs(true))
29 return; 45 return;
30 46
31 if (target_->sources().empty()) {
32 *err_ = Err(function_call_, "Empty sources for copy command.",
33 "You have to specify at least one file to copy in the \"sources\".");
34 return;
35 }
36 if (target_->action_values().outputs().list().size() != 1) { 47 if (target_->action_values().outputs().list().size() != 1) {
37 *err_ = Err(function_call_, "Copy command must have exactly one output.", 48 *err_ = Err(function_call_, "Copy command must have exactly one output.",
38 "You must specify exactly one value in the \"outputs\" array for the " 49 "You must specify exactly one value in the \"outputs\" array for the "
39 "destination of the copy\n(see \"gn help copy\"). If there are " 50 "destination of the copy\n(see \"gn help copy\"). If there are "
40 "multiple sources to copy, use source expansion\n(see \"gn help " 51 "multiple sources to copy, use source expansion\n(see \"gn help "
41 "source_expansion\")."); 52 "source_expansion\").");
42 return; 53 return;
43 } 54 }
44 } 55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698