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

Unified Diff: tools/gn/bundle_data.cc

Issue 1892243002: Write a phony target for the top-level directory of a create_bundle target. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/bundle_data.h ('k') | tools/gn/ninja_create_bundle_target_writer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/bundle_data.cc
diff --git a/tools/gn/bundle_data.cc b/tools/gn/bundle_data.cc
index 7faccbdc51a6442ddec6626e31af77f53d38f03c..f1b60c0084839e5708b37ba4337c80b84496c16e 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,18 @@ 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& build_dir = settings->build_settings()->build_dir();
+ std::string bundle_root_relative = RebasePath(root_dir(), build_dir);
+
+ size_t first_component = bundle_root_relative.find('/');
+ if (first_component != std::string::npos) {
+ base::StringPiece outermost_bundle_dir =
+ base::StringPiece(bundle_root_relative).substr(0, first_component);
+ std::string return_value(build_dir.value());
+ outermost_bundle_dir.AppendToString(&return_value);
+ return SourceFile(SourceFile::SWAP_IN, &return_value);
+ }
+ return SourceFile(root_dir());
+}
« no previous file with comments | « tools/gn/bundle_data.h ('k') | tools/gn/ninja_create_bundle_target_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698