mirror of
https://github.com/neovim/neovim.git
synced 2026-01-16 09:57:00 +00:00
feat(build.zig): install parsers in install step
Problem: The install step does not install parsers Solution: Make the install step depend on installing parsers
This commit is contained in:
64
build.zig
64
build.zig
@@ -623,25 +623,31 @@ pub fn build(b: *std.Build) !void {
|
||||
xxd_exe.linkLibC();
|
||||
test_deps.dependOn(&b.addInstallArtifact(xxd_exe, .{}).step);
|
||||
|
||||
if (b.lazyDependency("treesitter_c", .{ .target = target, .optimize = optimize })) |parser| {
|
||||
test_deps.dependOn(add_ts_parser(b, "c", parser.path("."), false, target, optimize));
|
||||
}
|
||||
if (b.lazyDependency("treesitter_markdown", .{ .target = target, .optimize = optimize })) |parser| {
|
||||
test_deps.dependOn(add_ts_parser(b, "markdown", parser.path("tree-sitter-markdown/"), true, target, optimize));
|
||||
test_deps.dependOn(add_ts_parser(b, "markdown_inline", parser.path("tree-sitter-markdown-inline/"), true, target, optimize));
|
||||
}
|
||||
if (b.lazyDependency("treesitter_vim", .{ .target = target, .optimize = optimize })) |parser| {
|
||||
test_deps.dependOn(add_ts_parser(b, "vim", parser.path("."), true, target, optimize));
|
||||
}
|
||||
if (b.lazyDependency("treesitter_vimdoc", .{ .target = target, .optimize = optimize })) |parser| {
|
||||
test_deps.dependOn(add_ts_parser(b, "vimdoc", parser.path("."), false, target, optimize));
|
||||
}
|
||||
if (b.lazyDependency("treesitter_lua", .{ .target = target, .optimize = optimize })) |parser| {
|
||||
test_deps.dependOn(add_ts_parser(b, "lua", parser.path("."), true, target, optimize));
|
||||
}
|
||||
if (b.lazyDependency("treesitter_query", .{ .target = target, .optimize = optimize })) |parser| {
|
||||
test_deps.dependOn(add_ts_parser(b, "query", parser.path("."), false, target, optimize));
|
||||
}
|
||||
const parser_c = b.dependency("treesitter_c", .{ .target = target, .optimize = optimize });
|
||||
test_deps.dependOn(add_ts_parser(b, "c", parser_c.path("."), false, target, optimize, .test_));
|
||||
install.dependOn(add_ts_parser(b, "c", parser_c.path("."), false, target, optimize, .install));
|
||||
|
||||
const parser_markdown = b.dependency("treesitter_markdown", .{ .target = target, .optimize = optimize });
|
||||
test_deps.dependOn(add_ts_parser(b, "markdown", parser_markdown.path("tree-sitter-markdown/"), true, target, optimize, .test_));
|
||||
install.dependOn(add_ts_parser(b, "markdown", parser_markdown.path("tree-sitter-markdown/"), true, target, optimize, .install));
|
||||
test_deps.dependOn(add_ts_parser(b, "markdown_inline", parser_markdown.path("tree-sitter-markdown-inline/"), true, target, optimize, .test_));
|
||||
install.dependOn(add_ts_parser(b, "markdown_inline", parser_markdown.path("tree-sitter-markdown-inline/"), true, target, optimize, .install));
|
||||
|
||||
const parser_vim = b.dependency("treesitter_vim", .{ .target = target, .optimize = optimize });
|
||||
test_deps.dependOn(add_ts_parser(b, "vim", parser_vim.path("."), true, target, optimize, .test_));
|
||||
install.dependOn(add_ts_parser(b, "vim", parser_vim.path("."), true, target, optimize, .install));
|
||||
|
||||
const parser_vimdoc = b.dependency("treesitter_vimdoc", .{ .target = target, .optimize = optimize });
|
||||
test_deps.dependOn(add_ts_parser(b, "vimdoc", parser_vimdoc.path("."), false, target, optimize, .test_));
|
||||
install.dependOn(add_ts_parser(b, "vimdoc", parser_vimdoc.path("."), false, target, optimize, .install));
|
||||
|
||||
const parser_lua = b.dependency("treesitter_lua", .{ .target = target, .optimize = optimize });
|
||||
test_deps.dependOn(add_ts_parser(b, "lua", parser_lua.path("."), true, target, optimize, .test_));
|
||||
install.dependOn(add_ts_parser(b, "lua", parser_lua.path("."), true, target, optimize, .install));
|
||||
|
||||
const parser_query = b.dependency("treesitter_query", .{ .target = target, .optimize = optimize });
|
||||
test_deps.dependOn(add_ts_parser(b, "query", parser_query.path("."), false, target, optimize, .test_));
|
||||
install.dependOn(add_ts_parser(b, "query", parser_query.path("."), false, target, optimize, .install));
|
||||
|
||||
var unit_headers: ?[]const LazyPath = null;
|
||||
if (support_unittests) {
|
||||
@@ -702,6 +708,7 @@ pub fn add_ts_parser(
|
||||
scanner: bool,
|
||||
target: std.Build.ResolvedTarget,
|
||||
optimize: std.builtin.OptimizeMode,
|
||||
path: enum { test_, install },
|
||||
) *std.Build.Step {
|
||||
const parser = b.addLibrary(.{
|
||||
.name = name,
|
||||
@@ -716,10 +723,21 @@ pub fn add_ts_parser(
|
||||
parser.addIncludePath(parser_dir.path(b, "src"));
|
||||
parser.linkLibC();
|
||||
|
||||
const parser_install = b.addInstallArtifact(parser, .{
|
||||
.dest_sub_path = b.fmt("parser/{s}.so", .{name}),
|
||||
});
|
||||
return &parser_install.step;
|
||||
switch (path) {
|
||||
.install => {
|
||||
const parser_install = b.addInstallArtifact(parser, .{
|
||||
.dest_dir = .{ .override = .{ .custom = "share/nvim/runtime/parser" } },
|
||||
.dest_sub_path = b.fmt("{s}.so", .{name}),
|
||||
});
|
||||
return &parser_install.step;
|
||||
},
|
||||
.test_ => {
|
||||
const parser_install = b.addInstallArtifact(parser, .{
|
||||
.dest_sub_path = b.fmt("parser/{s}.so", .{name}),
|
||||
});
|
||||
return &parser_install.step;
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub fn lua_version_info(b: *std.Build) []u8 {
|
||||
|
||||
@@ -48,32 +48,26 @@
|
||||
.treesitter_c = .{
|
||||
.url = "git+https://github.com/tree-sitter/tree-sitter-c?ref=v0.24.1#7fa1be1b694b6e763686793d97da01f36a0e5c12",
|
||||
.hash = "N-V-__8AANxPSABzw3WBTSH_YkwaGAfrK6PBqAMqQedkDDim",
|
||||
.lazy = true,
|
||||
},
|
||||
.treesitter_markdown = .{
|
||||
.url = "git+https://github.com/tree-sitter-grammars/tree-sitter-markdown?ref=v0.5.1#2dfd57f547f06ca5631a80f601e129d73fc8e9f0",
|
||||
.hash = "N-V-__8AABcZUwBZelO8MiLRwuLD1Wk34qHHbXtS4UW3Khys",
|
||||
.lazy = true,
|
||||
},
|
||||
.treesitter_lua = .{
|
||||
.url = "git+https://github.com/tree-sitter-grammars/tree-sitter-lua?ref=v0.4.1#816840c592ab973500ae9750763c707b447e7fef",
|
||||
.hash = "N-V-__8AAHCmCAAf-5sa_C1N5Ts8B7V-vTKqUEMJZVnNkq_y",
|
||||
.lazy = true,
|
||||
},
|
||||
.treesitter_vim = .{
|
||||
.url = "git+https://github.com/tree-sitter-grammars/tree-sitter-vim?ref=v0.7.0#3dd4747082d1b717b8978211c06ef7b6cd16125b",
|
||||
.hash = "N-V-__8AAMArVAB4uo2wg2XRs8HBviQ4Pq366cC_iRolX4Vc",
|
||||
.lazy = true,
|
||||
},
|
||||
.treesitter_vimdoc = .{
|
||||
.url = "git+https://github.com/neovim/tree-sitter-vimdoc?ref=v4.1.0#f061895a0eff1d5b90e4fb60d21d87be3267031a",
|
||||
.hash = "N-V-__8AAI7VCgBqRcQ-vIxB8DJJFhmLG42p6rfwCWIdypSJ",
|
||||
.lazy = true,
|
||||
},
|
||||
.treesitter_query = .{
|
||||
.url = "git+https://github.com/tree-sitter-grammars/tree-sitter-query?ref=v0.8.0#a225e21d81201be77da58de614e2b7851735677a",
|
||||
.hash = "N-V-__8AAMR5AwAzZ5_8S2p2COTEf5usBeeT4ORzh-lBGkWy",
|
||||
.lazy = true,
|
||||
},
|
||||
},
|
||||
.paths = .{
|
||||
|
||||
Reference in New Issue
Block a user