Skip to content

Commit f96e028

Browse files
lowasserduckladydinh
authored andcommitted
Upgrade to Bazel 7.6.1 (LTS), Java 17, bzlmod and C++ 17.
1 parent a969a91 commit f96e028

24 files changed

+1501
-169
lines changed

.bazelrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
build --cxxopt=-std=c++14 --host_cxxopt=-std=c++14
1+
build --cxxopt=-std=c++17 --host_cxxopt=-std=c++17

.bazelversion

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.3.2
1+
7.6.1

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ build
55
local.properties
66
*.iml
77
/bazel-*
8+
MODULE.bazel.lock
9+
*/bin/*

MODULE.bazel

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
module(
2+
name = "com_github_grpc_grpc_kotlin",
3+
version = "2.1.0",
4+
)
5+
6+
bazel_dep(name = "protobuf", repo_name = "com_google_protobuf", version = "30.2")
7+
bazel_dep(name = "rules_kotlin", repo_name = "io_bazel_rules_kotlin", version = "2.1.3")
8+
bazel_dep(name = "rules_java", version = "8.11.0")
9+
bazel_dep(name = "rules_jvm_external", version = "6.7")
10+
bazel_dep(name = "grpc-java", repo_name = "io_grpc_grpc_java", version = "1.71.0")
11+
12+
maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
13+
maven.install(
14+
# Rerun whenever adding new artifacts.
15+
# $ REPIN=1 bazelisk run @maven//:pin
16+
artifacts = [
17+
"com.google.jimfs:jimfs:1.3.0",
18+
"com.google.truth:truth:1.4.2",
19+
"com.google.truth.extensions:truth-proto-extension:1.4.2",
20+
"com.google.protobuf:protobuf-java:4.30.2",
21+
"com.google.protobuf:protobuf-kotlin:4.30.2",
22+
"com.google.guava:guava:33.3.1-android",
23+
"com.squareup:kotlinpoet:1.14.2",
24+
"junit:junit:4.13.2",
25+
"org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1",
26+
"org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.10.1",
27+
],
28+
fetch_sources = False,
29+
lock_file = "//:maven_install.json",
30+
generate_compat_repositories = True,
31+
strict_visibility = True,
32+
)
33+
use_repo(maven, "maven")

WORKSPACE

-70
This file was deleted.

build.gradle.kts

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ subprojects {
4040
version = rootProject.version
4141

4242
tasks.withType<JavaCompile> {
43-
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
44-
targetCompatibility = JavaVersion.VERSION_1_8.toString()
43+
sourceCompatibility = JavaVersion.VERSION_17.toString()
44+
targetCompatibility = JavaVersion.VERSION_17.toString()
4545
}
4646

4747
tasks.withType<KotlinCompile> {
4848
kotlinOptions {
4949
freeCompilerArgs = listOf("-Xjsr305=strict")
50-
jvmTarget = JavaVersion.VERSION_1_8.toString()
50+
jvmTarget = JavaVersion.VERSION_17.toString()
5151
}
5252
}
5353

compiler/build.gradle.kts

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ application {
1111
java {
1212
withSourcesJar()
1313
toolchain {
14-
languageVersion = JavaLanguageVersion.of(8)
14+
languageVersion = JavaLanguageVersion.of(17)
1515
}
1616
}
1717

@@ -34,7 +34,6 @@ dependencies {
3434
testImplementation(libs.jimfs)
3535
testImplementation(libs.protobuf.gradle.plugin)
3636
testImplementation(libs.protobuf.java)
37-
testImplementation(libs.mockito.kotlin)
3837
testImplementation(libs.junit.jupiter.engine)
3938
testImplementation(libs.mockito.core)
4039
}

compiler/src/main/java/io/grpc/kotlin/generator/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ kt_jvm_library(
1313
"//compiler/src/main/java/io/grpc/kotlin/generator/protoc",
1414
"//stub/src/main/java/io/grpc/kotlin:context",
1515
"//stub/src/main/java/io/grpc/kotlin:stub",
16-
"@com_google_guava_guava",
1716
"@com_google_protobuf//:protobuf_java",
1817
"@io_grpc_grpc_java//core",
18+
"@maven//:com_google_guava_guava",
1919
"@maven//:com_squareup_kotlinpoet",
2020
"@maven//:org_jetbrains_kotlinx_kotlinx_coroutines_core",
2121
],

compiler/src/main/java/io/grpc/kotlin/generator/protoc/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ kt_jvm_library(
1111
srcs = glob(["*.kt"]),
1212
deps = [
1313
"//compiler/src/main/java/io/grpc/kotlin/generator/protoc/util/graph",
14-
"@com_google_guava_guava",
1514
"@com_google_protobuf//:protobuf_java",
15+
"@maven//:com_google_guava_guava",
1616
"@maven//:com_squareup_kotlinpoet",
1717
],
1818
)

compiler/src/main/java/io/grpc/kotlin/generator/protoc/util/graph/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ kt_jvm_library(
1111
srcs = ["TopologicalSortGraph.kt"],
1212
deps = [
1313
"//compiler/src/main/java/io/grpc/kotlin/generator/protoc/util/sort",
14-
"@com_google_guava_guava//:com_google_guava_guava",
14+
"@maven//:com_google_guava_guava",
1515
],
1616
)

compiler/src/main/java/io/grpc/kotlin/generator/protoc/util/graph/TopologicalSortGraph.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import io.grpc.kotlin.generator.protoc.util.sort.TopologicalSort.sortLexicograph
2323

2424
@Beta
2525
object TopologicalSortGraph {
26-
fun <N> topologicalOrdering(graph: Graph<N>): List<N> {
26+
fun <N: Any> topologicalOrdering(graph: Graph<N>): List<N> {
2727
checkArgument(graph.isDirected, "Cannot get topological ordering of an undirected graph.")
2828
val partialOrdering: PartialOrdering<N> = object : PartialOrdering<N> {
2929
override fun getPredecessors(element: N): Set<N> = element?.let {

examples/android/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ dependencies {
1616
}
1717

1818
kotlin {
19-
jvmToolchain(8)
19+
jvmToolchain(17)
2020
}
2121

2222
android {

examples/client/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
}
55

66
kotlin {
7-
jvmToolchain(8)
7+
jvmToolchain(17)
88
}
99

1010
dependencies {

examples/gradle/libs.versions.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[plugins]
22
android-application = { id = "com.android.application", version = "8.3.0" }
33
android-library = { id = "com.android.library", version = "8.3.0" }
4-
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version = "1.9.23" }
5-
kotlin-android = { id = "org.jetbrains.kotlin.android", version = "1.9.23" }
6-
protobuf = { id = "com.google.protobuf", version = "0.9.4" }
4+
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version = "2.1.20" }
5+
kotlin-android = { id = "org.jetbrains.kotlin.android", version = "2.1.20" }
6+
protobuf = { id = "com.google.protobuf", version = "0.9.5" }
77
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version = "12.1.0" }
88
palantir-graal = { id = "com.palantir.graal", version = "0.12.0" }
99
jib = { id = "com.google.cloud.tools.jib", version = "3.4.1" }

examples/server/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ plugins {
55
}
66

77
kotlin {
8-
jvmToolchain(8)
8+
jvmToolchain(17)
99
}
1010

1111
dependencies {

examples/stub-android/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ dependencies {
1616
}
1717

1818
kotlin {
19-
jvmToolchain(8)
19+
jvmToolchain(17)
2020
}
2121

2222
android {

examples/stub-lite/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ dependencies {
1515
}
1616

1717
kotlin {
18-
jvmToolchain(8)
18+
jvmToolchain(17)
1919
}
2020

2121
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().all {

examples/stub/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ dependencies {
1616
}
1717

1818
kotlin {
19-
jvmToolchain(8)
19+
jvmToolchain(17)
2020
}
2121

2222
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().all {

gradle/libs.versions.toml

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
[plugins]
2-
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version = "1.8.0" }
3-
protobuf = { id = "com.google.protobuf", version = "0.9.4" }
2+
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version = "2.1.20" }
3+
protobuf = { id = "com.google.protobuf", version = "0.9.5" }
44
test-retry = { id = "org.gradle.test-retry", version = "1.5.7" }
5-
publish-plugin = { id = "io.github.gradle-nexus.publish-plugin", version = "1.3.0" }
6-
dokka = { id = "org.jetbrains.dokka", version = "1.9.20" }
5+
publish-plugin = { id = "io.github.gradle-nexus.publish-plugin", version = "2.0.0" }
6+
dokka = { id = "org.jetbrains.dokka", version = "2.0.0" }
77
qoomon-git-versioning = { id = "me.qoomon.git-versioning", version = "6.4.3" }
88
kotlin-power-assert = { id = "com.bnorm.power.kotlin-power-assert", version = "0.13.0" }
99

1010
[libraries]
11-
kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version = "1.8.0" }
12-
kotlinx-coroutines-core-jvm = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core-jvm", version = "1.8.0" }
13-
kotlinx-coroutines-debug = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-debug", version = "1.8.0" }
11+
kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version = "1.10.1" }
12+
kotlinx-coroutines-core-jvm = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core-jvm", version = "1.10.1" }
1413
grpc-protobuf = { group = "io.grpc", name = "grpc-protobuf", version = "1.62.2" }
1514
grpc-protobuf-lite = { group = "io.grpc", name = "grpc-protobuf-lite", version = "1.62.2" }
1615
grpc-alts = { group = "io.grpc", name = "grpc-alts", version = "1.62.2" }
@@ -26,11 +25,10 @@ junit = { group = "junit", name = "junit", version = "4.13.2" }
2625
junit-platform-launcher = { group = "org.junit.platform", name = "junit-platform-launcher", version = "1.10.2" }
2726
guava = { group = "com.google.guava", name = "guava", version = "33.0.0-jre" }
2827
jimfs = { group = "com.google.jimfs", name = "jimfs", version = "1.3.0" }
29-
protobuf-gradle-plugin = { group = "com.google.protobuf", name = "protobuf-gradle-plugin", version = "0.9.4" }
30-
mockito-kotlin = { group = "com.nhaarman.mockitokotlin2", name = "mockito-kotlin", version = "2.2.0" }
28+
protobuf-gradle-plugin = { group = "com.google.protobuf", name = "protobuf-gradle-plugin", version = "0.9.5" }
3129
junit-jupiter = { group = "org.junit.jupiter", name = "junit-jupiter", version = "5.10.2" }
3230
junit-jupiter-engine = { group = "org.junit.jupiter", name = "junit-jupiter-engine", version = "5.10.2" }
33-
mockito-core = { group = "org.mockito", name = "mockito-core", version = "4.11.0" }
31+
mockito-core = { group = "org.mockito", name = "mockito-core", version = "5.17.0" }
3432
protoc = { group = "com.google.protobuf", name = "protoc", version = "3.25.3" }
3533
protobuf-java = { group = "com.google.protobuf", name = "protobuf-java", version = "3.25.3" }
3634
truth = { group = "com.google.truth", name = "truth", version = "1.4.2" }

0 commit comments

Comments
 (0)