From: Mikko Rasa Date: Tue, 20 Dec 2022 12:00:14 +0000 (+0200) Subject: Adjust build signatures to contain the tool tag X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=bc6d4c540e7132c829dd558ca9d8acfbde7d71e1;p=builder.git Adjust build signatures to contain the tool tag External tools now have a build signature by default. --- diff --git a/source/datatool.cpp b/source/datatool.cpp index d23c00d..75d52aa 100644 --- a/source/datatool.cpp +++ b/source/datatool.cpp @@ -52,7 +52,9 @@ Target *DataTool::create_target(const list &sources, const string &arg string DataTool::create_build_signature(const BuildInfo &binfo) const { - string result; + string result = Tool::create_build_signature(binfo); + if(binfo.debug || binfo.optimize) + result += ','; if(binfo.debug) result += 'g'; if(binfo.optimize>0) diff --git a/source/gnuarchiver.cpp b/source/gnuarchiver.cpp index 7e79ec0..742278d 100644 --- a/source/gnuarchiver.cpp +++ b/source/gnuarchiver.cpp @@ -41,11 +41,6 @@ Target *GnuArchiver::create_target(const list &sources, const string & return lib; } -string GnuArchiver::create_build_signature(const BuildInfo &) const -{ - return FS::basename(executable->get_path()); -} - Task *GnuArchiver::run(const Target &target) const { const StaticLibrary &lib = dynamic_cast(target); diff --git a/source/gnuarchiver.h b/source/gnuarchiver.h index ce3906d..702b7eb 100644 --- a/source/gnuarchiver.h +++ b/source/gnuarchiver.h @@ -9,7 +9,6 @@ public: GnuArchiver(Builder &, const Architecture &); Target *create_target(const std::list &, const std::string &) override; - std::string create_build_signature(const BuildInfo &) const override; Task *run(const Target &) const override; }; diff --git a/source/gnucompiler.cpp b/source/gnucompiler.cpp index 26570c7..97d3b30 100644 --- a/source/gnucompiler.cpp +++ b/source/gnucompiler.cpp @@ -84,13 +84,14 @@ string GnuCompiler::create_build_signature(const BuildInfo &binfo) const if(!executable) return string(); - string result = FS::basename(executable->get_path()); + string result = Tool::create_build_signature(binfo); if(!architecture->get_cpu().empty()) { result += ",m"; result += architecture->get_cpu(); } - result += ','; + if(binfo.debug || binfo.optimize) + result += ','; if(binfo.debug) result += 'g'; if(binfo.optimize) diff --git a/source/gnulinker.cpp b/source/gnulinker.cpp index 61332b2..0d730a4 100644 --- a/source/gnulinker.cpp +++ b/source/gnulinker.cpp @@ -198,7 +198,7 @@ GnuLinker::Linker::Linker(GnuLinker &p, const string &ct): string GnuLinker::Linker::create_build_signature(const BuildInfo &binfo) const { - string result = FS::basename(executable->get_path()); + string result = Tool::create_build_signature(binfo); result += ','; if(binfo.libmode<=BuildInfo::STATIC) result += 't'; diff --git a/source/msvcarchiver.cpp b/source/msvcarchiver.cpp index a724eb1..5ac406b 100644 --- a/source/msvcarchiver.cpp +++ b/source/msvcarchiver.cpp @@ -39,11 +39,6 @@ Target *MsvcArchiver::create_target(const list &sources, const string return lib; } -string MsvcArchiver::create_build_signature(const BuildInfo &) const -{ - return FS::basename(executable->get_path()); -} - Task *MsvcArchiver::run(const Target &target) const { const StaticLibrary &lib = dynamic_cast(target); diff --git a/source/msvcarchiver.h b/source/msvcarchiver.h index a8fe34f..d09e145 100644 --- a/source/msvcarchiver.h +++ b/source/msvcarchiver.h @@ -14,7 +14,6 @@ public: MsvcArchiver(Builder &, const Architecture &, const MicrosoftTools &); Target *create_target(const std::list &, const std::string &) override; - std::string create_build_signature(const BuildInfo &) const override; Task *run(const Target &) const override; }; diff --git a/source/msvccompiler.cpp b/source/msvccompiler.cpp index c676790..df6bd46 100644 --- a/source/msvccompiler.cpp +++ b/source/msvccompiler.cpp @@ -58,7 +58,7 @@ Target *MsvcCompiler::create_target(const list &sources, const string string MsvcCompiler::create_build_signature(const BuildInfo &binfo) const { - string result = FS::basename(executable->get_path()); + string result = Tool::create_build_signature(binfo); result += ','; if(binfo.debug) result += 'g'; diff --git a/source/msvclinker.cpp b/source/msvclinker.cpp index 4974428..8ff4d9c 100644 --- a/source/msvclinker.cpp +++ b/source/msvclinker.cpp @@ -55,7 +55,7 @@ Target *MsvcLinker::create_target(const list &sources, const string &a string MsvcLinker::create_build_signature(const BuildInfo &binfo) const { - string result = FS::basename(executable->get_path()); + string result = Tool::create_build_signature(binfo); result += ','; if(binfo.strip) result += 's'; diff --git a/source/tool.cpp b/source/tool.cpp index 44255a1..377dc7f 100644 --- a/source/tool.cpp +++ b/source/tool.cpp @@ -1,7 +1,9 @@ #include +#include #include #include "architecture.h" #include "builder.h" +#include "filetarget.h" #include "tool.h" using namespace std; @@ -66,6 +68,14 @@ void Tool::prepare() } } +string Tool::create_build_signature(const BuildInfo &) const +{ + if(executable) + return format("%s=%s", tag, FS::basename(executable->get_path())); + else + return string(); +} + SubTool::SubTool(Tool &p): Tool(p), diff --git a/source/tool.h b/source/tool.h index fa18ba8..c49b4c4 100644 --- a/source/tool.h +++ b/source/tool.h @@ -106,7 +106,7 @@ public: null if the tool does not want to handle installing in a special way. */ virtual Target *create_install(Target &) const { return 0; } - virtual std::string create_build_signature(const BuildInfo &) const { return std::string(); } + virtual std::string create_build_signature(const BuildInfo &) const; void prepare();