xolstice / protobuf-maven-plugin

Maven Plugin that executes the Protocol Buffers (protoc) compiler
https://www.xolstice.org/protobuf-maven-plugin/
Other
236 stars 78 forks source link

[DOC] - Provide an example of the javascript options that can be passed #55

Open clehene opened 5 years ago

clehene commented 5 years ago

Applicable Issues

Fixes #...

Description

clehene commented 5 years ago

@sergei-ivanov while I'm at it, trying to figure things out, I'm thinking it may be helpful to post some comments here for reference. I'm currently trying to generate js output and grpc-web output. Note that there's no packaged grpc-web artifact we could use so I'm just using my local copy

<configuration>
          <protoSourceRoot>../src/main/proto/v1alpha1</protoSourceRoot>
          <pluginId>grpc-web</pluginId>
          <pluginExecutable>
            <!--TODO https://github.com/maven-download-plugin/maven-download-plugin-->
            ${user.home}/Downloads/protoc-gen-grpc-web-1.0.3-darwin-x86_64
          </pluginExecutable>
          <pluginParameter>import_style=commonjs+dts,mode=grpcweb</pluginParameter>
          <javaScriptOptions>import_style=commonjs,binary</javaScriptOptions>
        </configuration>

I trying get all files in the same dir to avoid moving them afterwards.

First thing I noticed is that I can't figure put how to set the compile-custom / plugin directory. The OutputDirectory property is likely clashing and it if set it will be picked up and used for both compile-custom and compile-X and the second will delete the output of the first.

Given that protoc normally runs in a single phase, I wonder if we shouldn't emulate the same behavior and not have a separate compile-custom?

sergei-ivanov commented 5 years ago

You have two options:

  1. Define separate executions with independent configuration (you can specify different output directories on the execution level). I have added an example configuration for multiple executions, but I'll need to release the plugin for the site to be updated. You can see it in the site sources meanwhile.
  2. Turn off clearing out of the output directory. I changed the default to "do not clear" for the pending release, because it made life unnecessary harder for many people. See #48 for details.

I suggest that I release the plugin, so that you can test the latest changes. And we'll update the documentation in the next minor release.

clehene commented 5 years ago

@sergei-ivanov thank you. It's ok to release the plugin if it's ready, but if notI already build it locally so could test with that. I'm good either way. As a side note, I find myself occasionally going back to code to figure out if something is possible (in fact that prompted me to have these changes).

I wonder if intro and usage could be combiner to have an exhaustive documentation in a single document. That allows doing searches for keywords like "clear" in a single page rather than trying to figure out the links that may contain the info - just a thought.