Giter Club home page Giter Club logo

Comments (1)

alexeagle avatar alexeagle commented on June 18, 2024

Doing some design thinking on this:

We can rely on update_source_file pointing to an action that just produces the .bzl content as a regular output, rather than having a standalone program the user invokes with bazel run. Unlike rules_go it means you have testing that the deps.bzl stays up-to-date.

The current implementation is pure starlark, because repository_ctx gives us file read/write. However as an action we need to spawn a process to read the file, so reusing the code is tricky. Options:

  • fetch and run a standalone starlark interpreter and run the library code in it
  • rely on a python toolchain, and load the starlark helper functions as if they were python code, which works so long as we stub out the starlark builtins
  • repository rule is no longer pure starlark, instead calling some helper program which can also be run as an action. Downside is the toolchain isn't available during repository rule execution so it makes that more complex for all users, even if they didn't want to check in the resulting .bzl file
  • maintain a port of the same logic in another language like JS that can run in the action

The translate_package_lock rule doesn't just produce the deps.bzl file. It also creates a bunch of aliases in BUILD files in the generated repo, so you can dep on @npm_deps//acorn rather than @npm__acorn-8.5.7//:pkg. The aliases are both shorter, and guarantee you only import your direct dependencies. We'd lose that feature in this usecase.

from rules_js.

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.