Skip to content

Commit

Permalink
Merge pull request #983 from ppalaga/200326-config-opts
Browse files Browse the repository at this point in the history
Move quarkus.camel.resources.* config options to quarkus.camel.native…
  • Loading branch information
oscerd committed Mar 26, 2020
2 parents b03e4d1 + 5675391 commit 2165e16
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 14 deletions.
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

0 comments on commit 2165e16

Please sign in to comment.