AppBuilder generated code and Git merge conflicts

We have lots of legacy GUI code written in the AppBuilder and PDSOE.

 

When a minor change to a screen is made, the AppBuilder-generated-code shifts the code for frame definitions all over the place, creating complex merge conflicts when merging into staging branches with Git.

 

For example, within a frame a few widget widths are changed. The definition for the frame is moved from line 200 to line 450.

 

Is there anyway to stop the AppBuilder from behaving this way?

 

To mitigate this we're having to create dependencies on previous branches but this is complex and creates a blocker for getting code into production.

 


Mike Fechner and Ian Colenutt like this.
  • Thomas Wurl (Taste IT Consulting)

    It didn't leave me alone. Finally I found the bug. It's more a typo than a bug.

    adeshar/_gendefs.p -> PROCEDURE put-frame-definitions-in relies on the fact that widgets that cannot be tabbed (like text, image, ...) have a u._tab-order of 0. Before writing the code out, adeshar/_gendefs.p calls adeuib/_tabord.p. This procedure assigns the proper value to the widgets _U._tab-order depending on the settings of the Tab Order Dialog: L-to-R|R-to-L][,COLUMNS, custom.

     

    There a two loops to filter QUERY,TEXT,IMAGE,RECTANGLE,LABEL. The first one is correct. The second one had the bug.

    Buffer _U used instead of x_U. Just one "x" missing 😁.

    Text and others got a value for _tab-order > 0. And the value was unpredictable, because the query sorts by _tab-order which is initialy 0 for text, so the order for widgets with _tab-order = 0 is by recid.

     

    OPEN QUERY t_order 

       PRESELECT EACH x_U

            WHERE x_U._parent-recid = p_Urecid 

            AND x_U._STATUS eq p_status

            AND RECID (x_U) ne p_Urecid

            /**** Thomas Wurl, Taste IT Consulting 29.12.2021 - _U was used instead of x_U ****/

            /*AND NOT CAN-DO ('QUERY,TEXT,IMAGE,RECTANGLE,LABEL':U, _U._TYPE),*/

            AND NOT CAN-DO ('QUERY,TEXT,IMAGE,RECTANGLE,LABEL':U, x_U._TYPE),

            EACH x_L

            WHERE x_L._u-recid = RECID(x_U) 

            AND x_L._LO-NAME = "Master Layout":U

            AND NOT x_L._NO-FOCUS

            BY x_U._TAB-ORDER.

     

    GET FIRST t_order.

    DO WHILE AVAILABLE (x_U):

     skip_object = FALSE.

     IF x_U._TYPE = "FILL-IN":U AND x_U._SUBTYPE = "TEXT":U THEN skip_object = TRUE.

     IF NOT skip_object THEN

      ASSIGN tab_i     = tab_i + 1

          x_U._TAB-ORDER = tab_i.

     GET NEXT t_order.

    END.

     

    So:

    • adeshar/_gendefs.p is fine and needs no fix.
    • adeuib/_tabord.p was the problem and needs to be fixed.

     

    Attached is this:

    • adeuib/_tabord.p fixed
    • protools/FrameDefs.w -> Protool to look at the widget in the current open window in the AB.
    • vcustomer.w, dcustomer.w -> a sample viewer and sdo for sports.customer where you can watch the behavior with FrameDefs.w

     

    To see the problem:

    • Open the viewer without using the fixed version of _tabord.p (just rename the folder adeuib to xadeuib)
    • After opening the viever _tab-order for text is 0.
    • After code generation (save or preview) the _tab-order has a value.
    • Close the viewer and open it again. You may see different values. If not open something else like the sdo ...

     

    Then apply the patch: rename xadeuib back to adeuib. Open the viewer again. Check it with FrameDefs.w again.

     

    Now it's fine! The code of _tab-order.p is from 1995. It never worked before! 😂

     

    Happy New Year 2022!

     

     

     

     

     

     

     

     

    Selected as Best
  • Marcos Kirchner (Customer)

    Oh, this have been driving the team over here crazy for a very long time. Sometimes it happens even when we don't change any graphical stuff at all, only some procedure code.

     

    Never found a good solution for this. A few times we would manually undo the definitions dance before checkin.

     

    Also, we avoid as much as possible having more than 1 dev working on the same .W file, as the changes made by multiple devs tend to be very hard to merge together, even when definitions are not moving around.

    • Havard Danielsen (Progress Software)

      > Oh, this have been driving the team over here crazy for a very long time. Sometimes it happens even when we don't change any graphical stuff at all, only some procedure code.

       

      @Marcos Kirchner (Customer)​ 

      The AppBuilder is more than 20 years old and during its life time there have been changes to how the code is generated. This have been done to fix bugs or support new performance related features. If you edit code generated with an older version then any change may cause changes in how the code is generated also in sections that you did not edit.

       

      One way to minimize this problem is to do a minor change (for example a comment) and save so that the code is generated by the current AppBuilder and then do a diff with the original source and check the code in if there are big differences, before you do the real changes.

       

  • Stefan Marquardt (Customer)

    We have the same issues with the appbuilder, it doesn't move only, it destroys sometime the code changing existing properties and compile fails.

    And on top having all our lower case code in upper case again.

     

    It's ridiculous and I'm wondering about whether all users are so used of that and don't complain.

     

     

     

    • Havard Danielsen (Progress Software)

      @Stefan Marquardt (Customer)​ 

      > it destroys sometime the code changing existing properties and compile fails.

       

      This may happen if you remove or rename UI components that are referenced in manual edited code. If you encounter this under other circumstances then please report a bug.

  • Stefan Marquardt (Customer)

    I think you are a dreamer to think they will fix the old appbuilder, I asked for case fix and it was denied