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

Move quarkus.camel.resources.* config options to quarkus.camel.native… #983

Merged
merged 1 commit into from
Mar 26, 2020
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
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/extensions/mustache.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ from("direct:start").to("mustache://template/simple.mustache");
In order to work in native mode the `include-patterns` configuration should be set. For instance, in the `application.properties` file as below :
[source,properties]
----
quarkus.camel.resources.include-patterns = template/*.mustache
quarkus.camel.native.resources.include-patterns = template/*.mustache
----

More information about selecting resources for inclusion in the native executable could be found at xref:native-mode.adoc#embedding-resource-in-native-executable[Embedding resource in native executable].
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ In case you are missing some Camel feature in the list:
== Camel Components

// components: START
Number of Camel components: 145 in 110 JAR artifacts (0 deprecated)
Number of Camel components: 146 in 111 JAR artifacts (0 deprecated)

[width="100%",cols="4,1,1,5",options="header"]
|===
Expand Down
4 changes: 2 additions & 2 deletions docs/modules/ROOT/pages/native-mode.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ in Quarkus documentation.
Resources needed at runtime need to be explicitly embedded in the built native executable. In such situations, the `include-patterns` and `exclude-patterns` configurations could be set in `application.properties` as demonstrated below:
[source,properties]
----
quarkus.camel.resources.include-patterns = docs/*,images/*
quarkus.camel.resources.exclude-patterns = docs/ignored.adoc,images/ignored.png
quarkus.camel.native.resources.include-patterns = docs/*,images/*
quarkus.camel.native.resources.exclude-patterns = docs/ignored.adoc,images/ignored.png
----
In the example above, resources named _docs/included.adoc_ and _images/included.png_ would be embedded in the native executable while _docs/ignored.adoc_ and _images/ignored.png_ would not.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.apache.camel.impl.engine.DefaultDataFormatResolver;
import org.apache.camel.impl.engine.DefaultLanguageResolver;
import org.apache.camel.quarkus.core.CamelConfig;
import org.apache.camel.quarkus.core.CamelConfig.ResourcesConfig;
import org.apache.camel.quarkus.core.Flags;
import org.apache.camel.quarkus.core.deployment.util.PathFilter;
import org.apache.camel.spi.DataFormat;
Expand Down Expand Up @@ -214,16 +215,17 @@ List<NativeImageResourceBuildItem> camelRuntimeCatalog(
void embedSelectResourcesInNativeExecutable(CamelConfig config, ApplicationArchivesBuildItem archives,
BuildProducer<NativeImageResourceBuildItem> resources) {

if (!config.resources.includePatterns.isPresent()) {
final ResourcesConfig resourcesConfig = config.native_.resources;
if (!resourcesConfig.includePatterns.isPresent()) {
LOGGER.debug("Not scanning resources for native inclusion as include-patterns is not set");
return;
}

PathFilter.Builder builder = new PathFilter.Builder();
LOGGER.debug("Scanning resources for native inclusion from include-patterns {}",
config.resources.includePatterns.get());
builder.include(config.resources.includePatterns);
builder.exclude(config.resources.excludePatterns);
resourcesConfig.includePatterns.get());
builder.include(resourcesConfig.includePatterns);
builder.exclude(resourcesConfig.excludePatterns);
PathFilter pathFilter = builder.build();

for (ApplicationArchive archive : archives.getAllApplicationArchives()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ public class CamelConfig {
public RuntimeCatalogConfig runtimeCatalog;

/**
* Build time configuration options for resources inclusion in the native executable.
* Build time configuration options related to the building of native executable.
*/
@ConfigItem
public ResourcesConfig resources;
@ConfigItem(name = "native")
public NativeConfig native_;

@ConfigGroup
public static class MainConfig {
Expand Down Expand Up @@ -186,6 +186,16 @@ public static class ServiceRegistryConfig {
public Optional<List<String>> includePatterns;
}

@ConfigGroup
public static class NativeConfig {
/**
* Build time configuration options for resources inclusion in the native executable.
*/
@ConfigItem
public ResourcesConfig resources;

}

@ConfigGroup
public static class ResourcesConfig {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ quarkus.log.category."org.apache.camel.quarkus.core".level = DEBUG
#
quarkus.camel.main.enabled = false
quarkus.camel.runtime-catalog.languages = false
quarkus.camel.resources.include-patterns = include-pattern-folder/*
quarkus.camel.resources.exclude-patterns = exclude-pattern-folder/*,include-pattern-folder/excluded.txt
quarkus.camel.native.resources.include-patterns = include-pattern-folder/*
quarkus.camel.native.resources.exclude-patterns = exclude-pattern-folder/*,include-pattern-folder/excluded.txt

#
# Camel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
## limitations under the License.
## ---------------------------------------------------------------------------

quarkus.camel.resources.include-patterns = template/*.mustache
quarkus.camel.native.resources.include-patterns = template/*.mustache