devonfw / cobigen

Code-based Incremental Generator
Apache License 2.0
35 stars 70 forks source link

Optimize CobiGen startup process and detection of a monolithic configuration #1664

Open EduardKrieger opened 1 year ago

EduardKrieger commented 1 year ago

The detection of a monolithic configuration occurs late in the startup process and takes place, after a CobiGen object is created, in the configurationHolder by a simple query whether the passed path of the configuration contains a template sets. This can be checked earlier and the DeprecatedMonolithicConfigurationException can be thrown faster and would improve the startup of Cobigen.

Throw of the Exception: https://github.com/devonfw/cobigen/blob/27dced68bb8d0d6fc672508016d92621b5526150/cobigen/cobigen-core/src/main/java/com/devonfw/cobigen/impl/CobiGenFactory.java#L101-L102

The check for a template-sets configuration https://github.com/devonfw/cobigen/blob/27dced68bb8d0d6fc672508016d92621b5526150/cobigen/cobigen-core/src/main/java/com/devonfw/cobigen/impl/config/ConfigurationHolder.java#L186-L195

I would suggest implementing the new check right before registerPlugins(): https://github.com/devonfw/cobigen/blob/27dced68bb8d0d6fc672508016d92621b5526150/cobigen-cli/cli/src/main/java/com/devonfw/cobigen/cli/utils/CobiGenUtils.java#L47-L63