Open
Conversation
Bazel 9 removes native.cc_* and native.java_* rules from Starlark, requiring explicit imports from rules_cc and rules_java.
Add explicit dependencies required for Bazel 9: - rules_cc 0.2.16: provides cc_binary, cc_library, cc_test - rules_java 9.0.3: provides java_* rules Also update related dependencies: - rules_go: 0.56.1 → 0.59.0 (compatibility with Bazel 9) - gazelle: 0.40.0 → 0.47.0 (compatibility with rules_go 0.59.0) - rules_nodejs: 6.2.0-codeql.1 → 6.7.3 (upstream version)
rules_python 1.x requires explicit toolchain setup and no longer auto-registers toolchains. Register Python 3.12 toolchain to ensure Python tools work correctly with Bazel 9.
Add +@rules_cc to --incompatible_autoload_externally to enable graceful migration path for cc_* rule usages before all files are updated with explicit imports.
Bazel 9 removes native.cc_* and CcInfo from global scope. Update: - swift/rules.bzl: Add cc_binary, cc_library, CcInfo imports; use explicit cc_binary/cc_library instead of native.cc_* - misc/bazel/cmake/cmake.bzl: Add CcInfo import for provider usage
Add explicit load statements for cc_binary, cc_library, and cc_test from @rules_cc//cc:defs.bzl in: - shared/cpp/BUILD.bazel - swift/logging/BUILD.bazel - misc/bazel/internal/zipmerge/BUILD.bazel
Add explicit load statements for java_library and java_test from @rules_java//java:defs.bzl in: - javascript/extractor/BUILD.bazel - javascript/extractor/test/com/semmle/js/extractor/test/BUILD.bazel
Bazel 9 moves the C++ runfiles library from @bazel_tools to @rules_cc. Update: - zipmerge_test.cpp: Change include from tools/cpp/runfiles to rules_cc/cc/runfiles and update namespace accordingly - BUILD.bazel: Update dependency from @bazel_tools//tools/cpp/runfiles to @rules_cc//cc/runfiles
Fix malformed JSON in metadata file - remove trailing comma after last array element.
c3452fb to
2483b89
Compare
rules_android has repository visibility issues with Bazel 9 when the Android SDK is present. Since we don't use Android, disable detection by setting ANDROID_HOME to empty.
Upgrade from 2.2.0-codeql.1 to 2.2.2-codeql.1 which includes: - Fix Windows bzlmod builder classpath issue - Move to official bazel worker api This eliminates the need for --legacy_external_runfiles on Windows. Also fix codegen templates to be included in runfiles.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR upgrades Bazel from version 8.4.2 to 9.0.0, a major version upgrade that removes native.cc_* and native.java_* rules from Starlark scope, requiring explicit imports from rules_cc and rules_java.
Changes:
- Upgrade Bazel to 9.0.0 and add new module dependencies (rules_cc 0.2.16, rules_java 9.0.3)
- Update related dependencies for Bazel 9 compatibility (rules_go, gazelle, rules_nodejs, rules_kotlin)
- Add explicit load() statements for cc_* and java_* rules across .bzl and BUILD files
- Migrate C++ runfiles API from @bazel_tools to @rules_cc
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| .bazelversion | Upgrade Bazel version from 8.4.2 to 9.0.0 |
| .bazelrc | Add @rules_cc to incompatible_autoload_externally flag and disable Android SDK auto-detection |
| MODULE.bazel | Add rules_cc and rules_java dependencies, update rules_go/gazelle/rules_nodejs/rules_kotlin versions, register Python 3.12 toolchain |
| swift/rules.bzl | Add load() for cc_binary, cc_library, CcInfo; replace native.cc_* calls |
| swift/logging/BUILD.bazel | Add load() for cc_library from rules_cc |
| shared/cpp/BUILD.bazel | Add load() for cc_library from rules_cc |
| misc/bazel/cmake/cmake.bzl | Add load() for CcInfo from rules_cc |
| misc/bazel/internal/zipmerge/BUILD.bazel | Add load() for cc_* rules; migrate runfiles dependency from @bazel_tools to @rules_cc |
| misc/bazel/internal/zipmerge/zipmerge_test.cpp | Update runfiles include path and namespace from bazel::tools to rules_cc::cc |
| misc/codegen/BUILD.bazel | Add dbscheme, ql, and rust template filegroups to data dependencies |
| misc/codegen/templates/BUILD.bazel | Create filegroups for dbscheme, ql, and rust templates |
| javascript/extractor/BUILD.bazel | Add load() for java_library from rules_java |
| javascript/extractor/test/com/semmle/js/extractor/test/BUILD.bazel | Add load() for java_test from rules_java |
| misc/bazel/registry/modules/rules_kotlin/metadata.json | Add rules_kotlin 2.2.2-codeql.1 to versions list |
| misc/bazel/registry/modules/rules_kotlin/2.2.2-codeql.1/* | Add new rules_kotlin version with patches and MODULE.bazel configuration |
| misc/bazel/registry/modules/rules_kotlin/2.2.0-codeql.1/source.json | Reorder patches (cosmetic change for consistency) |
| misc/bazel/registry/modules/rules_nodejs/metadata.json | Fix malformed JSON (critical issue - file is incomplete after changes) |
| "6.2.0-codeql.1" | ||
| ] | ||
| } | ||
| "6.2.0-codeql.1" |
There was a problem hiding this comment.
The JSON file is malformed after the changes. Line 3 should be part of a complete JSON array, but it's missing the closing bracket and brace. The file should be:
{
"versions": [
"6.2.0-codeql.1"
]
}
The diff shows lines being removed but line 3 appears incomplete in the result.
Suggested change
| "6.2.0-codeql.1" | |
| "6.2.0-codeql.1" | |
| ] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Upgrade Bazel from 8.x to 9.0.0.
Bazel 9 removes
native.cc_*andnative.java_*rules from Starlark scope, requiring explicit imports fromrules_ccandrules_java.Changes
Core upgrade
.bazelversionNew module dependencies
rules_cc0.2.16: providescc_binary,cc_library,cc_testrules_java9.0.3: providesjava_*rulesrules_go0.56.1 → 0.59.0 (Bazel 9 compatibility)gazelle0.40.0 → 0.47.0 (rules_go 0.59.0 compatibility)rules_nodejs6.2.0-codeql.1 → 6.7.3 (upstream version)rules_kotlin2.2.0-codeql.1 → 2.2.2-codeql.1 (Windows bzlmod fix)Configuration
+@rules_ccto--incompatible_autoload_externallyfor graceful migrationANDROID_HOME=) to avoidrules_androidBazel 9 compatibility issuesStarlark migrations
load()statements forcc_binary,cc_library,CcInfoin.bzlfilesnative.cc_*calls with explicit rule namesBUILD file migrations
load()forcc_binary,cc_library,cc_testfrom@rules_cc//cc:defs.bzlload()forjava_library,java_testfrom@rules_java//java:defs.bzlC++ runfiles API migration
@bazel_tools//tools/cpp/runfilesto@rules_cc//cc/runfileszipmerge_test.cppWindows compatibility fixes
rules_kotlinto 2.2.2 which fixes Windows bzlmod builder classpath issuesFixes
rules_nodejsmetadata (trailing comma)