-
Notifications
You must be signed in to change notification settings - Fork 2
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
Adding dependencies #1
Comments
Hi @dmateusp, I'm glad you like it. I must confess I haven't looked at this in a long while and also moved mostly to rust these days, though maybe I can still help you. Looks like the go_proto_library is not properly handled. I think I can take a closer look soon. |
I keep hearing good things about Rust :) The proto is created manually, it's built like this:
But when I import I tried to debug by listing the path, and it doesn't seem like any of the dependencies are available to |
Then what you have to do is add Lines 220 to 223 in 7f43ad5
... via parameter of the go_ent_library(
...
deps = [
":myproto_go_proto",
],
) |
I have tried that :/, but it still isn't available to Line 62 in 7f43ad5
|
Would you happen to have a simplified example project that I can clone and test with? I can't seem to find my old project at the moment. (Probably only on backup after I switched machines last year.) |
I've added a PR with an example that reproduces it |
Thanks for the example! I took a first look and, yes, you're right the deps are not available to the |
I think that's what this rule is for: https://github.com/bazelbuild/rules_go/blob/master/docs/go/core/rules.md#go_path but I didn't manage to get it working! |
Nice find! See latest commit in main: 3041436 |
I rebased and updated the PR, but I wasn't able to build locally still :/ don't you get the same error with ❯ bazel build //...
INFO: Analyzed 16 targets (182 packages loaded, 11170 targets configured).
INFO: Found 16 targets...
ERROR: /Users/dmateusp/code/rules_ent/example/schema/BUILD.bazel:18:15: Generating Ent files in bazel-out/darwin-fastbuild/bin/example/schema failed: (Exit 1): bash failed: error executing command (from target //example/schema:db_generate) /bin/bash -c ... (remaining 6 arguments skipped)
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
2023/05/01 17:14:46 entc failed: entc/load: parse schema dir: /private/var/tmp/_bazel_dmateusp/bcd25fcbe2b4fbce9df1fa3134e8a311/sandbox/darwin-sandbox/125/execroot/com_github_cloneable_rules_ent/example/schema/user.go:7:2: could not import github.com/cloneable/rules_ent/example/protos (invalid package name: "") ? |
Sorry, while trying out a few things yesterday I noticed that this happens with any transitive dependency and I replaced the proto lib with a regular Go package for faster testing. I did not revert that to test this, but now I know what's wrong: Because the .pb.go file is generated it's not listed like a regular source file in the tree, but under the target dir that produced it: |
@cloneable could you push the version that works with the zip step maybe? (even if it's on a branch) |
hey @cloneable thanks for sharing this!
I've been using it for a while, now I wanted to use the Ent approach described here to have a Proto object store/retreived from the DB easily.
To do that, I need to import my proto generated type into my
schema
file, butentc
doesn't seem to see my dependency at all:I've tried to change the rule but I'm a total beginner at writing Bazel rules so I haven't managed, do you have an idea how this could be supported?
The text was updated successfully, but these errors were encountered: