Skip to content

It should be possible to use the same extension as both a production and dev dependency #14635

@shs96c

Description

@shs96c

Description of the problem / feature request:

It's often useful to use the same extension as both a production and development time dependency. eg.

# In MODULE.bazel
http = use_extension(":extensions.bzl", "http")
dev_http = use_extension(":extensions.bzl", "http", dev_dependency = True)

http.archive(
   name = "prod_dep"
   sha256 = "..."
   urls = [ ... ],
)

dev_http.archive(
  name = "dev_dep",
   sha256 = "..."
   urls = [ ... ],
)

When one tries this, the following error is shown:

ERROR: Traceback (most recent call last):
	File "<root>/MODULE.bazel", line 19, column 26, in <toplevel>
Error in use_extension: this extension is already being used at <root>/MODULE.bazel:10:22

As an aside, this message not include the name of the extension which makes debugging harder.

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

See above

What's the output of bazel info release?

release 5.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2We'll consider working on this in future. (Assignee optional)area-BzlmodBzlmod-specific PRs, issues, and feature requeststeam-ExternalDepsExternal dependency handling, remote repositiories, WORKSPACE file.type: feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions