GithubHelp home page GithubHelp logo

Comments (2)

sluongng avatar sluongng commented on July 24, 2024

cc: @dnathe4th

The BUILD file must have already existed for package() to be generated. If there is no existing BUILD file, only the go language extension would pick up *.go files and generate targets with public visibility.

Then on the 2nd run, the actual package() is generated on the newly created BUILD file.


I think the fix here is as follows:

  1. Add a doc to ensure that language/bazel/visibility should always be run last, and when it runs, it should consider/detect newly generated BUILD files by language extensions that run prior.

  2. Apply "corrective" visibility over existing targets (unless # keep is used).

WDYT?

from bazel-gazelle.

dnathe4th avatar dnathe4th commented on July 24, 2024

Yeah I think (1) is the answer. Let me dig in a bit to see why it isn't detecting the newly created BUILD file (since the example repo does have the extension running after the go extension. It is unfortunate there isn't a good way to articulate a dependency between extensions.

(2) brings up a good point I went back and forth with in consulting another engineer when I originally authored the extension. There was a reasonable argument to be made that the package level default construct was not needed at all; the directive could just write to all rules' visibility attributes directly. The argument against this approach was that package(default_visibility) was a construct that already existed and was not going away, so better to have gazelle lean in on existing bazel rather than layering on an independent path to achieve the same goal. I think the same argument can also be made against overwriting any visibility directly: there's already a bazel pattern of the default and the rule specific attribute co-existing, let's not violate that by making a guess as to whether this extension should rewrite.

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.