From a56444a3fe233c183d9595c61b3798d826774726 Mon Sep 17 00:00:00 2001 From: Jarod42 Date: Fri, 11 Jun 2021 20:15:33 +0200 Subject: [PATCH] Add missing support for prebuildmessage/postbuildmessage for Codelite. --- modules/codelite/codelite_project.lua | 16 +++++++++---- .../codelite/tests/test_codelite_config.lua | 23 +++++++++++++++++++ 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/modules/codelite/codelite_project.lua b/modules/codelite/codelite_project.lua index d427fe41..af356897 100755 --- a/modules/codelite/codelite_project.lua +++ b/modules/codelite/codelite_project.lua @@ -314,10 +314,14 @@ end function m.preBuild(cfg) - if #cfg.prebuildcommands > 0 then + if #cfg.prebuildcommands > 0 or cfg.prebuildmessage then _p(3, '') - local commands = os.translateCommandsAndPaths(cfg.prebuildcommands, cfg.project.basedir, cfg.project.location) p.escaper(codelite.escElementText) + if cfg.prebuildmessage then + local command = os.translateCommandsAndPaths("@{ECHO} " .. cfg.prebuildmessage, cfg.project.basedir, cfg.project.location) + _x(4, '%s', command) + end + local commands = os.translateCommandsAndPaths(cfg.prebuildcommands, cfg.project.basedir, cfg.project.location) for _, command in ipairs(commands) do _x(4, '%s', command) end @@ -327,10 +331,14 @@ end function m.postBuild(cfg) - if #cfg.postbuildcommands > 0 then + if #cfg.postbuildcommands > 0 or cfg.postbuildmessage then _p(3, '') - local commands = os.translateCommandsAndPaths(cfg.postbuildcommands, cfg.project.basedir, cfg.project.location) p.escaper(codelite.escElementText) + if cfg.postbuildmessage then + local command = os.translateCommandsAndPaths("@{ECHO} " .. cfg.postbuildmessage, cfg.project.basedir, cfg.project.location) + _x(4, '%s', command) + end + local commands = os.translateCommandsAndPaths(cfg.postbuildcommands, cfg.project.basedir, cfg.project.location) for _, command in ipairs(commands) do _x(4, '%s', command) end diff --git a/modules/codelite/tests/test_codelite_config.lua b/modules/codelite/tests/test_codelite_config.lua index e98c8b88..4a72da68 100644 --- a/modules/codelite/tests/test_codelite_config.lua +++ b/modules/codelite/tests/test_codelite_config.lua @@ -181,6 +181,29 @@ ]] end + function suite.OnProjectCfg_PreBuildMessage() + prebuildmessage "test" + prepare() + codelite.project.preBuild(cfg) + test.capture [[ + + @echo test + + ]] + end + + function suite.OnProjectCfg_PostBuildMessage() + postbuildmessage "test" + prepare() + codelite.project.postBuild(cfg) + test.capture [[ + + @echo test + + ]] + end + + function suite.OnProjectCfg_General() system "Windows" prepare()