Skip to content

Commit

Permalink
grpc docs fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
michalszynkiewicz committed Jul 23, 2020
1 parent 3ecb368 commit bbb79f1
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public interface CodeGenProvider {
String providerId();

/**
* File extensions that CodeGenProvider will generate code from
* File extension that CodeGenProvider will generate code from
*
* @return collection of file extensions
* @return file extension
*/
@NotNull
String inputExtension();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
import io.quarkus.bootstrap.prebuild.CodeGenException;
import io.quarkus.deployment.codegen.CodeGenData;

/**
* A set of methods to initialize and execute {@link CodeGenProvider}s.
*/
public class CodeGenerator {

// used by Gradle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class QuarkusPrepare extends QuarkusTask {
private boolean test = false;

public QuarkusPrepare() {
super("Quarkus performs pre-build preparations, such as sources generation");
super("Performs Quarkus pre-build preparations, such as sources generation");
}

@TaskAction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import io.quarkus.deployment.CodeGenerator;
import io.quarkus.deployment.codegen.CodeGenData;

@Mojo(name = "prepare", defaultPhase = LifecyclePhase.GENERATE_SOURCES, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME)
@Mojo(name = "prepare", defaultPhase = LifecyclePhase.GENERATE_SOURCES, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, threadSafe = true)
public class CodeGenMojo extends AbstractMojo {

@Parameter(defaultValue = "${project.build.directory}")
Expand Down
27 changes: 14 additions & 13 deletions docs/src/main/asciidoc/grpc-getting-started.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ The default configuration is enough, but you can also select some extensions if

== Configuring your project

Edit the `pom.xml` file to add the Quarkus gRPC extension dependency (just under `<dependencies>`):

[source,xml]
----
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-grpc</artifactId>
</dependency>
----

Make sure you have `prepare` goal of `quarkus-maven-plugin` enabled in your `pom.xml`:

[source,xml]
Expand All @@ -39,7 +49,7 @@ Make sure you have `prepare` goal of `quarkus-maven-plugin` enabled in your `pom

With this configuration, you can put your service and message definitions in the `src/main/proto` directory.
`quarkus-maven-plugin` will generate Java files from your `proto` files.
Alternatively, you can use `protobuf-maven-plugin` to generate these files, more in <<Generating Java files from proto with protobuf-maven-plugin>>
Alternatively to using the `prepare` goal of the `quarkus-maven-plugin`, you can use `protobuf-maven-plugin` to generate these files, more in <<Generating Java files from proto with protobuf-maven-plugin>>

Let's start with a simple _Hello_ service.
Create the `src/main/proto/helloworld.proto` file with the following content:
Expand Down Expand Up @@ -258,18 +268,9 @@ You can also package the application into a native executable with: `mvn package
== Generating Java files from proto with protobuf-maven-plugin

Alternatively to using Quarkus code generation to generate stubs for `proto` files, you can also use
`protobuf-maven-plugin` for this purpose.
To do it, edit the `pom.xml` file to add the quarkus gRPC extension dependency and the JSR 305 (just under `<dependencies>`):

[source,xml]
----
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-grpc</artifactId>
</dependency>
----
`protobuf-maven-plugin`.

In the `<properties>` section, define the 2 following properties:
To do it, first define the 2 following properties in the `<properties>` section:

[source,xml,subs="verbatim,attributes"]
----
Expand All @@ -279,7 +280,7 @@ In the `<properties>` section, define the 2 following properties:

They configure the gRPC version and the `protoc` version.

Finally, add to the `build` section the `os-maven-plugin` extension and the `protobuf-maven-plugin` configuration.
Then, add to the `build` section the `os-maven-plugin` extension and the `protobuf-maven-plugin` configuration.

[source,xml,subs="verbatim,attributes"]
----
Expand Down

0 comments on commit bbb79f1

Please sign in to comment.