Skip to content

Migrate to Bzlmod #328

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

Merged
merged 1 commit into from
Jun 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
common --noenable_bzlmod
common --enable_bzlmod
common --enable_workspace
build --java_runtime_version=remotejdk_11
build --java_language_version=11

# Hide Java 8 deprecation warnings.
common --javacopt=-Xlint:-options

3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ bazel-cel-java
bazel-out
bazel-testlogs

MODULE.bazel*

# IntelliJ IDEA
.idea
*.iml
Expand All @@ -32,3 +30,4 @@ target
mvn-artifacts

*.swp
*.lock
115 changes: 115 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

module(
name = "cel_java",
)

bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_jvm_external", version = "6.7")
bazel_dep(name = "protobuf", version = "29.3", repo_name = "com_google_protobuf") # see https://github.com/bazelbuild/rules_android/issues/373
bazel_dep(name = "googleapis", version = "0.0.0-20241220-5e258e33.bcr.1", repo_name = "com_google_googleapis")
bazel_dep(name = "rules_pkg", version = "1.0.1")
bazel_dep(name = "rules_license", version = "1.0.0")
bazel_dep(name = "rules_proto", version = "7.1.0")
bazel_dep(name = "rules_java", version = "8.12.0")
bazel_dep(name = "rules_android", version = "0.6.4")
bazel_dep(name = "googleapis-java", version = "1.0.0")
bazel_dep(name = "cel-spec", repo_name = "cel_spec", version = "0.24.0")

switched_rules = use_extension("@com_google_googleapis//:extensions.bzl", "switched_rules")
switched_rules.use_languages(java = True)
use_repo(switched_rules, "com_google_googleapis_imports")

maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")

GUAVA_VERSION = "33.4.8"
TRUTH_VERSION = "1.4.4"

# Compile only artifacts
[
maven.artifact(
neverlink = True,
artifact = artifact,
group = group,
version = version,
)
for group, artifact, version in [coord.split(":") for coord in [
"com.google.code.findbugs:annotations:3.0.1",
"com.google.errorprone:error_prone_annotations:2.38.0",
]]
]

# Test only artifacts
[
maven.artifact(
testonly = True,
artifact = artifact,
group = group,
version = version,
)
for group, artifact, version in [coord.split(":") for coord in [
"org.mockito:mockito-core:4.11.0",
"io.github.classgraph:classgraph:4.8.179",
"com.google.testparameterinjector:test-parameter-injector:1.18",
"com.google.guava:guava-testlib:" + GUAVA_VERSION + "-jre",
"com.google.truth.extensions:truth-java8-extension:" + TRUTH_VERSION,
"com.google.truth.extensions:truth-proto-extension:" + TRUTH_VERSION,
"com.google.truth.extensions:truth-liteproto-extension:" + TRUTH_VERSION,
"com.google.truth:truth:" + TRUTH_VERSION,

]]
]

maven.install(
name = "maven",
# keep sorted
artifacts = [
"com.google.auto.value:auto-value:1.11.0",
"com.google.auto.value:auto-value-annotations:1.11.0",
"com.google.guava:guava:" + GUAVA_VERSION + "-jre",
"com.google.protobuf:protobuf-java:4.31.0",
"com.google.protobuf:protobuf-java-util:4.31.0",
"com.google.re2j:re2j:1.8",
"info.picocli:picocli:4.7.7",
"org.antlr:antlr4-runtime:4.13.2",
"org.freemarker:freemarker:2.3.34",
"org.jspecify:jspecify:1.0.0",
"org.threeten:threeten-extra:1.8.0",
"org.yaml:snakeyaml:2.4",
],
repositories = [
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
)

maven.install(
name = "maven_android",
# keep sorted
artifacts = [
"com.google.guava:guava:" + GUAVA_VERSION + "-android",
"com.google.protobuf:protobuf-javalite:4.31.0",
],
repositories = [
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
)

use_repo(maven, "maven", "maven_android")

non_module_dependencies = use_extension("//:repositories.bzl", "non_module_dependencies")
use_repo(non_module_dependencies, "antlr4_jar")
use_repo(non_module_dependencies, "bazel_common")
Loading
Loading