Skip to content

Conversation

@redsun82
Copy link
Contributor

@redsun82 redsun82 commented Feb 5, 2026

Summary

This PR upgrades Bazel to version 9.0.0 and includes the necessary migration steps:

  • Upgrade Bazel to 9.0.0
  • Add rules_cc and rules_java module dependencies
  • Add Python 3.12 toolchain registration
  • Add rules_cc to autoload configuration
  • Migrate Starlark files to explicit rules_cc imports
  • Migrate BUILD files to explicit rules_cc imports
  • Migrate BUILD files to explicit rules_java imports
  • Migrate C++ runfiles API from bazel_tools to rules_cc
  • Fix rules_nodejs metadata JSON formatting

Bazel 9 removes native.cc_* and native.java_* rules from Starlark. These
now return stub functions that fail at analysis time. The autoload mechanism
(--incompatible_autoload_externally) that would automatically redirect these
is disabled in Bazel 9 (bazelbuild/bazel#23043), so all usages must be
converted to explicit loads from rules_cc and rules_java.

Similarly, providers like CcInfo and APIs like cc_common are no longer
available as globals and must be explicitly imported from their new locations.

Version updates:
- .bazelversion: 8.4.2 → 9.0.0
- MODULE.bazel: Added rules_cc 0.2.16, rules_java 9.0.3 dependencies
- MODULE.bazel: Added Python 3.12 toolchain registration (rules_python 1.x
  requires explicit toolchain setup, no longer auto-registers)

Bazelrc changes:
- Removed --incompatible_strict_action_env (now default, flag removed in Bazel 9)
- Removed --legacy_external_runfiles (now default false, flag removed)
- Added +@rules_cc,+@rules_java,+@rules_shell to autoload for graceful migration

BUILD/bzl migrations:
- swift/rules.bzl: Added cc_binary, cc_library, CcInfo imports; changed
  native.cc_binary → cc_binary, native.cc_library → cc_library
- misc/bazel/cmake/cmake.bzl: Added CcInfo import (used in provider returns)
- misc/bazel/internal/zipmerge/BUILD.bazel: Added cc_binary, cc_library, cc_test
- shared/cpp/BUILD.bazel, swift/logging/BUILD.bazel: Added cc_library load
- javascript/extractor/test/.../BUILD.bazel: Added java_test load

C++ runfiles API migration:
- zipmerge_test.cpp: Bazel 9 moves the C++ runfiles library from
  @bazel_tools//tools/cpp/runfiles to @rules_cc//cc/runfiles. Updated
  include path and namespace accordingly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant