Optimized ZCL_ABAPGIT_TADIR=>BUILD for better performance (#1725)

* Optimized ZCL_ABAPGIT_TADIR=>BUILD for better performance

- Using the optimizations in ZCL_ABAPGIT_FOLDER_LOGIC (PR #1723) and ZCL_ABAPGIT_SAP_PACKAGE (PR #1724) to optimize the TADIR build method, by first determining all relevant subpackages and then processing them in one go instead of having to recurse and read information from the DB separately.
- Note that the optimization can also be used without the changes in #1723 and #1724, but the effect will be less or worse and the coding requires adaptations.

* Fixes coding artifact of #1723

Removed a coding artifact that makes use of importing parameter ÌO_FOLDER_LOGIC`, which is no longer needed in the flat BUILD processing.

* Adapted for rework in #1724

After adapting PR #1724 to no longer use buffering, but instead select packages with a level-based selection, the buffering parameter in `ZCL_ABAPGIT_SAP_PACKAGE=>LIST_SUBPACKAGES` no longer exists and should not be used in this PR.

* Compressed IF/ELSE construct

* Removed whitespaces

* Fixed auto-merge issue

Removed a double variable declaration resulting from git auto-merge
This commit is contained in:
Michael Käsemann 2018-08-02 06:48:13 +02:00 committed by Lars Hvam
parent 9d79bc3cc5
commit f9746cf199

View File

@ -52,10 +52,17 @@ CLASS zcl_abapgit_tadir IMPLEMENTATION.
ls_srcsystem LIKE LINE OF lt_srcsystem,
ls_exclude LIKE LINE OF lt_excludes.
DATA: lo_folder_logic TYPE REF TO zcl_abapgit_folder_logic.
DATA: last_package TYPE devclass VALUE cl_abap_char_utilities=>horizontal_tab.
FIELD-SYMBOLS: <ls_tdevc> LIKE LINE OF lt_tdevc,
<ls_tadir> LIKE LINE OF rt_tadir.
"Determine Packages to Read
DATA: lt_packages TYPE zif_abapgit_sap_package=>ty_devclass_tt.
IF iv_ignore_subpackages = abap_false.
lt_packages = zcl_abapgit_factory=>get_sap_package( iv_package )->list_subpackages( ).
ENDIF.
INSERT iv_package INTO lt_packages INDEX 1.
ls_exclude-sign = 'I'.
ls_exclude-option = 'EQ'.
@ -76,32 +83,44 @@ CLASS zcl_abapgit_tadir IMPLEMENTATION.
APPEND ls_srcsystem TO lt_srcsystem.
ENDIF.
IF lt_packages IS NOT INITIAL.
SELECT * FROM tadir
INTO CORRESPONDING FIELDS OF TABLE rt_tadir
WHERE devclass = iv_package
FOR ALL ENTRIES IN lt_packages
WHERE devclass = lt_packages-table_line
AND pgmid = 'R3TR'
AND object NOT IN lt_excludes
AND delflag = abap_false
AND srcsystem IN lt_srcsystem
ORDER BY PRIMARY KEY. "#EC CI_GENBUFF "#EC CI_SUBRC
ENDIF.
SORT rt_tadir BY devclass pgmid object obj_name.
CREATE OBJECT lo_skip_objects.
rt_tadir = lo_skip_objects->skip_sadl_generated_objects(
it_tadir = rt_tadir
io_log = io_log ).
LOOP AT lt_packages ASSIGNING FIELD-SYMBOL(<package>).
" Local packages are not in TADIR, only in TDEVC, act as if they were
IF iv_package CP '$*'. " OR iv_package CP 'T*' ).
IF <package> CP '$*'. " OR <package> CP 'T*' ).
APPEND INITIAL LINE TO rt_tadir ASSIGNING <ls_tadir>.
<ls_tadir>-pgmid = 'R3TR'.
<ls_tadir>-object = 'DEVC'.
<ls_tadir>-obj_name = iv_package.
<ls_tadir>-devclass = iv_package.
<ls_tadir>-obj_name = <package>.
<ls_tadir>-devclass = <package>.
ENDIF.
ENDLOOP.
LOOP AT rt_tadir ASSIGNING <ls_tadir>.
IF last_package <> <ls_tadir>-devclass.
"Change in Package
last_package = <ls_tadir>-devclass.
IF NOT io_dot IS INITIAL.
"Reuse given Folder Logic Instance
lo_folder_logic = io_folder_logic.
IF lo_folder_logic IS NOT BOUND.
"Get Folder Logic Instance
lo_folder_logic = zcl_abapgit_folder_logic=>get_instance( ).
@ -110,10 +129,10 @@ CLASS zcl_abapgit_tadir IMPLEMENTATION.
lv_path = lo_folder_logic->package_to_path(
iv_top = iv_top
io_dot = io_dot
iv_package = iv_package ).
iv_package = <ls_tadir>-devclass ).
ENDIF.
ENDIF.
LOOP AT rt_tadir ASSIGNING <ls_tadir>.
<ls_tadir>-path = lv_path.
CASE <ls_tadir>-object.
@ -123,23 +142,6 @@ CLASS zcl_abapgit_tadir IMPLEMENTATION.
ENDCASE.
ENDLOOP.
* look for subpackages
IF iv_ignore_subpackages = abap_false.
SELECT * FROM tdevc INTO TABLE lt_tdevc
WHERE parentcl = iv_package
ORDER BY PRIMARY KEY. "#EC CI_SUBRC "#EC CI_GENBUFF
ENDIF.
LOOP AT lt_tdevc ASSIGNING <ls_tdevc>.
lt_tadir = build( iv_package = <ls_tdevc>-devclass
iv_only_local_objects = iv_only_local_objects
iv_top = iv_top
io_dot = io_dot
io_log = io_log
io_folder_logic = lo_folder_logic ). "Hand down existing folder logic instance
APPEND LINES OF lt_tadir TO rt_tadir.
ENDLOOP.
ENDMETHOD. "build