]> git.tdb.fi Git - builder.git/commitdiff
Adjust build signatures to contain the tool tag
authorMikko Rasa <tdb@tdb.fi>
Tue, 20 Dec 2022 12:00:14 +0000 (14:00 +0200)
committerMikko Rasa <tdb@tdb.fi>
Tue, 20 Dec 2022 12:05:12 +0000 (14:05 +0200)
External tools now have a build signature by default.

source/datatool.cpp
source/gnuarchiver.cpp
source/gnuarchiver.h
source/gnucompiler.cpp
source/gnulinker.cpp
source/msvcarchiver.cpp
source/msvcarchiver.h
source/msvccompiler.cpp
source/msvclinker.cpp
source/tool.cpp
source/tool.h

index d23c00de00f8531898c7278d50db78730e88ddc0..75d52aaac8506d23007cd343acee69ce08ba122a 100644 (file)
@@ -52,7 +52,9 @@ Target *DataTool::create_target(const list<Target *> &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)
index 7e79ec08d7749efab9a52567df947b2fdf64f545..742278de668653f17895abab2e6d003fc9698e16 100644 (file)
@@ -41,11 +41,6 @@ Target *GnuArchiver::create_target(const list<Target *> &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<const StaticLibrary &>(target);
index ce3906da228226a766ce2c809ae3b97156f0d564..702b7eb67b015aefb22fe6b84a1072558a605074 100644 (file)
@@ -9,7 +9,6 @@ public:
        GnuArchiver(Builder &, const Architecture &);
 
        Target *create_target(const std::list<Target *> &, const std::string &) override;
-       std::string create_build_signature(const BuildInfo &) const override;
        Task *run(const Target &) const override;
 };
 
index 26570c702602978a286d9c146a689b5fe515d9e8..97d3b3086b275b444ca8c4432ae349fcd5cae0b5 100644 (file)
@@ -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)
index 61332b2452a3e39069d2f1084008fb199b838c7c..0d730a4a30f3a26dd3dc1e50b92f15db54481ef8 100644 (file)
@@ -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';
index a724eb16577ae0eb9638a9287b485073fa14a227..5ac406b008b6029c87b61ba7c999c77dc60ab1e3 100644 (file)
@@ -39,11 +39,6 @@ Target *MsvcArchiver::create_target(const list<Target *> &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<const StaticLibrary &>(target);
index a8fe34f887e6b75a7873385dcc4fa4ff144189c0..d09e145468f4fdd4ca7fb54d08f10c4397822151 100644 (file)
@@ -14,7 +14,6 @@ public:
        MsvcArchiver(Builder &, const Architecture &, const MicrosoftTools &);
 
        Target *create_target(const std::list<Target *> &, const std::string &) override;
-       std::string create_build_signature(const BuildInfo &) const override;
 
        Task *run(const Target &) const override;
 };
index c676790eb4fddbb126c16fad464f310dafbb9233..df6bd468c2d4862657ca38b7f37dd2d7cc1ab843 100644 (file)
@@ -58,7 +58,7 @@ Target *MsvcCompiler::create_target(const list<Target *> &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';
index 49744288fcc1ffaefb4e57a4eec29430646fe741..8ff4d9cdd96dc98df028f60d80c579a2b7c40550 100644 (file)
@@ -55,7 +55,7 @@ Target *MsvcLinker::create_target(const list<Target *> &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';
index 44255a1eb5ca692fe1fc03461cd63e4d422eca61..377dc7f4bc0813ae095ede177bbaf004512244de 100644 (file)
@@ -1,7 +1,9 @@
 #include <msp/core/algorithm.h>
+#include <msp/fs/utils.h>
 #include <msp/strings/format.h>
 #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),
index fa18ba8dca338d57c5e37c2c8fe42269f61ef1b1..c49b4c473257b0ff06f8e2e07cca2a4fbc444b54 100644 (file)
@@ -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();