Skip to content

Commit

Permalink
Merge branch 'master' into kt_jvm_proto_helper
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesward authored Sep 27, 2023
2 parents 656f83b + 43256eb commit bc7e4ed
Show file tree
Hide file tree
Showing 25 changed files with 137 additions and 94 deletions.
1 change: 1 addition & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build --cxxopt=-std=c++14 --host_cxxopt=-std=c++14
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.1.0
6.3.2
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
## Change Log

### 1.4.0

#### Changes

* Bump org.gradle.test-retry from 1.5.2 to 1.5.4 by @dependabot in https://github.com/grpc/grpc-kotlin/pull/413
* Bump uraimo/run-on-arch-action from 2.0.5 to 2.5.1 by @dependabot in https://github.com/grpc/grpc-kotlin/pull/404
* Bump actions/cache from 1 to 3 by @dependabot in https://github.com/grpc/grpc-kotlin/pull/406
* Bump actions/checkout from 1 to 3 by @dependabot in https://github.com/grpc/grpc-kotlin/pull/408
* Bump actions/setup-java from 2 to 3 by @dependabot in https://github.com/grpc/grpc-kotlin/pull/409
* Bump org.junit.jupiter:junit-jupiter-engine from 5.8.2 to 5.10.0 by @dependabot in https://github.com/grpc/grpc-kotlin/pull/405
* Bump com.google.jimfs:jimfs from 1.2 to 1.3.0 by @dependabot in https://github.com/grpc/grpc-kotlin/pull/407
* Bump com.google.protobuf from 0.8.18 to 0.9.4 by @dependabot in https://github.com/grpc/grpc-kotlin/pull/412
* Bump org.jetbrains.dokka from 1.6.21 to 1.8.20 by @dependabot in https://github.com/grpc/grpc-kotlin/pull/416
* Bump jvm from 1.9.0 to 1.9.10 in /examples by @dependabot in https://github.com/grpc/grpc-kotlin/pull/410
* Bump com.google.truth.extensions:truth-proto-extension from 1.1.3 to 1.1.5 by @dependabot in https://github.com/grpc/grpc-kotlin/pull/419
* Bump io.github.gradle-nexus.publish-plugin from 1.1.0 to 1.3.0 by @dependabot in https://github.com/grpc/grpc-kotlin/pull/418
* Bump org.mockito:mockito-core from 4.5.1 to 4.11.0 by @dependabot in https://github.com/grpc/grpc-kotlin/pull/422
* Bump com.google.protobuf:protobuf-gradle-plugin from 0.8.18 to 0.9.4 by @dependabot in https://github.com/grpc/grpc-kotlin/pull/421
* Bump org.jetbrains.dokka from 1.8.20 to 1.9.0 by @dependabot in https://github.com/grpc/grpc-kotlin/pull/424
* Bump actions/checkout from 3 to 4 by @dependabot in https://github.com/grpc/grpc-kotlin/pull/426
* Bump composeVersion from 1.5.0 to 1.5.1 in /examples by @dependabot in https://github.com/grpc/grpc-kotlin/pull/427
* Bump org.gradle.test-retry from 1.5.4 to 1.5.5 by @dependabot in https://github.com/grpc/grpc-kotlin/pull/430
* version bumps and related fixes by @jamesward in https://github.com/grpc/grpc-kotlin/pull/417

## New Contributors
* @brettchabot made their first contribution in https://github.com/grpc/grpc-kotlin/pull/417
* @dependabot made their first contribution in https://github.com/grpc/grpc-kotlin/pull/413

**Full Changelog**: https://github.com/grpc/grpc-kotlin/compare/v1.3.1...v1.4.0


### 1.3.1

#### Changes
Expand Down
6 changes: 3 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ load(
# Maven
maven_install(
artifacts = [
"com.google.jimfs:jimfs:1.1",
"com.google.truth.extensions:truth-proto-extension:1.0.1",
"com.google.protobuf:protobuf-kotlin:3.18.0",
"com.google.jimfs:jimfs:1.3.0",
"com.google.truth.extensions:truth-proto-extension:1.1.3",
"com.google.protobuf:protobuf-kotlin:3.24.1",
] + IO_GRPC_GRPC_KOTLIN_ARTIFACTS + IO_GRPC_GRPC_JAVA_ARTIFACTS,
override_targets = dict(
IO_GRPC_GRPC_KOTLIN_OVERRIDE_TARGETS.items() +
Expand Down
20 changes: 8 additions & 12 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "1.6.21" apply false
kotlin("jvm") version "1.8.0" apply false
id("com.google.protobuf") version "0.9.4" apply false
id("org.gradle.test-retry") version "1.5.5"
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
}

group = "io.grpc"
version = "1.3.1" // CURRENT_GRPC_KOTLIN_VERSION
version = "1.4.0" // CURRENT_GRPC_KOTLIN_VERSION

ext["grpcVersion"] = "1.46.0"
ext["protobufVersion"] = "3.20.1"
ext["coroutinesVersion"] = "1.6.2"
ext["grpcVersion"] = "1.57.2"
ext["protobufVersion"] = "3.24.1"
ext["coroutinesVersion"] = "1.7.3"

subprojects {

Expand Down Expand Up @@ -134,11 +134,7 @@ subprojects {
}
}

nexusPublishing {
repositories {
sonatype {
username.set(System.getenv("SONATYPE_USERNAME"))
password.set(System.getenv("SONATYPE_PASSWORD"))
}
}
nexusPublishing.repositories.sonatype {
username.set(System.getenv("SONATYPE_USERNAME"))
password.set(System.getenv("SONATYPE_PASSWORD"))
}
6 changes: 3 additions & 3 deletions compiler/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ dependencies {

// Misc
implementation(kotlin("reflect"))
implementation("com.squareup:kotlinpoet:1.11.0")
implementation("com.google.truth:truth:1.1.3")
implementation("com.squareup:kotlinpoet:1.14.2")
implementation("com.google.truth:truth:1.1.5")

// Testing
testImplementation("junit:junit:4.13.2")
testImplementation("com.google.guava:guava:29.0-jre")
testImplementation("com.google.guava:guava:32.1.2-jre")
testImplementation("com.google.jimfs:jimfs:1.3.0")
testImplementation("com.google.protobuf:protobuf-gradle-plugin:0.9.4")
testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,43 +32,43 @@ fun assertThat(declarations: Declarations): DeclarationsSubject =
/** A Truth subject for [Declarations]. */
class DeclarationsSubject(
failureMetadata: FailureMetadata,
private val actual: Declarations
private val actual: Declarations?
) : Subject(failureMetadata, actual) {
fun generatesTopLevel(indentedCode: String) {
val actualCode =
FileSpec.builder("", "MyDeclarations.kt")
.apply { actual.writeOnlyTopLevel(this) }
.apply { actual?.writeOnlyTopLevel(this) }
.build()
check("topLevel").about(fileSpecs).that(actualCode).generates(indentedCode)
}

fun generatesEnclosed(indentedCode: String) {
val actualCode =
FileSpec.builder("", "MyDeclarations.kt")
.apply { actual.writeToEnclosingFile(this) }
.apply { actual?.writeToEnclosingFile(this) }
.build()
check("enclosed").about(fileSpecs).that(actualCode).generates(indentedCode)
}

fun generatesNoTopLevelMembers() {
val actualCode =
FileSpec.builder("", "MyDeclarations.kt")
.apply { actual.writeOnlyTopLevel(this) }
.apply { actual?.writeOnlyTopLevel(this) }
.build()
check("topLevel")
.withMessage("top level declarations: %s", actualCode)
.that(actual.hasTopLevelDeclarations)
.that(actual?.hasTopLevelDeclarations)
.isFalse()
}

fun generatesNoEnclosedMembers() {
val actualCode =
FileSpec.builder("", "MyDeclarations.kt")
.apply { actual.writeToEnclosingFile(this) }
.apply { actual?.writeToEnclosingFile(this) }
.build()
check("enclosed")
.withMessage("enclosed declarations: %s", actualCode)
.that(actual.hasEnclosingScopeDeclarations)
.that(actual?.hasEnclosingScopeDeclarations)
.isFalse()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fun assertThat(fileSpec: FileSpec): FileSpecSubject = assertAbout(fileSpecs).tha
/** A Truth subject for [FileSpec]. */
class FileSpecSubject(
failureMetadata: FailureMetadata,
private val actual: FileSpec
private val actual: FileSpec?
) : Subject(failureMetadata, actual) {
fun generates(indentedCode: String) {
val expectedCode = indentedCode.trimIndent()
Expand All @@ -38,6 +38,6 @@ class FileSpecSubject(
}

fun hasName(name: String) {
check("name").that(actual.name).isEqualTo(name)
check("name").that(actual?.name).isEqualTo(name)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fun assertThat(funSpec: FunSpec): FunSpecSubject = Truth.assertAbout(funSpecs).t
/** A Truth subject for [FunSpec]. */
class FunSpecSubject(
failureMetadata: FailureMetadata,
private val actual: FunSpec
private val actual: FunSpec?
) : Subject(failureMetadata, actual) {
fun generates(indentedCode: String) {
val expectedCode = indentedCode.trimIndent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fun assertThat(typeSpec: TypeSpec): TypeSpecSubject = assertAbout(typeSpecs).tha
/** A Truth subject for [TypeSpec]. */
class TypeSpecSubject(
failureMetadata: FailureMetadata,
private val actual: TypeSpec
private val actual: TypeSpec?
) : Subject(failureMetadata, actual) {
fun generates(indentedCode: String) {
val expectedCode = indentedCode.trimIndent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,10 @@ class DeclarationsTest {
package com.foo.bar
import kotlin.Int
import kotlin.Unit
public val someProperty: Int
public fun someFunction(): Unit {
public fun someFunction() {
}
""".trimIndent()
)
Expand Down Expand Up @@ -111,10 +110,8 @@ class DeclarationsTest {
"""
package com.foo.bar
import kotlin.Unit
public object SomeObject {
public fun someFunction(): Unit {
public fun someFunction() {
}
}
""".trimIndent()
Expand Down Expand Up @@ -172,9 +169,7 @@ class DeclarationsTest {
assertThat(decls)
.generatesTopLevel(
"""
import kotlin.Unit
public fun someFunction(): Unit {
public fun someFunction() {
}
"""
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ class GeneratorConfigTest {
"""
package com.google
import kotlin.Unit
public fun fooBar(): Unit {
public fun fooBar() {
}
""".trimIndent()
)
Expand All @@ -77,9 +75,7 @@ class GeneratorConfigTest {
"""
package com.google
import kotlin.Unit
public inline fun fooBar(): Unit {
public inline fun fooBar() {
}
""".trimIndent()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package io.grpc.kotlin.generator.protoc.testing

import com.google.common.truth.ExpectFailure.SimpleSubjectBuilderCallback
import com.google.common.truth.ExpectFailure.expectFailureAbout
import com.squareup.kotlinpoet.INT
import com.squareup.kotlinpoet.PropertySpec
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/test/proto/helloworld/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ package(default_visibility = ["//compiler/src/test:__subpackages__"])
proto_library(
name = "hello_world_proto",
srcs = ["helloworld.proto"],
strip_import_prefix = "//compiler/src/test/proto",
strip_import_prefix = "/compiler/src/test/proto",
)

java_proto_library(
Expand Down
18 changes: 9 additions & 9 deletions compiler/src/test/proto/testing/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ package(default_visibility = ["//compiler/src/test:__subpackages__"])
proto_library(
name = "example3_proto",
srcs = ["example3.proto"],
strip_import_prefix = "//compiler/src/test/proto",
strip_import_prefix = "/compiler/src/test/proto",
deps = ["@com_google_protobuf//:wrappers_proto"],
)

Expand All @@ -21,7 +21,7 @@ java_proto_library(
proto_library(
name = "has_explicit_outer_class_name_proto",
srcs = ["has_explicit_outer_class_name.proto"],
strip_import_prefix = "//compiler/src/test/proto",
strip_import_prefix = "/compiler/src/test/proto",
)

java_proto_library(
Expand All @@ -32,7 +32,7 @@ java_proto_library(
proto_library(
name = "has_nested_class_name_conflict_proto",
srcs = ["has_nested_class_name_conflict.proto"],
strip_import_prefix = "//compiler/src/test/proto",
strip_import_prefix = "/compiler/src/test/proto",
)

java_proto_library(
Expand All @@ -43,7 +43,7 @@ java_proto_library(
proto_library(
name = "has_outer_class_name_conflict_proto",
srcs = ["has_outer_class_name_conflict.proto"],
strip_import_prefix = "//compiler/src/test/proto",
strip_import_prefix = "/compiler/src/test/proto",
)

java_proto_library(
Expand All @@ -54,7 +54,7 @@ java_proto_library(
proto_library(
name = "implicit_java_package_proto",
srcs = ["implicit_java_package.proto"],
strip_import_prefix = "//compiler/src/test/proto",
strip_import_prefix = "/compiler/src/test/proto",
)

java_proto_library(
Expand All @@ -65,7 +65,7 @@ java_proto_library(
proto_library(
name = "proto-file-with-hyphen_proto",
srcs = ["proto-file-with-hyphen.proto"],
strip_import_prefix = "//compiler/src/test/proto",
strip_import_prefix = "/compiler/src/test/proto",
)

java_proto_library(
Expand All @@ -76,7 +76,7 @@ java_proto_library(
proto_library(
name = "service_name_conflicts_with_file_proto",
srcs = ["service_name_conflicts_with_file.proto"],
strip_import_prefix = "//compiler/src/test/proto",
strip_import_prefix = "/compiler/src/test/proto",
)

java_proto_library(
Expand All @@ -87,7 +87,7 @@ java_proto_library(
proto_library(
name = "service_t_proto",
srcs = ["serviceT.proto"],
strip_import_prefix = "//compiler/src/test/proto",
strip_import_prefix = "/compiler/src/test/proto",
)

java_proto_library(
Expand All @@ -98,7 +98,7 @@ java_proto_library(
proto_library(
name = "test_proto3_optional",
srcs = ["test_proto3_optional.proto"],
strip_import_prefix = "//compiler/src/test/proto",
strip_import_prefix = "/compiler/src/test/proto",
)

java_proto_library(
Expand Down
4 changes: 2 additions & 2 deletions examples/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ plugins {
id("com.android.application") version "8.1.1" apply false
id("com.google.protobuf") version "0.9.4" apply false
kotlin("jvm") version "1.9.10" apply false
id("org.jlleitschuh.gradle.ktlint") version "11.5.1" apply false
id("org.jlleitschuh.gradle.ktlint") version "11.6.0" apply false
}

// todo: move to subprojects, but how?
ext["grpcVersion"] = "1.57.2"
ext["grpcKotlinVersion"] = "1.3.1" // CURRENT_GRPC_KOTLIN_VERSION
ext["grpcKotlinVersion"] = "1.4.0" // CURRENT_GRPC_KOTLIN_VERSION
ext["protobufVersion"] = "3.24.1"
ext["coroutinesVersion"] = "1.7.3"

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit bc7e4ed

Please sign in to comment.