-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adjust readme: use zig fetch
in ## How to use
#89
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,21 +32,11 @@ There are 2 branches you can use for your development. | |
## How to use | ||
|
||
1. Add `protobuf` to your `build.zig.zon`. | ||
```zig | ||
.{ | ||
.name = "my_project", | ||
.version = "0.0.1", | ||
.paths = .{""}, | ||
.dependencies = .{ | ||
.protobuf = .{ | ||
.url = "https://github.com/Arwalk/zig-protobuf/archive/<some-commit-sha>.tar.gz", | ||
.hash = "12ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", | ||
// leave the hash as is, the build system will tell you which hash to put here based on your commit | ||
}, | ||
}, | ||
} | ||
```sh | ||
zig fetch --save "git+https://github.com/Arwalk/zig-protobuf#v2.0.0" | ||
``` | ||
1. Use the `protobuf` module | ||
1. Use the `protobuf` module. In your `build.zig`'s build function, add the dependency as module before | ||
`b.installArtifact(exe)`. | ||
```zig | ||
pub fn build(b: *std.Build) !void { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm hesitant to keep this one for context, the snippet "goes inside the build fn" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No problem :) i will just revert it. I have been overthinking this before, too 😅. EDIT: I do not really remember if at first i read it in an article about zig or simply saw it in the zigzap release notes, but i find this to be a good pattern. So it is either easy to use for people who know the drill and can simply copy and insert, but does not give meaningful context for people who are not that familiar with zig yet ...or it gives additional information to people being not that familiar with the zig build process, but with manually selecting the lines you need to copy over to the build.zig file. Its the small things haha 🫠 So in the end my conclusion is it is helpful to show There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm ok with this personally. As stated in #48 we need to make a proper documentation at some point. |
||
// first create a build for the dependency | ||
|
@@ -60,7 +50,6 @@ There are 2 branches you can use for your development. | |
} | ||
``` | ||
|
||
|
||
## Generating .zig files out of .proto definitions | ||
|
||
You can do this programatically as a compilation step for your application. The following snippet shows how to create a `zig build gen-proto` command for your project. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing <3