| 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_file_rule.h" | 5 #include "tools/gn/bundle_file_rule.h" |
| 6 | 6 |
| 7 #include "tools/gn/output_file.h" | 7 #include "tools/gn/output_file.h" |
| 8 #include "tools/gn/settings.h" | 8 #include "tools/gn/settings.h" |
| 9 #include "tools/gn/substitution_pattern.h" | 9 #include "tools/gn/substitution_pattern.h" |
| 10 #include "tools/gn/substitution_writer.h" | 10 #include "tools/gn/substitution_writer.h" |
| 11 #include "tools/gn/target.h" | 11 #include "tools/gn/target.h" |
| 12 | 12 |
| 13 BundleFileRule::BundleFileRule(const std::vector<SourceFile> sources, | 13 BundleFileRule::BundleFileRule(const std::vector<SourceFile> sources, |
| 14 const SubstitutionPattern& pattern) | 14 const SubstitutionPattern& pattern) |
| 15 : sources_(sources), pattern_(pattern) {} | 15 : sources_(sources), pattern_(pattern) {} |
| 16 | 16 |
| 17 BundleFileRule::BundleFileRule(const BundleFileRule& other) = default; |
| 18 |
| 17 BundleFileRule::~BundleFileRule() {} | 19 BundleFileRule::~BundleFileRule() {} |
| 18 | 20 |
| 19 SourceFile BundleFileRule::ApplyPatternToSource( | 21 SourceFile BundleFileRule::ApplyPatternToSource( |
| 20 const Settings* settings, | 22 const Settings* settings, |
| 21 const BundleData& bundle_data, | 23 const BundleData& bundle_data, |
| 22 const SourceFile& source_file) const { | 24 const SourceFile& source_file) const { |
| 23 std::string output_path; | 25 std::string output_path; |
| 24 for (const auto& subrange : pattern_.ranges()) { | 26 for (const auto& subrange : pattern_.ranges()) { |
| 25 switch (subrange.type) { | 27 switch (subrange.type) { |
| 26 case SUBSTITUTION_LITERAL: | 28 case SUBSTITUTION_LITERAL: |
| (...skipping 21 matching lines...) Expand all Loading... |
| 48 return SourceFile(SourceFile::SWAP_IN, &output_path); | 50 return SourceFile(SourceFile::SWAP_IN, &output_path); |
| 49 } | 51 } |
| 50 | 52 |
| 51 OutputFile BundleFileRule::ApplyPatternToSourceAsOutputFile( | 53 OutputFile BundleFileRule::ApplyPatternToSourceAsOutputFile( |
| 52 const Settings* settings, | 54 const Settings* settings, |
| 53 const BundleData& bundle_data, | 55 const BundleData& bundle_data, |
| 54 const SourceFile& source_file) const { | 56 const SourceFile& source_file) const { |
| 55 return OutputFile(settings->build_settings(), | 57 return OutputFile(settings->build_settings(), |
| 56 ApplyPatternToSource(settings, bundle_data, source_file)); | 58 ApplyPatternToSource(settings, bundle_data, source_file)); |
| 57 } | 59 } |
| OLD | NEW |