From 1c96b72dfa41aea1ab7c78b33143b692023e7ad6 Mon Sep 17 00:00:00 2001 From: bfredl Date: Thu, 8 May 2025 12:00:32 +0200 Subject: [PATCH] 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 --- build.zig.zon | 6 +++--- scripts/bump_deps.lua | 37 ++++++++++++++++++++++++++++++++----- src/build_lua.zig | 2 +- 3 files changed, 36 insertions(+), 9 deletions(-) diff --git a/build.zig.zon b/build.zig.zon index f8f95e1449..9465fe981c 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -13,9 +13,9 @@ .url = "https://github.com/neovim/deps/raw/d495ee6f79e7962a53ad79670cb92488abe0b9b4/opt/lpeg-1.1.0.tar.gz", .hash = "122084badadeb91106dd06b2055119a944c340563536caefd8e22d4064182f7cd6e6", }, - .libluv = .{ - .url = "https://github.com/luvit/luv/releases/download/1.48.0-2/luv-1.48.0-2.tar.gz", - .hash = "122050b45fc1b2d1e72d30d3e4f446735ab95bbb88658bc1de736e5dc71c3e3cd767", + .luv = .{ + .url = "git+https://github.com/luvit/luv?ref=1.50.0-1#891ba330ea0b676eacbd943ab12bf5e8d4295119", + .hash = "N-V-__8AAKX9DgD3bigqB5adNqFpMGvwbNSGdaXBUpneaNDi", }, .lua_compat53 = .{ .url = "https://github.com/lunarmodules/lua-compat-5.3/archive/v0.13.tar.gz", diff --git a/scripts/bump_deps.lua b/scripts/bump_deps.lua index a44e4a2d5e..2e5b4a353a 100755 --- a/scripts/bump_deps.lua +++ b/scripts/bump_deps.lua @@ -26,6 +26,15 @@ local repos = { 'uncrustify/uncrustify', } +local zig_mode = { + luajit = false, + uncrustify = false, + wasmtime = false, + unibilium = 'nested', + utf8proc = 'nested', + libuv = 'nested', +} + local dependency_table = {} --- @type table for _, repo in pairs(repos) do 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 ref string 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_path = temp_dir .. '/' .. archive_name @@ -113,7 +122,8 @@ end local function ref(name, _ref) 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( { 'git', 'diff', '--quiet', 'HEAD', '--', deps_file }, @@ -138,12 +148,29 @@ local function ref(name, _ref) end print('Updating ' .. name .. ' to ' .. archive.url .. '\n') - update_deps_file(symbol, 'URL', archive.url:gsub('/', '\\/')) - update_deps_file(symbol, 'SHA256', archive.sha) + update_deps_file(symbol_upper, 'URL', archive.url:gsub('/', '\\/')) + 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({ 'git', 'commit', - deps_file, '-m', commit_prefix .. 'bump ' .. name .. ' to ' .. comment, }, 'git failed to commit') diff --git a/src/build_lua.zig b/src/build_lua.zig index be3c709aca..5d06cdf3aa 100644 --- a/src/build_lua.zig +++ b/src/build_lua.zig @@ -110,7 +110,7 @@ pub fn build_libluv( lua: *std.Build.Step.Compile, libuv: *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 lib = b.addStaticLibrary(.{ .name = "luv",