andau / abapCI

Continuous Integration for ABAP
MIT License
62 stars 14 forks source link

Feature Request / Question #7

Closed timostark closed 5 years ago

timostark commented 5 years ago

Hi @andau,

I installed the source-code of the plugin now and was also easily able to get it running in debug mode - thanks for that. Quick Question: Ideally I'd like to trigger a single ATC check (like when pressing CTRL+SHIFT+F2) when activating, and actually trigger an ATC check. Have you tried that before? I assume that the corresponding API is within com.sap.adt.atc.ui.internal.launch package. I am not really able though to communicate with objects in that package (or find the correct API) - anyways I am also not the biggest java developer.. So have you tried that before, and have any hints? Pull request with corresponding option in the settings would follow ofc..

image

Greets, Timo

timostark commented 5 years ago

PS: Some smaller remarks:

andau commented 5 years ago

Hi Timo!

The feature to trigger ATC checks only for the activated objects is now part of the plugin. I hope this is exactly what you need. The approach is related to the boy scout rule, so only modified ABAP objects are included in the evaluation. I am using the standard functionality provided by ABAP in Eclipse, see for example the Java class abapci/handlers/AbapAtcHandler.java.

The issues with the detection of inactive objects should be much better now. I think you checked out exactly when I was rebuilding the activation detection. Function modules are (currently) not detected, but if you find any other issues feel free to report or fix them.

Sure using the ATC problem view would be a cool thing. The two main reason to not use it were that first I want to indicate active ATC findings with a color on the UI and second I want to accumulate the ATC findings with each activation).

Personally I do not like to mix Unit tests and ATC checks because Unit tests indicate an code error and ATC checks hopefully only a code smell.

But finally the Plugin is highly configurable and thus everybody should use it as it fits best for her/him.

I am curious about your further feedback. Greetings, Andreas

timostark commented 5 years ago

Dear Andreas,

Thanks a lot for your update. I will recheck your commits immediatly after my vacation on friday. I am curious also about your jenkins integration. We have just Established a jenkins pipeline on our Side - with code checks, automatic deployments,unit Tests and e2etests.. ( no big experience though if that Really brings all the benefit i hope from it). Maybe we can have a chat together on how you are building up your pipeline and compare the 'best Practices'? Regarding ATC: i would prefer to have the atc problem viewer of abap in eclipse, over an own version of it. Especially because of the source code highlighting and available quick fixes. At least in the last version you were 'only' reusing the backend communication for the atc Check (of abap in eclipse). This backend communication did not update the source code highlighting or similiar.. For that there seems to be different apis (in the abap eclipse atc package). Unfortunatly in the private package. I was able to trigger the command (rightclick run atc) - that is also not perfect though as it will always only run for one file. If you are interested i can still send you the api call). Have you tried to get the source code highlighting and quick fixes Working? Thanks a lot again, Timo

timostark commented 5 years ago

Another question: i understood that the unit tests are always executed for all objects in the selected packages right? does the plugin also allow to only run unit tests for the activated objects? We have 5k unit tests. Running all of them all the Time seems to be a bit workprocess intensive:)

andau commented 5 years ago

Hi Timo!

Regarding the Unit test run. Please check the second option in the preferences. When this checkbox is activated only the unit tests for the actived objects are triggered. 5k unit tests - respect.

The target of the plugin is not to replace any of the Abap in Eclipse views. Of course it would be cool to get the ATC problem view triggered with an activation (especially with the latest possibilites of delta runs). But I did not find out till how it can be done without a too tight coupling of the Plugin to ABAP in Eclipse. Currently I am using the views as follow:

  1. ABAP CI Dashboard or the status bar shows the current source code state (3 different colors)
  2. when the error is self-explaining its immediaetly fixed
  3. else I use the standard ATC and Unit tests for fixing the issues. ... so the plugin is only for visualisation, for fixing the errors the standard views are much better

The Jenkins integration is something I freezed at the moment. Currently we have only daily testruns and no pipeline installed. The feature in the abapCI Plugin was planned to get dependent jobs triggered for example and sapUI Jenkins job - this works but I do not use it frequently. Your established system sounds quite mature, maybe you can find some additional info in the following resources:
https://twitter.com/lechnerc77/status/1017325589190135809 https://github.com/lechnerc77/ABAP_CI_PIPELINE_BASE https://medium.com/pacroy/continuous-integration-in-abap-3db48fc21028

Greetings, Andreas

timostark commented 5 years ago

"But I did not find out till how it can be done without a too tight coupling of the Plugin to ABAP in Eclipse."

Can you give me a short hint, about what you've found here? Not that I'd like to couple them thighly, but honestly the only solution I found so far, is to analyze the eclipse command being fired when executing the ATC Checks via rightlick (or shortcut), and sending that from the plugin after activation. That is far from beeing nice though. Have you found a better solution here (even with tight coupling)?

Regards, Timo

andau commented 5 years ago

Well the code to trigger the standard View would be something like the following

AtcLauncher atcHandler = new AtcLauncher(...);  /** <<<<< */ 
    try {
        atcHandler.launch(projectName, projectSettings, adtItems);
    } catch (CoreException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

But at runtime this leads to the error below as the package com/sap/adt/atc/ui/internal/launch is not included in the export packages of the corresponding plugin. java.lang.NoClassDefFoundError: com/sap/adt/atc/ui/internal/launch/AtcLauncher.

An solution would be to duplicate all the classes which can not be accessed but that would lead to a large bunch of dependencies.