Index: tools/gn/filesystem_utils.cc |
diff --git a/tools/gn/filesystem_utils.cc b/tools/gn/filesystem_utils.cc |
index 6279964914f96f150eeea9baed64b361c143fcf2..9140f80660e94f69abdf7d667bcc4cb1d372f9e2 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,13 @@ 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 result = build_settings->build_dir().value(); |
+ result.append(GetOutputSubdirName(toolchain_label, is_default)); |
+ return SourceDir(SourceDir::SWAP_IN, &result); |
+} |
+ |
SourceDir GetToolchainGenDir(const Settings* settings) { |
const OutputFile& toolchain_subdir = settings->toolchain_output_subdir(); |
@@ -688,6 +705,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); |