Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

migrating new_local_repository() rules from WORKSPACE to MODULE.bazel

101 views
Skip to first unread message

Diego

unread,
Jan 28, 2025, 2:59:02 PMJan 28
to bazel-discuss
Hi, the migration guide at https://bazel.build/external/migration doesn't make it clear how to migrate new_local_repository() rules. For example, I have this rule below in my WORKSPACE to access windows libraries and I don't know how to port it to MODULE.bazel

new_local_repository(
    name = "win32_libs",
    # NOTE: replace with your own Windows libraries path
    path = "C:/Program Files (x86)/Windows Kits/10/Lib/10.0.18362.0/um/x64",
    build_file_content = """
cc_library(
    name = "win32",
    srcs = [
        "Gdi32.lib",
        "User32.lib",
        "OpenGL32.lib",
    ],
    visibility = ["//visibility:public"],
)
""",
)


How can I port this rule to MODULE.bazel?

Thanks!
--
https://github.com/thinlizzy/ - C++11 and C++14 open source wrappers and libraries for various purposes (XML, image, webserver... and even a MTG implementation)
http://baudejogos.net - o único site brasileiro decente de jogos!!

Keith Smiley

unread,
Jan 28, 2025, 3:03:06 PMJan 28
to Diego, bazel-discuss
One option is `use_repo_rule`, example from our codebase:

```
new_local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "new_local_repository")

new_local_repository(
    name = "llvm-raw",
    build_file_content = "exports_files(glob([\"**\"]))",
    path = "third-party/llvm-project",
)
```
--
Keith Smiley


--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/bazel-discuss/CAA5%3Di_F_HgvY2gcC60heLw9wcxjYzkyQk5SCdut22X0zdP1_Tw%40mail.gmail.com.

Diego

unread,
Jan 28, 2025, 4:39:49 PMJan 28
to Keith Smiley, bazel-discuss
it worked perfectly. thank you :)
Reply all
Reply to author
Forward
0 new messages