Coder Social home page Coder Social logo

Add additional modules to module_ctx about bazel HOT 2 OPEN

matts1 avatar matts1 commented on June 9, 2024
Add additional modules to module_ctx

from bazel.

Comments (2)

Wyverald avatar Wyverald commented on June 9, 2024

This sounds good to me (except maybe if we can find a better name for current_module).

The implementation is quite simple (file in question: https://cs.opensource.google/bazel/bazel/+/master:src/main/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleExtensionContext.java), so contributions are welcome.

from bazel.

fmeum avatar fmeum commented on June 9, 2024

In the module extensions I have worked on so far, the usual pattern has been:

def _impl(module_ctx):
  collected_data = ...

  for mod in module_ctx.module:
      if mod.is_root:
          do_stuff(collected_data)

      do_other_stuff(collected_data)

I can see the new helpers being useful in smaller module extensions, but I think that many (most?) extensions will want to do something (even if just validation) with all modules, not just root and "current" module. The new symbols would get us into a situation where do_something(module_ctx.root_module), if mod.is_root: do_something(mod) and if mod == module_ctx.root_module: do_something(mod) are all different ways to do the same thing.

I am a bit worried that introducing new API that doesn't provide any truly new information could end up making module_ctx more confusing.

from bazel.

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.