mirror of
https://github.com/neovim/neovim.git
synced 2026-04-21 14:55:33 +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();
|
xxd_exe.linkLibC();
|
||||||
test_deps.dependOn(&b.addInstallArtifact(xxd_exe, .{}).step);
|
test_deps.dependOn(&b.addInstallArtifact(xxd_exe, .{}).step);
|
||||||
|
|
||||||
if (b.lazyDependency("treesitter_c", .{ .target = target, .optimize = optimize })) |parser| {
|
const parser_c = b.dependency("treesitter_c", .{ .target = target, .optimize = optimize });
|
||||||
test_deps.dependOn(add_ts_parser(b, "c", parser.path("."), false, target, 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));
|
||||||
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));
|
const parser_markdown = b.dependency("treesitter_markdown", .{ .target = target, .optimize = optimize });
|
||||||
test_deps.dependOn(add_ts_parser(b, "markdown_inline", parser.path("tree-sitter-markdown-inline/"), true, target, 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));
|
||||||
if (b.lazyDependency("treesitter_vim", .{ .target = target, .optimize = optimize })) |parser| {
|
test_deps.dependOn(add_ts_parser(b, "markdown_inline", parser_markdown.path("tree-sitter-markdown-inline/"), true, target, optimize, .test_));
|
||||||
test_deps.dependOn(add_ts_parser(b, "vim", parser.path("."), true, target, optimize));
|
install.dependOn(add_ts_parser(b, "markdown_inline", parser_markdown.path("tree-sitter-markdown-inline/"), true, target, optimize, .install));
|
||||||
}
|
|
||||||
if (b.lazyDependency("treesitter_vimdoc", .{ .target = target, .optimize = optimize })) |parser| {
|
const parser_vim = b.dependency("treesitter_vim", .{ .target = target, .optimize = optimize });
|
||||||
test_deps.dependOn(add_ts_parser(b, "vimdoc", parser.path("."), false, target, 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));
|
||||||
if (b.lazyDependency("treesitter_lua", .{ .target = target, .optimize = optimize })) |parser| {
|
|
||||||
test_deps.dependOn(add_ts_parser(b, "lua", parser.path("."), true, target, optimize));
|
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_));
|
||||||
if (b.lazyDependency("treesitter_query", .{ .target = target, .optimize = optimize })) |parser| {
|
install.dependOn(add_ts_parser(b, "vimdoc", parser_vimdoc.path("."), false, target, optimize, .install));
|
||||||
test_deps.dependOn(add_ts_parser(b, "query", parser.path("."), false, target, optimize));
|
|
||||||
}
|
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;
|
var unit_headers: ?[]const LazyPath = null;
|
||||||
if (support_unittests) {
|
if (support_unittests) {
|
||||||
@@ -702,6 +708,7 @@ pub fn add_ts_parser(
|
|||||||
scanner: bool,
|
scanner: bool,
|
||||||
target: std.Build.ResolvedTarget,
|
target: std.Build.ResolvedTarget,
|
||||||
optimize: std.builtin.OptimizeMode,
|
optimize: std.builtin.OptimizeMode,
|
||||||
|
path: enum { test_, install },
|
||||||
) *std.Build.Step {
|
) *std.Build.Step {
|
||||||
const parser = b.addLibrary(.{
|
const parser = b.addLibrary(.{
|
||||||
.name = name,
|
.name = name,
|
||||||
@@ -716,10 +723,21 @@ pub fn add_ts_parser(
|
|||||||
parser.addIncludePath(parser_dir.path(b, "src"));
|
parser.addIncludePath(parser_dir.path(b, "src"));
|
||||||
parser.linkLibC();
|
parser.linkLibC();
|
||||||
|
|
||||||
const parser_install = b.addInstallArtifact(parser, .{
|
switch (path) {
|
||||||
.dest_sub_path = b.fmt("parser/{s}.so", .{name}),
|
.install => {
|
||||||
});
|
const parser_install = b.addInstallArtifact(parser, .{
|
||||||
return &parser_install.step;
|
.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 {
|
pub fn lua_version_info(b: *std.Build) []u8 {
|
||||||
|
|||||||
@@ -48,32 +48,26 @@
|
|||||||
.treesitter_c = .{
|
.treesitter_c = .{
|
||||||
.url = "git+https://github.com/tree-sitter/tree-sitter-c?ref=v0.24.1#7fa1be1b694b6e763686793d97da01f36a0e5c12",
|
.url = "git+https://github.com/tree-sitter/tree-sitter-c?ref=v0.24.1#7fa1be1b694b6e763686793d97da01f36a0e5c12",
|
||||||
.hash = "N-V-__8AANxPSABzw3WBTSH_YkwaGAfrK6PBqAMqQedkDDim",
|
.hash = "N-V-__8AANxPSABzw3WBTSH_YkwaGAfrK6PBqAMqQedkDDim",
|
||||||
.lazy = true,
|
|
||||||
},
|
},
|
||||||
.treesitter_markdown = .{
|
.treesitter_markdown = .{
|
||||||
.url = "git+https://github.com/tree-sitter-grammars/tree-sitter-markdown?ref=v0.5.1#2dfd57f547f06ca5631a80f601e129d73fc8e9f0",
|
.url = "git+https://github.com/tree-sitter-grammars/tree-sitter-markdown?ref=v0.5.1#2dfd57f547f06ca5631a80f601e129d73fc8e9f0",
|
||||||
.hash = "N-V-__8AABcZUwBZelO8MiLRwuLD1Wk34qHHbXtS4UW3Khys",
|
.hash = "N-V-__8AABcZUwBZelO8MiLRwuLD1Wk34qHHbXtS4UW3Khys",
|
||||||
.lazy = true,
|
|
||||||
},
|
},
|
||||||
.treesitter_lua = .{
|
.treesitter_lua = .{
|
||||||
.url = "git+https://github.com/tree-sitter-grammars/tree-sitter-lua?ref=v0.4.1#816840c592ab973500ae9750763c707b447e7fef",
|
.url = "git+https://github.com/tree-sitter-grammars/tree-sitter-lua?ref=v0.4.1#816840c592ab973500ae9750763c707b447e7fef",
|
||||||
.hash = "N-V-__8AAHCmCAAf-5sa_C1N5Ts8B7V-vTKqUEMJZVnNkq_y",
|
.hash = "N-V-__8AAHCmCAAf-5sa_C1N5Ts8B7V-vTKqUEMJZVnNkq_y",
|
||||||
.lazy = true,
|
|
||||||
},
|
},
|
||||||
.treesitter_vim = .{
|
.treesitter_vim = .{
|
||||||
.url = "git+https://github.com/tree-sitter-grammars/tree-sitter-vim?ref=v0.7.0#3dd4747082d1b717b8978211c06ef7b6cd16125b",
|
.url = "git+https://github.com/tree-sitter-grammars/tree-sitter-vim?ref=v0.7.0#3dd4747082d1b717b8978211c06ef7b6cd16125b",
|
||||||
.hash = "N-V-__8AAMArVAB4uo2wg2XRs8HBviQ4Pq366cC_iRolX4Vc",
|
.hash = "N-V-__8AAMArVAB4uo2wg2XRs8HBviQ4Pq366cC_iRolX4Vc",
|
||||||
.lazy = true,
|
|
||||||
},
|
},
|
||||||
.treesitter_vimdoc = .{
|
.treesitter_vimdoc = .{
|
||||||
.url = "git+https://github.com/neovim/tree-sitter-vimdoc?ref=v4.1.0#f061895a0eff1d5b90e4fb60d21d87be3267031a",
|
.url = "git+https://github.com/neovim/tree-sitter-vimdoc?ref=v4.1.0#f061895a0eff1d5b90e4fb60d21d87be3267031a",
|
||||||
.hash = "N-V-__8AAI7VCgBqRcQ-vIxB8DJJFhmLG42p6rfwCWIdypSJ",
|
.hash = "N-V-__8AAI7VCgBqRcQ-vIxB8DJJFhmLG42p6rfwCWIdypSJ",
|
||||||
.lazy = true,
|
|
||||||
},
|
},
|
||||||
.treesitter_query = .{
|
.treesitter_query = .{
|
||||||
.url = "git+https://github.com/tree-sitter-grammars/tree-sitter-query?ref=v0.8.0#a225e21d81201be77da58de614e2b7851735677a",
|
.url = "git+https://github.com/tree-sitter-grammars/tree-sitter-query?ref=v0.8.0#a225e21d81201be77da58de614e2b7851735677a",
|
||||||
.hash = "N-V-__8AAMR5AwAzZ5_8S2p2COTEf5usBeeT4ORzh-lBGkWy",
|
.hash = "N-V-__8AAMR5AwAzZ5_8S2p2COTEf5usBeeT4ORzh-lBGkWy",
|
||||||
.lazy = true,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
.paths = .{
|
.paths = .{
|
||||||
|
|||||||
Reference in New Issue
Block a user