Git Product home page Git Product logo

exported_macros's Introduction

Exported Macros

GitHub repository for minimally reproducing a rules_nodejs bug.

In rules_nodejs v3, strict_visibility is enabled by default. This is great to avoid accidentally depending on a transitive dep, but causes other challenges. Most notably, strict deps cannot take into account dependencies from macros originating in Bazel libraries.

In this example, this workspace provides a my_binary() macro which generates a nodejs_binary(). This binary happens to use yargs as a dependency to parse arguments. It is listed in the package.json and works correctly when used in this workspace's BUILD.bazel file.

$ bazel run //:binary -- --foo bar
bar

However, in external is a separate workspace which depends on this example via NPM and calls the same macro. Attempting to use it throws an error:

$ bazel run //:pkg.pack && \
    (cd external/ && npm install && npm install ../exported_macros-*.tgz && bazel run //:binary -- --foo bar)
# ...
ERROR: /home/dparker/Source/exported_macros/external/BUILD.bazel:3:10: in nodejs_binary rule //:binary: target '@npm//yargs:yargs' is not visible from target '//:binary'. Check the visibility declaration of the former target if you think the dependency is legitimate
ERROR: Analysis of target '//:binary' failed; build aborted: Analysis of target '//:binary' failed

Because the macro is executed in a separate workspace, and that workspace does not have a dependency on yargs, the generated nodejs_binary() fails the strict visibility check.

exported_macros's People

Contributors

dgp1130 avatar

Watchers

 avatar  avatar  avatar

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.