diff --git a/camel-k-quarkus/camel-k-quarkus-knative/runtime/pom.xml b/camel-k-quarkus/camel-k-quarkus-knative/runtime/pom.xml index 53dc33e85..522905cf4 100644 --- a/camel-k-quarkus/camel-k-quarkus-knative/runtime/pom.xml +++ b/camel-k-quarkus/camel-k-quarkus-knative/runtime/pom.xml @@ -42,7 +42,15 @@ org.apache.camel.k - camel-k-runtime-knative + camel-knative-api + + + org.apache.camel.k + camel-knative + + + org.apache.camel.k + camel-knative-http org.apache.camel diff --git a/tooling/camel-k-maven-plugin/src/it/generate-catalog-main/verify.groovy b/tooling/camel-k-maven-plugin/src/it/generate-catalog-main/verify.groovy index 99fdadd3e..bd8666d00 100644 --- a/tooling/camel-k-maven-plugin/src/it/generate-catalog-main/verify.groovy +++ b/tooling/camel-k-maven-plugin/src/it/generate-catalog-main/verify.groovy @@ -30,3 +30,11 @@ assert catalog.spec.runtime.capabilities['rest'].dependencies[1].groupId == 'org assert catalog.spec.runtime.capabilities['rest'].dependencies[1].artifactId == 'camel-undertow' assert catalog.metadata.labels['camel.apache.org/runtime.version'] == runtimeVersion + +assert catalog.spec.artifacts['camel-knative'].dependencies.size == 3 +assert catalog.spec.artifacts['camel-knative'].dependencies.find { it.groupId == 'org.apache.camel.k' && it.artifactId == 'camel-knative-api'} +assert catalog.spec.artifacts['camel-knative'].dependencies.find { it.groupId == 'org.apache.camel.k' && it.artifactId == 'camel-knative'} +assert catalog.spec.artifacts['camel-knative'].dependencies.find { it.groupId == 'org.apache.camel.k' && it.artifactId == 'camel-knative-http'} + +assert catalog.spec.artifacts['camel-knative'].schemes.size == 1 +assert catalog.spec.artifacts['camel-knative'].schemes[0].id == 'knative' diff --git a/tooling/camel-k-maven-plugin/src/it/generate-catalog-quarkus/verify.groovy b/tooling/camel-k-maven-plugin/src/it/generate-catalog-quarkus/verify.groovy index 8c0df4c16..3f9680bc9 100644 --- a/tooling/camel-k-maven-plugin/src/it/generate-catalog-quarkus/verify.groovy +++ b/tooling/camel-k-maven-plugin/src/it/generate-catalog-quarkus/verify.groovy @@ -30,3 +30,9 @@ assert catalog.spec.runtime.capabilities['rest'].dependencies[1].groupId == 'org assert catalog.spec.runtime.capabilities['rest'].dependencies[1].artifactId == 'camel-quarkus-platform-http' assert catalog.metadata.labels['camel.apache.org/runtime.version'] == runtimeVersion + +assert catalog.spec.artifacts['camel-knative'].dependencies.size == 1 +assert catalog.spec.artifacts['camel-knative'].dependencies[0].groupId == 'org.apache.camel.k' +assert catalog.spec.artifacts['camel-knative'].dependencies[0].artifactId == 'camel-k-quarkus-knative' +assert catalog.spec.artifacts['camel-knative'].schemes.size == 1 +assert catalog.spec.artifacts['camel-knative'].schemes[0].id == 'knative' diff --git a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CamelArtifact.java b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CamelArtifact.java index d03191973..8b60ab65c 100644 --- a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CamelArtifact.java +++ b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CamelArtifact.java @@ -18,6 +18,7 @@ import java.util.Collections; import java.util.Set; +import java.util.function.BooleanSupplier; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -65,5 +66,11 @@ default Set getJavaTypes() { } class Builder extends ImmutableCamelArtifact.Builder { + public Builder addDependencies(BooleanSupplier condition, Artifact... artifacts) { + if (condition.getAsBoolean()) { + addDependencies(artifacts); + } + return this; + } } } diff --git a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3x.java b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3x.java index c0fc4b8f6..e23544368 100644 --- a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3x.java +++ b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3x.java @@ -24,6 +24,7 @@ import com.vdurmont.semver4j.Semver; import org.apache.camel.catalog.CamelCatalog; +import org.apache.camel.catalog.DefaultRuntimeProvider; import org.apache.camel.catalog.quarkus.QuarkusRuntimeProvider; import org.apache.camel.k.tooling.maven.model.CamelArtifact; import org.apache.camel.k.tooling.maven.model.CamelLoader; @@ -151,10 +152,16 @@ public void process(MavenProject project, CamelCatalog catalog, CamelCatalogSpec new CamelArtifact.Builder() .groupId("org.apache.camel.k") .artifactId("camel-k-runtime-knative") - .addDependencies(MavenArtifact.from("org.apache.camel.k", "camel-k-loader-yaml")) - .addDependencies(MavenArtifact.from("org.apache.camel.k", "camel-knative-api")) - .addDependencies(MavenArtifact.from("org.apache.camel.k", "camel-knative")) - .addDependencies(MavenArtifact.from("org.apache.camel.k", "camel-knative-http")) + .addDependencies( + () -> catalog.getRuntimeProvider() instanceof DefaultRuntimeProvider, + MavenArtifact.from("org.apache.camel.k", "camel-k-loader-yaml"), + MavenArtifact.from("org.apache.camel.k", "camel-knative-api"), + MavenArtifact.from("org.apache.camel.k", "camel-knative"), + MavenArtifact.from("org.apache.camel.k", "camel-knative-http")) + .addDependencies( + () -> catalog.getRuntimeProvider() instanceof QuarkusRuntimeProvider, + MavenArtifact.from("org.apache.camel.k", "camel-k-quarkus-knative"), + MavenArtifact.from("org.apache.camel.k", "camel-k-quarkus-loader-yaml")) .build() ); @@ -166,8 +173,14 @@ public void process(MavenProject project, CamelCatalog catalog, CamelCatalogSpec .id("knative") .http(true) .build()) - .addDependencies(MavenArtifact.from("org.apache.camel.k", "camel-knative-api")) - .addDependencies(MavenArtifact.from("org.apache.camel.k", "camel-knative-http")) + .addDependencies( + () -> catalog.getRuntimeProvider() instanceof DefaultRuntimeProvider, + MavenArtifact.from("org.apache.camel.k", "camel-knative-api"), + MavenArtifact.from("org.apache.camel.k", "camel-knative"), + MavenArtifact.from("org.apache.camel.k", "camel-knative-http")) + .addDependencies( + () -> catalog.getRuntimeProvider() instanceof QuarkusRuntimeProvider, + MavenArtifact.from("org.apache.camel.k", "camel-k-quarkus-knative")) .build() ); } diff --git a/tooling/camel-k-maven-plugin/src/test/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3Test.java b/tooling/camel-k-maven-plugin/src/test/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3Test.java index 82e99a5f0..9a953bcc9 100644 --- a/tooling/camel-k-maven-plugin/src/test/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3Test.java +++ b/tooling/camel-k-maven-plugin/src/test/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3Test.java @@ -53,8 +53,6 @@ public void testAcceptLessThanLower() { @Test public void testAcceptEqualToHigher() { - CatalogProcessor3x cp3 = new CatalogProcessor3x(); - CamelCatalog catalog = versionCamelCatalog("4.0.0"); assertThat(new CatalogProcessor3x().accepts(catalog)).isFalse(); @@ -87,7 +85,7 @@ public void testArtifactsEnrichment() { assertThat(artifactMap.get("camel-k-runtime-knative")).satisfies(a -> { assertThat(a.getDependencies()).anyMatch( - d -> d.getGroupId().equals("org.apache.camel.k") && d.getArtifactId().equals("camel-knative") + d -> d.getGroupId().equals("org.apache.camel.k") && d.getArtifactId().equals("camel-knative-api") ); assertThat(a.getDependencies()).anyMatch( d -> d.getGroupId().equals("org.apache.camel.k") && d.getArtifactId().equals("camel-knative")