Skip to content

Flip --enable_workspace to false #23023

@meteorcloudy

Description

@meteorcloudy

Motivation

Disabling WORKSPACE by default is the next step towards migrating the Bazel ecosystem to Bzlmod for managing external dependencies.

Benefits of Bzlmod over WORKSPACE:

  • Automatic MVS-based Bazel module dependency resolution
  • No need to declare transitive dependencies
  • Better integration with third-party package managers with module extension
  • Repo level visibility control
  • Easy to inspect dependency graph with bazel mod
  • Support for lockfile, vendor/offline mode

We plan to remove this flag and the entire WORKSPACE logic in Bazel 9.

For more information, check https://bazel.build/external/overview

Description

With --enable_workspace defaults to false, the WORKSPACE file is no longer needed and does not take any effect in a Bazel project.

You should expect the following breaking behaviours:

  • The root of a Bazel repo is no longer marked by WORKSPACE, but by MODULE.bazel (or REPO.bazel).
  • External dependencies defined in WORKSPACE are no longer effective. You may start to see errors like "unknown repo 'foo' requested from @@".
  • Toolchains/platforms registered in WORKSPACE are no longer effective
  • Bind statement (already deprecated) are no longer effective

If all your external dependencies have migrated to Bzlmod, WORSPACE and WORKSPACE.bzlmod files can be safely deleted. Otherwise, you can temporarily enable WORKSPACE via --enable_workspace=true.

Incompatible Flag

--noenable_workspace

Migration Guide

Please refer to https://bazel.build/external/migration on how to migrate from WORKSPACE to Bzlmod.

We'll continue to improve the migration guide on common issues and best practices, PRs from the community are also welcomed!

And please feel free to report issues that are blocking your migration.

In which Bazel LTS version will this incompatible change be enabled?

Bazel 8

Additional Context

No response

TODO List

Metadata

Metadata

Labels

P1I'll work on this now. (Assignee required)area-BzlmodBzlmod-specific PRs, issues, and feature requestsbreaking-change-8.0incompatible-changeIncompatible/breaking changeteam-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