You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by "Jing Zhao (JIRA)" <ji...@apache.org> on 2017/03/02 02:30:45 UTC

[jira] [Comment Edited] (RATIS-33) Protobuf gets compiled only when both activation conditions are triggered

    [ https://issues.apache.org/jira/browse/RATIS-33?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15891500#comment-15891500 ] 

Jing Zhao edited comment on RATIS-33 at 3/2/17 2:29 AM:
--------------------------------------------------------

I did a little hack in the pom file. I added a new profile "skipCompileProto" which uses two activation conditions:
{code}
+      <activation>
+        <file>
+          <exists>${sources.dir}</exists>
+        </file>
+        <property>
+          <name>!compile-protobuf</name>
+        </property>
+      </activation>
{code}

Thus if src/main/java does not exist, or if compile-protobuf is provided, then this new profile gets deactivated which triggers the shade.


was (Author: jingzhao):
I did a little more hack in the pom file. I added a new profile "skipCompileProto" which uses two activation conditions:
{code}
+      <activation>
+        <file>
+          <exists>${sources.dir}</exists>
+        </file>
+        <property>
+          <name>!compile-protobuf</name>
+        </property>
+      </activation>
{code}

Thus if src/main/java does not exist, or if compile-protobuf is provided, then this new profile gets deactivated which triggers the shade.

> Protobuf gets compiled only when both activation conditions are triggered
> -------------------------------------------------------------------------
>
>                 Key: RATIS-33
>                 URL: https://issues.apache.org/jira/browse/RATIS-33
>             Project: Ratis
>          Issue Type: Bug
>            Reporter: Jing Zhao
>            Assignee: Jing Zhao
>         Attachments: RATIS-33.000.patch, RATIS-33.001.patch
>
>
> In RATIS-26 we specify the following activation conditions for compiling protobuf files:
> {code}
>       <activation>
>         <!-- Activate this if the generated source directory is missing. It will automatically
>          kick the protoc compilation if you are doing a mvn install for the first time. Otherwise
>          it will only compile the resources under src/main/java as usual.  If you want to
>          force-compile the proto files (for example after changing them), you should run with
>          mvn install -Dcompile-protobuf -->
>         <file>
>           <missing>${sources.dir}</missing>
>         </file>
>         <property>
>           <name>compile-protobuf</name>
>         </property>
>       </activation>
> {code}
> This does not work after maven version 3.2.2, due to MNG-4565 that changes the activation condition relationships from OR to AND. Thus we have to do both 1) delete ratis-proto-shaded/src/main/java, and 2) include -Dcompile-protobuf in the command to trigger the protobuf compilation.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)