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

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

Issue 1911873002: Store BundleData paths as SourceDirs rather than strings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn-phony-bundle-target
Patch Set: 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/create_bundle_target_generator.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_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"
(...skipping 11 matching lines...) Expand all
22 const Settings* settings, 22 const Settings* settings,
23 const BundleData& bundle_data, 23 const BundleData& bundle_data,
24 const SourceFile& source_file) const { 24 const SourceFile& source_file) const {
25 std::string output_path; 25 std::string output_path;
26 for (const auto& subrange : pattern_.ranges()) { 26 for (const auto& subrange : pattern_.ranges()) {
27 switch (subrange.type) { 27 switch (subrange.type) {
28 case SUBSTITUTION_LITERAL: 28 case SUBSTITUTION_LITERAL:
29 output_path.append(subrange.literal); 29 output_path.append(subrange.literal);
30 break; 30 break;
31 case SUBSTITUTION_BUNDLE_ROOT_DIR: 31 case SUBSTITUTION_BUNDLE_ROOT_DIR:
32 output_path.append(bundle_data.root_dir()); 32 output_path.append(bundle_data.root_dir().value());
33 break; 33 break;
34 case SUBSTITUTION_BUNDLE_RESOURCES_DIR: 34 case SUBSTITUTION_BUNDLE_RESOURCES_DIR:
35 output_path.append(bundle_data.resources_dir()); 35 output_path.append(bundle_data.resources_dir().value());
36 break; 36 break;
37 case SUBSTITUTION_BUNDLE_EXECUTABLE_DIR: 37 case SUBSTITUTION_BUNDLE_EXECUTABLE_DIR:
38 output_path.append(bundle_data.executable_dir()); 38 output_path.append(bundle_data.executable_dir().value());
39 break; 39 break;
40 case SUBSTITUTION_BUNDLE_PLUGINS_DIR: 40 case SUBSTITUTION_BUNDLE_PLUGINS_DIR:
41 output_path.append(bundle_data.plugins_dir()); 41 output_path.append(bundle_data.plugins_dir().value());
42 break; 42 break;
43 default: 43 default:
44 output_path.append(SubstitutionWriter::GetSourceSubstitution( 44 output_path.append(SubstitutionWriter::GetSourceSubstitution(
45 settings, source_file, subrange.type, 45 settings, source_file, subrange.type,
46 SubstitutionWriter::OUTPUT_ABSOLUTE, SourceDir())); 46 SubstitutionWriter::OUTPUT_ABSOLUTE, SourceDir()));
47 break; 47 break;
48 } 48 }
49 } 49 }
50 return SourceFile(SourceFile::SWAP_IN, &output_path); 50 return SourceFile(SourceFile::SWAP_IN, &output_path);
51 } 51 }
52 52
53 OutputFile BundleFileRule::ApplyPatternToSourceAsOutputFile( 53 OutputFile BundleFileRule::ApplyPatternToSourceAsOutputFile(
54 const Settings* settings, 54 const Settings* settings,
55 const BundleData& bundle_data, 55 const BundleData& bundle_data,
56 const SourceFile& source_file) const { 56 const SourceFile& source_file) const {
57 return OutputFile(settings->build_settings(), 57 return OutputFile(settings->build_settings(),
58 ApplyPatternToSource(settings, bundle_data, source_file)); 58 ApplyPatternToSource(settings, bundle_data, source_file));
59 } 59 }
OLDNEW
« no previous file with comments | « tools/gn/bundle_data.cc ('k') | tools/gn/create_bundle_target_generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698