automatiko-io / automatiko-engine

Automatiko workflow engine to build services and functions
https://automatiko.io
Apache License 2.0
76 stars 9 forks source link

Gradle codegen path issue #447

Closed deepakkapoor23 closed 1 month ago

deepakkapoor23 commented 3 months ago

DLS workflow example produces the following error during build although the build continues after this. The highlighted path seems incorrect. This is a source file and not generated one, it shouldn't be looking for it in the build directory.

This error is only seen with a Gradle build but not with a Maven build.

java.io.FileNotFoundException: C:\dev\projects\automatiko\automatiko-examples\build\classes\java\main\src\main\java\io\automatiko\examples\dsl\MyWorkflows.java (The system cannot find the path specified) at java.base/java.io.FileInputStream.open0(Native Method) at java.base/java.io.FileInputStream.open(FileInputStream.java:216) at java.base/java.io.FileInputStream.(FileInputStream.java:157) at com.github.javaparser.Providers.provider(Providers.java:62) at com.github.javaparser.JavaParser.parse(JavaParser.java:198) at com.github.javaparser.JavaParserAdapter.parse(JavaParserAdapter.java:95) at com.github.javaparser.StaticJavaParser.parse(StaticJavaParser.java:141) at io.automatiko.engine.codegen.LambdaParser.parseLambdas(LambdaParser.java:32) at io.automatiko.engine.codegen.LambdaParser.parseLambdas(LambdaParser.java:19) at io.automatiko.engine.quarkus.deployment.AutomatikoQuarkusProcessor.addProcessGenerator(AutomatikoQuarkusProcessor.java:658) at io.automatiko.engine.quarkus.deployment.AutomatikoQuarkusProcessor.createApplicationGenerator(AutomatikoQuarkusProcessor.java:636) at io.automatiko.engine.quarkus.deployment.AutomatikoQuarkusProcessor.generateClassesFromResourcesStep(AutomatikoQuarkusProcessor.java:184) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849) at io.quarkus.builder.BuildContext.run(BuildContext.java:256) at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521) at java.base/java.lang.Thread.run(Thread.java:833) at org.jboss.threads.JBossThread.run(JBossThread.java:483) java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at io.automatiko.engine.quarkus.deployment.AutomatikoQuarkusProcessor.addProcessGenerator(AutomatikoQuarkusProcessor.java:674) at io.automatiko.engine.quarkus.deployment.AutomatikoQuarkusProcessor.createApplicationGenerator(AutomatikoQuarkusProcessor.java:636) at io.automatiko.engine.quarkus.deployment.AutomatikoQuarkusProcessor.generateClassesFromResourcesStep(AutomatikoQuarkusProcessor.java:184) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849) at io.quarkus.builder.BuildContext.run(BuildContext.java:256) at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521) at java.base/java.lang.Thread.run(Thread.java:833) at org.jboss.threads.JBossThread.run(JBossThread.java:483) Caused by: java.lang.IllegalStateException: Missing lambda expressions for method 'split' at io.automatiko.engine.workflow.builder.BuilderContext.get(BuilderContext.java:18) at io.automatiko.engine.workflow.builder.SplitNodeBuilder.when(SplitNodeBuilder.java:32) at io.automatiko.examples.dsl.MyWorkflows.split(MyWorkflows.java:43)

mswiderski commented 3 months ago

currently automatiko does not support gradle as build tool, mainly due to the fact I personally have zero experience with it as build tool so won't be easy for me to do that.

deepakkapoor23 commented 3 months ago

I see that its generating rest of the code well with Gradle, I am not sure if this is just a warning or will actually impact anything in the run.

mswiderski commented 3 months ago

it most likely will have some impact as it attempts to get the source of the lambda used within workflows which was mainly script or expressions - so if you don't use that then it should be fine. Plus maybe it will be easy to be fixed - what is the path that gradle stores the source files in?

deepakkapoor23 commented 3 months ago

Gradle generated source should ideally be in build/classes/java/quarkus-generated-sources/automatiko but it ends up in build/classes/java/main/target/generated-sources/automatiko (as if it was being built with Maven). The paths are mixed up.

image

mswiderski commented 3 months ago

yeah, that is because it does not really handle gradle at all and all paths are based on maven default project structure.

deepakkapoor23 commented 3 months ago

Can the codegen be modified to recognize Gradle as built tool with a system property -Dorg.gradle.appname ? And have different paths (generated source, resources, compiled classes) based on Gradle vs Maven build tool.

mswiderski commented 3 months ago

will try to fix it as part of the other issue with windows paths .. maybe there will be just a matter to check based on different project structures.

mswiderski commented 3 months ago

started to look at this and PR with some changes are submitted - still work in progress https://github.com/automatiko-io/automatiko-engine/pull/457

where things are generated can be currently controlled by system properties (-Dio.automatiko.codegen.resources.directory)

in addition, in application.properties you can set the quarkus.automatiko.source-folder property that points to where source files can be found, especially important for Java DSL workflows.

Could you please give it a try? If still does not work having a sample gradle project with some hints how to run it could be useful.

mswiderski commented 1 month ago

closing due no response