fix(deps): make script/bump_deps.lua update build.zig.zon versions in sync

Also bring luv version in build.zig.zon up to date

This skips some deps not currently managed/used by build.zig
This commit is contained in:
bfredl
2025-05-08 12:00:32 +02:00
committed by Christian Clason
parent 1d9990daac
commit 1c96b72dfa
3 changed files with 36 additions and 9 deletions

View File

@ -13,9 +13,9 @@
.url = "https://github.com/neovim/deps/raw/d495ee6f79e7962a53ad79670cb92488abe0b9b4/opt/lpeg-1.1.0.tar.gz", .url = "https://github.com/neovim/deps/raw/d495ee6f79e7962a53ad79670cb92488abe0b9b4/opt/lpeg-1.1.0.tar.gz",
.hash = "122084badadeb91106dd06b2055119a944c340563536caefd8e22d4064182f7cd6e6", .hash = "122084badadeb91106dd06b2055119a944c340563536caefd8e22d4064182f7cd6e6",
}, },
.libluv = .{ .luv = .{
.url = "https://github.com/luvit/luv/releases/download/1.48.0-2/luv-1.48.0-2.tar.gz", .url = "git+https://github.com/luvit/luv?ref=1.50.0-1#891ba330ea0b676eacbd943ab12bf5e8d4295119",
.hash = "122050b45fc1b2d1e72d30d3e4f446735ab95bbb88658bc1de736e5dc71c3e3cd767", .hash = "N-V-__8AAKX9DgD3bigqB5adNqFpMGvwbNSGdaXBUpneaNDi",
}, },
.lua_compat53 = .{ .lua_compat53 = .{
.url = "https://github.com/lunarmodules/lua-compat-5.3/archive/v0.13.tar.gz", .url = "https://github.com/lunarmodules/lua-compat-5.3/archive/v0.13.tar.gz",

View File

@ -26,6 +26,15 @@ local repos = {
'uncrustify/uncrustify', 'uncrustify/uncrustify',
} }
local zig_mode = {
luajit = false,
uncrustify = false,
wasmtime = false,
unibilium = 'nested',
utf8proc = 'nested',
libuv = 'nested',
}
local dependency_table = {} --- @type table<string, string> local dependency_table = {} --- @type table<string, string>
for _, repo in pairs(repos) do for _, repo in pairs(repos) do
dependency_table[vim.fs.basename(repo)] = repo dependency_table[vim.fs.basename(repo)] = repo
@ -65,7 +74,7 @@ local deps_file = nvim_src_dir .. '/' .. 'cmake.deps/deps.txt'
--- @param repo string --- @param repo string
--- @param ref string --- @param ref string
local function get_archive_info(repo, ref) local function get_archive_info(repo, ref)
local temp_dir = os.getenv('TMPDIR') or os.getenv('TEMP') local temp_dir = os.getenv('TMPDIR') or os.getenv('TEMP') or '/tmp'
local archive_name = ref .. '.tar.gz' local archive_name = ref .. '.tar.gz'
local archive_path = temp_dir .. '/' .. archive_name local archive_path = temp_dir .. '/' .. archive_name
@ -113,7 +122,8 @@ end
local function ref(name, _ref) local function ref(name, _ref)
local repo = dependency_table[name] local repo = dependency_table[name]
local symbol = string.gsub(name, 'tree%-sitter', 'treesitter'):gsub('%-', '_'):upper() local symbol = string.gsub(name, 'tree%-sitter', 'treesitter'):gsub('%-', '_')
local symbol_upper = symbol:upper()
run_die( run_die(
{ 'git', 'diff', '--quiet', 'HEAD', '--', deps_file }, { 'git', 'diff', '--quiet', 'HEAD', '--', deps_file },
@ -138,12 +148,29 @@ local function ref(name, _ref)
end end
print('Updating ' .. name .. ' to ' .. archive.url .. '\n') print('Updating ' .. name .. ' to ' .. archive.url .. '\n')
update_deps_file(symbol, 'URL', archive.url:gsub('/', '\\/')) update_deps_file(symbol_upper, 'URL', archive.url:gsub('/', '\\/'))
update_deps_file(symbol, 'SHA256', archive.sha) update_deps_file(symbol_upper, 'SHA256', archive.sha)
run_die({ 'git', 'add', deps_file })
local zig = zig_mode[symbol]
if zig ~= false then
if zig == 'nested' then
-- don't care about un-cding, "git commit" doesn't care and then we die
vim.fn.chdir('deps/' .. symbol)
end
-- note: get_gh_commit_sha is likely superfluous with zig. but use the same resolved hash, for consistency.
run_die({
'zig',
'fetch',
'--save=' .. symbol,
'git+https://github.com/' .. repo .. '?ref=' .. _ref,
})
run_die({ 'git', 'add', 'build.zig.zon' })
end
run_die({ run_die({
'git', 'git',
'commit', 'commit',
deps_file,
'-m', '-m',
commit_prefix .. 'bump ' .. name .. ' to ' .. comment, commit_prefix .. 'bump ' .. name .. ' to ' .. comment,
}, 'git failed to commit') }, 'git failed to commit')

View File

@ -110,7 +110,7 @@ pub fn build_libluv(
lua: *std.Build.Step.Compile, lua: *std.Build.Step.Compile,
libuv: *std.Build.Step.Compile, libuv: *std.Build.Step.Compile,
) !*std.Build.Step.Compile { ) !*std.Build.Step.Compile {
const upstream = b.dependency("libluv", .{}); const upstream = b.dependency("luv", .{});
const compat53 = b.dependency("lua_compat53", .{}); const compat53 = b.dependency("lua_compat53", .{});
const lib = b.addStaticLibrary(.{ const lib = b.addStaticLibrary(.{
.name = "luv", .name = "luv",