Skip to content

Conversation

dmdashenkov
Copy link
Contributor

@dmdashenkov dmdashenkov commented Aug 26, 2020

Previously, Model Compiler downloaded the executable Jar with the protoc plugin into the .spine directory. This solution is bad for several reasons. The primary one — as it has been discovered, it does not work with included builds.

In this PR we simplify the process of locating the Jar. Just like before, there are two scripts (for Windows and for *nix), which launch the Jar (via the java CLI tool). Unlike before, those scripts are not Maven artifacts but resources of the Model Compiler. Also, the script resources contain a placeholder for the path to the Jar.

To launch the plugin, Model Compiler resolves a dependency on the executable Jar and writes the appropriate script file into a temporary dir with the path to the resolved Jar. Then, Model Compiler configures the Protobuf Gradle plugin to launch the Spine protoc plugin via the written script file.

The benefit of the new solution is that all the FS paths are absolute, i.e. there is no difference in who requests the plugin: a root project, a subproject or an included build.

@dmdashenkov dmdashenkov self-assigned this Aug 26, 2020
@codecov
Copy link

codecov bot commented Aug 26, 2020

Codecov Report

Merging #559 into master will increase coverage by 0.10%.
The diff coverage is 1.72%.

@@             Coverage Diff              @@
##             master     #559      +/-   ##
============================================
+ Coverage     73.86%   73.96%   +0.10%     
  Complexity     2968     2968              
============================================
  Files           507      506       -1     
  Lines         12009    11990      -19     
  Branches        672      671       -1     
============================================
- Hits           8871     8869       -2     
+ Misses         2911     2893      -18     
- Partials        227      228       +1     

@dmdashenkov dmdashenkov marked this pull request as ready for review August 26, 2020 13:20
@dmdashenkov dmdashenkov requested a review from armiol August 26, 2020 13:20
@dmdashenkov
Copy link
Contributor Author

@armiol, PTAL.

Copy link
Collaborator

@armiol armiol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dmdashenkov LGTM with a comment.

@@ -103,32 +99,13 @@ private void configureProtocTasks(GenerateProtoTaskCollection tasks) {
*
* @param plugins
* container of all plugins
* @param project
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please have a description. In particular, in the context of the current issue, it may be either a root project or a project of a child Gradle module.

@dmdashenkov dmdashenkov merged commit e2e6ed0 into master Aug 26, 2020
@dmdashenkov dmdashenkov deleted the simplify-protoc-plugin-location branch August 26, 2020 14:19
@dmitrykuzmin dmitrykuzmin mentioned this pull request Sep 8, 2020
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

Successfully merging this pull request may close these issues.

Protobuf compiler is downloaded to the .spine under an included project
2 participants