summaryrefslogtreecommitdiff
path: root/src/task_ar.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/task_ar.cc')
-rw-r--r--src/task_ar.cc30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/task_ar.cc b/src/task_ar.cc
index 19a65ae..3b45cc2 100644
--- a/src/task_ar.cc
+++ b/src/task_ar.cc
@@ -11,20 +11,20 @@
#include "util.h"
#include "tools.h"
-TaskAR::TaskAR(const ctor::build_configuration& config,
- const ctor::settings& settings,
+TaskAR::TaskAR(const ctor::build_configuration& config_,
+ const ctor::settings& settings_,
const std::string& target,
const std::vector<std::string>& objects,
- const std::string& sourceDir)
- : Task(config, settings, sourceDir)
- , config(config)
- , settings(settings)
- , sourceDir(sourceDir)
+ const std::string& sourceDir_)
+ : Task(config_, settings_, sourceDir_)
+ , _targetFile(target)
+ , config(config_)
+ , settings(settings_)
+ , sourceDir(sourceDir_)
{
target_type = ctor::target_type::static_library;
output_system = config.system;
- _targetFile = target;
auto toolchain = getToolChain(config.system);
_targetFile = extension(toolchain, target_type, config.system, _targetFile);
for(const auto& object : objects)
@@ -36,7 +36,7 @@ TaskAR::TaskAR(const ctor::build_configuration& config,
for(const auto& dep : config.depends)
{
- depFiles.push_back(dep);
+ depFiles.emplace_back(dep);
}
flagsFile = std::filesystem::path(settings.builddir) / cleanUp(sourceDir) / targetFile().stem();
@@ -105,7 +105,8 @@ int TaskAR::runInner()
if(settings.verbose == 0)
{
- std::cout << "AR => " << targetFile().string() << std::endl;
+ std::string output = "AR => " + targetFile().string() + '\n';
+ std::cout << output << std::flush;
}
const auto& c = ctor::get_configuration();
@@ -120,7 +121,13 @@ int TaskAR::runInner()
break;
}
- return execute(tool, args, {}, settings.verbose > 0);
+ auto res = execute(settings, tool, args, c.env);
+ if(res != 0)
+ {
+ std::filesystem::remove(targetFile());
+ }
+
+ return res;
}
int TaskAR::clean()
@@ -188,7 +195,6 @@ std::string TaskAR::flagsString() const
flagsStr += str;
}
}
- flagsStr += "\n";
for(const auto& dep : config.depends)
{