| 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 #ifndef TOOLS_GN_BUNDLE_FILE_RULE_H_ | 5 #ifndef TOOLS_GN_BUNDLE_FILE_RULE_H_ |
| 6 #define TOOLS_GN_BUNDLE_FILE_RULE_H_ | 6 #define TOOLS_GN_BUNDLE_FILE_RULE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "tools/gn/source_file.h" | 10 #include "tools/gn/source_file.h" |
| 11 #include "tools/gn/substitution_pattern.h" | 11 #include "tools/gn/substitution_pattern.h" |
| 12 | 12 |
| 13 class BundleData; | 13 class BundleData; |
| 14 class Settings; | 14 class Settings; |
| 15 class SourceFile; | 15 class SourceFile; |
| 16 class Target; |
| 16 class OutputFile; | 17 class OutputFile; |
| 17 | 18 |
| 18 // BundleFileRule contains the information found in a "bundle_data" target. | 19 // BundleFileRule contains the information found in a "bundle_data" target. |
| 19 class BundleFileRule { | 20 class BundleFileRule { |
| 20 public: | 21 public: |
| 21 BundleFileRule(const std::vector<SourceFile> sources, | 22 BundleFileRule(const Target* bundle_data_target, |
| 23 const std::vector<SourceFile> sources, |
| 22 const SubstitutionPattern& pattern); | 24 const SubstitutionPattern& pattern); |
| 23 BundleFileRule(const BundleFileRule& other); | 25 BundleFileRule(const BundleFileRule& other); |
| 24 ~BundleFileRule(); | 26 ~BundleFileRule(); |
| 25 | 27 |
| 26 // Applies the substitution pattern to a source file, returning the result | 28 // Applies the substitution pattern to a source file, returning the result |
| 27 // as either a SourceFile or an OutputFile. | 29 // as either a SourceFile or an OutputFile. |
| 28 SourceFile ApplyPatternToSource(const Settings* settings, | 30 SourceFile ApplyPatternToSource(const Settings* settings, |
| 29 const BundleData& bundle_data, | 31 const BundleData& bundle_data, |
| 30 const SourceFile& source_file) const; | 32 const SourceFile& source_file) const; |
| 31 OutputFile ApplyPatternToSourceAsOutputFile( | 33 OutputFile ApplyPatternToSourceAsOutputFile( |
| 32 const Settings* settings, | 34 const Settings* settings, |
| 33 const BundleData& bundle_data, | 35 const BundleData& bundle_data, |
| 34 const SourceFile& source_file) const; | 36 const SourceFile& source_file) const; |
| 35 | 37 |
| 38 // Returns the associated target (of type Target::BUNDLE_DATA). May be |
| 39 // null during testing. |
| 40 const Target* target() const { return target_; } |
| 41 |
| 36 // Returns the list of SourceFiles. | 42 // Returns the list of SourceFiles. |
| 37 const std::vector<SourceFile>& sources() const { return sources_; } | 43 const std::vector<SourceFile>& sources() const { return sources_; } |
| 38 | 44 |
| 39 private: | 45 private: |
| 46 const Target* target_; |
| 40 std::vector<SourceFile> sources_; | 47 std::vector<SourceFile> sources_; |
| 41 SubstitutionPattern pattern_; | 48 SubstitutionPattern pattern_; |
| 42 }; | 49 }; |
| 43 | 50 |
| 44 #endif // TOOLS_GN_BUNDLE_FILE_RULE_H_ | 51 #endif // TOOLS_GN_BUNDLE_FILE_RULE_H_ |
| OLD | NEW |