davsclaus opened a new pull request, #29946: URL: https://github.com/apache/camel/pull/29946
Two of the four points of item 6 of [CAMEL-26930](https://issues.apache.org/jira/browse/CAMEL-26930): in dev mode, `application.properties` was never reloaded, and with files in two folders only one folder was watched. (`--exclude` comes in another PR; the reload for logs, target and `.git` is #29928.) ## Problem Without a source directory, `RunPipeline.setupReload` (and `CamelMainRunner.reloadArgs` for a run in a plain JVM) watched the folder of the first file that is in another folder than the current one, with the files as given on the command line as the pattern: - `camel run` adds the auto-detected `./application.properties`, and the pattern `./application.properties` does not match the file the watcher sees (`application.properties`), so a change of a property was never reloaded, which `camel-jbang-running.adoc` says it is. - `camel run a.camel.yaml other/b.camel.yaml --dev` watched `other`, so a change of `a.camel.yaml` (or of `application.properties`) was not seen. ## Change `RunPipeline.reloadFolder` watches the deepest folder that has all the files, and gives the files relative to that folder, normalized, as the pattern. A file in `.camel-jbang`, which the watch leaves out, does not widen the folder. `CamelMainRunner` uses it too; it gave only the file names, without the sub folders. On the launcher, `camel run a.camel.yaml other/b.camel.yaml --dev`, with `a.camel.yaml` logging `{{greeting}}`, then changing `application.properties`, `a.camel.yaml` and `other/b.camel.yaml` in turn: ``` main: Live route reloading enabled (directory: other) A hello (after the property change) A hello (after the edit of a.camel.yaml) B edited this branch: Live route reloading enabled (directory: .) Reloading properties: file:application.properties ... A changed A edited changed B edited ``` ## Tests - `RunPipelineReloadFolderTest` (new): files in the current directory, `./application.properties`, files in two folders (also `../x` and `../y`), in one other folder, a file of `.camel-jbang`, absolute paths. - The golden `dev.run.txt` of `RunExportGoldenTest` ran `golden/yaml/hello.camel.yaml` and `golden/groovy/Greeting.groovy` and watched only `golden/yaml`; it now watches `golden` with `yaml/hello.camel.yaml,groovy/Greeting.groovy`. - camel-jbang-run: 309 pass. camel-jbang-core: 3002 + 259 pass (`DependencyUpdateTest` flaked twice and passed on the rerun). _Claude Code on behalf of davsclaus_ 🤖 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]
