backport: build(windows): vendor xxd.c (#36755)

backport https://github.com/neovim/neovim/pull/36746

Problem:
Currently we fetch a prebuilt xxd.exe from neovim/deps for Windows,
which is not ideal in terms of obviousness, misses updates, and is
clumsy to update.

Solution:
Similar to tee.c (#36363), vendor xxd.c from Vim and build it as part
of the Neovim build process. This makes the source obvious, enables
analyzer checks, and simplifies updates.

Fixes #36664

Co-authored-by: benarcher2691 <ben.archer2691@gmail.com>
This commit is contained in:
Justin M. Keyes
2025-11-30 00:33:55 -05:00
committed by GitHub
parent 79b67ce331
commit 1f93acc293
5 changed files with 1257 additions and 3 deletions

View File

@@ -0,0 +1,19 @@
local t = require('test.testutil')
local n = require('test.functional.testnvim')()
local eq = t.eq
local clear = n.clear
local fn = n.fn
local testprg = n.testprg
describe('xxd', function()
before_each(clear)
it('works', function()
-- Round-trip test: encode then decode should return original
local input = 'hello'
local encoded = fn.system({ testprg('xxd') }, input)
local decoded = fn.system({ testprg('xxd'), '-r' }, encoded)
eq(input, decoded)
end)
end)