mirror of
https://github.com/abapGit/abapGit.git
synced 2025-05-01 12:20:51 +08:00
Refactor: Activation log (#5302)
* Refactor: Activation log - Merges the activation log into the regular pull log - Removes duplicate messages * Update Co-authored-by: Lars Hvam <larshp@hotmail.com>
This commit is contained in:
parent
a828d80044
commit
ce31e33688
|
@ -19,6 +19,7 @@ CLASS zcl_abapgit_objects_activation DEFINITION
|
||||||
CLASS-METHODS activate
|
CLASS-METHODS activate
|
||||||
IMPORTING
|
IMPORTING
|
||||||
!iv_ddic TYPE abap_bool DEFAULT abap_false
|
!iv_ddic TYPE abap_bool DEFAULT abap_false
|
||||||
|
!ii_log TYPE REF TO zif_abapgit_log
|
||||||
RAISING
|
RAISING
|
||||||
zcx_abapgit_exception .
|
zcx_abapgit_exception .
|
||||||
CLASS-METHODS clear .
|
CLASS-METHODS clear .
|
||||||
|
@ -41,26 +42,33 @@ CLASS zcl_abapgit_objects_activation DEFINITION
|
||||||
CLASS-DATA:
|
CLASS-DATA:
|
||||||
gt_objects TYPE TABLE OF dwinactiv .
|
gt_objects TYPE TABLE OF dwinactiv .
|
||||||
|
|
||||||
CLASS-METHODS update_where_used .
|
CLASS-METHODS update_where_used
|
||||||
|
IMPORTING
|
||||||
|
!ii_log TYPE REF TO zif_abapgit_log.
|
||||||
CLASS-METHODS use_new_activation_logic
|
CLASS-METHODS use_new_activation_logic
|
||||||
RETURNING
|
RETURNING
|
||||||
VALUE(rv_use_new_activation_logic) TYPE abap_bool .
|
VALUE(rv_use_new_activation_logic) TYPE abap_bool .
|
||||||
CLASS-METHODS activate_new
|
CLASS-METHODS activate_new
|
||||||
IMPORTING
|
IMPORTING
|
||||||
!iv_ddic TYPE abap_bool DEFAULT abap_false
|
!iv_ddic TYPE abap_bool DEFAULT abap_false
|
||||||
|
!ii_log TYPE REF TO zif_abapgit_log
|
||||||
RAISING
|
RAISING
|
||||||
zcx_abapgit_exception .
|
zcx_abapgit_exception .
|
||||||
CLASS-METHODS activate_old
|
CLASS-METHODS activate_old
|
||||||
IMPORTING
|
IMPORTING
|
||||||
!iv_ddic TYPE abap_bool DEFAULT abap_false
|
!iv_ddic TYPE abap_bool DEFAULT abap_false
|
||||||
|
!ii_log TYPE REF TO zif_abapgit_log
|
||||||
RAISING
|
RAISING
|
||||||
zcx_abapgit_exception .
|
zcx_abapgit_exception .
|
||||||
CLASS-METHODS activate_ddic
|
CLASS-METHODS activate_ddic
|
||||||
|
IMPORTING
|
||||||
|
!ii_log TYPE REF TO zif_abapgit_log
|
||||||
RAISING
|
RAISING
|
||||||
zcx_abapgit_exception .
|
zcx_abapgit_exception .
|
||||||
CLASS-METHODS show_activation_errors
|
CLASS-METHODS add_errors_to_log
|
||||||
IMPORTING
|
IMPORTING
|
||||||
!iv_logname TYPE ddmass-logname
|
!iv_logname TYPE ddmass-logname
|
||||||
|
!ii_log TYPE REF TO zif_abapgit_log
|
||||||
RAISING
|
RAISING
|
||||||
zcx_abapgit_exception .
|
zcx_abapgit_exception .
|
||||||
ENDCLASS.
|
ENDCLASS.
|
||||||
|
@ -76,12 +84,16 @@ CLASS zcl_abapgit_objects_activation IMPLEMENTATION.
|
||||||
COMMIT WORK AND WAIT.
|
COMMIT WORK AND WAIT.
|
||||||
|
|
||||||
IF use_new_activation_logic( ) = abap_true.
|
IF use_new_activation_logic( ) = abap_true.
|
||||||
activate_new( iv_ddic ).
|
activate_new(
|
||||||
|
iv_ddic = iv_ddic
|
||||||
|
ii_log = ii_log ).
|
||||||
ELSE.
|
ELSE.
|
||||||
activate_old( iv_ddic ).
|
activate_old(
|
||||||
|
iv_ddic = iv_ddic
|
||||||
|
ii_log = ii_log ).
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
update_where_used( ).
|
update_where_used( ii_log ).
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
@ -152,7 +164,10 @@ CLASS zcl_abapgit_objects_activation IMPLEMENTATION.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
IF lv_rc > 0.
|
IF lv_rc > 0.
|
||||||
show_activation_errors( lv_logname ).
|
add_errors_to_log(
|
||||||
|
iv_logname = lv_logname
|
||||||
|
ii_log = ii_log ).
|
||||||
|
zcx_abapgit_exception=>raise( 'Activation cancelled. Check the inactive objects.' ).
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
" Remove objects from activation queue to avoid double activation in activate_old
|
" Remove objects from activation queue to avoid double activation in activate_old
|
||||||
|
@ -181,14 +196,14 @@ CLASS zcl_abapgit_objects_activation IMPLEMENTATION.
|
||||||
li_progress->show( iv_current = 98
|
li_progress->show( iv_current = 98
|
||||||
iv_text = 'Activating DDIC' ).
|
iv_text = 'Activating DDIC' ).
|
||||||
|
|
||||||
activate_ddic( ).
|
activate_ddic( ii_log ).
|
||||||
|
|
||||||
ELSE.
|
ELSE.
|
||||||
|
|
||||||
li_progress->show( iv_current = 98
|
li_progress->show( iv_current = 98
|
||||||
iv_text = 'Activating non DDIC' ).
|
iv_text = 'Activating non DDIC' ).
|
||||||
|
|
||||||
activate_old( ).
|
activate_old( ii_log ).
|
||||||
|
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
|
@ -275,6 +290,43 @@ CLASS zcl_abapgit_objects_activation IMPLEMENTATION.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD add_errors_to_log.
|
||||||
|
|
||||||
|
DATA: lt_lines TYPE STANDARD TABLE OF trlog,
|
||||||
|
lv_logname_db TYPE ddprh-protname.
|
||||||
|
|
||||||
|
FIELD-SYMBOLS: <ls_line> LIKE LINE OF lt_lines.
|
||||||
|
|
||||||
|
|
||||||
|
lv_logname_db = iv_logname.
|
||||||
|
|
||||||
|
CALL FUNCTION 'TR_READ_LOG'
|
||||||
|
EXPORTING
|
||||||
|
iv_log_type = 'DB'
|
||||||
|
iv_logname_db = lv_logname_db
|
||||||
|
TABLES
|
||||||
|
et_lines = lt_lines
|
||||||
|
EXCEPTIONS
|
||||||
|
invalid_input = 1
|
||||||
|
access_error = 2
|
||||||
|
OTHERS = 3.
|
||||||
|
|
||||||
|
IF sy-subrc <> 0.
|
||||||
|
zcx_abapgit_exception=>raise_t100( ).
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
" Only error messsages
|
||||||
|
DELETE lt_lines WHERE severity <> 'E'.
|
||||||
|
" Remove "Return code..." message
|
||||||
|
DELETE lt_lines WHERE class = 'D0' AND number = '319'.
|
||||||
|
|
||||||
|
LOOP AT lt_lines ASSIGNING <ls_line>.
|
||||||
|
ii_log->add( <ls_line>-line ).
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
METHOD add_item.
|
METHOD add_item.
|
||||||
add( iv_type = is_item-obj_type
|
add( iv_type = is_item-obj_type
|
||||||
iv_name = is_item-obj_name ).
|
iv_name = is_item-obj_name ).
|
||||||
|
@ -318,52 +370,12 @@ CLASS zcl_abapgit_objects_activation IMPLEMENTATION.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
METHOD show_activation_errors.
|
|
||||||
|
|
||||||
DATA: lt_lines TYPE STANDARD TABLE OF trlog,
|
|
||||||
lv_logname_db TYPE ddprh-protname,
|
|
||||||
li_log TYPE REF TO zif_abapgit_log.
|
|
||||||
|
|
||||||
FIELD-SYMBOLS: <ls_line> LIKE LINE OF lt_lines.
|
|
||||||
|
|
||||||
|
|
||||||
lv_logname_db = iv_logname.
|
|
||||||
|
|
||||||
CALL FUNCTION 'TR_READ_LOG'
|
|
||||||
EXPORTING
|
|
||||||
iv_log_type = 'DB'
|
|
||||||
iv_logname_db = lv_logname_db
|
|
||||||
TABLES
|
|
||||||
et_lines = lt_lines
|
|
||||||
EXCEPTIONS
|
|
||||||
invalid_input = 1
|
|
||||||
access_error = 2
|
|
||||||
OTHERS = 3.
|
|
||||||
|
|
||||||
IF sy-subrc <> 0.
|
|
||||||
zcx_abapgit_exception=>raise_t100( ).
|
|
||||||
ENDIF.
|
|
||||||
|
|
||||||
DELETE lt_lines WHERE severity <> 'E'.
|
|
||||||
|
|
||||||
CREATE OBJECT li_log TYPE zcl_abapgit_log.
|
|
||||||
li_log->set_title( 'Activation Errors' ).
|
|
||||||
|
|
||||||
LOOP AT lt_lines ASSIGNING <ls_line>.
|
|
||||||
li_log->add( <ls_line>-line ).
|
|
||||||
ENDLOOP.
|
|
||||||
|
|
||||||
IF li_log->count( ) > 0.
|
|
||||||
zcl_abapgit_log_viewer=>show_log( li_log ).
|
|
||||||
ENDIF.
|
|
||||||
|
|
||||||
ENDMETHOD.
|
|
||||||
|
|
||||||
|
|
||||||
METHOD update_where_used.
|
METHOD update_where_used.
|
||||||
|
|
||||||
DATA: ls_class LIKE LINE OF gt_classes,
|
DATA: ls_class LIKE LINE OF gt_classes,
|
||||||
lo_cross TYPE REF TO cl_wb_crossreference,
|
lo_cross TYPE REF TO cl_wb_crossreference,
|
||||||
|
ls_item TYPE zif_abapgit_definitions=>ty_item,
|
||||||
|
lv_error TYPE c LENGTH 1,
|
||||||
lv_include TYPE programm,
|
lv_include TYPE programm,
|
||||||
li_progress TYPE REF TO zif_abapgit_progress.
|
li_progress TYPE REF TO zif_abapgit_progress.
|
||||||
|
|
||||||
|
@ -389,7 +401,15 @@ CLASS zcl_abapgit_objects_activation IMPLEMENTATION.
|
||||||
p_name = lv_include
|
p_name = lv_include
|
||||||
p_include = lv_include.
|
p_include = lv_include.
|
||||||
|
|
||||||
lo_cross->index_actualize( ).
|
lo_cross->index_actualize( IMPORTING p_error = lv_error ).
|
||||||
|
|
||||||
|
IF lv_error = abap_true.
|
||||||
|
ls_item-obj_type = ls_class-object.
|
||||||
|
ls_item-obj_name = ls_class-clsname.
|
||||||
|
ii_log->add(
|
||||||
|
iv_msg = 'Error updating where-used list'
|
||||||
|
is_item = ls_item ).
|
||||||
|
ENDIF.
|
||||||
ENDLOOP.
|
ENDLOOP.
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
|
@ -794,13 +794,21 @@ CLASS zcl_abapgit_objects IMPLEMENTATION.
|
||||||
|
|
||||||
CASE is_step-step_id.
|
CASE is_step-step_id.
|
||||||
WHEN zif_abapgit_object=>gc_step_id-ddic.
|
WHEN zif_abapgit_object=>gc_step_id-ddic.
|
||||||
zcl_abapgit_objects_activation=>activate( abap_true ).
|
zcl_abapgit_objects_activation=>activate(
|
||||||
|
iv_ddic = abap_true
|
||||||
|
ii_log = ii_log ).
|
||||||
WHEN zif_abapgit_object=>gc_step_id-abap.
|
WHEN zif_abapgit_object=>gc_step_id-abap.
|
||||||
zcl_abapgit_objects_activation=>activate( abap_false ).
|
zcl_abapgit_objects_activation=>activate(
|
||||||
|
iv_ddic = abap_false
|
||||||
|
ii_log = ii_log ).
|
||||||
WHEN zif_abapgit_object=>gc_step_id-late.
|
WHEN zif_abapgit_object=>gc_step_id-late.
|
||||||
" late can have both DDIC (like TABL with REF TO) and non-DDIC objects
|
" late can have both DDIC (like TABL with REF TO) and non-DDIC objects
|
||||||
zcl_abapgit_objects_activation=>activate( abap_true ).
|
zcl_abapgit_objects_activation=>activate(
|
||||||
zcl_abapgit_objects_activation=>activate( abap_false ).
|
iv_ddic = abap_true
|
||||||
|
ii_log = ii_log ).
|
||||||
|
zcl_abapgit_objects_activation=>activate(
|
||||||
|
iv_ddic = abap_false
|
||||||
|
ii_log = ii_log ).
|
||||||
ENDCASE.
|
ENDCASE.
|
||||||
|
|
||||||
* Call postprocessing
|
* Call postprocessing
|
||||||
|
|
|
@ -39,7 +39,7 @@ ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CLASS ZCL_ABAPGIT_LOG IMPLEMENTATION.
|
CLASS zcl_abapgit_log IMPLEMENTATION.
|
||||||
|
|
||||||
|
|
||||||
METHOD constructor.
|
METHOD constructor.
|
||||||
|
@ -258,6 +258,7 @@ CLASS ZCL_ABAPGIT_LOG IMPLEMENTATION.
|
||||||
ls_msg-exception = <ls_log>-exception.
|
ls_msg-exception = <ls_log>-exception.
|
||||||
APPEND ls_msg TO rt_msg.
|
APPEND ls_msg TO rt_msg.
|
||||||
ENDLOOP.
|
ENDLOOP.
|
||||||
|
DELETE ADJACENT DUPLICATES FROM rt_msg.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user