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

DSL Markers in maven plugin? #26

Closed
asad-awadia opened this issue Feb 1, 2019 · 3 comments
Closed

DSL Markers in maven plugin? #26

asad-awadia opened this issue Feb 1, 2019 · 3 comments

Comments

@asad-awadia
Copy link

asad-awadia commented Feb 1, 2019

How do you use use_dsl_markers in ProtoBuildersGenOptions via maven?

@asad-awadia asad-awadia changed the title RC Kotlin Maven dependencies DSL Markers in maven plugin? Feb 1, 2019
@marcoferrer
Copy link
Owner

marcoferrer commented Feb 18, 2019

Which protoc plugin artifact are your using? protoc-gen-grpc-coroutines or protoc-gen-kroto-plus? Only the kroto-plus artifact with support the use_dsl_markers option. To enable it, confirm your kroto config path is being set correctly in maven.

<execution>
        <id>kroto-plus</id>
        <goals>
             <goal>compile-custom</goal>
         </goals>
         <configuration>
             <pluginId>kroto-plus</pluginId>
             <pluginArtifact>com.github.marcoferrer.krotoplus:protoc-gen-kroto-plus:${krotoPlusVersion}:jar:jvm8</pluginArtifact>
             <pluginParameter>ConfigPath=${project.basedir}/krotoPlusConfig.asciipb</pluginParameter>
         </configuration>
</execution>

Then in krotoPlusConfig.asciipb, inside your proto_builders configuration, set the flag.
asciipb

proto_builders {
    ....
    use_dsl_markers: true
}

json

"protoBuilders": [
     {
         .....,
         "useDslMarkers": true
     }
]

Another important note is that the use_dsl_markers option relies on the protoc-insertions feature.
So the output directory of both protoc-gen-kroto-plus and protoc-gen-java must match.

Im not 100% familiar with all the configuration options for the protobuf maven plugin, but a quick google search shows the outputDirectory option might be what you need

<configuration>
    <pluginId>kroto-plus</pluginId>
    <pluginArtifact>com.github.marcoferrer.krotoplus:protoc-gen-kroto-plus:${krotoPlusVersion}:jar:jvm8</pluginArtifact>
    <pluginParameter>ConfigPath=${project.basedir}/krotoPlusConfig.asciipb</pluginParameter>
    <outputDirectory>${basedir}/target/generated-sources/path/to/java/output</outputDirectory>
</configuration>

@marcoferrer
Copy link
Owner

marcoferrer commented Feb 20, 2019

I had some time to fully dig into this and found the source of the issue. The protobuf maven plugin doesnt fully support the protoc insertions api at the moment. My findings are documented here

@marcoferrer
Copy link
Owner

Closing as a duplicate of #28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants