You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2020/05/05 10:45:45 UTC

[camel-quarkus] branch master updated (8b865a1 -> 50b1002)

This is an automated email from the ASF dual-hosted git repository.

lburgazzoli pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git.


    from 8b865a1  Replace hard coded native test categories with dynamic lookup
     new 8daf843  chore: replace deprecated methods
     new 0244923  chore: idiomatic use of builder
     new 50b1002  chore: suppress unchecked call wrning

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../quarkus/core/deployment/BuildProcessor.java    | 30 +++++-----
 .../quarkus/core/deployment/CamelSupport.java      | 35 +++++------
 .../core/deployment/NativeImageProcessor.java      | 67 ++++++++++++----------
 .../camel/quarkus/core/FastCamelContext.java       |  2 +
 4 files changed, 72 insertions(+), 62 deletions(-)


[camel-quarkus] 01/03: chore: replace deprecated methods

Posted by lb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 8daf843494a0282e5d46b63d6d14e0348dee35a3
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Mon May 4 08:10:28 2020 +0200

    chore: replace deprecated methods
---
 .../quarkus/core/deployment/BuildProcessor.java    | 30 +++++------
 .../quarkus/core/deployment/CamelSupport.java      | 35 ++++++-------
 .../core/deployment/NativeImageProcessor.java      | 58 ++++++++++++----------
 3 files changed, 65 insertions(+), 58 deletions(-)

diff --git a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/BuildProcessor.java b/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/BuildProcessor.java
index fe2e2fe..9f20a8c 100644
--- a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/BuildProcessor.java
+++ b/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/BuildProcessor.java
@@ -249,20 +249,22 @@ class BuildProcessor {
             // any discovery at runtime.
             //
             for (ApplicationArchive archive : applicationArchives.getAllApplicationArchives()) {
-                Path path = archive.getArchiveRoot().resolve(BaseTypeConverterRegistry.META_INF_SERVICES_TYPE_CONVERTER_LOADER);
-                if (!Files.isRegularFile(path)) {
-                    continue;
-                }
-
-                try {
-                    Files.readAllLines(path, StandardCharsets.UTF_8).stream()
-                            .map(String::trim)
-                            .filter(l -> !l.isEmpty())
-                            .filter(l -> !l.startsWith("#"))
-                            .map(l -> (Class<? extends TypeConverterLoader>) recorderContext.classProxy(l))
-                            .forEach(loader -> recorder.addTypeConverterLoader(typeConverterRegistry, loader));
-                } catch (IOException e) {
-                    throw new RuntimeException("Error discovering TypeConverterLoader", e);
+                for (Path root : archive.getRootDirs()) {
+                    Path path = root.resolve(BaseTypeConverterRegistry.META_INF_SERVICES_TYPE_CONVERTER_LOADER);
+                    if (!Files.isRegularFile(path)) {
+                        continue;
+                    }
+
+                    try {
+                        Files.readAllLines(path, StandardCharsets.UTF_8).stream()
+                                .map(String::trim)
+                                .filter(l -> !l.isEmpty())
+                                .filter(l -> !l.startsWith("#"))
+                                .map(l -> (Class<? extends TypeConverterLoader>) recorderContext.classProxy(l))
+                                .forEach(loader -> recorder.addTypeConverterLoader(typeConverterRegistry, loader));
+                    } catch (IOException e) {
+                        throw new RuntimeException("Error discovering TypeConverterLoader", e);
+                    }
                 }
             }
 
diff --git a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelSupport.java b/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelSupport.java
index a15215a..108e82f 100644
--- a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelSupport.java
+++ b/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelSupport.java
@@ -64,26 +64,27 @@ public final class CamelSupport {
         final Predicate<Path> filter = pathFilter.asPathPredicate();
 
         for (ApplicationArchive archive : archives.getAllApplicationArchives()) {
-            final Path root = archive.getArchiveRoot();
-            final Path resourcePath = root.resolve(CAMEL_SERVICE_BASE_PATH);
+            for (Path root : archive.getRootDirs()) {
+                final Path resourcePath = root.resolve(CAMEL_SERVICE_BASE_PATH);
 
-            if (!Files.isDirectory(resourcePath)) {
-                continue;
-            }
-
-            safeWalk(resourcePath).filter(Files::isRegularFile).forEach(file -> {
-                // the root archive may point to a jar file or the absolute path of
-                // a project's build output so we need to relativize to make the
-                // FastFactoryFinder work as expected
-                Path key = root.relativize(file);
+                if (!Files.isDirectory(resourcePath)) {
+                    continue;
+                }
 
-                if (filter.test(key)) {
-                    String clazz = readProperties(file).getProperty("class");
-                    if (clazz != null) {
-                        answer.add(new CamelServiceBuildItem(key, clazz));
+                safeWalk(resourcePath).filter(Files::isRegularFile).forEach(file -> {
+                    // the root archive may point to a jar file or the absolute path of
+                    // a project's build output so we need to relativize to make the
+                    // FastFactoryFinder work as expected
+                    Path key = root.relativize(file);
+
+                    if (filter.test(key)) {
+                        String clazz = readProperties(file).getProperty("class");
+                        if (clazz != null) {
+                            answer.add(new CamelServiceBuildItem(key, clazz));
+                        }
                     }
-                }
-            });
+                });
+            }
         }
 
         return answer.stream();
diff --git a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/NativeImageProcessor.java b/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/NativeImageProcessor.java
index 65ffb62..921a981 100644
--- a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/NativeImageProcessor.java
+++ b/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/NativeImageProcessor.java
@@ -190,21 +190,22 @@ public class NativeImageProcessor {
 
             if (config.runtimeCatalog.models) {
                 for (ApplicationArchive archive : archives.getAllApplicationArchives()) {
-                    final Path root = archive.getArchiveRoot();
-                    final Path resourcePath = root.resolve(CamelContextHelper.MODEL_DOCUMENTATION_PREFIX);
+                    for (Path root : archive.getRootDirs()) {
+                        final Path resourcePath = root.resolve(CamelContextHelper.MODEL_DOCUMENTATION_PREFIX);
 
-                    if (!Files.isDirectory(resourcePath)) {
-                        continue;
-                    }
+                        if (!Files.isDirectory(resourcePath)) {
+                            continue;
+                        }
 
-                    List<String> items = CamelSupport.safeWalk(resourcePath)
-                            .filter(Files::isRegularFile)
-                            .map(root::relativize)
-                            .map(Path::toString)
-                            .collect(Collectors.toList());
+                        List<String> items = CamelSupport.safeWalk(resourcePath)
+                                .filter(Files::isRegularFile)
+                                .map(root::relativize)
+                                .map(Path::toString)
+                                .collect(Collectors.toList());
 
-                    LOGGER.debug("Register catalog json: {}", items);
-                    resources.add(new NativeImageResourceBuildItem(items));
+                        LOGGER.debug("Register catalog json: {}", items);
+                        resources.add(new NativeImageResourceBuildItem(items));
+                    }
                 }
             }
 
@@ -229,15 +230,17 @@ public class NativeImageProcessor {
             PathFilter pathFilter = builder.build();
 
             for (ApplicationArchive archive : archives.getAllApplicationArchives()) {
-                LOGGER.debug("Scanning resources for native inclusion from archive at {}", archive.getArchiveLocation());
-
-                final Path rootPath = archive.getArchiveRoot();
-                Stream<Path> resourceStream = CamelSupport.safeWalk(rootPath).filter(path -> Files.isRegularFile(path));
-                resourceStream.map(rootPath::relativize).filter(pathFilter.asPathPredicate())
-                        .forEach(filteredPath -> {
-                            resources.produce(new NativeImageResourceBuildItem(filteredPath.toString()));
-                            LOGGER.debug("Embedding resource in native executable: {}", filteredPath.toString());
-                        });
+                LOGGER.debug("Scanning resources for native inclusion from archive at {}", archive.getPaths());
+
+                for (Path rootPath : archive.getRootDirs()) {
+                    CamelSupport.safeWalk(rootPath).filter(path -> Files.isRegularFile(path))
+                            .map(rootPath::relativize)
+                            .filter(pathFilter.asPathPredicate())
+                            .forEach(filteredPath -> {
+                                resources.produce(new NativeImageResourceBuildItem(filteredPath.toString()));
+                                LOGGER.debug("Embedding resource in native executable: {}", filteredPath.toString());
+                            });
+                }
             }
         }
 
@@ -264,13 +267,14 @@ public class NativeImageProcessor {
             final PathFilter pathFilter = builder.build();
 
             for (ApplicationArchive archive : archives.getAllApplicationArchives()) {
-                LOGGER.debug("Scanning resources for native inclusion from archive at {}", archive.getArchiveLocation());
+                LOGGER.debug("Scanning resources for native inclusion from archive at {}", archive.getPaths());
 
-                final Path rootPath = archive.getArchiveRoot();
-                String[] selectedClassNames = pathFilter.scanClassNames(rootPath, CamelSupport.safeWalk(rootPath),
-                        Files::isRegularFile);
-                if (selectedClassNames.length > 0) {
-                    reflectiveClasses.produce(new ReflectiveClassBuildItem(true, true, selectedClassNames));
+                for (Path rootPath : archive.getRootDirs()) {
+                    String[] selectedClassNames = pathFilter.scanClassNames(rootPath, CamelSupport.safeWalk(rootPath),
+                            Files::isRegularFile);
+                    if (selectedClassNames.length > 0) {
+                        reflectiveClasses.produce(new ReflectiveClassBuildItem(true, true, selectedClassNames));
+                    }
                 }
             }
         }


[camel-quarkus] 02/03: chore: idiomatic use of builder

Posted by lb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 02449238dc3645dcebfb9dd969fdac105250433d
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Mon May 4 08:20:57 2020 +0200

    chore: idiomatic use of builder
---
 .../camel/quarkus/core/deployment/NativeImageProcessor.java      | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/NativeImageProcessor.java b/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/NativeImageProcessor.java
index 921a981..a219a11 100644
--- a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/NativeImageProcessor.java
+++ b/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/NativeImageProcessor.java
@@ -222,12 +222,13 @@ public class NativeImageProcessor {
                 return;
             }
 
-            PathFilter.Builder builder = new PathFilter.Builder();
             LOGGER.debug("Scanning resources for native inclusion from include-patterns {}",
                     resourcesConfig.includePatterns.get());
-            builder.include(resourcesConfig.includePatterns);
-            builder.exclude(resourcesConfig.excludePatterns);
-            PathFilter pathFilter = builder.build();
+
+            PathFilter pathFilter = new PathFilter.Builder()
+                    .include(resourcesConfig.includePatterns)
+                    .exclude(resourcesConfig.excludePatterns)
+                    .build();
 
             for (ApplicationArchive archive : archives.getAllApplicationArchives()) {
                 LOGGER.debug("Scanning resources for native inclusion from archive at {}", archive.getPaths());


[camel-quarkus] 03/03: chore: suppress unchecked call wrning

Posted by lb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 50b10024b6b19ab237e14dab8338d82e002f7cf0
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Mon May 4 08:21:33 2020 +0200

    chore: suppress unchecked call wrning
---
 .../src/main/java/org/apache/camel/quarkus/core/FastCamelContext.java   | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/FastCamelContext.java b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/FastCamelContext.java
index 768a48f..5ae4af7 100644
--- a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/FastCamelContext.java
+++ b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/FastCamelContext.java
@@ -692,6 +692,7 @@ public class FastCamelContext extends AbstractCamelContext implements CatalogCam
         return RouteReifier.adviceWith(definition, this, builder);
     }
 
+    @SuppressWarnings("unchecked")
     @Override
     public void registerValidator(ValidatorDefinition def) {
         model.getValidators().add(def);
@@ -703,6 +704,7 @@ public class FastCamelContext extends AbstractCamelContext implements CatalogCam
         return new ValidatorKey(new DataType(def.getType()));
     }
 
+    @SuppressWarnings("unchecked")
     @Override
     public void registerTransformer(TransformerDefinition def) {
         model.getTransformers().add(def);