Skip to content
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

Auto mapping google.api.http #29

Merged
merged 41 commits into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
cefac69
just hold
DanielLiu1123 Nov 14, 2023
12ab3d4
Merge branch 'main' into pb-http-mapping
DanielLiu1123 Apr 6, 2024
3e43265
Refactor JsonTranscoderRouterFunction
DanielLiu1123 Apr 9, 2024
bd239a0
Rename to TranscodingRouterFunction
DanielLiu1123 Apr 9, 2024
bdd4fb9
Keep goging
DanielLiu1123 Apr 11, 2024
3c82079
Add processUnaryCall method
DanielLiu1123 Apr 11, 2024
3300c60
Refactor GrpcUtil
DanielLiu1123 Apr 11, 2024
7a08f54
Add some test code
DanielLiu1123 Apr 14, 2024
fd58a90
Upgrade SB 3.3.0
DanielLiu1123 Apr 14, 2024
15a8bbf
Fixes tests
DanielLiu1123 Apr 14, 2024
ef54b4c
Fixed spotbugs
DanielLiu1123 Apr 14, 2024
b401e0b
Almost done
DanielLiu1123 Apr 15, 2024
ce4c758
Error handling
DanielLiu1123 Apr 16, 2024
015f919
Cancel call
DanielLiu1123 Apr 16, 2024
72a7fe1
Change the way to copy githooks
DanielLiu1123 Apr 17, 2024
94ca0d6
feat: keep goging ERP-9588
DanielLiu1123 Apr 22, 2024
fe1506c
Refactor
DanielLiu1123 Apr 22, 2024
b2fe239
Keep going
DanielLiu1123 Apr 23, 2024
b1621ea
Change class name to HeaderConverter
DanielLiu1123 Apr 24, 2024
2fd3a49
Change method name
DanielLiu1123 Apr 24, 2024
81b9984
Change base package to grpcstarter
DanielLiu1123 Apr 24, 2024
5392fe6
GrpcService alias for Component
DanielLiu1123 Apr 24, 2024
f09dc42
see Component#value()
DanielLiu1123 Apr 24, 2024
3f43fcb
Refactor
DanielLiu1123 Apr 29, 2024
2e72fa0
Refactor
DanielLiu1123 May 1, 2024
044e512
Add transcoding webmvc/webflux
DanielLiu1123 May 1, 2024
4183e59
Use IdentityHashMap
DanielLiu1123 May 1, 2024
45583d6
Update application-grpc-starter-test-example.yml
DanielLiu1123 May 1, 2024
6fabde3
Optimize test extension
DanielLiu1123 May 1, 2024
c512f00
Add T2
DanielLiu1123 May 1, 2024
3025fda
rename to transcoding
DanielLiu1123 May 4, 2024
3d16deb
Almost done
DanielLiu1123 May 4, 2024
fbd037a
Add comment
DanielLiu1123 May 4, 2024
60f0d24
server stream supports non Get method
DanielLiu1123 May 4, 2024
095e4f8
optimize build
DanielLiu1123 May 4, 2024
e05045d
use api
DanielLiu1123 May 4, 2024
6fbf038
fix tests
DanielLiu1123 May 4, 2024
f23433b
optimize examples
DanielLiu1123 May 4, 2024
d5c3be4
optimize build
DanielLiu1123 May 4, 2024
89f0840
fix githooks script
DanielLiu1123 May 4, 2024
a5bff66
Update readme
DanielLiu1123 May 4, 2024
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Build](https://img.shields.io/github/actions/workflow/status/DanielLiu1123/grpc-starter/build.yml?branch=main)](https://github.com/DanielLiu1123/grpc-starter/actions)
[![Maven Central](https://img.shields.io/maven-central/v/io.github.danielliu1123/grpc-starter-dependencies?versionPrefix=3.)](https://central.sonatype.com/artifact/io.github.danielliu1123/grpc-starter-dependencies)
[![Maven Central](https://img.shields.io/maven-central/v/com.freemanan/grpc-starter-dependencies?versionPrefix=2.)](https://central.sonatype.com/artifact/com.freemanan/grpc-starter-dependencies)
[![Maven Central](https://img.shields.io/maven-central/v/io.github.danielliu1123/grpc-starter-dependencies?versionPrefix=2.)](https://central.sonatype.com/artifact/io.github.danielliu1123/grpc-starter-dependencies)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

[Documentation](https://danielliu1123.github.io/grpc-starter)
Expand Down Expand Up @@ -44,11 +44,11 @@ implementation("io.github.danielliu1123:grpc-boot-starter")

```java
@SpringBootApplication
@EnableGrpcClients("io.grpc")
public class SimpleApp extends SimpleServiceGrpc.SimpleServiceImplBase {

public static void main(String[] args) {
new SpringApplicationBuilder(SimpleApp.class)
.properties("grpc.client.base-packages=io.grpc")
.properties("grpc.client.authority=127.0.0.1:9090")
.run(args);
}
Expand Down
43 changes: 17 additions & 26 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
plugins {
id 'org.springframework.boot' version "${springBootVersion}" apply false
id 'io.spring.dependency-management' version "${springDependencyManagementVersion}" apply false
id "com.google.protobuf" version "${protobufGradlePluginVersion}" apply false
id 'com.diffplug.spotless' version "${spotlessVersion}" apply false
id "org.springframework.boot" version "${springBootVersion}" apply false
id "io.spring.dependency-management" version "${springDependencyManagementVersion}" apply false
id "com.diffplug.spotless" version "${spotlessVersion}" apply false
id "com.github.spotbugs" version "${spotbugsVersion}" apply false
id "build.buf" version "${bufGradlePluginVersion}" apply false
id "com.google.protobuf" version "${protobufGradlePluginVersion}" apply false
}

allprojects {
Expand All @@ -13,34 +12,33 @@ allprojects {
return
}

apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: "java"
apply plugin: "java-library"

java {
registerFeature('optionalSupport') {
registerFeature("optionalSupport") {
usingSourceSet(sourceSets.main)
}
}

repositories {
mavenLocal()
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}
compileJava {
options.encoding = 'UTF-8'
options.compilerArgs << '-parameters'
options.encoding = "UTF-8"
options.compilerArgs << "-parameters"
}
compileTestJava {
options.encoding = 'UTF-8'
options.compilerArgs << '-parameters'
options.encoding = "UTF-8"
options.compilerArgs << "-parameters"
}
test {
useJUnitPlatform()
}
// dependency management
apply plugin: 'io.spring.dependency-management'
apply plugin: "io.spring.dependency-management"
dependencyManagement {
imports {
mavenBom "org.springframework.boot:spring-boot-dependencies:${springBootVersion}"
Expand All @@ -57,9 +55,9 @@ allprojects {
compileOnly("com.github.spotbugs:spotbugs-annotations:${spotbugsAnnotationsVersion}")
}
// spotless
apply plugin: 'com.diffplug.spotless'
apply plugin: "com.diffplug.spotless"
spotless {
encoding 'UTF-8'
encoding "UTF-8"
java {
toggleOffOn()
removeUnusedImports()
Expand All @@ -69,7 +67,7 @@ allprojects {

targetExclude "build/generated/**"

custom('Refuse wildcard imports', {
custom("Refuse wildcard imports", {
if (it =~ /\nimport .*\*;/) {
throw new IllegalStateException("Do not use wildcard imports, 'spotlessApply' cannot resolve this issue, please fix it manually.")
}
Expand All @@ -78,17 +76,10 @@ allprojects {
}

// spotbugs
apply plugin: 'com.github.spotbugs'
apply plugin: "com.github.spotbugs"
spotbugs {
spotbugsTest.enabled = false
omitVisitors.addAll 'FindReturnRef', 'DontReusePublicIdentifiers'
omitVisitors.addAll "FindReturnRef", "DontReusePublicIdentifiers"
excludeFilter = file("${rootDir}/config/spotbugs/exclude.xml")
}
}

tasks.register('installGitHook', Copy) {
from "$rootProject.rootDir/.githooks"
into { new File(rootProject.rootDir, '.git/hooks') }
fileMode 0775
}
installGitHook
2 changes: 1 addition & 1 deletion docs/en-us/client/onboarding.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
1. Add the dependency:

```groovy
implementation 'com.freemanan:grpc-client-boot-starter'
implementation 'io.github.danielliu1123:grpc-client-boot-starter'
```

2. Configure the scanning of gRPC stubs:
Expand Down
4 changes: 2 additions & 2 deletions docs/en-us/extension/json-transcoder.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ HTTP/JSON call methods with just one set of gRPC implementations.
1. Add Dependencies

```groovy
implementation 'com.freemanan:grpc-boot-starter'
implementation 'com.freemanan:grpc-starter-web'
implementation 'io.github.danielliu1123:grpc-boot-starter'
implementation 'io.github.danielliu1123:grpc-starter-web'
implementation 'io.grpc:grpc-testing-proto' // For demonstration purposes, using gRPC's simple service
```

Expand Down
2 changes: 1 addition & 1 deletion docs/en-us/extension/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ clients.
1. Add dependencies

```groovy
implementation("com.freemanan:grpc-starter-metrics")
implementation("io.github.danielliu1123:grpc-starter-metrics")
// Actuator uses Micrometer as the metrics collection facade, here we use Prometheus
// You can refer to the list of metric collectors supported by Micrometer at https://micrometer.io/docs/
implementation("io.micrometer:micrometer-registry-prometheus")
Expand Down
4 changes: 2 additions & 2 deletions docs/en-us/extension/protobuf-validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ user
1. Add the dependency

```groovy
implementation("com.freemanan:grpc-starter-protovalidate")
implementation("io.github.danielliu1123:grpc-starter-protovalidate")
```

> In most cases, you only need the API module to depend on the `grpc-starter-protovalidate` module.
Expand Down Expand Up @@ -59,7 +59,7 @@ user
1. Add the dependency

```groovy
implementation("com.freemanan:grpc-starter-validation")
implementation("io.github.danielliu1123:grpc-starter-validation")
```

> In most cases, you only need the API module to depend on the `grpc-starter-validation` module.
Expand Down
2 changes: 1 addition & 1 deletion docs/en-us/extension/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The Test extension integrates with `SpringBootTest`.
Add the dependency:

```groovy
testImplementation("com.freemanan:grpc-starter-test")
testImplementation("io.github.danielliu1123:grpc-starter-test")
```

After adding the dependency, the gRPC server will communicate using in-process by default.
Expand Down
2 changes: 1 addition & 1 deletion docs/en-us/extension/tracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ clients.
2. Add dependencies

```groovy
implementation("com.freemanan:grpc-starter-tracing")
implementation("io.github.danielliu1123:grpc-starter-tracing")
// You can refer to the list of tracing systems supported by Micrometer at https://micrometer.io/docs/tracing
implementation("io.micrometer:micrometer-tracing-bridge-brave")
```
Expand Down
8 changes: 4 additions & 4 deletions docs/en-us/guide/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#### **Gradle**

```groovy
implementation platform('com.freemanan:grpc-starter-dependencies:3.2.4')
implementation 'com.freemanan:grpc-boot-starter'
implementation platform('io.github.danielliu1123:grpc-starter-dependencies:3.2.4')
implementation 'io.github.danielliu1123:grpc-boot-starter'
```

#### **Maven**
Expand All @@ -15,7 +15,7 @@ implementation 'com.freemanan:grpc-boot-starter'
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.freemanan</groupId>
<groupId>io.github.danielliu1123</groupId>
<artifactId>grpc-starter-dependencies</artifactId>
<version>3.2.4</version>
<type>pom</type>
Expand All @@ -25,7 +25,7 @@ implementation 'com.freemanan:grpc-boot-starter'
</dependencyManagement>

<dependency>
<groupId>com.freemanan</groupId>
<groupId>io.github.danielliu1123</groupId>
<artifactId>grpc-boot-starter</artifactId>
</dependency>
```
Expand Down
4 changes: 2 additions & 2 deletions docs/en-us/server/onboarding.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
Add dependencies:

```groovy
implementation 'com.freemanan:grpc-server-boot-starter'
implementation 'io.github.danielliu1123:grpc-server-boot-starter'
```

or

```groovy
implementation 'com.freemanan:grpc-boot-starter'
implementation 'io.github.danielliu1123:grpc-boot-starter'
```

> `grpc-boot-starter` includes `grpc-server-boot-starter` and `grpc-client-boot-starter`.
Expand Down
2 changes: 1 addition & 1 deletion docs/zh-cn/client/onboarding.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
1. 引入依赖

```groovy
implementation 'com.freemanan:grpc-client-boot-starter'
implementation 'io.github.danielliu1123:grpc-client-boot-starter'
```

2. 配置扫描 gRPC stubs
Expand Down
4 changes: 2 additions & 2 deletions docs/zh-cn/extension/json-transcoder.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ JSON transcoder 扩展将 gRPC 服务转换为 HTTP/JSON 服务,**_只需要
1. 添加依赖

```groovy
implementation 'com.freemanan:grpc-boot-starter'
implementation 'com.freemanan:grpc-starter-web'
implementation 'io.github.danielliu1123:grpc-boot-starter'
implementation 'io.github.danielliu1123:grpc-starter-web'
implementation 'io.grpc:grpc-testing-proto' // 为了演示,使用 gRPC 提供的 simple service
```

Expand Down
2 changes: 1 addition & 1 deletion docs/zh-cn/extension/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Metrics 扩展了 Spring Boot Actuator,为 gRPC 服务端和客户端提供了
1. 引入依赖

```groovy
implementation("com.freemanan:grpc-starter-metrics")
implementation("io.github.danielliu1123:grpc-starter-metrics")
// Actuator 使用 Micrometer 作为指标采集门面,这里使用 Prometheus
// Micrometer 支持的指标采集器可以参考 https://micrometer.io/docs/
implementation("io.micrometer:micrometer-registry-prometheus")
Expand Down
4 changes: 2 additions & 2 deletions docs/zh-cn/extension/protobuf-validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ user
1. 添加依赖项

```groovy
implementation("com.freemanan:grpc-starter-protovalidate")
implementation("io.github.danielliu1123:grpc-starter-protovalidate")
```

> 在大多数情况下,您只需要 API 模块依赖 `grpc-starter-protovalidate` 模块。
Expand Down Expand Up @@ -57,7 +57,7 @@ user
1. 添加依赖项

```groovy
implementation("com.freemanan:grpc-starter-validation")
implementation("io.github.danielliu1123:grpc-starter-validation")
```

> 在大多数情况下,您只需要 API 模块依赖 `grpc-starter-validation` 模块。
Expand Down
2 changes: 1 addition & 1 deletion docs/zh-cn/extension/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Test 扩展对 `SpringBootTest` 做了集成。
添加依赖:

```groovy
testImplementation("com.freemanan:grpc-starter-test")
testImplementation("io.github.danielliu1123:grpc-starter-test")
```

添加依赖后 gRPC server 默认会使用 in-process 进行通信,可以通过 `@InProcessName` 注解获取 in-process name。
Expand Down
2 changes: 1 addition & 1 deletion docs/zh-cn/extension/tracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Tracing 扩展了 Spring Boot Actuator,为 gRPC 服务端和客户端提供了
2. 引入依赖

```groovy
implementation("com.freemanan:grpc-starter-tracing")
implementation("io.github.danielliu1123:grpc-starter-tracing")
// Micrometer 支持的 Tracing system 可以参考 https://micrometer.io/docs/tracing
implementation("io.micrometer:micrometer-tracing-bridge-brave")
```
Expand Down
8 changes: 4 additions & 4 deletions docs/zh-cn/guide/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#### ** Gradle **

```groovy
implementation platform('com.freemanan:grpc-starter-dependencies:3.2.4')
implementation 'com.freemanan:grpc-boot-starter'
implementation platform('io.github.danielliu1123:grpc-starter-dependencies:3.2.4')
implementation 'io.github.danielliu1123:grpc-boot-starter'
```

#### ** Maven **
Expand All @@ -16,7 +16,7 @@ implementation 'com.freemanan:grpc-boot-starter'
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.freemanan</groupId>
<groupId>io.github.danielliu1123</groupId>
<artifactId>grpc-starter-dependencies</artifactId>
<version>3.2.4</version>
<type>pom</type>
Expand All @@ -26,7 +26,7 @@ implementation 'com.freemanan:grpc-boot-starter'
</dependencyManagement>

<dependency>
<groupId>com.freemanan</groupId>
<groupId>io.github.danielliu1123</groupId>
<artifactId>grpc-boot-starter</artifactId>
</dependency>
```
Expand Down
4 changes: 2 additions & 2 deletions docs/zh-cn/server/onboarding.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
添加依赖:

```groovy
implementation 'com.freemanan:grpc-server-boot-starter'
implementation 'io.github.danielliu1123:grpc-server-boot-starter'
```

或者

```groovy
implementation 'com.freemanan:grpc-boot-starter'
implementation 'io.github.danielliu1123:grpc-boot-starter'
```

> grpc-boot-starter 包含了 grpc-server-boot-starter 和 grpc-client-boot-starter
Expand Down
8 changes: 8 additions & 0 deletions examples/grpc-sample-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,11 @@ dependencies {

apply from: "${rootDir}/gradle/deploy.gradle"
apply from: "${rootDir}/gradle/protobuf.gradle"

sourceSets {
main {
proto {
srcDirs "proto"
}
}
}
23 changes: 0 additions & 23 deletions examples/grpc-sample-api/src/main/proto/sample/pet/v1/pet.proto

This file was deleted.

Loading