diff --git a/.bazelrc b/.bazelrc index 554440cf..3ce91d27 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1 +1 @@ -build --cxxopt=-std=c++14 --host_cxxopt=-std=c++14 +common --enable_bzlmod diff --git a/.bazelversion b/.bazelversion index 91e4a9f2..a8a18875 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -6.3.2 +7.1.2 diff --git a/.gitignore b/.gitignore index 70007a4a..ffa42aac 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,6 @@ build local.properties *.iml /bazel-* + +# Following https://github.com/bazelbuild/rules_java/blob/master/.gitignore#L20 example, ignore the lock file. +MODULE.bazel.lock diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 00000000..1bea6452 --- /dev/null +++ b/MODULE.bazel @@ -0,0 +1,47 @@ +module( + name = "grpc-kotlin", + version = "0.0.0", + repo_name = "com_github_grpc_grpc_kotlin", +) + +bazel_dep(name = "rules_jvm_external", version = "6.1") +bazel_dep(name = "rules_proto", version = "6.0.0") +bazel_dep( + name = "grpc-java", + version = "1.62.2", + repo_name = "io_grpc_grpc_java", +) +bazel_dep( + name = "protobuf", + version = "24.4", # Latest doesn't seem to work. TODO: Pick the latest working version... + repo_name = "com_google_protobuf", +) +bazel_dep(name = "rules_kotlin", version = "1.9.5", repo_name = "io_bazel_rules_kotlin") + +IO_GRPC_GRPC_KOTLIN_ARTIFACTS = [ + "com.google.guava:guava:32.0.1-android", + "com.squareup:kotlinpoet:1.14.2", + "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3", + "org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.7.3", + "org.jetbrains.kotlinx:kotlinx-coroutines-debug:1.7.3", +] + +maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven") +maven.install( + name = "grpc_kotlin_maven", + artifacts = [ + "io.grpc:protoc-gen-grpc-kotlin:1.4.1", + "com.google.jimfs:jimfs:1.3.0", + "com.google.truth.extensions:truth-proto-extension:1.1.3", + "com.google.protobuf:protobuf-kotlin:4.27.1", + ] + IO_GRPC_GRPC_KOTLIN_ARTIFACTS, + generate_compat_repositories = True, + repositories = [ + "https://repo.maven.apache.org/maven2/", + ], +) +use_repo( + maven, + "com_google_guava_guava", + maven = "grpc_kotlin_maven", +) diff --git a/WORKSPACE.bzlmod b/WORKSPACE.bzlmod new file mode 100644 index 00000000..e69de29b