You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "tkobayas (via GitHub)" <gi...@apache.org> on 2024/01/04 03:03:08 UTC

[PR] [KIE-790] Build error on RuleUnit multiple OOPath lines [incubator-kie-drools]

tkobayas opened a new pull request, #5640:
URL: https://github.com/apache/incubator-kie-drools/pull/5640

   https://github.com/apache/incubator-kie-issues/issues/790
   
   <details>
   <summary>
   How to replicate CI configuration locally?
   </summary>
   
   Build Chain tool does "simple" maven build(s), the builds are just Maven commands, but because the repositories relates and depends on each other and any change in API or class method could affect several of those repositories there is a need to use [build-chain tool](https://github.com/kiegroup/github-action-build-chain) to handle cross repository builds and be sure that we always use latest version of the code for each repository.
    
   [build-chain tool](https://github.com/kiegroup/github-action-build-chain) is a build tool which can be used on command line locally or in Github Actions workflow(s), in case you need to change multiple repositories and send multiple dependent pull requests related with a change you can easily reproduce the same build by executing it on Github hosted environment or locally in your development environment. See [local execution](https://github.com/kiegroup/github-action-build-chain#local-execution) details to get more information about it.
   </details>
   
   <details>
   <summary>
   How to retest this PR or trigger a specific build:
   </summary>
   
   - for <b>pull request checks</b>  
     Please add comment: <b>Jenkins retest this</b>
   
   - for a <b>specific pull request check</b>  
     Please add comment: <b>Jenkins (re)run [drools|kogito-runtimes|kogito-apps|kogito-examples] tests</b>
   
   - for a <b>full downstream build</b> 
     - for <b>jenkins</b> job: please add comment: <b>Jenkins run fdb</b>
     - for <b>github actions</b> job: add the label `run_fdb`
   
   - <b>a compile downstream build</b> please  add comment: <b>Jenkins run cdb</b>
   
   - <b>an upstream build</b> please add comment: <b>Jenkins run upstream</b>
   
   - for <b>quarkus branch checks</b>  
     Run checks against Quarkus current used branch  
     Please add comment: <b>Jenkins run quarkus-branch</b>
   
   - for a <b>quarkus branch specific check</b>  
     Run checks against Quarkus current used branch  
     Please add comment: <b>Jenkins (re)run [drools|kogito-runtimes|kogito-apps|kogito-examples] quarkus-branch</b>
   
   - for <b>quarkus main checks</b>  
     Run checks against Quarkus main branch  
     Please add comment: <b>Jenkins run quarkus-main</b>
   
   - for a <b>specific quarkus main check</b>  
     Run checks against Quarkus main branch  
     Please add comment: <b>Jenkins (re)run [drools|kogito-runtimes|kogito-apps|kogito-examples] quarkus-main</b>
   
   - for <b>quarkus lts checks</b>  
     Run checks against Quarkus lts branch  
     Please add comment: <b>Jenkins run quarkus-lts</b>
   
   - for a <b>specific quarkus lts check</b>  
     Run checks against Quarkus lts branch  
     Please add comment: <b>Jenkins (re)run [drools|kogito-runtimes|kogito-apps|kogito-examples] quarkus-lts</b>
   
   - for <b>native checks</b>  
     Run native checks  
     Please add comment: <b>Jenkins run native</b>
   
   - for a <b>specific native check</b>  
     Run native checks 
     Please add comment: <b>Jenkins (re)run [drools|kogito-runtimes|kogito-apps|kogito-examples] native</b>
   
    - for <b>native lts checks</b>  
     Run native checks against quarkus lts branch
     Please add comment: <b>Jenkins run native-lts</b>
   
   - for a <b>specific native lts check</b>  
     Run native checks against quarkus lts branch
     Please add comment: <b>Jenkins (re)run [drools|kogito-runtimes|kogito-apps|kogito-examples] native-lts</b>
   </details>
   
   <details>
   <summary>
   How to backport a pull request to a different branch?
   </summary>
   
   In order to automatically create a **backporting pull request** please add one or more labels having the following format `backport-<branch-name>`, where `<branch-name>` is the name of the branch where the pull request must be backported to (e.g., `backport-7.67.x` to backport the original PR to the `7.67.x` branch).
   
   > **NOTE**: **backporting** is an action aiming to move a change (usually a commit) from a branch (usually the main one) to another one, which is generally referring to a still maintained release branch. Keeping it simple: it is about to move a specific change or a set of them from one branch to another.
   
   Once the original pull request is successfully merged, the automated action will create one backporting pull request per each label (with the previous format) that has been added.
   
   If something goes wrong, the author will be notified and at this point a manual backporting is needed.
   
   > **NOTE**: this automated backporting is triggered whenever a pull request on `main` branch is labeled or closed, but both conditions must be satisfied to get the new PR created.
   </details>
   
   <!-- TODO to uncomment if activating the quarkus-3 rewrite PR job -->
   <!-- <details>
   <summary>
   Quarkus-3 PR check is failing ... what to do ?
   </summary>
   The Quarkus 3 check is applying patches from the `.ci/environments/quarkus-3/patches`.
   
   The first patch, called `0001_before_sh.patch`, is generated from Openrewrite `.ci/environments/quarkus-3/quarkus3.yml` recipe. The patch is created to speed up the check. But it may be that some changes in the PR broke this patch.  
   No panic, there is an easy way to regenerate it. You just need to comment on the PR:
   ```
   jenkins rewrite quarkus-3
   ```
   and it should, after some minutes (~20/30min) apply a commit on the PR with the patch regenerated.
   
   Other patches were generated manually. If any of it fails, you will need to manually update it... and push your changes.
   </details> -->


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [KIE-790] Build error on RuleUnit multiple OOPath lines [incubator-kie-drools]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #5640:
URL: https://github.com/apache/incubator-kie-drools/pull/5640#discussion_r1441232656


##########
drools-drl/drools-drl-parser/pom.xml:
##########
@@ -127,47 +127,47 @@
                                             <path refid="maven.compile.classpath"/>
                                         </path -->
                                         <echo message="Generating Lexer (${antlr.debugParser})"/>
+<!--                                        <java classname="org.antlr.Tool" fork="true">-->
+<!--                                            <jvmarg line="-Xmx750M -Xincgc"/>-->
+<!--                                            <arg line="${antlr.debugParser} -lib src/main/resources/org/drools/compiler/lang src/main/resources/org/drools/compiler/lang/DRL5Lexer.g"/>-->
+<!--                                            <classpath refid="maven.compile.classpath"/>-->
+<!--                                        </java>-->
                                         <java classname="org.antlr.Tool" fork="true">

Review Comment:
   I commented out unused Antlr gen tasks. If you want to use them, you would need to fix the file paths to keep up with past refactoring.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [KIE-790] Build error on RuleUnit multiple OOPath lines [incubator-kie-drools]

Posted by "mariofusco (via GitHub)" <gi...@apache.org>.
mariofusco merged PR #5640:
URL: https://github.com/apache/incubator-kie-drools/pull/5640


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [KIE-790] Build error on RuleUnit multiple OOPath lines [incubator-kie-drools]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on PR #5640:
URL: https://github.com/apache/incubator-kie-drools/pull/5640#issuecomment-1876851742

   Thank you, Mario! @mariofusco @lucamolteni Please review.
   
   > For what regards having a proper oopath separator, actually we already have the `;`
   > ...
   > However I just searched our documentation to check if we're mentioning this and indeed I couldn't find any reference to it, so it would be nice to also add it to the docs.
   
   Oh, thanks. It worked! I filed https://github.com/apache/incubator-kie-issues/issues/803 and will work on it :)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [KIE-790] Build error on RuleUnit multiple OOPath lines [incubator-kie-drools]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #5640:
URL: https://github.com/apache/incubator-kie-drools/pull/5640#discussion_r1441235961


##########
drools-drl/drools-drl-parser/src/main/resources/org/drools/drl/parser/DRL6Expressions.g:
##########
@@ -567,7 +574,7 @@ xpathSeparator
     ;
 
 xpathPrimary returns [BaseDescr result]
-    : xpathChunk+
+    : xpathChunk ({notStartWithNewline()}? xpathChunk)*

Review Comment:
   This parser rule means "if a line starts with `/`, it is considered as a new OOPath, not a continuation of the previous OOPath." 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [KIE-790] Build error on RuleUnit multiple OOPath lines [incubator-kie-drools]

Posted by "mariofusco (via GitHub)" <gi...@apache.org>.
mariofusco commented on PR #5640:
URL: https://github.com/apache/incubator-kie-drools/pull/5640#issuecomment-1876748457

   @tkobayas This is a problem that I discussed in the past also with @lucamolteni and @tarilabs and we never found a solution. I think yours is very clever and fixes an actual unexpected problem for many users, so I'm in favor for bringing it in.
   
   For what regards having a proper oopath separator, actually we already have the `;` which in my opinion is the most obvious one., so I wouldn't introduce any other. In essence if you write 
   ```
   /measurements[ $id: id == "color", $colorVal : val ]; // <-- note the semicolon at the end of this line 
   /sensors[ id == $id ]
   ```
   it should already work. However I just searched our documentation to check if we're mentioning this and indeed I couldn't find any reference to it, so it would be nice to also add it to the docs.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [KIE-790] Build error on RuleUnit multiple OOPath lines [incubator-kie-drools]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #5640:
URL: https://github.com/apache/incubator-kie-drools/pull/5640#discussion_r1441232656


##########
drools-drl/drools-drl-parser/pom.xml:
##########
@@ -127,47 +127,47 @@
                                             <path refid="maven.compile.classpath"/>
                                         </path -->
                                         <echo message="Generating Lexer (${antlr.debugParser})"/>
+<!--                                        <java classname="org.antlr.Tool" fork="true">-->
+<!--                                            <jvmarg line="-Xmx750M -Xincgc"/>-->
+<!--                                            <arg line="${antlr.debugParser} -lib src/main/resources/org/drools/compiler/lang src/main/resources/org/drools/compiler/lang/DRL5Lexer.g"/>-->
+<!--                                            <classpath refid="maven.compile.classpath"/>-->
+<!--                                        </java>-->
                                         <java classname="org.antlr.Tool" fork="true">

Review Comment:
   I commented out unused Antlr gen tasks. If you want to use them, you would need to fix the file paths to keep up with past refactoring directory changes.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [KIE-790] Build error on RuleUnit multiple OOPath lines [incubator-kie-drools]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #5640:
URL: https://github.com/apache/incubator-kie-drools/pull/5640#discussion_r1441233856


##########
drools-drl/drools-drl-parser/pom.xml:
##########
@@ -127,47 +127,47 @@
                                             <path refid="maven.compile.classpath"/>
                                         </path -->
                                         <echo message="Generating Lexer (${antlr.debugParser})"/>
+<!--                                        <java classname="org.antlr.Tool" fork="true">-->
+<!--                                            <jvmarg line="-Xmx750M -Xincgc"/>-->
+<!--                                            <arg line="${antlr.debugParser} -lib src/main/resources/org/drools/compiler/lang src/main/resources/org/drools/compiler/lang/DRL5Lexer.g"/>-->
+<!--                                            <classpath refid="maven.compile.classpath"/>-->
+<!--                                        </java>-->
                                         <java classname="org.antlr.Tool" fork="true">
-                                            <jvmarg line="-Xmx750M -Xincgc"/>
-                                            <arg line="${antlr.debugParser} -lib src/main/resources/org/drools/compiler/lang src/main/resources/org/drools/compiler/lang/DRL5Lexer.g"/>
-                                            <classpath refid="maven.compile.classpath"/>
-                                        </java>
-                                        <java classname="org.antlr.Tool" fork="true">
-                                            <jvmarg line="-Xmx750M -Xincgc"/>
-                                            <arg line="${antlr.debugParser} -lib src/main/resources/org/drools/compiler/lang src/main/resources/org/drools/compiler/lang/DRL6Lexer.g"/>
+                                            <jvmarg line="-Xmx750M"/>
+                                            <arg line="${antlr.debugParser} -lib src/main/resources/org/drools/drl/parser src/main/resources/org/drools/drl/parser/DRL6Lexer.g"/>

Review Comment:
   My change is basically on `DRL6Expressions.g`, but I needed to also enable `DRL6Lexer.g` gen to use `DRL6Lexer.tokens`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [KIE-790] Build error on RuleUnit multiple OOPath lines [incubator-kie-drools]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on PR #5640:
URL: https://github.com/apache/incubator-kie-drools/pull/5640#issuecomment-1876260603

   DRL considers a new line is just `WS`, which is not used as a delimiter of the syntax.
   
   So it was valid to parse
   ```
           /measurements[ $id: id == "color", $colorVal : val ]
   	/sensors[ id == $id ]
   ```
   as one constraint:
   ```
   /measurements[ $id: id == "color", $colorVal : val ]/sensors[ id == $id ]
   ```
   
   However, if we want to consider that they are 2 OOPath patterns, we need to use a new line as a delimiter. So this fix is exceptional.
   
   As a fundamental fix, IMO, we need to introduce an explicit syntax to begin an OOPath. e.g. `$/`
   For example)
   ```
           $/measurements[ $id: id == "color", $colorVal : val ]
   	$/sensors[ id == $id ]
   ```
   
   WDYT? @mariofusco 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org