Merge pull request #1645 from Jarod42/prepostbuildmessageCodelite

Add missing support for prebuildmessage/postbuildmessage for Codelite.
This commit is contained in:
starkos 2021-06-14 11:42:22 -04:00 committed by GitHub
commit 665af20c17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 4 deletions

View File

@ -314,10 +314,14 @@
end
function m.preBuild(cfg)
if #cfg.prebuildcommands > 0 then
if #cfg.prebuildcommands > 0 or cfg.prebuildmessage then
_p(3, '<PreBuild>')
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, '<Command Enabled="yes">%s</Command>', command)
end
local commands = os.translateCommandsAndPaths(cfg.prebuildcommands, cfg.project.basedir, cfg.project.location)
for _, command in ipairs(commands) do
_x(4, '<Command Enabled="yes">%s</Command>', 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, '<PostBuild>')
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, '<Command Enabled="yes">%s</Command>', command)
end
local commands = os.translateCommandsAndPaths(cfg.postbuildcommands, cfg.project.basedir, cfg.project.location)
for _, command in ipairs(commands) do
_x(4, '<Command Enabled="yes">%s</Command>', command)
end

View File

@ -181,6 +181,29 @@
]]
end
function suite.OnProjectCfg_PreBuildMessage()
prebuildmessage "test"
prepare()
codelite.project.preBuild(cfg)
test.capture [[
<PreBuild>
<Command Enabled="yes">@echo test</Command>
</PreBuild>
]]
end
function suite.OnProjectCfg_PostBuildMessage()
postbuildmessage "test"
prepare()
codelite.project.postBuild(cfg)
test.capture [[
<PostBuild>
<Command Enabled="yes">@echo test</Command>
</PostBuild>
]]
end
function suite.OnProjectCfg_General()
system "Windows"
prepare()