[ 
https://issues.apache.org/jira/browse/CAMEL-19504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17737527#comment-17737527
 ] 

Otavio Rodolfo Piske edited comment on CAMEL-19504 at 8/29/23 4:43 AM:
-----------------------------------------------------------------------

One idea I thought about solving this problem is to generate a metadata file 
instead of generating code. That way we can: 

 
 # Generalize the Configurer so that it reads the metadata file instead. 
 # Remove a HUGE amount of (generated) code
 # Simplify the generator code (which is very hard code to read/maintain)
 # Make the build much faster (due to approximately 12204 lines of code less)
 # Reuse the metadata in conjunction with the catalog and other files we 
already have to provide more help and features, as there will be another source 
with additional configuration information.


was (Author: orpiske):
One idea I thought about solving this problem is to generate a metadata file 
instead of generating code. That way we can: 

 
 # Generalize the Configurer so that it reads the metadata file instead. 
 # Remove a HUGE amount of (generated) code which improve the build time 
(approximately 12204 lines of code)
 # Simplify the generator code (which is very hard code to read/maintain)
 # Make the build much faster
 # Reuse the metadata in conjunction with the catalog and other files we 
already have to provide more help and features, as there will be another source 
with additional configuration information.

> camel-core: post-compile lifecycle phase leads to double compilation
> --------------------------------------------------------------------
>
>                 Key: CAMEL-19504
>                 URL: https://issues.apache.org/jira/browse/CAMEL-19504
>             Project: Camel
>          Issue Type: Task
>          Components: build system, camel-core, camel-core-reifier
>            Reporter: Otavio Rodolfo Piske
>            Priority: Major
>         Attachments: camel-core-model-twice.log, double-compilation.txt.gz
>
>
> I discovered that our build seems to waste a lot of time recompiling code due 
> to some of the code generators generating the code in a post-compile Maven 
> lifecycle phase.
>  
> This seems to happen for a lot of modules, but below I describe the problem 
> for the camel-core-model.
>  
> Here's the problem:
> 1. The camel-core-model [depends on the 
> camel-package-maven-plugin|https://github.com/apache/camel/blob/41e0df411bf80104f10929d8d80392564cbcaf72/core/camel-core-model/pom.xml#L72-L88]
>  to generate the configurers (such as 
> [ServiceCallConfigurationConfigurer|https://github.com/apache/camel/blob/41e0df411bf80104f10929d8d80392564cbcaf72/core/camel-core-model/src/generated/java/org/apache/camel/model/cloud/ServiceCallConfigurationConfigurer.java],
>  
> [Resilience4jConfigurationDefinitionConfigurer|https://github.com/apache/camel/blob/41e0df411bf80104f10929d8d80392564cbcaf72/core/camel-core-model/src/generated/java/org/apache/camel/model/Resilience4jConfigurationDefinitionConfigurer.java],
>  etc).
> 2. The 
> [ConfigurerGeneratorMojo|https://github.com/apache/camel/blob/41e0df411bf80104f10929d8d80392564cbcaf72/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/GenerateConfigurerMojo.java#L32-L35]
>  uses the PROCESS_CLASSES lifecycle phase as the default.
> 3. As per [Maven 
> documentation|https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Lifecycle_Reference],
>  the process class phase happens after the compile.
> 4. As a result, the code is generated after the first compilation, which 
> leads to warning "[INFO] Changes detected - recompiling the module" and a 
> recompilation of the module.
> 5. In some cases, this leads to a recompilation of the whole module, which 
> can increase the build time significantly for large modules.
>  
> See the attached log files for examples.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to