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

   _Claude Code on behalf of davsclaus_
   
   Stage 1c-2 of 
[CAMEL-24727](https://issues.apache.org/jira/browse/CAMEL-24727) (stage 1 of 
[CAMEL-24724](https://issues.apache.org/jira/browse/CAMEL-24724)), after 
#28671, #28675, #28688 and #28696.
   
   `camel run` and `camel export` should share one settings pipeline: how the 
files, `application.properties`, the profile and the options become the 
settings of the run (`camel-jbang-run.properties`, which the exporter reads) 
and the properties of `KameletMain`. Today it is ~550 lines inside `Run.run()`, 
tied to picocli fields. This PR moves it, unchanged, into camel-jbang-export, 
so the next step (1c-3) can build the silent run of an export on it, without 
picocli and without camel-jbang-core.
   
   It is a refactor, with no change of behaviour: the golden tests of #28696 
pass with their expected files unchanged.
   
   ## Changes
   
   New package `org.apache.camel.dsl.jbang.export.run` in camel-jbang-export:
   
   - **`RunRequest`**: the inputs of the pipeline, as public fields (like 
`ExportRequest`): the files, the name, the profile, the run options (dev, 
source and data dir, stub, trace, modeline, ...), the Maven resolver, the 
server options, the execution limits, JFR and OpenTelemetry, and the kind of 
run (export, debug, transform, script). The kinds stay five flags, as `run()` 
checks them in a fixed order.
   - **`RunSettings`**: writes `camel-jbang-run.properties` in the work dir 
(the same bytes as before) and holds the two ways a setting reaches 
`KameletMain`: the value of the profile or the default as an initial property, 
and an explicit flag as an override property (CAMEL-24705).
   - **`RunDownloadListener`**: the former inner class of `Run`, writing 
through `RunSettings`.
   - **`RunFiles`**: the checks of the kind of a file (skip, known DSL file, 
script, Groovy, TLS, JKube, readme, profile properties, excludes).
   - **`RunPipeline`**: the code of `Run.run()` from creating `KameletMain` to 
the dependencies: the options and settings, the loop over the files, the 
routes, classpath and other file settings, the properties locations, and the 
dependencies (profile, properties files, plugins, observe, OpenAPI UI, MCP, 
OpenTelemetry, JFR). What only the CLI has arrives as hooks: the printer, the 
active plugins (looked up with picocli, then customized and asked for their 
exporters at the same point as before), the `doAddInitialProperty` hook of the 
subclasses of `Run`, the clipboard, and the warning for `--data-dir` without 
`--source-dir`.
   
   `Run.run()` keeps what is the command's: the checks of the arguments and 
`camel run .`, the runtime of a `pom.xml` and the dispatch to Maven, cleaning 
the work dir, loading the profile, configuring the logging (the command's job 
since #28688), generating the OpenAPI file, `--code`, finding the files, then 
the `--camel-version` checks and how to run (in this JVM, another JVM, 
background, debug). `toRunRequest()` fills the request from the options; it 
shares the lists of the files and dependencies, and `fromRunRequest()` takes 
back what the pipeline completes and the run reads afterwards (the name, the 
files, the stub, the properties files, the ports).
   
   One block moved within `Run`: scanning a `pom.xml` project (`camel run 
pom.xml`) now runs just before the pipeline, as it uses the Maven scanning of 
camel-jbang-core. Before, it ran after the generated OpenAPI file was added to 
the files; with `--openapi` the files are never only a `pom.xml`, so the result 
is the same.
   
   Tests of the moved helpers moved with them: `RunPipelineTest` (OpenAPI UI 
and MCP options) and `RunPropertiesFilesDependenciesTest` are now in 
camel-jbang-export. The core tests of the command's options stay, with checks 
that the options reach the request.
   
   ## Tests
   
   - `RunExportGoldenTest`: 41 tests pass, and its expected files are unchanged.
   - camel-jbang-export: 123 tests pass (14 new or moved).
   - camel-jbang-core: 2491 tests in the default fork and 283 in the serial 
fork. The failures are local only, and fail the same way on `main`: 
`EvalSimpleTest` (it runs the Camel installed with JBang) and 9 tests of the AI 
commands.
   - The plugins that build on camel-jbang-core (edit, generate, kubernetes, 
mcp, test, tui, validate) and camel-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