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

Claus Ibsen commented on CAMEL-24727:
-------------------------------------

Follow-up for after the stage 1 PRs (#28671, #28675, #28688) are merged: 
Exporter should hold an ExportRequest instead of extending it.

Today {{Exporter extends ExportRequest}}, so an exporter is a request. That is 
because the exporters (CamelMainExporter, QuarkusExporter, SpringBootExporter) 
are a git mv of the old ExportBaseCommand subclasses, whose options were their 
own fields, and they use the 55 request fields directly in about 1000 places. 
oscerd suggested composition in the review of 
https://github.com/apache/camel/pull/28675 : the Exporter keeps a request 
field, as it already does for the ExportContext. That reads more cleanly, and 
an exporter could then no longer be passed where a plain request is expected.

The change was left out of #28675 so the move stays readable. It will be a 
separate, mechanical PR, with no change in behaviour. Each exporter already 
works on its own shallow copy of the request, which ProjectExporter.export 
makes, so the caller's request is not changed.

_Claude Code on behalf of davsclaus_

> camel-jbang: stage 1 - extract camel-jbang-export module
> --------------------------------------------------------
>
>                 Key: CAMEL-24727
>                 URL: https://issues.apache.org/jira/browse/CAMEL-24727
>             Project: Camel
>          Issue Type: Sub-task
>          Components: camel-jbang
>            Reporter: Ricardo Martinez
>            Assignee: Claus Ibsen
>            Priority: Trivial
>             Fix For: 4.24.0
>
>
> h2. Motivation
> The only Java API to export a Camel integration to a Maven project is 
> {{camel-jbang-core}}, i.e. the Camel CLI itself. Every consumer therefore 
> depends on picocli, jline and ~3500 lines of Run.
> This stage moves the export machinery into a picocli-free library module so 
> that consumers like Kaoto and the Camel TUI can create and run exported 
> projects through a pure Java API.
> h2. What changes
> New module {{dsl/camel-jbang/camel-jbang-export}} (package 
> {{org.apache.camel.dsl.jbang.export}}).
> Dependencies: camel-kamelet-main, camel-tooling-maven, camel-catalog, 
> freemarker, plexus-xml, snakeyaml. No picocli, no jline.
> Key relocated / new types:
> || Today (camel-jbang-core) || Moves to camel-jbang-export ||
> | ExportBaseCommand option fields | {{ExportRequest}} — plain mutable config |
> | ExportBaseCommand logic (resolveDependencies, copySourceFiles, 
> copyMavenWrapper, ...) | {{Exporter}} abstract class, same protected hook 
> names |
> | ExportCamelMain, ExportQuarkus, ExportSpringBoot (package-private) | 
> {{CamelMainExporter}}, {{QuarkusExporter}}, {{SpringBootExporter}} (public) |
> | Export.doExport() runtime switch | {{ProjectExporter}} facade: {{int 
> export(ExportRequest)}} |
> | ExportBaseCommand.runSilently(), Run exportRun branch, RunDownloadListener, 
> writeSettings | {{SilentRun}} + {{RunSettings}} |
> | ExportHelper, RunHelper pom half, TemplateHelper, VersionHelper, 
> QuarkusHelper, RuntimeUtil, PathUtils, XmlHelper, and others | move as-is 
> (already picocli-free) |
> | RuntimeType, CamelJBangConstants, PluginExporter, Printer, Source, 
> SourceScheme, SourceHelper | move; consumers rewrite imports |
> | pom.ftl templates, Dockerfiles, readme templates, run-java.sh, 
> maven-wrapper/, camel-wrapper/ | move |
> {{Export}} and {{ExportBaseCommand}} stay in {{camel-jbang-core}} as picocli 
> delegates until stage 6. {{camel-jbang-runner}} dependency flips from 
> {{camel-jbang-core}} to {{camel-jbang-export}}.
> {{Run}} loses the exportRun branch, RunDownloadListener, writeSettings and 
> the bodies of the three run<Runtime> methods (~700 lines); they become calls 
> to ProjectExporter and ProjectRunner.
> Add the module to {{dsl/camel-jbang/pom.xml}}, {{bom/camel-bom}} and the 
> camel-package-maven-plugin config. Move export-related tests (ExportTest, 
> ExportHelperTest, RuntimeTypeTest) to the new module.
> h2. Compatibility
> * Package change for RuntimeType, Printer, PluginExporter, 
> CamelJBangConstants, SourceScheme, ExportHelper — in-tree consumers rewrite 
> imports in the same PR; out-of-tree camel-jbang plugins need the same import 
> rewrite. Document in the 4.x upgrade guide.
> * {{.camel-jbang/camel-jbang-run.properties}} path and keys are preserved.
> * No CLI option added, removed or renamed.
> h2. Note
> After this stage a consumer of {{camel-jbang-export}} or 
> {{camel-jbang-runner}} no longer carries picocli or jline. camel-kamelet-main 
> is still a mandatory compile dependency of
> {{camel-jbang-export}} (resolved in stage 7).



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to