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

   The `--exclude` point of item 6 of 
[CAMEL-26930](https://issues.apache.org/jira/browse/CAMEL-26930). The other 
points of item 6 are #29928 (reload for logs, target, `.git`) and #29946 
(properties reload, two folders).
   
   ## Problem
   
   - `RunFiles.skipFile` matched an exclude against the file name only, so a 
pattern with a folder (`sub/skip.camel.yaml`, `routes/**`) never matched.
   - `camel run .`, `--source-dir` and `camel dev` load the directory with 
`camel.main.routesIncludePattern=file:<dir>/**`, and `--exclude` was not 
applied to it at all. This is a regression of CAMEL-25349, which made `camel 
run .` a source directory run; the golden case `excludes` (a directory with 
`--exclude=*.xml`) had the `.xml` route loaded.
   
   ## Change
   
   - An exclude matches the file name, as before, or the path as given (without 
a leading `./`).
   - With a source directory, the excludes become 
`camel.main.routesExcludePattern`, under the directory: `file:<dir>/<pattern>`, 
and a pattern without a folder matches a file name in any folder 
(`file:<dir>/**/<pattern>`), as it does for the files given by name. A 
`routesExcludePattern` set already is kept.
   - They are also excludes of the dev mode reload pattern (`!<pattern>`), so 
saving an excluded file does not load it; also for a run in a plain JVM 
(`CamelMainRunner`).
   
   On the launcher, with `a`, `skip`, `sub/b` and `sub/skip2` routes:
   
   ```
                                                                       main     
                  this branch
   camel run a.camel.yaml sub/b.camel.yaml sub/skip2.camel.yaml \
             --exclude=sub/skip2.camel.yaml                            a sub/b 
sub/skip2          a sub/b
   camel run . --exclude=skip.camel.yaml                               a skip 
sub/b sub/skip2     a sub/b sub/skip2
   camel run . --exclude=sub/**                                        a skip 
sub/b sub/skip2     a skip
   camel run . --exclude=skip*.camel.yaml                              (all)    
                  a sub/b
   camel run --source-dir=sub --exclude=skip2.camel.yaml               (all of 
sub)               sub/b
   camel run . --dev --exclude=skip.camel.yaml, then save skip         -        
                  not loaded
   ```
   
   ## Tests
   
   - `RunFilesTest.anExcludeWithAFolderMatchesThePath`: a path, `./` and 
`sub/**` match; a file name pattern still matches in any folder.
   - `RunPipelineExcludeTest` (new): the exclude pattern under `.` and under 
`routes/`, none for no excludes, and the reload excludes.
   - The golden `excludes.run.txt` now has 
`camel.main.routesExcludePattern=file:.../excludes/**/*.xml`.
   - camel-jbang-run: 307 pass. camel-jbang-core: 3002 + 259 pass.
   
   _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]

Reply via email to