Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support of prelink steps (similar to prebuild steps) for Codelite. #2070

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion modules/codelite/codelite_project.lua
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@
end

function m.preBuild(cfg)
if #cfg.prebuildcommands > 0 or cfg.prebuildmessage then
if #cfg.prebuildcommands > 0 or cfg.prebuildmessage or #cfg.prelinkcommands > 0 or cfg.prelinkmessage then
_p(3, '<PreBuild>')
p.escaper(codelite.escElementText)
if cfg.prebuildmessage then
Expand All @@ -336,6 +336,17 @@
for _, command in ipairs(commands) do
_x(4, '<Command Enabled="yes">%s</Command>', command)
end
if #cfg.prelinkcommands then
p.warnOnce("codelite_prelink", "prelinkcommands is treated as prebuildcommands by Codelite")
end
if cfg.prelinkmessage then
local command = os.translateCommandsAndPaths("@{ECHO} " .. p.quote(cfg.prelinkmessage), cfg.project.basedir, cfg.project.location)
_x(4, '<Command Enabled="yes">%s</Command>', command)
end
local commands = os.translateCommandsAndPaths(cfg.prelinkcommands, cfg.project.basedir, cfg.project.location)
for _, command in ipairs(commands) do
_x(4, '<Command Enabled="yes">%s</Command>', command)
end
p.escaper(codelite.esc)
_p(3, '</PreBuild>')
else
Expand Down
25 changes: 25 additions & 0 deletions modules/codelite/tests/test_codelite_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,31 @@ cmd2</StartupCommands>
]]
end

function suite.OnProjectCfg_PreLinkAfterPreBuild()
prebuildmessage "msg_prebuild"
prebuildcommands {
"cmd_prebuild1",
"cmd_prebuild2"
}
prelinkmessage "msg_prelink"
prelinkcommands {
"cmd_prelink1",
"cmd_prelink2"
}
prepare()
codelite.project.preBuild(prj)
test.capture [[
<PreBuild>
<Command Enabled="yes">@echo "msg_prebuild"</Command>
<Command Enabled="yes">cmd_prebuild1</Command>
<Command Enabled="yes">cmd_prebuild2</Command>
<Command Enabled="yes">@echo "msg_prelink"</Command>
<Command Enabled="yes">cmd_prelink1</Command>
<Command Enabled="yes">cmd_prelink2</Command>
</PreBuild>
]]
end

function suite.OnProjectCfg_PostBuild()
postbuildcommands { "cmd0", "cmd1" }
prepare()
Expand Down
6 changes: 4 additions & 2 deletions website/docs/prelinkcommands.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Specifies shell commands to run after the source files have been compiled, but before the link step.
Specifies shell commands to run after the source files have been compiled, but before the link step (if unsupported by the action, it will be treated the same as [prebuildcommands](prebuildcommands.md)).

```lua
prelinkcommands { "commands" }
Expand All @@ -19,11 +19,13 @@ Premake 4.4 or later.
### Examples ###

```lua
prelinkcommands { "{COPY} %[default.config] %[bin/project.config]" }
prelinkcommands { "{COPYFILE} %[default.config] %[bin/project.config]" }
```

### See Also ###

* [Tokens](Tokens.md)
* [prelinkmessage](prelinkmessage.md)
* [prebuildcommands](prebuildcommands.md)
* [postbuildcommands](postbuildcommands.md)
* [Tokens](Tokens.md)
Loading