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

Unified Diff: tools/gn/filesystem_utils.cc

Issue 279023002: Add GN function get_label_info (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 6 years, 7 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
Index: tools/gn/filesystem_utils.cc
diff --git a/tools/gn/filesystem_utils.cc b/tools/gn/filesystem_utils.cc
index 6279964914f96f150eeea9baed64b361c143fcf2..ca9aae13e6a536d1474c49a5bce3ecdd83cf7734 100644
--- a/tools/gn/filesystem_utils.cc
+++ b/tools/gn/filesystem_utils.cc
@@ -667,6 +667,16 @@ SourceDir SourceDirForCurrentDirectory(const base::FilePath& source_root) {
return SourceDirForPath(source_root, cd);
}
+std::string GetOutputSubdirName(const Label& toolchain_label, bool is_default) {
+ // The default toolchain has no subdir.
+ if (is_default)
+ return std::string();
+
+ // For now just assume the toolchain name is always a valid dir name. We may
+ // want to clean up the in the future.
+ return toolchain_label.name();
+}
+
SourceDir GetToolchainOutputDir(const Settings* settings) {
const OutputFile& toolchain_subdir = settings->toolchain_output_subdir();
@@ -677,6 +687,19 @@ SourceDir GetToolchainOutputDir(const Settings* settings) {
return SourceDir(SourceDir::SWAP_IN, &result);
}
+SourceDir GetToolchainOutputDir(const BuildSettings* build_settings,
+ const Label& toolchain_label, bool is_default) {
+ std::string toolchain_subdir =
+ GetOutputSubdirName(toolchain_label, is_default);
+
+ std::string result = build_settings->build_dir().value();
+ if (!toolchain_subdir.empty()) {
+ result.append(toolchain_subdir);
+ result.push_back('/');
+ }
+ return SourceDir(SourceDir::SWAP_IN, &result);
+}
+
SourceDir GetToolchainGenDir(const Settings* settings) {
const OutputFile& toolchain_subdir = settings->toolchain_output_subdir();
@@ -688,6 +711,14 @@ SourceDir GetToolchainGenDir(const Settings* settings) {
return SourceDir(SourceDir::SWAP_IN, &result);
}
+SourceDir GetToolchainGenDir(const BuildSettings* build_settings,
+ const Label& toolchain_label, bool is_default) {
+ std::string result = GetToolchainOutputDir(
+ build_settings, toolchain_label, is_default).value();
+ result.append("gen/");
+ return SourceDir(SourceDir::SWAP_IN, &result);
+}
+
SourceDir GetOutputDirForSourceDir(const Settings* settings,
const SourceDir& source_dir) {
SourceDir toolchain = GetToolchainOutputDir(settings);

Powered by Google App Engine
This is Rietveld 408576698