summaryrefslogtreecommitdiff
path: root/src/buildtool/main/main.cpp
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2022-08-18 16:32:58 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2022-08-19 14:09:01 +0200
commit141035d936a0b361d2802499fd9b824e8c6a6a5e (patch)
tree0f5bc621a5fed369c9cbaaaccf03d4d83ad9e948 /src/buildtool/main/main.cpp
parent37f0272bf0d6c75b62c7bb10f3d1b80e1d1c41fb (diff)
downloadjustbuild-141035d936a0b361d2802499fd9b824e8c6a6a5e.tar.gz
main: honor configuration for target_file name
... also when determining default module or target.
Diffstat (limited to 'src/buildtool/main/main.cpp')
-rw-r--r--src/buildtool/main/main.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp
index b7b22056..30035819 100644
--- a/src/buildtool/main/main.cpp
+++ b/src/buildtool/main/main.cpp
@@ -348,13 +348,11 @@ void SetupHashFunction() {
[[nodiscard]] auto DetermineCurrentModule(
std::filesystem::path const& workspace_root,
FileRoot const& target_root,
- std::optional<std::string> const& target_file_name_opt) -> std::string {
+ std::string const& target_file_name) -> std::string {
auto cwd = std::filesystem::current_path();
auto subdir = std::filesystem::proximate(cwd, workspace_root);
if (subdir.is_relative() and (*subdir.begin() != "..")) {
// cwd is subdir of workspace_root
- std::string target_file_name =
- target_file_name_opt ? *target_file_name_opt : "TARGETS";
if (auto root_dir = FindRoot(subdir, target_root, {target_file_name})) {
return root_dir->string();
}
@@ -376,10 +374,12 @@ void SetupHashFunction() {
std::exit(kExitFailure);
}
auto current_module = std::string{"."};
+ std::string target_file_name =
+ *RepositoryConfig::Instance().TargetFileName(main_repo);
if (main_ws_root) {
// module detection only works if main workspace is on the file system
current_module = DetermineCurrentModule(
- *main_ws_root, *target_root, clargs.target_file_name);
+ *main_ws_root, *target_root, target_file_name);
}
auto config = ReadConfiguration(clargs);
if (clargs.target) {
@@ -397,8 +397,6 @@ void SetupHashFunction() {
}
return Target::ConfiguredTarget{std::move(*entity), std::move(config)};
}
- std::string target_file_name =
- clargs.target_file_name ? *clargs.target_file_name : "TARGETS";
auto const target_file =
(std::filesystem::path{current_module} / target_file_name).string();
auto file_content = target_root->ReadFile(target_file);