You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2022/06/21 14:29:22 UTC

[GitHub] [camel-quarkus] zbendhiba opened a new pull request, #3867: Add JVM extension DSL modeline

zbendhiba opened a new pull request, #3867:
URL: https://github.com/apache/camel-quarkus/pull/3867

   Fixes #3834
   
   <!-- Uncomment and fill this section if your PR is not trivial
   [ ] An issue should be filed for the change unless this is a trivial change (fixing a typo or similar). One issue should ideally be fixed by not more than one commit and the other way round, each commit should fix just one issue, without pulling in other changes.
   [ ] Each commit in the pull request should have a meaningful and properly spelled subject line and body. Copying the title of the associated issue is typically enough. Please include the issue number in the commit message prefixed by #.
   [ ] The pull request description should explain what the pull request does, how, and why. If the info is available in the associated issue or some other external document, a link is enough.
   [ ] Phrases like Fix #<issueNumber> or Fixes #<issueNumber> will auto-close the named issue upon merging the pull request. Using them is typically a good idea.
   [ ] Please run mvn process-resources -Pformat (and amend the changes if necessary) before sending the pull request.
   [ ] Contributor guide is your good friend: https://camel.apache.org/camel-quarkus/latest/contributor-guide.html
   -->


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zbendhiba commented on a diff in pull request #3867: Add extension DSL modeline

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on code in PR #3867:
URL: https://github.com/apache/camel-quarkus/pull/3867#discussion_r914520600


##########
integration-tests/dsl-modeline/src/test/java/org/apache/camel/quarkus/component/dsl/modeline/it/DslModelineTest.java:
##########
@@ -0,0 +1,195 @@
+/*
+ * 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.component.dsl.modeline.it;
+
+import java.util.List;
+
+import javax.ws.rs.core.Response;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.Matchers.equalTo;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+@QuarkusTest
+public class DslModelineTest {
+
+    @Test
+    void testModelineSingleDependency() {
+        String line = "// camel-k: dependency=mvn:org.my:application:1.0";

Review Comment:
   I'll move it to WIP to check this one, how it is supposed to work. If it's more than detecting, and it has to upload those while runtime, it could be problematic.
   Also by checking the code of the component, there are other kinds of options, like Environment variables,.  I'm not sure the `System.getEnv` is appropriate for Quarkus  runtime 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zbendhiba commented on a diff in pull request #3867: Add extension DSL modeline

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on code in PR #3867:
URL: https://github.com/apache/camel-quarkus/pull/3867#discussion_r914517915


##########
extensions/dsl-modeline/deployment/src/main/java/org/apache/camel/quarkus/component/dsl/modeline/deployment/DslModelineProcessor.java:
##########
@@ -0,0 +1,50 @@
+/*
+ * 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.component.dsl.modeline.deployment;
+
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.annotations.ExecutionTime;
+import io.quarkus.deployment.annotations.Record;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.pkg.steps.NativeBuild;
+import io.quarkus.runtime.RuntimeValue;
+import org.apache.camel.CamelContext;
+import org.apache.camel.quarkus.component.dsl.modeline.runtime.PropertyTraitRecorder;
+import org.apache.camel.quarkus.core.deployment.spi.CamelContextBuildItem;
+
+public class DslModelineProcessor {
+    private static final String FEATURE = "camel-dsl-modeline";
+
+    @BuildStep
+    FeatureBuildItem feature() {
+        return new FeatureBuildItem(FEATURE);
+    }
+
+    @BuildStep(onlyIf = NativeBuild.class)
+    void nativeUnsupported() {
+        throw new RuntimeException("The " + FEATURE + " extension is not supported in native mode "
+                + "as loading DSL modeline code at runtime is not supported on GraalVM");
+    }
+
+    @Record(value = ExecutionTime.RUNTIME_INIT)
+    @BuildStep
+    void addPropertyTrait(CamelContextBuildItem camelContextBuildItem, PropertyTraitRecorder propertyTraitRecorder) {
+        RuntimeValue<CamelContext> context = camelContextBuildItem.getCamelContext();
+        propertyTraitRecorder.addPropertyTrait(context);

Review Comment:
   it seems to work for this one



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zbendhiba commented on pull request #3867: Add JVM extension DSL modeline

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on PR #3867:
URL: https://github.com/apache/camel-quarkus/pull/3867#issuecomment-1161828090

   @davsclaus could you review please ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zbendhiba commented on pull request #3867: Add JVM extension DSL modeline

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on PR #3867:
URL: https://github.com/apache/camel-quarkus/pull/3867#issuecomment-1167315226

   @davsclaus what makes [this propertiesSource](https://github.com/apache/camel/blob/2245f5c1eb1c63ec0beaaf598cc476bb6038a1ff/dsl/camel-dsl-modeline/src/main/java/org/apache/camel/dsl/modeline/DefaultModelineFactory.java#L64) different from null. I'm missing the part of what creates this one.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zbendhiba commented on a diff in pull request #3867: Add extension DSL modeline

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on code in PR #3867:
URL: https://github.com/apache/camel-quarkus/pull/3867#discussion_r995555768


##########
integration-tests/dsl-modeline/src/test/java/org/apache/camel/quarkus/component/dsl/modeline/it/DslModelineTest.java:
##########
@@ -0,0 +1,195 @@
+/*
+ * 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.component.dsl.modeline.it;
+
+import java.util.List;
+
+import javax.ws.rs.core.Response;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.Matchers.equalTo;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+@QuarkusTest
+public class DslModelineTest {
+
+    @Test
+    void testModelineSingleDependency() {
+        String line = "// camel-k: dependency=mvn:org.my:application:1.0";

Review Comment:
   @jamesnetherton  oh yes nice catch. I regenerated this file. The status was also incorrect. Moved to "Preview", as other JVM extensions



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zbendhiba commented on pull request #3867: Add JVM extension DSL modeline

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on PR #3867:
URL: https://github.com/apache/camel-quarkus/pull/3867#issuecomment-1161831841

   @davsclaus I want to make sure, it's an extension needed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zbendhiba commented on pull request #3867: Add JVM extension DSL modeline

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on PR #3867:
URL: https://github.com/apache/camel-quarkus/pull/3867#issuecomment-1161876024

   Needs an integration test


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zbendhiba commented on pull request #3867: Add JVM extension DSL modeline

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on PR #3867:
URL: https://github.com/apache/camel-quarkus/pull/3867#issuecomment-1167141045

   @davsclaus @jamesnetherton I'm trying to get some examples in the project. The lookup of properties doesn't work out of the box.
   
   This[ line of code](https://github.com/apache/camel/blob/ff571a78846e0f292753749a771cd808cea84b65/dsl/camel-dsl-modeline/src/test/java/org/apache/camel/dsl/modeline/ModelineParserTest.java#L108) doesn't get the expected result. 
   The reason behind is that the property is not available in the `camel-microprofile-config` propertiesComponent.
   
   Any idea how can I bind those camel-dsl-modeline properties? 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zbendhiba commented on pull request #3867: Add JVM extension DSL modeline

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on PR #3867:
URL: https://github.com/apache/camel-quarkus/pull/3867#issuecomment-1167276622

   > Yes you cannot test it as if that is added to the property - the modeline is in use during route creations and are available for these routes.
   > 
   > Can you try to get the property trait via
   > 
   > ```
   >         PropertiesComponent pc = camelContext.getPropertiesComponent();
   >         PropertiesSource ps = pc.getPropertiesSource("property");
   > ```
   
   Nope, but I guess the way I test is not okay.
   When you say `the modeline is in use during route creations`. Is having the dependency is enough, or do we need to configure the context before starting the routes ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] jamesnetherton commented on a diff in pull request #3867: Add extension DSL modeline

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on code in PR #3867:
URL: https://github.com/apache/camel-quarkus/pull/3867#discussion_r913863805


##########
extensions/dsl-modeline/deployment/src/main/java/org/apache/camel/quarkus/component/dsl/modeline/deployment/DslModelineProcessor.java:
##########
@@ -0,0 +1,50 @@
+/*
+ * 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.component.dsl.modeline.deployment;
+
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.annotations.ExecutionTime;
+import io.quarkus.deployment.annotations.Record;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.pkg.steps.NativeBuild;
+import io.quarkus.runtime.RuntimeValue;
+import org.apache.camel.CamelContext;
+import org.apache.camel.quarkus.component.dsl.modeline.runtime.PropertyTraitRecorder;
+import org.apache.camel.quarkus.core.deployment.spi.CamelContextBuildItem;
+
+public class DslModelineProcessor {
+    private static final String FEATURE = "camel-dsl-modeline";
+
+    @BuildStep
+    FeatureBuildItem feature() {
+        return new FeatureBuildItem(FEATURE);
+    }
+
+    @BuildStep(onlyIf = NativeBuild.class)
+    void nativeUnsupported() {
+        throw new RuntimeException("The " + FEATURE + " extension is not supported in native mode "
+                + "as loading DSL modeline code at runtime is not supported on GraalVM");
+    }
+
+    @Record(value = ExecutionTime.RUNTIME_INIT)
+    @BuildStep
+    void addPropertyTrait(CamelContextBuildItem camelContextBuildItem, PropertyTraitRecorder propertyTraitRecorder) {
+        RuntimeValue<CamelContext> context = camelContextBuildItem.getCamelContext();
+        propertyTraitRecorder.addPropertyTrait(context);

Review Comment:
   Yes `@Record(value = ExecutionTime.STATIC_INIT)`.
   
   But there is probably a bit more work involved to make it work that way, which I why I proposed we could consider doing a follow up issue for it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] davsclaus commented on pull request #3867: Add JVM extension DSL modeline

Posted by GitBox <gi...@apache.org>.
davsclaus commented on PR #3867:
URL: https://github.com/apache/camel-quarkus/pull/3867#issuecomment-1167156353

   Yes you cannot test it as if that is added to the property - the modeline is in use during route creations and are available for these routes.
   
   Can you try to get the property trait via
   
   ```
           PropertiesComponent pc = camelContext.getPropertiesComponent();
           PropertiesSource ps = pc.getPropertiesSource("property");
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zbendhiba commented on a diff in pull request #3867: Add extension DSL modeline

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on code in PR #3867:
URL: https://github.com/apache/camel-quarkus/pull/3867#discussion_r913838745


##########
extensions/dsl-modeline/deployment/src/main/java/org/apache/camel/quarkus/component/dsl/modeline/deployment/DslModelineProcessor.java:
##########
@@ -0,0 +1,50 @@
+/*
+ * 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.component.dsl.modeline.deployment;
+
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.annotations.ExecutionTime;
+import io.quarkus.deployment.annotations.Record;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.pkg.steps.NativeBuild;
+import io.quarkus.runtime.RuntimeValue;
+import org.apache.camel.CamelContext;
+import org.apache.camel.quarkus.component.dsl.modeline.runtime.PropertyTraitRecorder;
+import org.apache.camel.quarkus.core.deployment.spi.CamelContextBuildItem;
+
+public class DslModelineProcessor {
+    private static final String FEATURE = "camel-dsl-modeline";
+
+    @BuildStep
+    FeatureBuildItem feature() {
+        return new FeatureBuildItem(FEATURE);
+    }
+
+    @BuildStep(onlyIf = NativeBuild.class)
+    void nativeUnsupported() {
+        throw new RuntimeException("The " + FEATURE + " extension is not supported in native mode "
+                + "as loading DSL modeline code at runtime is not supported on GraalVM");
+    }
+
+    @Record(value = ExecutionTime.RUNTIME_INIT)
+    @BuildStep
+    void addPropertyTrait(CamelContextBuildItem camelContextBuildItem, PropertyTraitRecorder propertyTraitRecorder) {
+        RuntimeValue<CamelContext> context = camelContextBuildItem.getCamelContext();
+        propertyTraitRecorder.addPropertyTrait(context);

Review Comment:
   @jamesnetherton Do you mean replacing it by ```@Record(value = ExecutionTime.STATIC_INIT)``` or removing the record ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] jamesnetherton commented on a diff in pull request #3867: Add extension DSL modeline

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on code in PR #3867:
URL: https://github.com/apache/camel-quarkus/pull/3867#discussion_r994737491


##########
integration-tests/dsl-modeline/src/test/java/org/apache/camel/quarkus/component/dsl/modeline/it/DslModelineTest.java:
##########
@@ -0,0 +1,195 @@
+/*
+ * 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.component.dsl.modeline.it;
+
+import java.util.List;
+
+import javax.ws.rs.core.Response;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.Matchers.equalTo;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+@QuarkusTest
+public class DslModelineTest {
+
+    @Test
+    void testModelineSingleDependency() {
+        String line = "// camel-k: dependency=mvn:org.my:application:1.0";

Review Comment:
   Might be best to tweak the extension metadata so that it's consistent with the other JVM only extensions. E.g add `unlisted: true`. Otherwise it shows up on code.quarkus.io.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] davsclaus commented on pull request #3867: Add JVM extension DSL modeline

Posted by GitBox <gi...@apache.org>.
davsclaus commented on PR #3867:
URL: https://github.com/apache/camel-quarkus/pull/3867#issuecomment-1167531329

   Its loaded via classpath service detection
   https://github.com/apache/camel/blob/2245f5c1eb1c63ec0beaaf598cc476bb6038a1ff/dsl/camel-dsl-modeline/src/generated/resources/META-INF/services/org/apache/camel/properties-source-factory
   
   Which is done on startup at
   https://github.com/apache/camel/blob/main/core/camel-base/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java#L740
   
   It may be that camel-quarkus need some "build step" code that detect that camel-modeline-dsl is on the classpath and automatic loads the properties source and enlist in the registry.
   
   For what its worth is similar to how many of the other optional services in Camel are auto-detect from classpath, where quarkus has some build time optimizations.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zbendhiba commented on a diff in pull request #3867: Add extension DSL modeline

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on code in PR #3867:
URL: https://github.com/apache/camel-quarkus/pull/3867#discussion_r994723821


##########
integration-tests/dsl-modeline/src/test/java/org/apache/camel/quarkus/component/dsl/modeline/it/DslModelineTest.java:
##########
@@ -0,0 +1,195 @@
+/*
+ * 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.component.dsl.modeline.it;
+
+import java.util.List;
+
+import javax.ws.rs.core.Response;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.Matchers.equalTo;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+@QuarkusTest
+public class DslModelineTest {
+
+    @Test
+    void testModelineSingleDependency() {
+        String line = "// camel-k: dependency=mvn:org.my:application:1.0";

Review Comment:
   I put it to JVM only for now



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zbendhiba commented on a diff in pull request #3867: Add extension DSL modeline

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on code in PR #3867:
URL: https://github.com/apache/camel-quarkus/pull/3867#discussion_r913808222


##########
extensions/dsl-modeline/deployment/src/main/java/org/apache/camel/quarkus/component/dsl/modeline/deployment/DslModelineProcessor.java:
##########
@@ -0,0 +1,50 @@
+/*
+ * 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.component.dsl.modeline.deployment;
+
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.annotations.ExecutionTime;
+import io.quarkus.deployment.annotations.Record;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.pkg.steps.NativeBuild;
+import io.quarkus.runtime.RuntimeValue;
+import org.apache.camel.CamelContext;
+import org.apache.camel.quarkus.component.dsl.modeline.runtime.PropertyTraitRecorder;
+import org.apache.camel.quarkus.core.deployment.spi.CamelContextBuildItem;
+
+public class DslModelineProcessor {
+    private static final String FEATURE = "camel-dsl-modeline";
+
+    @BuildStep
+    FeatureBuildItem feature() {
+        return new FeatureBuildItem(FEATURE);
+    }
+
+    @BuildStep(onlyIf = NativeBuild.class)
+    void nativeUnsupported() {

Review Comment:
   Oh yes I need to delete this one.
   Thanks



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zbendhiba merged pull request #3867: Add extension DSL modeline

Posted by GitBox <gi...@apache.org>.
zbendhiba merged PR #3867:
URL: https://github.com/apache/camel-quarkus/pull/3867


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zbendhiba commented on pull request #3867: Add JVM extension DSL modeline

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on PR #3867:
URL: https://github.com/apache/camel-quarkus/pull/3867#issuecomment-1168872377

   @davsclaus thanks for all the explanations. I resolved it by adding the trait via a recorder on Runtime Init.
   I'll add more tests, and try native mode, so I'm keeping this one as draft. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zbendhiba commented on pull request #3867: Add JVM extension DSL modeline

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on PR #3867:
URL: https://github.com/apache/camel-quarkus/pull/3867#issuecomment-1173864869

   The PR is ready for reviews. I've added integrations tests and native support


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] jamesnetherton commented on a diff in pull request #3867: Add extension DSL modeline

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on code in PR #3867:
URL: https://github.com/apache/camel-quarkus/pull/3867#discussion_r913455540


##########
extensions/dsl-modeline/deployment/src/main/java/org/apache/camel/quarkus/component/dsl/modeline/deployment/DslModelineProcessor.java:
##########
@@ -0,0 +1,50 @@
+/*
+ * 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.component.dsl.modeline.deployment;
+
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.annotations.ExecutionTime;
+import io.quarkus.deployment.annotations.Record;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.pkg.steps.NativeBuild;
+import io.quarkus.runtime.RuntimeValue;
+import org.apache.camel.CamelContext;
+import org.apache.camel.quarkus.component.dsl.modeline.runtime.PropertyTraitRecorder;
+import org.apache.camel.quarkus.core.deployment.spi.CamelContextBuildItem;
+
+public class DslModelineProcessor {
+    private static final String FEATURE = "camel-dsl-modeline";
+
+    @BuildStep
+    FeatureBuildItem feature() {
+        return new FeatureBuildItem(FEATURE);
+    }
+
+    @BuildStep(onlyIf = NativeBuild.class)
+    void nativeUnsupported() {
+        throw new RuntimeException("The " + FEATURE + " extension is not supported in native mode "
+                + "as loading DSL modeline code at runtime is not supported on GraalVM");
+    }
+
+    @Record(value = ExecutionTime.RUNTIME_INIT)
+    @BuildStep
+    void addPropertyTrait(CamelContextBuildItem camelContextBuildItem, PropertyTraitRecorder propertyTraitRecorder) {
+        RuntimeValue<CamelContext> context = camelContextBuildItem.getCamelContext();
+        propertyTraitRecorder.addPropertyTrait(context);

Review Comment:
   We don't have to do this now, but we can probably optimize this to be `STATIC_INIT`. E.g create the `PropertiesComponent` at build time, configure any additional stuff like traits and then pass it to the `CamelContext` we create.



##########
integration-tests/dsl-modeline/src/test/java/org/apache/camel/quarkus/component/dsl/modeline/it/DslModelineTest.java:
##########
@@ -0,0 +1,195 @@
+/*
+ * 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.component.dsl.modeline.it;
+
+import java.util.List;
+
+import javax.ws.rs.core.Response;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.Matchers.equalTo;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+@QuarkusTest
+public class DslModelineTest {
+
+    @Test
+    void testModelineSingleDependency() {
+        String line = "// camel-k: dependency=mvn:org.my:application:1.0";

Review Comment:
   We test that the parsing of the modeline bits work correctly, which is great.
   
   But, does stuff like declaring additional dependencies actually work in a real Camel Quarkus app?



##########
extensions/dsl-modeline/deployment/src/main/java/org/apache/camel/quarkus/component/dsl/modeline/deployment/DslModelineProcessor.java:
##########
@@ -0,0 +1,50 @@
+/*
+ * 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.component.dsl.modeline.deployment;
+
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.annotations.ExecutionTime;
+import io.quarkus.deployment.annotations.Record;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.pkg.steps.NativeBuild;
+import io.quarkus.runtime.RuntimeValue;
+import org.apache.camel.CamelContext;
+import org.apache.camel.quarkus.component.dsl.modeline.runtime.PropertyTraitRecorder;
+import org.apache.camel.quarkus.core.deployment.spi.CamelContextBuildItem;
+
+public class DslModelineProcessor {
+    private static final String FEATURE = "camel-dsl-modeline";
+
+    @BuildStep
+    FeatureBuildItem feature() {
+        return new FeatureBuildItem(FEATURE);
+    }
+
+    @BuildStep(onlyIf = NativeBuild.class)
+    void nativeUnsupported() {

Review Comment:
   PR comment states that native support was added but this suggests that there is no native support?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org