| 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/bundle_data.h" | 5 #include "tools/gn/bundle_data.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/output_file.h" | 10 #include "tools/gn/output_file.h" |
| 10 #include "tools/gn/settings.h" | 11 #include "tools/gn/settings.h" |
| 11 #include "tools/gn/substitution_writer.h" | 12 #include "tools/gn/substitution_writer.h" |
| 12 #include "tools/gn/target.h" | 13 #include "tools/gn/target.h" |
| 13 | 14 |
| 14 namespace { | 15 namespace { |
| 15 | 16 |
| 16 // Return directory of |path| without the trailing directory separator. | 17 // Return directory of |path| without the trailing directory separator. |
| 17 base::StringPiece FindDirNoTrailingSeparator(base::StringPiece path) { | 18 base::StringPiece FindDirNoTrailingSeparator(base::StringPiece path) { |
| 18 base::StringPiece::size_type pos = path.find_last_of("/\\"); | 19 base::StringPiece::size_type pos = path.find_last_of("/\\"); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 45 } | 46 } |
| 46 | 47 |
| 47 } // namespace | 48 } // namespace |
| 48 | 49 |
| 49 BundleData::BundleData() {} | 50 BundleData::BundleData() {} |
| 50 | 51 |
| 51 BundleData::~BundleData() {} | 52 BundleData::~BundleData() {} |
| 52 | 53 |
| 53 void BundleData::AddBundleData(const Target* target) { | 54 void BundleData::AddBundleData(const Target* target) { |
| 54 DCHECK_EQ(target->output_type(), Target::BUNDLE_DATA); | 55 DCHECK_EQ(target->output_type(), Target::BUNDLE_DATA); |
| 56 for (const auto& pattern : bundle_deps_filter_) { |
| 57 if (pattern.Matches(target->label())) |
| 58 return; |
| 59 } |
| 55 bundle_deps_.push_back(target); | 60 bundle_deps_.push_back(target); |
| 56 } | 61 } |
| 57 | 62 |
| 58 void BundleData::OnTargetResolved(Target* owning_target) { | 63 void BundleData::OnTargetResolved(Target* owning_target) { |
| 59 // Only initialize file_rules_ and assets_catalog_sources for "create_bundle" | 64 // Only initialize file_rules_ and assets_catalog_sources for "create_bundle" |
| 60 // target (properties are only used by those targets). | 65 // target (properties are only used by those targets). |
| 61 if (owning_target->output_type() != Target::CREATE_BUNDLE) | 66 if (owning_target->output_type() != Target::CREATE_BUNDLE) |
| 62 return; | 67 return; |
| 63 | 68 |
| 64 UniqueVector<const Target*> assets_catalog_deps; | 69 UniqueVector<const Target*> assets_catalog_deps; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 outermost_bundle_dir.AppendToString(&return_value); | 164 outermost_bundle_dir.AppendToString(&return_value); |
| 160 return SourceFile(SourceFile::SWAP_IN, &return_value); | 165 return SourceFile(SourceFile::SWAP_IN, &return_value); |
| 161 } | 166 } |
| 162 return SourceFile(root_dir().value()); | 167 return SourceFile(root_dir().value()); |
| 163 } | 168 } |
| 164 | 169 |
| 165 SourceDir BundleData::GetBundleRootDirOutputAsDir( | 170 SourceDir BundleData::GetBundleRootDirOutputAsDir( |
| 166 const Settings* settings) const { | 171 const Settings* settings) const { |
| 167 return SourceDir(GetBundleRootDirOutput(settings).value()); | 172 return SourceDir(GetBundleRootDirOutput(settings).value()); |
| 168 } | 173 } |
| OLD | NEW |