You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2024/03/07 18:15:10 UTC
(camel) branch camel-4.4.x updated: CAMEL-20538: modeline for jbang DEPS should support style that jbang has, and if not found a better error message.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-4.4.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-4.4.x by this push:
new b296b289a64 CAMEL-20538: modeline for jbang DEPS should support style that jbang has, and if not found a better error message.
b296b289a64 is described below
commit b296b289a6461256581b237d3499d9d8bb67710e
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Mar 7 19:14:24 2024 +0100
CAMEL-20538: modeline for jbang DEPS should support style that jbang has, and if not found a better error message.
---
.../camel/dsl/modeline/DefaultModelineParser.java | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/dsl/camel-dsl-modeline/src/main/java/org/apache/camel/dsl/modeline/DefaultModelineParser.java b/dsl/camel-dsl-modeline/src/main/java/org/apache/camel/dsl/modeline/DefaultModelineParser.java
index 7d2569d93b4..fba0c68f6ca 100644
--- a/dsl/camel-dsl-modeline/src/main/java/org/apache/camel/dsl/modeline/DefaultModelineParser.java
+++ b/dsl/camel-dsl-modeline/src/main/java/org/apache/camel/dsl/modeline/DefaultModelineParser.java
@@ -106,6 +106,23 @@ public class DefaultModelineParser implements ModelineParser {
// skip @pom
continue;
}
+ // in case DEPS uses jbang ${ } style that refer to JVM system properties
+ if (part.contains("${") && part.contains("}")) {
+ String target = StringHelper.between(part, "${", "}");
+ String value = StringHelper.before(target, ":", target);
+ if (target.contains(":")) {
+ String def = StringHelper.after(target, ":");
+ value = System.getProperty(value, def);
+ } else {
+ String found = System.getProperty(value);
+ if (found == null) {
+ throw new IllegalArgumentException(
+ "Cannot find JVM system property: " + value + " for dependency: " + part);
+ }
+ value = found;
+ }
+ part = part.replace("${" + target + "}", value);
+ }
CamelContextCustomizer customizer = dep.parseTrait(resource, part);
if (customizer != null) {
answer.add(customizer);