davsclaus commented on code in PR #26660:
URL: https://github.com/apache/camel/pull/26660#discussion_r4060629718


##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/IntegrationLauncher.java:
##########
@@ -56,8 +56,12 @@ private IntegrationLauncher() {
      */
     public static JsonObject run(Path directory, List<String> files, String 
name, boolean dev, List<String> extraArgs) {
         List<String> cmd = new ArrayList<>(LauncherHelper.getCamelCommand());
-        List<String> sources = files == null || files.isEmpty() ? 
sourceFiles(directory) : files;
-        cmd.addAll(runArguments(sources, name, dev, extraArgs));
+        // no files given: the whole directory is the app (camel run 
--source-dir), so a file the agent adds later,
+        // a bean file, a Java class under src/main/java, is part of it and 
reloaded in dev mode (CAMEL-24861);
+        // with files given only those run, for a directory that holds several 
apps
+        boolean sourceDir = files == null || files.isEmpty();
+        List<String> sources = sourceDir ? sourceFiles(directory) : files;
+        cmd.addAll(sourceDir ? sourceDirArguments(name, dev, extraArgs) : 
runArguments(sources, name, dev, extraArgs));
         JsonObject result = new JsonObject();
         if (sources.isEmpty()) {
             result.put("directory", directory.toString());

Review Comment:
   Fixed: `sourceDirArguments` now sits above the `runArguments` Javadoc, which 
is back on `runArguments`.



##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/IntegrationLauncher.java:
##########
@@ -165,6 +173,24 @@ static List<String> sourceFiles(Path directory) {
      * @param  extraArgs further {@code camel run} arguments
      * @return           the arguments after the camel command itself
      */
+    /** The {@code camel run --source-dir=.} arguments: the directory the 
process starts in is the app. */
+    static List<String> sourceDirArguments(String name, boolean dev, 
List<String> extraArgs) {

Review Comment:
   Fixed: `sourceDirArguments` now sits above the `runArguments` Javadoc, which 
is back on `runArguments`.



-- 
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