Chromium Code Reviews| Index: tools/gn/bundle_data.cc |
| diff --git a/tools/gn/bundle_data.cc b/tools/gn/bundle_data.cc |
| index 7faccbdc51a6442ddec6626e31af77f53d38f03c..9ece9b519dfb8bd989223592d5b4f3163cdc9ed5 100644 |
| --- a/tools/gn/bundle_data.cc |
| +++ b/tools/gn/bundle_data.cc |
| @@ -5,6 +5,7 @@ |
| #include "tools/gn/bundle_data.h" |
| #include "base/logging.h" |
| +#include "tools/gn/filesystem_utils.h" |
| #include "tools/gn/output_file.h" |
| #include "tools/gn/settings.h" |
| #include "tools/gn/target.h" |
| @@ -103,6 +104,9 @@ void BundleData::GetOutputsAsSourceFiles( |
| if (!asset_catalog_sources_.empty()) |
| outputs_as_source->push_back(GetCompiledAssetCatalogPath()); |
| + |
| + if (!root_dir_.empty()) |
| + outputs_as_source->push_back(GetBundleRootDirOutput(settings)); |
| } |
| SourceFile BundleData::GetCompiledAssetCatalogPath() const { |
| @@ -110,3 +114,19 @@ SourceFile BundleData::GetCompiledAssetCatalogPath() const { |
| std::string assets_car_path = resources_dir_ + "/Assets.car"; |
| return SourceFile(SourceFile::SWAP_IN, &assets_car_path); |
| } |
| + |
| +SourceFile BundleData::GetBundleRootDirOutput(const Settings* settings) const { |
| + const SourceDir& root_out_dir = settings->build_settings()->build_dir(); |
|
brettw
2016/04/18 20:16:14
This variable should be called build_dir or root_b
Robert Sesek
2016/04/19 15:37:51
Done.
|
| + base::StringPiece bundle_root_relative = |
| + base::StringPiece(root_dir()).substr(root_out_dir.value().length()); |
|
brettw
2016/04/18 20:16:14
I'm confused by this code. The root_dir() returns
Robert Sesek
2016/04/19 15:37:51
The CreateBundleTargetGenerator extracts these fro
brettw
2016/04/21 19:14:00
Yes, I think these should be changed (unless there
Robert Sesek
2016/04/21 21:03:20
I'll do this in a follow-up CL.
|
| + |
| + size_t first_component = bundle_root_relative.find('/'); |
| + if (first_component != std::string::npos) { |
| + base::StringPiece outermost_bundle_dir = |
| + bundle_root_relative.substr(0, first_component); |
| + std::string return_value(root_out_dir.value()); |
| + outermost_bundle_dir.AppendToString(&return_value); |
| + return SourceFile(SourceFile::SWAP_IN, &return_value); |
| + } |
| + return SourceFile(root_dir()); |
| +} |