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

Side by Side Diff: tools/gn/bundle_data.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.h ('k') | tools/gn/bundle_file_rule.cc » ('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_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/output_file.h" 9 #include "tools/gn/output_file.h"
10 #include "tools/gn/settings.h" 10 #include "tools/gn/settings.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 for (const BundleFileRule& file_rule : file_rules_) { 98 for (const BundleFileRule& file_rule : file_rules_) {
99 for (const SourceFile& source : file_rule.sources()) { 99 for (const SourceFile& source : file_rule.sources()) {
100 outputs_as_source->push_back( 100 outputs_as_source->push_back(
101 file_rule.ApplyPatternToSource(settings, *this, source)); 101 file_rule.ApplyPatternToSource(settings, *this, source));
102 } 102 }
103 } 103 }
104 104
105 if (!asset_catalog_sources_.empty()) 105 if (!asset_catalog_sources_.empty())
106 outputs_as_source->push_back(GetCompiledAssetCatalogPath()); 106 outputs_as_source->push_back(GetCompiledAssetCatalogPath());
107 107
108 if (!root_dir_.empty()) 108 if (!root_dir_.is_null())
109 outputs_as_source->push_back(GetBundleRootDirOutput(settings)); 109 outputs_as_source->push_back(GetBundleRootDirOutput(settings));
110 } 110 }
111 111
112 SourceFile BundleData::GetCompiledAssetCatalogPath() const { 112 SourceFile BundleData::GetCompiledAssetCatalogPath() const {
113 DCHECK(!asset_catalog_sources_.empty()); 113 DCHECK(!asset_catalog_sources_.empty());
114 std::string assets_car_path = resources_dir_ + "/Assets.car"; 114 std::string assets_car_path = resources_dir_.value() + "/Assets.car";
115 return SourceFile(SourceFile::SWAP_IN, &assets_car_path); 115 return SourceFile(SourceFile::SWAP_IN, &assets_car_path);
116 } 116 }
117 117
118 SourceFile BundleData::GetBundleRootDirOutput(const Settings* settings) const { 118 SourceFile BundleData::GetBundleRootDirOutput(const Settings* settings) const {
119 const SourceDir& build_dir = settings->build_settings()->build_dir(); 119 const SourceDir& build_dir = settings->build_settings()->build_dir();
120 std::string bundle_root_relative = RebasePath(root_dir(), build_dir); 120 std::string bundle_root_relative = RebasePath(root_dir().value(), build_dir);
121 121
122 size_t first_component = bundle_root_relative.find('/'); 122 size_t first_component = bundle_root_relative.find('/');
123 if (first_component != std::string::npos) { 123 if (first_component != std::string::npos) {
124 base::StringPiece outermost_bundle_dir = 124 base::StringPiece outermost_bundle_dir =
125 base::StringPiece(bundle_root_relative).substr(0, first_component); 125 base::StringPiece(bundle_root_relative).substr(0, first_component);
126 std::string return_value(build_dir.value()); 126 std::string return_value(build_dir.value());
127 outermost_bundle_dir.AppendToString(&return_value); 127 outermost_bundle_dir.AppendToString(&return_value);
128 return SourceFile(SourceFile::SWAP_IN, &return_value); 128 return SourceFile(SourceFile::SWAP_IN, &return_value);
129 } 129 }
130 return SourceFile(root_dir()); 130 return SourceFile(root_dir().value());
131 } 131 }
OLDNEW
« no previous file with comments | « tools/gn/bundle_data.h ('k') | tools/gn/bundle_file_rule.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698