Skip to content

Commit c9dd78d

Browse files
lolskiclaude
andauthored
Bazel 8 upgrade (#433)
## Motivation Update Bazel version from 6.2 to 8.5.1. The upgrade is done in a backwards-compatible way, such that "upstream" repositories that are yet to be upgraded may depend on this repository. This is done by preserving WORKSPACE and the deps.bzl loader files alongside the new Bazel 8 ones. Once every repository has been upgraded to Bazel 8, these files will be removed. ## Implementation ### Create MODULE.bazel The new module declaration is organized into these sections: 1. Common (bazel_skylib, rules_pkg) 2. Languages & toolchains: Rust, Python, Kotlin, Java 3. Package managers: Rust crates, Maven 4. TypeDB repos (typedb_dependencies, typedb_bazel_distribution, typedb_behaviour) ### Syntactic and rule changes - Update behaviour test feature path resolution through the new construct `$(rootpath)` to resolve directory of the feature file --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 84a86ee commit c9dd78d

16 files changed

Lines changed: 1554 additions & 236 deletions

File tree

.bazelrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# License, v. 2.0. If a copy of the MPL was not distributed with this
33
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
44

5+
# Enable isolated extension usages for crate universe
6+
common --experimental_isolated_extension_usages
57

68
try-import ./.bazel-remote-cache.rc
79

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.2.0
1+
8.5.1

.factory/automation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ build:
2424
command: |
2525
bazel build //... --test_output=errors
2626
bazel run @typedb_dependencies//tool/checkstyle:test-coverage
27-
bazel test $(bazel query 'kind(checkstyle_test, //...)')
27+
bazel test $(bazel query 'kind(checkstyle_test, //...)') --test_output=errors
2828
bazel test $(bazel query 'kind(rustfmt_test, //...)') --@rules_rust//:rustfmt.toml=//rust:rustfmt_config
2929
# build-dependency:
3030
# image: typedb-ubuntu-22.04

BUILD

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@ checkstyle_test(
3030
".gitignore",
3131
".factory/automation.yml",
3232
"BUILD",
33+
"MODULE.bazel",
3334
"WORKSPACE",
3435
"deployment.bzl",
3536
"requirements.txt",
3637
],
3738
exclude = [
3839
".bazel-remote-cache.rc",
3940
".bazel-cache-credential.json",
41+
"MODULE.bazel.lock",
4042
"banner.png",
4143
"Cargo.toml",
4244
],
@@ -60,6 +62,5 @@ filegroup(
6062
"@typedb_dependencies//tool/release/notes:create",
6163
"@typedb_dependencies//tool/sonarcloud:code-analysis",
6264
"@typedb_dependencies//tool/unuseddeps:unused-deps",
63-
"@rust_analyzer_toolchain_tools//lib/rustlib/src:rustc_srcs"
6465
],
6566
)

MODULE.bazel

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# This Source Code Form is subject to the terms of the Mozilla Public
2+
# License, v. 2.0. If a copy of the MPL was not distributed with this
3+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
4+
5+
module(
6+
name = "typeql",
7+
version = "0.0.0",
8+
compatibility_level = 1,
9+
)
10+
11+
# ===========================================================
12+
# Common
13+
# ===========================================================
14+
15+
bazel_dep(name = "bazel_skylib", version = "1.7.1")
16+
bazel_dep(name = "rules_pkg", version = "1.0.1")
17+
18+
# ===========================================================
19+
# Languages & toolchains
20+
# ===========================================================
21+
22+
# Rust
23+
bazel_dep(name = "rules_rust", version = "0.56.0")
24+
rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
25+
rust.toolchain(
26+
edition = "2021",
27+
versions = ["1.81.0"],
28+
)
29+
use_repo(rust, "rust_toolchains")
30+
register_toolchains("@rust_toolchains//:all")
31+
32+
# Python
33+
bazel_dep(name = "rules_python", version = "1.0.0")
34+
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
35+
python.toolchain(
36+
is_default = True,
37+
python_version = "3.11",
38+
)
39+
40+
# Kotlin
41+
bazel_dep(name = "rules_kotlin", version = "2.0.0")
42+
register_toolchains("@rules_kotlin//kotlin/internal:default_toolchain")
43+
44+
# Java
45+
bazel_dep(name = "rules_java", version = "8.6.2")
46+
47+
# ===========================================================
48+
# Package managers
49+
# ===========================================================
50+
51+
# Rust crates
52+
crate = use_extension("@rules_rust//crate_universe:extensions.bzl", "crate")
53+
use_repo(crate, "crates")
54+
55+
# Maven
56+
bazel_dep(name = "rules_jvm_external", version = "6.6")
57+
58+
# ===========================================================
59+
# TypeDB repos
60+
# ===========================================================
61+
62+
bazel_dep(name = "typedb_dependencies", version = "0.0.0")
63+
git_override(
64+
module_name = "typedb_dependencies",
65+
remote = "https://github.com/typedb/dependencies",
66+
commit = "72a2ee5bdd90ea76129889b30f89da51bcdc7909",
67+
)
68+
69+
bazel_dep(name = "typedb_bazel_distribution", version = "0.0.0")
70+
git_override(
71+
module_name = "typedb_bazel_distribution",
72+
remote = "https://github.com/typedb/bazel-distribution",
73+
commit = "4e400ddcc52da12809db323874eb3516ee9ab5c3",
74+
)
75+
76+
bazel_dep(name = "typedb_behaviour", version = "0.0.0")
77+
git_override(
78+
module_name = "typedb_behaviour",
79+
remote = "https://github.com/typedb/typedb-behaviour",
80+
commit = "bc1e71c9334272178104f657b0996d9f15be66c9",
81+
)

MODULE.bazel.lock

Lines changed: 1450 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.8.2
1+
3.8.3-rc0

WORKSPACE

Lines changed: 3 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -2,147 +2,6 @@
22
# License, v. 2.0. If a copy of the MPL was not distributed with this
33
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
44

5-
6-
workspace(name = "typeql")
7-
8-
################################
9-
# Load @typedb_dependencies #
10-
################################
11-
12-
load("//dependencies/typedb:repositories.bzl", "typedb_dependencies")
13-
typedb_dependencies()
14-
15-
# Load //builder/python
16-
load("@typedb_dependencies//builder/python:deps.bzl", "rules_python")
17-
rules_python()
18-
load("@rules_python//python:repositories.bzl", "py_repositories")
19-
py_repositories()
20-
21-
# Load //builder/bazel for RBE
22-
load("@typedb_dependencies//builder/bazel:deps.bzl", "bazel_toolchain")
23-
bazel_toolchain()
24-
25-
# Load //builder/java
26-
load("@typedb_dependencies//builder/java:deps.bzl", "rules_jvm_external")
27-
rules_jvm_external()
28-
29-
# Load //builder/kotlin
30-
load("@typedb_dependencies//builder/kotlin:deps.bzl", "io_bazel_rules_kotlin")
31-
io_bazel_rules_kotlin()
32-
load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories")
33-
kotlin_repositories()
34-
load("@io_bazel_rules_kotlin//kotlin:core.bzl", "kt_register_toolchains")
35-
kt_register_toolchains()
36-
37-
# Load //builder/antlr
38-
load("@typedb_dependencies//builder/antlr:deps.bzl", "rules_antlr", "antlr_version")
39-
rules_antlr()
40-
41-
load("@rules_antlr//antlr:lang.bzl", "JAVA")
42-
load("@rules_antlr//antlr:repositories.bzl", "rules_antlr_dependencies")
43-
rules_antlr_dependencies(antlr_version, JAVA)
44-
45-
# Load //builder/rust
46-
load("@typedb_dependencies//builder/rust:deps.bzl", rust_deps = "deps")
47-
rust_deps()
48-
49-
load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains", "rust_analyzer_toolchain_tools_repository")
50-
rules_rust_dependencies()
51-
load("@rules_rust//tools/rust_analyzer:deps.bzl", "rust_analyzer_dependencies")
52-
rust_analyzer_dependencies()
53-
load("@rules_rust//rust:defs.bzl", "rust_common")
54-
rust_register_toolchains(
55-
edition = "2021",
56-
versions = ["1.81.0"],
57-
)
58-
59-
rust_analyzer_toolchain_tools_repository(
60-
name = "rust_analyzer_toolchain_tools",
61-
version = "1.81.0",
62-
)
63-
64-
load("@typedb_dependencies//library/crates:crates.bzl", "fetch_crates")
65-
fetch_crates()
66-
load("@crates//:defs.bzl", "crate_repositories")
67-
crate_repositories()
68-
69-
# Load //tool/common
70-
load("@typedb_dependencies//tool/common:deps.bzl", "typedb_dependencies_ci_pip")
71-
typedb_dependencies_ci_pip()
72-
load("@typedb_dependencies_ci_pip//:requirements.bzl", "install_deps")
73-
install_deps()
74-
75-
# Load //tool/checkstyle
76-
load("@typedb_dependencies//tool/checkstyle:deps.bzl", checkstyle_deps = "deps")
77-
checkstyle_deps()
78-
79-
# Load //tool/unuseddeps
80-
load("@typedb_dependencies//tool/unuseddeps:deps.bzl", unuseddeps_deps = "deps")
81-
unuseddeps_deps()
82-
83-
# Load //tool/sonarcloud
84-
load("@typedb_dependencies//tool/sonarcloud:deps.bzl", "sonarcloud_dependencies")
85-
sonarcloud_dependencies()
86-
87-
###################################
88-
# Load @typedb_bazel_distribution #
89-
###################################
90-
91-
load("@typedb_dependencies//distribution:deps.bzl", "typedb_bazel_distribution")
92-
typedb_bazel_distribution()
93-
94-
# Load //common
95-
load("@typedb_bazel_distribution//common:deps.bzl", "rules_pkg")
96-
rules_pkg()
97-
load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
98-
rules_pkg_dependencies()
99-
100-
# Load //pip
101-
load("@typedb_bazel_distribution//pip:deps.bzl", "typedb_bazel_distribution_pip")
102-
typedb_bazel_distribution_pip()
103-
load("@typedb_bazel_distribution_pip//:requirements.bzl", "install_deps")
104-
install_deps()
105-
106-
# Load //github
107-
load("@typedb_bazel_distribution//github:deps.bzl", "ghr_osx_zip", "ghr_linux_tar")
108-
ghr_osx_zip()
109-
ghr_linux_tar()
110-
111-
# Load //maven
112-
load("@typedb_bazel_distribution//maven:deps.bzl", typedb_bazel_distribution_maven_artifacts = "maven_artifacts")
113-
114-
# Load @typedb_bazel_distribution_cloudsmith
115-
load("@typedb_bazel_distribution//common/uploader:deps.bzl", "typedb_bazel_distribution_uploader")
116-
typedb_bazel_distribution_uploader()
117-
load("@typedb_bazel_distribution_uploader//:requirements.bzl", install_uploader_deps = "install_deps")
118-
install_uploader_deps()
119-
120-
#############################
121-
# Load @typedb_dependencies #
122-
#############################
123-
124-
load("//dependencies/typedb:repositories.bzl", "typedb_behaviour")
125-
typedb_behaviour()
126-
127-
load("@typedb_dependencies//common/java:artifacts.bzl", typedb_common_maven_artifacts = "maven_artifacts")
128-
load("@typedb_dependencies//tool/common:deps.bzl", typedb_dependencies_tool_maven_artifacts = "maven_artifacts")
129-
130-
############################
131-
# Load @maven dependencies #
132-
############################
133-
134-
load("//dependencies/maven:artifacts.bzl", typeql_artifacts = "artifacts")
135-
load("@typedb_dependencies//library/maven:rules.bzl", "maven")
136-
maven(
137-
typedb_bazel_distribution_maven_artifacts +
138-
typedb_common_maven_artifacts +
139-
typedb_dependencies_tool_maven_artifacts +
140-
typeql_artifacts
141-
)
142-
143-
############################################
144-
# Generate @typeql_workspace_refs #
145-
############################################
146-
147-
load("@typedb_bazel_distribution//common:rules.bzl", "workspace_refs")
148-
workspace_refs(name = "typeql_workspace_refs")
5+
# This file intentionally left empty.
6+
# It serves as a workspace root marker for Bazel.
7+
# All dependency management is done via MODULE.bazel (Bzlmod).

dependencies/maven/BUILD

Lines changed: 0 additions & 14 deletions
This file was deleted.

dependencies/maven/artifacts.bzl

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)