-
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨feat(
meson
): Build automation utility added.
- Loading branch information
Showing
2 changed files
with
107 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- meson.build bau actions | ||
|
||
local M = {} | ||
|
||
-- Backend - overseer tasks performed on option selected | ||
function M.action(option) | ||
local overseer = require("overseer") | ||
local final_message = "--task finished--" | ||
|
||
-- Global: MESON_BUILD_ROOT | ||
local success, build_dir = pcall(vim.api.nvim_get_var, 'MESON_BUILD_ROOT') | ||
if not success or build_dir == "" then build_dir = './build' end | ||
|
||
-- Global: MESON_BUILD_TYPE | ||
local success, build_type = pcall(vim.api.nvim_get_var, 'MESON_BUILD_TYPE') | ||
if not success or build_type == "" then build_type = '"debug"' end | ||
|
||
-- Global: MESON_CLEAN_FIRST | ||
local clean_first_arg = "" | ||
local _, clean_first = pcall(vim.api.nvim_get_var, 'MESON_CLEAN_FIRST') | ||
if clean_first == "true" then clean_first_arg = "--wipe" end | ||
|
||
-- Run command | ||
local cmd_setup = "meson setup " .. clean_first_arg .. build_dir .. " --buildtype=" .. build_type | ||
local cmd_build = "meson compile -C " .. build_dir .. " " .. option | ||
local cmd_target = "ninja -C " .. build_dir .. " " .. option | ||
print(cmd_build) | ||
local task = overseer.new_task({ | ||
name = "- Mason interpreter", | ||
strategy = { "orchestrator", | ||
tasks = {{ "shell", name = "- Run Meson → " .. option, | ||
cmd = "mkdir -p " .. build_dir .. | ||
" && " .. cmd_setup .. -- Setup | ||
" && " .. cmd_build .. -- Build target from the 'build' directory. | ||
--" && " .. cmd_target .. -- Run target | ||
" && echo '" .. cmd_setup .. " && " .. cmd_build .. "'" .. -- echo | ||
" && echo '" .. final_message .. "'" | ||
},},},}) | ||
task:start() | ||
vim.cmd("OverseerOpen") | ||
end | ||
|
||
return M | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters