| 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/output_file.h" | 9 #include "tools/gn/output_file.h" |
| 10 #include "tools/gn/settings.h" | 10 #include "tools/gn/settings.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 outputs_as_source->push_back(GetBundleRootDirOutput(settings)); | 141 outputs_as_source->push_back(GetBundleRootDirOutput(settings)); |
| 142 } | 142 } |
| 143 | 143 |
| 144 SourceFile BundleData::GetCompiledAssetCatalogPath() const { | 144 SourceFile BundleData::GetCompiledAssetCatalogPath() const { |
| 145 DCHECK(!assets_catalog_sources_.empty()); | 145 DCHECK(!assets_catalog_sources_.empty()); |
| 146 std::string assets_car_path = resources_dir_.value() + "/Assets.car"; | 146 std::string assets_car_path = resources_dir_.value() + "/Assets.car"; |
| 147 return SourceFile(SourceFile::SWAP_IN, &assets_car_path); | 147 return SourceFile(SourceFile::SWAP_IN, &assets_car_path); |
| 148 } | 148 } |
| 149 | 149 |
| 150 SourceFile BundleData::GetBundleRootDirOutput(const Settings* settings) const { | 150 SourceFile BundleData::GetBundleRootDirOutput(const Settings* settings) const { |
| 151 const SourceDir& build_dir = settings->build_settings()->build_dir(); | 151 const SourceDir& build_dir = settings->toolchain_output_dir(); |
| 152 std::string bundle_root_relative = RebasePath(root_dir().value(), build_dir); | 152 std::string bundle_root_relative = RebasePath(root_dir().value(), build_dir); |
| 153 | 153 |
| 154 size_t first_component = bundle_root_relative.find('/'); | 154 size_t first_component = bundle_root_relative.find('/'); |
| 155 if (first_component != std::string::npos) { | 155 if (first_component != std::string::npos) { |
| 156 base::StringPiece outermost_bundle_dir = | 156 base::StringPiece outermost_bundle_dir = |
| 157 base::StringPiece(bundle_root_relative).substr(0, first_component); | 157 base::StringPiece(bundle_root_relative).substr(0, first_component); |
| 158 std::string return_value(build_dir.value()); | 158 std::string return_value(build_dir.value()); |
| 159 outermost_bundle_dir.AppendToString(&return_value); | 159 outermost_bundle_dir.AppendToString(&return_value); |
| 160 return SourceFile(SourceFile::SWAP_IN, &return_value); | 160 return SourceFile(SourceFile::SWAP_IN, &return_value); |
| 161 } | 161 } |
| 162 return SourceFile(root_dir().value()); | 162 return SourceFile(root_dir().value()); |
| 163 } | 163 } |
| 164 | 164 |
| 165 SourceDir BundleData::GetBundleRootDirOutputAsDir( | 165 SourceDir BundleData::GetBundleRootDirOutputAsDir( |
| 166 const Settings* settings) const { | 166 const Settings* settings) const { |
| 167 return SourceDir(GetBundleRootDirOutput(settings).value()); | 167 return SourceDir(GetBundleRootDirOutput(settings).value()); |
| 168 } | 168 } |
| OLD | NEW |