Skip to content

Conversation

@lcian
Copy link
Member

@lcian lcian commented Aug 21, 2025

This way it can be used in other projects.

cursor[bot]

This comment was marked as outdated.

build.zig Outdated
Comment on lines 61 to 70
const sentry_module = b.addModule("sentry_zig", .{
.root_source_file = b.path("src/root.zig"),
.target = target,
.optimize = optimize,
});

// Add the same dependencies that the library has
sentry_module.addOptions("sentry_build", sentry_build_opts);
sentry_module.addImport("types", types);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential bug: The new sentry_module in build.zig imports the types module but fails to provide its required utils dependency, causing compilation failures for external consumers.
  • Description: The new sentry_module is configured to provide the types module to external consumers. However, the types module itself has a dependency on a utils module, as seen in src/types/Event.zig. The build script fails to declare this nested dependency for the sentry_module by omitting a call like types.addImport("utils", sentry_module). This will cause a compilation failure for any external project that consumes the library via the new module system and calls a function like captureError, which relies on the types module.

  • Suggested fix: In build.zig, after adding the types import to sentry_module, also add the required utils import for the types module. This can be done by adding types.addImport("utils", sentry_module); to ensure the dependency is resolved during compilation.
    severity: 0.8, confidence: 0.95

Did we get this right? 👍 / 👎 to inform future reviews.

README.md Outdated
Comment on lines 50 to 58
const sentry_zig_dep = b.addStaticLibrary(.{
.name = "sentry_zig",
.root_source_file = b.path("deps/sentry-zig/src/root.zig"),
.target = target,
.optimize = optimize,
});
exe.linkLibrary(sentry_zig_dep);
exe.root_module.addImport("sentry_zig", sentry_zig_dep.root_module);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential bug: The "Git Submodule" integration method in README.md is broken. It bypasses the necessary build script setup, causing a compilation failure due to an unresolved types module import.
  • Description: The README.md file presents two methods for integrating the library: Git Submodule and Package Manager. The "Git Submodule" method instructs the user to create a new static library directly from src/root.zig. This approach completely bypasses the project's build.zig file, which is responsible for setting up necessary module dependencies, such as the types module. Since src/root.zig directly imports types, following these instructions will lead to a guaranteed compilation failure because the types module will not be found.

  • Suggested fix: The "Git Submodule" instructions in README.md should be removed or corrected. The correct approach must involve using the project's build.zig to properly configure the library and its dependencies, rather than creating a static library from a single source file.
    severity: 0.75, confidence: 0.9

Did we get this right? 👍 / 👎 to inform future reviews.

Base automatically changed from lcian/docs/readme to main August 21, 2025 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants