| OLD | NEW |
| 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/create_bundle_target_generator.h" | 5 #include "tools/gn/create_bundle_target_generator.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "tools/gn/filesystem_utils.h" | 8 #include "tools/gn/filesystem_utils.h" |
| 9 #include "tools/gn/label_pattern.h" |
| 9 #include "tools/gn/parse_tree.h" | 10 #include "tools/gn/parse_tree.h" |
| 10 #include "tools/gn/scope.h" | 11 #include "tools/gn/scope.h" |
| 11 #include "tools/gn/substitution_type.h" | 12 #include "tools/gn/substitution_type.h" |
| 12 #include "tools/gn/target.h" | 13 #include "tools/gn/target.h" |
| 13 #include "tools/gn/value.h" | 14 #include "tools/gn/value.h" |
| 14 #include "tools/gn/value_extractors.h" | 15 #include "tools/gn/value_extractors.h" |
| 15 #include "tools/gn/variables.h" | 16 #include "tools/gn/variables.h" |
| 16 | 17 |
| 17 CreateBundleTargetGenerator::CreateBundleTargetGenerator( | 18 CreateBundleTargetGenerator::CreateBundleTargetGenerator( |
| 18 Target* target, | 19 Target* target, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 47 return; | 48 return; |
| 48 | 49 |
| 49 if (!FillCodeSigningSources()) | 50 if (!FillCodeSigningSources()) |
| 50 return; | 51 return; |
| 51 | 52 |
| 52 if (!FillCodeSigningOutputs()) | 53 if (!FillCodeSigningOutputs()) |
| 53 return; | 54 return; |
| 54 | 55 |
| 55 if (!FillCodeSigningArgs()) | 56 if (!FillCodeSigningArgs()) |
| 56 return; | 57 return; |
| 58 |
| 59 if (!FillDepsFilter()) |
| 60 return; |
| 57 } | 61 } |
| 58 | 62 |
| 59 bool CreateBundleTargetGenerator::FillBundleDir( | 63 bool CreateBundleTargetGenerator::FillBundleDir( |
| 60 const SourceDir& bundle_root_dir, | 64 const SourceDir& bundle_root_dir, |
| 61 const base::StringPiece& name, | 65 const base::StringPiece& name, |
| 62 SourceDir* bundle_dir) { | 66 SourceDir* bundle_dir) { |
| 63 const Value* value = scope_->GetValue(name, true); | 67 const Value* value = scope_->GetValue(name, true); |
| 64 if (!value) | 68 if (!value) |
| 65 return true; | 69 return true; |
| 66 if (!value->VerifyTypeIs(Value::STRING, err_)) | 70 if (!value->VerifyTypeIs(Value::STRING, err_)) |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 "No code signing script." | 190 "No code signing script." |
| 187 "You must define code_signing_script if you use code_signing_args."); | 191 "You must define code_signing_script if you use code_signing_args."); |
| 188 return false; | 192 return false; |
| 189 } | 193 } |
| 190 | 194 |
| 191 if (!value->VerifyTypeIs(Value::LIST, err_)) | 195 if (!value->VerifyTypeIs(Value::LIST, err_)) |
| 192 return false; | 196 return false; |
| 193 | 197 |
| 194 return target_->bundle_data().code_signing_args().Parse(*value, err_); | 198 return target_->bundle_data().code_signing_args().Parse(*value, err_); |
| 195 } | 199 } |
| 200 |
| 201 bool CreateBundleTargetGenerator::FillDepsFilter() { |
| 202 const Value* value = scope_->GetValue(variables::kDepsFilter, true); |
| 203 if (!value) |
| 204 return true; |
| 205 |
| 206 if (!value->VerifyTypeIs(Value::LIST, err_)) |
| 207 return false; |
| 208 |
| 209 const SourceDir& current_dir = scope_->GetSourceDir(); |
| 210 std::vector<LabelPattern>& deps_filter = target_->bundle_data().deps_filter(); |
| 211 for (const auto& item : value->list_value()) { |
| 212 deps_filter.push_back(LabelPattern::GetPattern(current_dir, item, err_)); |
| 213 if (err_->has_error()) |
| 214 return false; |
| 215 } |
| 216 |
| 217 return true; |
| 218 } |
| OLD | NEW |