Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 14 additions & 18 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@ const RunIntegrationTest = struct {
return build_example;
}

pub fn make(step: *std.Build.Step, prog_node: std.Progress.Node) anyerror!void {
_ = prog_node;
pub fn make(step: *std.Build.Step, options: std.Build.Step.MakeOptions) anyerror!void {
_ = options;
const self: *Self = @fieldParentPtr("step", step);
const b = self.step.owner;

Expand Down Expand Up @@ -465,19 +465,15 @@ const AddObjectArchive = struct {
//
// If we call `linkLibrary` instead of this code, then the build will
// fail with a linker failure complaining we have duplicate symbols.
for (destination.root_module.depending_steps.keys()) |compile| {
compile.step.dependOn(&source.step);
}

_ = source.getEmittedBin(); // Indicate there is a dependency on the outputted binary.
destination.root_module.include_dirs.append(b.allocator, .{ .other_step = source }) catch @panic("OOM");
for (destination.root_module.depending_steps.keys()) |compile| {
source.getEmittedIncludeTree().addStepDependencies(&compile.step);
}

return self;
}

pub fn make(step: *std.Build.Step, prog_node: std.Progress.Node) anyerror!void {
_ = prog_node;
pub fn make(step: *std.Build.Step, options: std.Build.Step.MakeOptions) anyerror!void {
_ = options;
const self: *Self = @fieldParentPtr("step", step);
self.addObjects() catch |err| {
return step.fail("Unable to add objects from {s}: {s}", .{
Expand Down Expand Up @@ -558,7 +554,7 @@ const GenerateGrammars = struct {

generate_grammars.module.addImport(
"tree_sitter",
generate_grammars.tree_sitter.module("tree_sitter"),
generate_grammars.tree_sitter.module("tree-sitter"),
);

for (grammars, 0..) |grammar, index| {
Expand Down Expand Up @@ -591,12 +587,12 @@ const GenerateGrammars = struct {
root_module.addObject(object);
}

root_module.addImport("tree_sitter", self.tree_sitter.module("tree_sitter"));
root_module.addImport("tree_sitter", self.tree_sitter.module("tree-sitter"));
root_module.addImport("generated_grammars", self.module);
}

pub fn make(step: *std.Build.Step, prog_node: std.Progress.Node) anyerror!void {
_ = prog_node;
pub fn make(step: *std.Build.Step, options: std.Build.Step.MakeOptions) anyerror!void {
_ = options;
const self: *GenerateGrammars = @fieldParentPtr("step", step);
self.writeModule() catch |err| {
return step.fail("Unable to write {s}: {s}", .{
Expand Down Expand Up @@ -729,7 +725,7 @@ const Deps = struct {
_ = AddObjectArchive.create(step, self.target, self.libcmark_gfm.artifact("cmark-gfm-extensions"));
_ = AddObjectArchive.create(step, self.target, self.tree_sitter_core.artifact("tree-sitter"));
step.root_module.addImport("mime", self.mime.module("mime"));
self.tree_sitter_grammars.link(&step.root_module);
self.tree_sitter_grammars.link(step.root_module);
}
};

Expand All @@ -752,11 +748,11 @@ fn formatTargetForRoc(b: *std.Build, target: std.Build.ResolvedTarget) []const u

// Run `zig ar --help` to see the archive formats ar supports.
fn formatTargetForAr(b: *std.Build, target: std.Build.ResolvedTarget) []const u8 {
return if (target.result.isGnu())
return if (target.result.isGnuLibC())
"--format=gnu"
else if (target.result.isMusl())
else if (target.result.isMuslLibC())
"--format=gnu" // This seems wrong, but nobody complained so :shrug:.
else if (target.result.isDarwin())
else if (target.result.isDarwinLibC())
"--format=darwin"
else {
const triple = target.result.linuxTriple(b.allocator) catch @panic("OOM");
Expand Down
53 changes: 43 additions & 10 deletions build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,23 +1,56 @@
.{
.name = "jay",
// This is the default name used by packages depending on this one. For
// example, when a user runs `zig fetch --save <url>`, this field is used
// as the key in the `dependencies` table. Although the user can choose a
// different name, most users will stick with this provided value.
//
// It is redundant to include "zig" in this name because it is already
// within the Zig package namespace.
.name = .jay,

// This is a [Semantic Version](https://semver.org/).
// In a future version of Zig it will be used for package deduplication.
.version = "0.0.0",
.minimum_zig_version = "0.13.0",

// Together with name, this represents a globally unique package
// identifier. This field is generated by the Zig toolchain when the
// package is first created, and then *never changes*. This allows
// unambiguous detection of one package being an updated version of
// another.
//
// When forking a Zig project, this id should be regenerated (delete the
// field and run `zig build`) if the upstream project is still maintained.
// Otherwise, the fork is *hostile*, attempting to take control over the
// original project's identity. Thus it is recommended to leave the comment
// on the following line intact, so that it shows up in code reviews that
// modify the field.
.fingerprint = 0xef3e049a37930c09, // Changing this has security and trust implications.

// Tracks the earliest Zig version that the package considers to be a
// supported use case.
.minimum_zig_version = "0.14.1",

// This field is optional.
// Each dependency must either provide a `url` and `hash`, or a `path`.
// `zig build --fetch` can be used to fetch all dependencies of a package, recursively.
// Once all dependencies are fetched, `zig build` no longer requires
// internet connectivity.
.dependencies = .{
.@"libcmark-gfm" = .{
.url = "https://github.com/abhinav/libcmark-gfm.zig/archive/0.1.0.tar.gz",
.hash = "1220b8a2a0e06f9adbe77b64be7482f5814383e647ced9a332f100044881af5e23a7",
.url = "https://github.com/jwoudenberg/libcmark-gfm.zig/archive/e9f404c22433a2920e153d7acffd2a3f295e7a1d.tar.gz",
.hash = "12202c3b6f9578f15bfefd19d3eda430832797b2d721a17e05faaf2b340a72647d7e",
},
.mime = .{
.url = "https://github.com/andrewrk/mime/archive/refs/tags/2.0.1.tar.gz",
.hash = "12209083b0c43d0f68a26a48a7b26ad9f93b22c9cff710c78ddfebb47b89cfb9c7a4",
.url = "https://github.com/andrewrk/mime/archive/refs/tags/3.0.0.tar.gz",
.hash = "mime-3.0.0-zwmL-6wgAADuFwn7gr-_DAQDGJdIim94aDIPa6qO-6GT",
},
.tree_sitter_core = .{
.url = "https://github.com/tree-sitter/tree-sitter/archive/refs/tags/v0.24.6.tar.gz",
.hash = "1220f44691132e06e4575ab7fed7737c05da86e3f8130ffa59751ce6eaba1b1d73ef",
.url = "https://github.com/tree-sitter/tree-sitter/archive/ac13c86675c3ad131270dc135d1effac01ae09f9.tar.gz",
.hash = "tree_sitter-0.26.0-Tw2sR4m8CwAW_Ztr_DGPW-k3ld5RtyWl0Ay4mB4cFU3g",
},
.tree_sitter = .{
.url = "https://github.com/tree-sitter/zig-tree-sitter/archive/refs/tags/v0.24.1.tar.gz",
.hash = "12206c44990aab41e534a0d8d597f856a46cd39b9fb26ad77708f9d37751ea730c50",
.url = "https://github.com/tree-sitter/zig-tree-sitter/archive/b4b72c903e69998fc88e27e154a5e3cc9166551b.tar.gz",
.hash = "tree_sitter-0.25.0-8heIf51vAQConvVIgvm-9mVIbqh7yabZYqPXfOpS3YoG",
},
.@"tree-sitter-elm" = .{
.url = "https://github.com/elm-tooling/tree-sitter-elm/archive/refs/tags/v5.7.0.tar.gz",
Expand Down
38 changes: 6 additions & 32 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading