davsclaus opened a new pull request, #28738:
URL: https://github.com/apache/camel/pull/28738

   _Claude Code on behalf of davsclaus_
   
   Part of [CAMEL-24727](https://issues.apache.org/jira/browse/CAMEL-24727). 
oscerd's review of #28675 suggested that an exporter should hold its 
`ExportRequest` instead of extending it; we agreed to do that as a separate 
mechanical change once the stage-1 stack had landed (#28735).
   
   Until now, `Exporter` extended `ExportRequest`, so each exporter 
(`CamelMainExporter`, `QuarkusExporter`, `SpringBootExporter`) was itself a 
request, with all its public fields, and all four classes were public. As 4.24 
has not been released yet, this is the time to settle the public API of 
camel-jbang-export before it becomes a compatibility promise: 
`ProjectExporter`, `ExportRequest`, `ExportContext` and `DependencyResolver`.
   
   ## Changes
   
   - **An exporter holds the request.** `Exporter` no longer extends 
`ExportRequest`: it holds a `protected final ExportRequest request`, a copy of 
the request it is given, as the copy constructor of `ExportRequest` did before. 
The uses of the request's fields in the exporters (227 of them) are now 
`request.x`. The change was made by the compiler: each reference that no longer 
resolved got the `request.` prefix, so a local variable or parameter with the 
same name as a field is left as it was. There is no other change to the 
exporters.
   - **The exporters are internal.** `Exporter`, `CamelMainExporter`, 
`QuarkusExporter`, `SpringBootExporter` and their constructors are 
package-private, as is `ProjectExporter.createExporter`.
   - **The helpers that other modules used move to `ExportHelper`.** 
`isCurrentDirOrParent` and `mavenGavComparator` (used by camel export), and 
`propertiesMap`, `mapBuildProperties`, `httpManagementPort` and 
`jkubeMavenPluginVersion` (used by the Kubernetes plugin) are static methods of 
`ExportHelper` in `org.apache.camel.dsl.jbang.export.common` now.
   - **camel-jbang-core exports through `ProjectExporter`.** `camel run 
--runtime=main|quarkus|spring-boot` and the commands that export to find the 
dependencies (`camel dependency list`, `camel sbom`) created an exporter 
themselves; they now call `ProjectExporter.export(baseDir, request)`. That 
method also checks that a runtime is set and that the local files exist: a 
missing runtime now gives "The runtime option must be specified" instead of a 
`NullPointerException` (the `switch` in `createExporter`), and a missing file 
"Path does not exist". `camel run` checks its files before, and the golden 
tests of the Maven runs give the same output.
   
   No behaviour changes: the request an exporter works on is still a copy, as 
before, so the caller's `ExportRequest` sees the same changes as before (none 
on its fields; its lists are shared, as the copy constructor of `ExportRequest` 
makes a shallow copy).
   
   ## Tests
   
   - `RunExportGoldenTest`: no change to the expected files.
   - camel-jbang-export: 127 tests pass.
   - camel-jbang-core: 2497 tests in the default fork and 285 in the serial 
fork. The only failures, `EvalSimpleTest` (it runs the Camel installed with 
JBang) and 9 tests of the AI tools, fail on `main` locally too.
   - The plugins and the launcher compile with their tests.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to