Giter Site home page Giter Site logo

Comments (7)

jayconrod avatar jayconrod commented on May 30, 2024

Not really sure what Gazelle can do with that directory without adding a lot of special cases. There are a large number of .proto files with no BUILD file.

I think there would need to be a handwritten BUILD file in that directory (either upstreamed, or emplaced with a repository rule) that defines proto_library and go_proto_library. When #12 is implemented, Gazelle would index these rules. When you import one of these proto files, it would resolve the dependency to the proto_library or go_proto_library as appropriate. WDYT?

from bazel-gazelle.

ashi009 avatar ashi009 commented on May 30, 2024

I'd go with external repo. As long as the generated build file is not using "//google/api" as target, I don't have to touch the build file and add #gazelle:ignore on the top.

I've already tried to use new_repository with a local build file as temp fix, which seems not a huge maintenance burden.

from bazel-gazelle.

jayconrod avatar jayconrod commented on May 30, 2024

There's no way to tell whether a proto import is from an external repo or not just by looking at the import string (without special cases). They're paths that are relative to the repo root, but they could be in any repo including the workspace.

When #12 is working, we'll have an index of all the proto files in external repos, so Gazelle will be able to generate correct targets. I think that will fix it.

from bazel-gazelle.

ashi009 avatar ashi009 commented on May 30, 2024

SG. I'll manually put these files in my workspace and put a huge DO NOT EDIT in the readme for now.

It's indeed annoying to work with these special cases, as the import syntax in proto files is not built for open source world at first place :(

from bazel-gazelle.

ashi009 avatar ashi009 commented on May 30, 2024

@jayconrod Indexing files in current workspace works already, and I think the external one seems can be solved by using repo overlays as the build files in third_party directory. Is this the direction gazelle moves toward to? I'd love to give it a shot if that's the long term plan.

from bazel-gazelle.

jayconrod avatar jayconrod commented on May 30, 2024

@ashi009 Sorry for the slow response; just got back from a trip.

The long-term plan for repositories that need some customization (that go_repository doesn't work for) is to use overlay build files (via Gazelle's http_archive and git_repository). The build files will be stored in a third_party directory and will be kept up to date with Gazelle, but they can have manual customizations, too.

The command to add a new repository to one of these rules or migrate an existing go_repository will look something like this:

gazelle update-repos -rule=git_repository example.com/repo

After that, you'll be able to update to a new commit and update build files at the same time with gazelle update-repos example.com/repo or gazelle update-repos -all.

I was hoping to have this working already, but a bunch of stuff has been happening in rules_go, so most of my attention has been there. I still hope to get this done soon.

from bazel-gazelle.

jayconrod avatar jayconrod commented on May 30, 2024

Closing this since Gazelle 0.13.0 includes special cases for protos in github.com/googleapis/googleapis and for the Well Known Types.

from bazel-gazelle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.