Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use capabilities instead of feature names #369

Merged
merged 1 commit into from
Nov 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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() {
}
}