-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Upgrade Bazel to 9.0.0 #21276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade Bazel to 9.0.0 #21276
Changes from 11 commits
d33375c
39218f5
4d6fb87
578efea
d1c6360
f881d36
10a2824
f8ed810
ca90de2
b38c326
37261b2
e4871fc
000d824
40b9084
05a50ad
dfe4511
a5905a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 8.4.2 | ||
| 9.0.0 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| load("@rules_java//java:defs.bzl", "java_test") | ||
|
|
||
| java_test( | ||
| name = "test", | ||
| srcs = glob(["**/*.java"]), | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| load("@rules_cc//cc/common:cc_info.bzl", "CcInfo") | ||
|
|
||
| CmakeInfo = provider( | ||
| fields = { | ||
| "name": "", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| module( | ||
| name = "rules_kotlin", | ||
| version = "2.2.2-codeql.1", | ||
| compatibility_level = 1, | ||
| repo_name = "rules_kotlin", | ||
| ) | ||
|
|
||
| bazel_dep(name = "platforms", version = "0.0.11") | ||
| bazel_dep(name = "bazel_skylib", version = "1.7.1") | ||
| bazel_dep(name = "rules_java", version = "8.9.0") | ||
| bazel_dep(name = "rules_android", version = "0.6.4") | ||
| bazel_dep(name = "bazel_features", version = "1.25.0") | ||
| bazel_dep(name = "protobuf", version = "29.0", repo_name = "com_google_protobuf") | ||
| bazel_dep(name = "rules_proto", version = "6.0.2", repo_name = "rules_proto") | ||
| bazel_dep(name = "abseil-py", version = "2.1.0", repo_name = "py_absl") | ||
| bazel_dep(name = "rules_cc", version = "0.0.16") | ||
| bazel_dep(name = "bazel_worker_api", version = "0.0.8") | ||
| bazel_dep(name = "bazel_worker_java", version = "0.0.8") | ||
|
|
||
| rules_java_toolchains = use_extension("@rules_java//java:extensions.bzl", "toolchains") | ||
| use_repo(rules_java_toolchains, "remote_java_tools") | ||
|
|
||
| rules_kotlin_extensions = use_extension( | ||
| "//src/main/starlark/core/repositories:bzlmod_setup.bzl", | ||
| "rules_kotlin_extensions", | ||
| ) | ||
| use_repo( | ||
| rules_kotlin_extensions, | ||
| "com_github_google_ksp", | ||
| "com_github_jetbrains_kotlin", | ||
| "com_github_pinterest_ktlint", | ||
| "kotlin_build_tools_impl", | ||
| "kotlinx_serialization_core_jvm", | ||
| "kotlinx_serialization_json", | ||
| "kotlinx_serialization_json_jvm", | ||
| ) | ||
|
|
||
| register_toolchains("//kotlin/internal:default_toolchain") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| --- a/src/main/starlark/core/options/opts.kotlinc.bzl 2000-01-01 01:00:00.000000000 +0100 | ||
| +++ b/src/main/starlark/core/options/opts.kotlinc.bzl 2025-11-17 16:51:01.012063056 +0100 | ||
| @@ -51,6 +51,11 @@ | ||
| return None | ||
| return ["-Xjdk-release=%s" % version] | ||
|
|
||
| +def _map_language_version_to_flag(version): | ||
| + if not version: | ||
| + return None | ||
| + return ["-language-version=%s" % version, "-api-version=%s" % version] | ||
| + | ||
| _KOPTS_ALL = { | ||
| "include_stdlibs": struct( | ||
| args = dict( | ||
| @@ -495,6 +500,15 @@ | ||
| value_to_flag = None, | ||
| map_value_to_flag = _map_warning_level, | ||
| ), | ||
| + "language_version": struct( | ||
| + args = dict( | ||
| + default = "1.9", | ||
| + doc = "-language-version", | ||
| + ), | ||
| + type = attr.string, | ||
| + value_to_flag = None, | ||
| + map_value_to_flag = _map_language_version_to_flag, | ||
| + ), | ||
| } | ||
|
|
||
| def _merge(key, rule_defined): |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| Emitting jdeps is broken for the 2.0.0 kotlin extractor, and we don't need those files. | ||
| Patching it here rather than passing `--@rules_kotlin//kotlin/settings:jvm_emit_jdeps=false` | ||
| allows us to not have to specify that option (and therefore pull in `rules_kotlin`) in `semmle-code`. | ||
|
||
| --- a/kotlin/settings/BUILD.bazel | ||
| +++ b/kotlin/settings/BUILD.bazel | ||
| @@ -16,6 +16,6 @@ release_archive( | ||
| # Flag that controls the emission of jdeps files during kotlin jvm compilation. | ||
| bool_flag( | ||
| name = "jvm_emit_jdeps", | ||
| - build_setting_default = True, # Upstream default behavior | ||
| + build_setting_default = False, | ||
| visibility = ["//visibility:public"], | ||
| ) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "integrity": "sha256-QR2yavs0ksyDUbW1NJkxUir+LFTyZRttEncwoSVtD2A=", | ||
| "url": "https://github.com/bazelbuild/rules_kotlin/releases/download/v2.2.2/rules_kotlin-v2.2.2.tar.gz", | ||
| "patches": { | ||
| "codeql_add_language_version_option.patch": "sha256-HoH8NWXxmYHmm/SxaugRdXgMntvcQx5gRLW2yQIvWhM=", | ||
| "codeql_do_not_emit_jdeps.patch": "sha256-gIlhXEY71vlCkpr5wj2vm3yv6RwcuKLhgbTGqdVvQfU=" | ||
| }, | ||
| "patch_strip": 1 | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,7 @@ | |
| ], | ||
| "versions": [ | ||
| "2.2.0-codeql.1", | ||
|
||
| "2.2.2-codeql.1" | ||
| ], | ||
| "yanked_versions": {} | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| load("@rules_cc//cc:defs.bzl", "cc_library") | ||
|
|
||
| cc_library( | ||
| name = "extractor_shared", | ||
| srcs = glob(["*.cpp"]), | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| load("@rules_cc//cc:defs.bzl", "cc_library") | ||
|
|
||
| cc_library( | ||
| name = "logging", | ||
| srcs = glob(["*.cpp"]), | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") | ||
| load("@rules_cc//cc/common:cc_info.bzl", "CcInfo") | ||
|
||
| load("//misc/bazel:os.bzl", "os_select") | ||
|
|
||
| # TODO: make a shared library with the internal repos for transitions | ||
|
|
@@ -124,7 +126,7 @@ def _wrap_cc(rule, kwargs): | |
| ) | ||
|
|
||
| def swift_cc_binary(**kwargs): | ||
| _wrap_cc(native.cc_binary, kwargs) | ||
| _wrap_cc(cc_binary, kwargs) | ||
|
|
||
| def swift_cc_library(**kwargs): | ||
| _wrap_cc(native.cc_library, kwargs) | ||
| _wrap_cc(cc_library, kwargs) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Any reason for the reshuffle here?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uh, let me check, maybe the the
fix.pyscript does not guarantee the orderThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, it uses
iterdirwithout sorting, so the order is not preserved. I'll make it lexicographic (which does mean a reshuffling here, but will avoid reshufflings in the future)