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

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

Issue 1842563006: DO NOT SUBMIT. Experimental Mac GN Framework support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Binary bundle data Created 4 years, 8 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
« no previous file with comments | « tools/gn/bundle_data.cc ('k') | tools/gn/bundle_file_rule.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/bundle_data_target_generator.h" 5 #include "tools/gn/bundle_data_target_generator.h"
6 6
7 #include "tools/gn/parse_tree.h" 7 #include "tools/gn/parse_tree.h"
8 #include "tools/gn/scope.h" 8 #include "tools/gn/scope.h"
9 #include "tools/gn/substitution_type.h" 9 #include "tools/gn/substitution_type.h"
10 #include "tools/gn/target.h" 10 #include "tools/gn/target.h"
11 #include "tools/gn/value.h" 11 #include "tools/gn/value.h"
12 #include "tools/gn/variables.h" 12 #include "tools/gn/variables.h"
13 13
14 BundleDataTargetGenerator::BundleDataTargetGenerator( 14 BundleDataTargetGenerator::BundleDataTargetGenerator(
15 Target* target, 15 Target* target,
16 Scope* scope, 16 Scope* scope,
17 const FunctionCallNode* function_call, 17 const FunctionCallNode* function_call,
18 Err* err) : TargetGenerator(target, scope, function_call, err) {} 18 Err* err) : TargetGenerator(target, scope, function_call, err) {}
19 19
20 BundleDataTargetGenerator::~BundleDataTargetGenerator() {} 20 BundleDataTargetGenerator::~BundleDataTargetGenerator() {}
21 21
22 void BundleDataTargetGenerator::DoRun() { 22 void BundleDataTargetGenerator::DoRun() {
23 target_->set_output_type(Target::BUNDLE_DATA); 23 target_->set_output_type(Target::BUNDLE_DATA);
24 24
25 if (!FillSources()) 25 if (!FillSources())
26 return; 26 return;
27 if (!FillOutputs()) 27 if (!FillOutputs())
28 return; 28 return;
29 29
30 const Value* value = scope_->GetValue(variables::kBinaryCompress, true);
31 if (value) {
32 if (value->type() != Value::BOOLEAN) {
33 *err_ = Err(function_call_,
34 "The binary_compress variable must be boolean");
35 return;
36 }
37 target_->bundle_data().set_binary_compress(value->boolean_value());
38 }
39
30 if (target_->sources().empty()) { 40 if (target_->sources().empty()) {
31 *err_ = Err(function_call_, "Empty sources for bundle_data target." 41 *err_ = Err(function_call_, "Empty sources for bundle_data target."
32 "You have to specify at least one file in the \"sources\"."); 42 "You have to specify at least one file in the \"sources\".");
33 return; 43 return;
34 } 44 }
35 if (target_->action_values().outputs().list().size() != 1) { 45 if (target_->action_values().outputs().list().size() != 1) {
36 *err_ = Err(function_call_, 46 *err_ = Err(function_call_,
37 "Target bundle_data must have exactly one ouput.", 47 "Target bundle_data must have exactly one ouput.",
38 "You must specify exactly one value in the \"output\" array for the" 48 "You must specify exactly one value in the \"output\" array for the"
39 "destination\ninto the generated bundle (see \"gn help bundle_data\"). " 49 "destination\ninto the generated bundle (see \"gn help bundle_data\"). "
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 95
86 if (SubstitutionIsInBundleDir(pattern.ranges()[0].type)) 96 if (SubstitutionIsInBundleDir(pattern.ranges()[0].type))
87 return true; 97 return true;
88 98
89 *err_ = Err(original_value, 99 *err_ = Err(original_value,
90 "File is not inside bundle directory.", 100 "File is not inside bundle directory.",
91 "The given file should be in the output directory. Normally you\n" 101 "The given file should be in the output directory. Normally you\n"
92 "would specify {{bundle_resources_dir}} or such substitution."); 102 "would specify {{bundle_resources_dir}} or such substitution.");
93 return false; 103 return false;
94 } 104 }
OLDNEW
« no previous file with comments | « tools/gn/bundle_data.cc ('k') | tools/gn/bundle_file_rule.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698