Skip to content

Commit 997f712

Browse files
authored
Merge pull request #2 from zZHorizonZz/update
Update Docs
1 parent f0db090 commit 997f712

15 files changed

+441
-496
lines changed

.github/workflows/publish.yml

Lines changed: 74 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,103 @@
1-
name: Publish the how-to
1+
name: Build and Publish
22

33
on:
44
push:
55
branches:
66
- master
7+
pull_request:
8+
branches:
9+
- master
710
schedule:
8-
- cron: '0 0 * * *'
11+
- cron: '0 0 * * *' # Daily build at midnight UTC
12+
13+
env:
14+
JAVA_VERSION: '17'
15+
MAVEN_VERSION: '3.9.5'
16+
MAVEN_OPTS: '-Xmx3072m'
917

1018
permissions:
1119
contents: read
1220
pages: write
1321
id-token: write
22+
actions: read
1423

1524
jobs:
16-
build-and-deploy:
17-
runs-on: ubuntu-latest
25+
build:
26+
name: Build on ${{ matrix.os }}
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
os: [ubuntu-latest, windows-latest, macos-latest]
31+
runs-on: ${{ matrix.os }}
32+
1833
steps:
19-
- uses: actions/checkout@v4
20-
- uses: actions/setup-java@v4
34+
- name: Checkout repository
35+
uses: actions/checkout@v4
36+
with:
37+
fetch-depth: 0
38+
39+
- name: Set up JDK ${{ env.JAVA_VERSION }}
40+
uses: actions/setup-java@v4
2141
with:
2242
distribution: 'temurin'
23-
java-version: '17'
24-
- name: Run builds
25-
run: |
26-
mkdir --parents "$HOME/.local/bin"
27-
curl -sL https://github.com/protocolbuffers/protobuf-javascript/releases/download/v3.21.4/protobuf-javascript-3.21.4-linux-x86_64.tar.gz | tar xzfO - bin/protoc-gen-js > "$HOME/.local/bin/protoc-gen-js"
28-
chmod u+x "$HOME/.local/bin/protoc-gen-js"
29-
curl -sL https://github.com/grpc/grpc-web/releases/download/1.5.0/protoc-gen-grpc-web-1.5.0-linux-x86_64 > "$HOME/.local/bin/protoc-gen-grpc-web"
30-
chmod u+x "$HOME/.local/bin/protoc-gen-grpc-web"
31-
./.run.builds.sh
43+
java-version: ${{ env.JAVA_VERSION }}
44+
cache: 'maven'
45+
46+
- name: Build with Maven
47+
run: mvn -B clean install
48+
49+
- name: Cache build artifacts
50+
uses: actions/cache@v3
51+
with:
52+
path: |
53+
~/.m2/repository
54+
target/
55+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
56+
restore-keys: |
57+
${{ runner.os }}-maven-
58+
59+
- name: Upload build artifacts
60+
uses: actions/upload-artifact@v4
61+
with:
62+
name: build-artifacts-${{ matrix.os }}
63+
path: target/
64+
retention-days: 5
65+
66+
publish:
67+
name: Generate and publish documentation
68+
runs-on: ubuntu-latest
69+
needs: build
70+
if: ${{ github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || github.event_name == 'schedule') }}
71+
72+
steps:
73+
- name: Checkout repository
74+
uses: actions/checkout@v4
75+
76+
- name: Download build artifacts
77+
uses: actions/download-artifact@v4
78+
with:
79+
name: build-artifacts-ubuntu-latest
80+
path: target/
81+
3282
- name: Setup Ruby
3383
uses: ruby/setup-ruby@v1
3484
with:
3585
ruby-version: '3.2.1'
36-
- name: Run Jekyll and deploy
86+
87+
- name: Install Jekyll dependencies
3788
run: ./.run.jekyll.sh
38-
- name: Setup Pages
89+
90+
- name: Setup GitHub Pages
3991
uses: actions/configure-pages@v3
92+
4093
- name: Upload GitHub Pages artifact
4194
uses: actions/upload-pages-artifact@v3
4295
with:
4396
path: ./_site/
97+
retention-days: 1
98+
4499
- name: Deploy to GitHub Pages
45100
id: deployment
46101
uses: actions/deploy-pages@v4
102+
with:
103+
timeout: 600000 # 10-minute timeout

README.adoc

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,8 @@ image::run.png[]
3030

3131
* A text editor or an IDE
3232
* Java 17 or higher
33-
* The https://github.com/protocolbuffers/protobuf-javascript/releases/tag/v3.21.4[`protoc` Javascript] plugin
34-
* The https://github.com/grpc/grpc-web/releases/tag/1.5.0[`protoc` gRPC Web] plugin
3533

36-
The `protoc` Javascript and gRPC Web plugin files must be installed somewhere on your `PATH` and be executable.
37-
38-
[TIP]
39-
====
40-
On several Linux systems, you can install the plugins like this:
41-
42-
[source,shell]
43-
----
44-
mkdir --parents "$HOME/.local/bin"
45-
curl -sL https://github.com/protocolbuffers/protobuf-javascript/releases/download/v3.21.4/protobuf-javascript-3.21.4-linux-x86_64.tar.gz | tar xzfO - bin/protoc-gen-js > "$HOME/.local/bin/protoc-gen-js"
46-
chmod u+x "$HOME/.local/bin/protoc-gen-js"
47-
curl -sL https://github.com/grpc/grpc-web/releases/download/1.5.0/protoc-gen-grpc-web-1.5.0-linux-x86_64 > "$HOME/.local/bin/protoc-gen-grpc-web"
48-
chmod u+x "$HOME/.local/bin/protoc-gen-grpc-web"
49-
----
50-
====
51-
52-
You don't have to install `protoc` or the Java plugin.
53-
They will be managed by a Maven plugin.
34+
You don't have to install `protoc` or the protoc plugins like vertx-grpc-protoc-plugin2, protobuf-javascript and protoc-gen-grpc-web as they will be managed by a Maven plugin.
5435

5536
== Create the project
5637

@@ -79,7 +60,7 @@ From the service definition, several files must be generated:
7960
* Javascript files
8061
* gRPC Web specific (Javascript) files.
8162

82-
The `protoc` invocation is managed with the https://github.com/xolstice/protobuf-maven-plugin[`protobuf-maven-plugin`].
63+
The `protoc` invocation is managed with the https://github.com/ascopes/protobuf-maven-plugin[`protobuf-maven-plugin`].
8364

8465
ifdef::env-github[]
8566
link:pom.xml[Maven POM file]
@@ -91,8 +72,7 @@ ifndef::env-github[]
9172
include::pom.xml[tags="protobuf-maven-plugin",indent=0]
9273
----
9374

94-
<1> Properties prefixed with `os.detected` are computed with the https://github.com/trustin/os-maven-plugin[os-maven-plugin] extension.
95-
<2> We choose to use the `CommonJS` modules generation style instead of closures.
75+
<1> We choose to use the `CommonJS` modules generation style instead of closures.
9676
endif::env-github[]
9777

9878
=== The server side

pom.xml

Lines changed: 78 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
<version>1.0-SNAPSHOT</version>
1111

1212
<properties>
13-
<vertx.version>5.0.0.CR2</vertx.version>
13+
<vertx.version>5.0.0</vertx.version>
1414
<grpc.version>1.65.1</grpc.version>
15-
<protoc.version>4.27.2</protoc.version>
16-
<protobuf.version>4.27.2</protobuf.version>
15+
<protoc.version>4.29.3</protoc.version>
16+
<protobuf.version>4.29.3</protobuf.version>
1717
</properties>
1818

1919
<!-- tag::dependencies[] -->
@@ -38,6 +38,7 @@
3838
<groupId>io.vertx</groupId>
3939
<artifactId>vertx-grpc-server</artifactId>
4040
</dependency>
41+
4142
<dependency>
4243
<groupId>com.google.protobuf</groupId>
4344
<artifactId>protobuf-java</artifactId>
@@ -62,66 +63,70 @@
6263
<!-- end::dependencies[] -->
6364

6465
<build>
65-
<extensions>
66-
<extension>
67-
<groupId>kr.motd.maven</groupId>
68-
<artifactId>os-maven-plugin</artifactId>
69-
<version>1.7.1</version>
70-
</extension>
71-
</extensions>
7266
<plugins>
7367
<!-- tag::protobuf-maven-plugin[] -->
7468
<plugin>
75-
<groupId>org.xolstice.maven.plugins</groupId>
69+
<groupId>io.github.ascopes</groupId>
7670
<artifactId>protobuf-maven-plugin</artifactId>
77-
<version>0.6.1</version>
71+
<version>3.2.0</version>
7872
<configuration>
79-
<protocArtifact>com.google.protobuf:protoc:${protoc.version}:exe:${os.detected.classifier}</protocArtifact> <!--1-->
80-
<clearOutputDirectory>false</clearOutputDirectory>
73+
<protocVersion>4.29.3</protocVersion>
74+
<sourceDirectories>src/main/proto</sourceDirectories>
75+
<javaEnabled>false</javaEnabled>
8176
</configuration>
8277
<executions>
8378
<execution>
8479
<id>compile-java</id>
8580
<configuration>
86-
<pluginId>grpc-java</pluginId>
87-
<pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}
88-
</pluginArtifact>
89-
<protocPlugins>
90-
<protocPlugin>
91-
<id>vertx-grpc-protoc-plugin2</id>
81+
<javaEnabled>true</javaEnabled>
82+
<outputDirectory>${project.basedir}/src/main/java</outputDirectory>
83+
<jvmMavenPlugins>
84+
<jvmMavenPlugin>
9285
<groupId>io.vertx</groupId>
9386
<artifactId>vertx-grpc-protoc-plugin2</artifactId>
9487
<version>${vertx.version}</version>
95-
<mainClass>io.vertx.grpc.plugin.VertxGrpcServerGenerator</mainClass>
96-
</protocPlugin>
97-
</protocPlugins>
98-
<pluginParameter>@generated=omit</pluginParameter>
99-
<outputDirectory>${project.basedir}/src/main/java</outputDirectory>
88+
<mainClass>io.vertx.grpc.plugin.VertxGrpcGenerator</mainClass>
89+
<jvmArgs>
90+
<jvmArg>--grpc-client=false</jvmArg>
91+
<jvmArg>--grpc-service</jvmArg>
92+
<jvmArg>--service-prefix=Vertx</jvmArg>
93+
<jvmArg>--vertx-codegen=false</jvmArg>
94+
</jvmArgs>
95+
</jvmMavenPlugin>
96+
</jvmMavenPlugins>
10097
</configuration>
10198
<goals>
102-
<goal>compile</goal>
103-
<goal>compile-custom</goal>
99+
<goal>generate</goal>
104100
</goals>
105101
</execution>
106102
<execution>
107-
<id>compile-js</id>
103+
<id>compile-javascript</id>
108104
<configuration>
109-
<javaScriptOptions>import_style=commonjs</javaScriptOptions> <!--2-->
110105
<outputDirectory>${project.basedir}/src/main/web</outputDirectory>
106+
<binaryUrlPlugins>
107+
<binaryUrlPlugin>
108+
<url>${protoc.gen.js.url}</url>
109+
<options>import_style=commonjs</options>
110+
</binaryUrlPlugin>
111+
</binaryUrlPlugins>
111112
</configuration>
112113
<goals>
113-
<goal>compile-js</goal>
114+
<goal>generate</goal>
114115
</goals>
115116
</execution>
116117
<execution>
117-
<id>compile-grpc-web</id>
118+
<id>compile-javascript-web</id>
118119
<configuration>
119-
<pluginId>grpc-web</pluginId>
120-
<pluginParameter>import_style=commonjs,mode=grpcwebtext</pluginParameter>
121120
<outputDirectory>${project.basedir}/src/main/web</outputDirectory>
121+
<binaryUrlPlugins>
122+
<binaryUrlPlugin>
123+
<url>${protoc.gen.grpc.web.url}</url>
124+
<options>import_style=typescript,mode=grpcwebtext</options>
125+
</binaryUrlPlugin>
126+
</binaryUrlPlugins>
122127
</configuration>
123128
<goals>
124-
<goal>compile-custom</goal>
129+
<goal>generate</goal>
125130
</goals>
126131
</execution>
127132
</executions>
@@ -177,4 +182,43 @@
177182
</plugins>
178183
</build>
179184

185+
<profiles>
186+
<profile>
187+
<id>windows</id>
188+
<activation>
189+
<os>
190+
<family>windows</family>
191+
</os>
192+
</activation>
193+
<properties>
194+
<protoc.gen.js.url>zip:https://github.com/protocolbuffers/protobuf-javascript/releases/download/v3.21.4/protobuf-javascript-3.21.4-win64.zip!/protobuf-javascript-3.21.4-win64/bin/protoc-gen-js.exe</protoc.gen.js.url>
195+
<protoc.gen.grpc.web.url>https://github.com/grpc/grpc-web/releases/download/1.5.0/protoc-gen-grpc-web-1.5.0-windows-x86_64.exe</protoc.gen.grpc.web.url>
196+
</properties>
197+
</profile>
198+
<profile>
199+
<id>unix</id>
200+
<activation>
201+
<os>
202+
<family>unix</family>
203+
</os>
204+
</activation>
205+
<properties>
206+
<protoc.gen.js.url>zip:https://github.com/protocolbuffers/protobuf-javascript/releases/download/v3.21.4/protobuf-javascript-3.21.4-linux-x86_64.zip!/bin/protoc-gen-js</protoc.gen.js.url>
207+
<protoc.gen.grpc.web.url>https://github.com/grpc/grpc-web/releases/download/1.5.0/protoc-gen-grpc-web-1.5.0-linux-x86_64</protoc.gen.grpc.web.url>
208+
</properties>
209+
</profile>
210+
<profile>
211+
<id>mac</id>
212+
<activation>
213+
<os>
214+
<family>mac</family>
215+
</os>
216+
</activation>
217+
<properties>
218+
<protoc.gen.js.url>zip:https://github.com/protocolbuffers/protobuf-javascript/releases/download/v3.21.4/protobuf-javascript-3.21.4-osx-x86_64.zip!/bin/protoc-gen-js</protoc.gen.js.url>
219+
<protoc.gen.grpc.web.url>https://github.com/grpc/grpc-web/releases/download/1.5.0/protoc-gen-grpc-web-1.5.0-darwin-x86_64</protoc.gen.grpc.web.url>
220+
</properties>
221+
</profile>
222+
</profiles>
223+
180224
</project>

0 commit comments

Comments
 (0)