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

pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new cc0c902bfbdd fix(ci): adding all-components auto generated unsupported 
arch profile
cc0c902bfbdd is described below

commit cc0c902bfbdd794c291be0db7b991bc761ba3ae3
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Thu Jan 22 12:49:43 2026 +0100

    fix(ci): adding all-components auto generated unsupported arch profile
    
    If we mark the component as "unsupported arch" via `camel.unsupported.arch` 
pom property, this is not going to be available in the all-components which is 
necessary when we want to skip a given module compilation
    
    Ref CAMEL-22869
---
 catalog/camel-allcomponents/pom.xml                | 30 +++++++++++++---
 components/camel-ai/camel-chroma/pom.xml           |  1 +
 .../maven/packaging/PrepareComponentMojo.java      | 40 ++++++++++++++++++----
 3 files changed, 59 insertions(+), 12 deletions(-)

diff --git a/catalog/camel-allcomponents/pom.xml 
b/catalog/camel-allcomponents/pom.xml
index 38e8c81170d6..35cc174b10b6 100644
--- a/catalog/camel-allcomponents/pom.xml
+++ b/catalog/camel-allcomponents/pom.xml
@@ -51,6 +51,7 @@
     </repositories>
 
     <dependencies>
+        <!-- CODEGEN SUPPORTED ARCHITECTURES DEPENDENCIES START -->
         <dependency>
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-activemq</artifactId>
@@ -416,11 +417,6 @@
             <artifactId>camel-chatscript</artifactId>
             <version>${project.version}</version>
         </dependency>
-        <dependency>
-            <groupId>org.apache.camel</groupId>
-            <artifactId>camel-chroma</artifactId>
-            <version>${project.version}</version>
-        </dependency>
         <dependency>
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-chunk</artifactId>
@@ -2271,6 +2267,30 @@
             <artifactId>camel-zookeeper-master</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <!-- CODEGEN SUPPORTED ARCHITECTURES DEPENDENCIES END -->
     </dependencies>
 
+    <profiles>
+        <!--
+        IMPORTANT: this is used to detect unsupported modules which cannot be 
compiled for certain architectures.
+        -->
+        <profile>
+            <id>unsupported-arch</id>
+            <activation>
+                <property>
+                    <name>!unsupported-arch</name>
+                </property>
+            </activation>
+            <dependencies>
+                <!-- CODEGEN UNSUPPORTED ARCHITECTURES DEPENDENCIES START -->
+                <dependency>
+                    <groupId>org.apache.camel</groupId>
+                    <artifactId>camel-chroma</artifactId>
+                    <version>${project.version}</version>
+                </dependency>
+                <!-- CODEGEN UNSUPPORTED ARCHITECTURES DEPENDENCIES END -->
+            </dependencies>
+        </profile>
+    </profiles>
+
 </project>
diff --git a/components/camel-ai/camel-chroma/pom.xml 
b/components/camel-ai/camel-chroma/pom.xml
index f99163943c55..1c0cb1668645 100644
--- a/components/camel-ai/camel-chroma/pom.xml
+++ b/components/camel-ai/camel-chroma/pom.xml
@@ -34,6 +34,7 @@
     <properties>
         <camel.surefire.parallel>true</camel.surefire.parallel>
         <camel.surefire.parallel.factor>4</camel.surefire.parallel.factor>
+        <camel.unsupported.arch>true</camel.unsupported.arch>
     </properties>
 
     <dependencies>
diff --git 
a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareComponentMojo.java
 
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareComponentMojo.java
index f278b1364990..3573e56a8706 100644
--- 
a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareComponentMojo.java
+++ 
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareComponentMojo.java
@@ -256,8 +256,8 @@ public class PrepareComponentMojo extends 
AbstractGeneratorMojo {
         Path root = findCamelDirectory(project.getBasedir(), 
"catalog/camel-allcomponents").toPath();
         Path pomFile = root.resolve("pom.xml");
 
-        final String startDependenciesMarker = "<dependencies>";
-        final String endDependenciesMarker = "</dependencies>";
+        final String startDependenciesMarker = "<!-- CODEGEN SUPPORTED 
ARCHITECTURES DEPENDENCIES START -->";
+        final String endDependenciesMarker = "<!-- CODEGEN SUPPORTED 
ARCHITECTURES DEPENDENCIES END -->";
 
         if (!Files.isRegularFile(pomFile)) {
             throw new MojoExecutionException("Pom file " + pomFile + " does 
not exist");
@@ -276,12 +276,20 @@ public class PrepareComponentMojo extends 
AbstractGeneratorMojo {
                     
"<dependency>\\s*<groupId>(?<groupId>.*)</groupId>\\s*<artifactId>(?<artifactId>.*)</artifactId>");
             Matcher matcher = pattern.matcher(between);
             TreeSet<MavenGav> dependencies = new TreeSet<>();
+            TreeSet<MavenGav> unsupportedArchDependencies = new TreeSet<>();
             while (matcher.find()) {
                 MavenGav gav = new MavenGav(matcher.group(1), 
matcher.group(2), "${project.version}", null);
                 dependencies.add(gav);
             }
-            // add ourselves
-            dependencies.add(new MavenGav(project.getGroupId(), 
project.getArtifactId(), "${project.version}", null));
+            if 
("true".equals(project.getProperties().getProperty("camel.unsupported.arch"))) {
+                // Add this component into the "unsupported architectures" 
profile
+                getLog().info("IMPORTANT NOTE: adding this component to the 
\"unupported architectures\" profile");
+                unsupportedArchDependencies
+                        .add(new MavenGav(project.getGroupId(), 
project.getArtifactId(), "${project.version}", null));
+            } else {
+                // Add this component into the regular list of dependencies
+                dependencies.add(new MavenGav(project.getGroupId(), 
project.getArtifactId(), "${project.version}", null));
+            }
 
             // generate string output of all dependencies
             String s = dependencies.stream()
@@ -289,9 +297,27 @@ public class PrepareComponentMojo extends 
AbstractGeneratorMojo {
                     .filter(g -> !g.artifactId.contains("-maven-plugin"))
                     .map(g -> g.asString("        "))
                     .collect(Collectors.joining("\n"));
-            final String updatedPom = before + startDependenciesMarker
-                                      + "\n" + s + "\n"
-                                      + "    " + endDependenciesMarker + after;
+            String updatedPom = before + startDependenciesMarker
+                                + "\n" + s + "\n"
+                                + "        " + endDependenciesMarker + after;
+
+            if (!unsupportedArchDependencies.isEmpty()) {
+                final String unsupportedStartDependenciesMarker
+                        = "<!-- CODEGEN UNSUPPORTED ARCHITECTURES DEPENDENCIES 
START -->";
+                final String unsupportedEndDependenciesMarker = "<!-- CODEGEN 
UNSUPPORTED ARCHITECTURES DEPENDENCIES END -->";
+                final String unsupportedBefore = Strings.before(updatedPom, 
unsupportedStartDependenciesMarker);
+                final String unsupportedAfter = Strings.after(updatedPom, 
unsupportedEndDependenciesMarker);
+
+                String newUnsupportedContent = 
unsupportedArchDependencies.stream()
+                        // skip maven plugins
+                        .filter(g -> !g.artifactId.contains("-maven-plugin"))
+                        .map(g -> g.asString("                "))
+                        .collect(Collectors.joining("\n"));
+
+                updatedPom = unsupportedBefore + 
unsupportedStartDependenciesMarker
+                             + "\n" + newUnsupportedContent + "\n"
+                             + "                " + 
unsupportedEndDependenciesMarker + unsupportedAfter;
+            }
 
             updateResource(root, "pom.xml", updatedPom);
         } catch (IOException e) {

Reply via email to