attilaolah / bazel-tools

Starlark Macros for Bazel
Apache License 2.0
2 stars 1 forks source link

How do you actually include this repo in a WORKSPACE? #1

Open Zemnmez opened 2 years ago

Zemnmez commented 2 years ago

I tried loading this repo via git:

    git_repository(
        name = "bazel_tools",
        branch = "master",
        remote = "git@github.com:attilaolah/bazel-tools.git"
    )

But I got:

ERROR: Skipping '//ts/cmd/svgshot:npm_pkg': error loading package 'ts/cmd/svgshot': at /home/thomas/devel/monorepo/js/npm/package_json/rules.bzl:2:6: Every .bzl file must have a corresponding package, but '@bazel_tools//:defs.bzl' does not have one. Please create a BUILD file in the same or any parent directory. Note that this BUILD file does not need to do anything except exist.
WARNING: Target pattern parsing failed.

Is there some other way I should be including it?

attilaolah commented 2 years ago

I think the main problem is that in https://github.com/attilaolah/bazel-tools/blob/master/WORKSPACE#L19, I name the repo tools so you'd have to name it like that as well. I think this should be fixed by adopting Bazel modules, but to be honest I haven't really used this repo in a long time. Pull requests are welcome though!

So either propose a new name and send a pull request, or rename your git_repository(name = "tools", …) instead of name = "bazel_tools", and hope that there are no collisions 😞

attilaolah commented 2 years ago

Or maybe all that is missing is to pass build_file = "BUILD.bazel"? I'm not sure.