Skip to content

Commit

Permalink
Use capabilities instead of feature names
Browse files Browse the repository at this point in the history
  • Loading branch information
lburgazzoli committed Nov 3, 2019
1 parent 719774d commit 86b5830
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.apache.camel.quarkus.core.deployment.CamelRoutesCollectorBuildItem;
import org.apache.camel.quarkus.core.deployment.CamelSupport;
import org.apache.camel.quarkus.core.deployment.CamelXmlLoaderBuildItem;
import org.apache.camel.quarkus.support.common.CamelCapabilities;

class XmlProcessor {

Expand All @@ -36,7 +37,7 @@ JaxbFileRootBuildItem fileRoot() {
return new JaxbFileRootBuildItem(CamelSupport.CAMEL_ROOT_PACKAGE_DIRECTORY);
}

@BuildStep
@BuildStep(providesCapabilities = CamelCapabilities.XML)
FeatureBuildItem feature() {
return new FeatureBuildItem(FEATURE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@

import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.arc.deployment.BeanContainerBuildItem;
import io.quarkus.deployment.Capabilities;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.annotations.ExecutionTime;
import io.quarkus.deployment.annotations.Overridable;
import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.ApplicationArchivesBuildItem;
import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.ServiceStartBuildItem;
import io.quarkus.deployment.builditem.ShutdownContextBuildItem;
import io.quarkus.deployment.recording.RecorderContext;
Expand All @@ -44,6 +44,7 @@
import org.apache.camel.quarkus.core.CoreAttachmentsRecorder;
import org.apache.camel.quarkus.core.Flags;
import org.apache.camel.quarkus.core.UploadAttacher;
import org.apache.camel.quarkus.support.common.CamelCapabilities;
import org.apache.camel.spi.Registry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -137,8 +138,9 @@ public CamelXmlLoaderBuildItem createXmlLoader(CamelRecorder recorder) {

@BuildStep
@Record(ExecutionTime.STATIC_INIT)
void disableXmlReifiers(CamelRecorder recorder, List<FeatureBuildItem> features) {
if (features.stream().map(FeatureBuildItem::getInfo).noneMatch("camel-xml"::equals)) {
void disableXmlReifiers(CamelRecorder recorder, Capabilities capabilities) {
if (!capabilities.isCapabilityPresent(CamelCapabilities.XML)) {
LOGGER.debug("Camel XML capability not detected, disable XML reifiers");
recorder.disableXmlReifiers();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@

import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import org.apache.camel.quarkus.support.common.CamelCapabilities;

class Feature {
private static final String FEATURE = "camel-core";

@BuildStep
@BuildStep(providesCapabilities = CamelCapabilities.CORE)
FeatureBuildItem feature() {
return new FeatureBuildItem(FEATURE);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.quarkus.support.common;

public final class CamelCapabilities {
public static final String CORE = "org.apache.camel";
public static final String XML = "org.apache.camel.xml";

private CamelCapabilities() {
}
}

0 comments on commit 86b5830

Please sign in to comment.