larshp / abapmerge

Merge ABAP classes/interfaces/INCLUDEs into single file
MIT License
24 stars 14 forks source link

Unused classes are included in merged output #430

Open pokrakam opened 1 week ago

pokrakam commented 1 week ago

Q: Is this by bug or design? I guess design, assumption being that anything in the source tree could be called dynamically, correct?

Example,

PROGRAM zrun.
START-OF-SELECTION.
WRITE / 'Hello, World!'.

will include all classes in the merge:

REPORT zrun.

CLASS zcl_foo DEFINITION DEFERRED.
CLASS zcl_foo DEFINITION.
  PUBLIC SECTION.
    METHODS run.
  PROTECTED SECTION.
  PRIVATE SECTION.
ENDCLASS.
CLASS zcl_foo IMPLEMENTATION.

  METHOD run.
    WRITE / 'Hello, World!'.
    " INCLUDE zhello.
  ENDMETHOD.

ENDCLASS.
START-OF-SELECTION.
WRITE / 'Hello, World!'.

****************************************************
INTERFACE lif_abapmerge_marker.
* abapmerge 0.16.4 - 2024-10-14T13:41:02.173Z
  CONSTANTS c_merge_timestamp TYPE string VALUE `2024-10-14T13:41:02.173Z`.
  CONSTANTS c_abapmerge_version TYPE string VALUE `0.16.4`.
ENDINTERFACE.
****************************************************

Would it make sense to have something like --exclude-unused ? (Assuming it's not a mountain of effort).

larshp commented 1 week ago

Most of the classes in abapgit is not "used", so its by design. Can add a flag tho