CharlesAHunt / scalapb-gradle-plugin

Gradle Plugin for ScalaPB
12 stars 8 forks source link

Plugin not working behind corporate proxy #8

Closed lostiniceland closed 6 years ago

lostiniceland commented 6 years ago

The plugin currently doesnt work behind an proxy (no direct internet-connection). This is actually a ScalaPB issue (see scalapb/ScalaPB#435), but as suggested there one can use the embedded protoc-jar-version by specifying this version explicit.

-v3.5.1

Please add an option to the extension (maybe embedded=true) which uses the shipped protoc-jar.

CharlesAHunt commented 6 years ago

This is added in version 1.2.0, which is published to Gradle plugins. The default is set to -v360, the readme is updated, but you can set your own version as well with protocVersion in scalapbConfig {...}:

scalapbConfig {
    dependentProtoSources = ["path/to/external/proto/sources", "or/some/other/path"]
    targetDir = "/target/scala/managed"
    protocVersion = "-v360"
}

Let me know if you are having any problems with this.

lostiniceland commented 6 years ago

You dont like pull-requests, do you :-D Thanks for the update.

It works for me, by providing protocVersion = "-v351" which is also my protobuf-java (3.5.1) version. But when updating my protobuf-java-dependency to 3.6.0 and using protocVersion = "-v360" (or leaving it out for the default case). I get this again

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':scalapb'.
> Error occurred while compiling protobuf files: Unsupported platform: protoc-3.6.0-windows-x86_64.exe

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

I also dont think it's best to specify a version for the plugin which is not in sync with the project dependency. Hence I choose to use the actual embedded depdency. Have a look at the change from my PR, where I use the explicit version of the embeded protoc-jar from the dependency. I think this is less error-prone.

CharlesAHunt commented 6 years ago

Oh my goodness! I didn't even notice the PR. I apologize. I'll resolve the conflicts with your branch and merge that in tomorrow and publish. Thanks for letting me know. :-)

Thank you!