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

use Vert.x RPC service code generation #53

Closed
vorburger opened this issue May 17, 2018 · 10 comments
Closed

use Vert.x RPC service code generation #53

vorburger opened this issue May 17, 2018 · 10 comments
Assignees

Comments

@vorburger
Copy link
Member

to replace current event bus messaging related code

@vorburger
Copy link
Member Author

vorburger commented May 17, 2018

@pmlopes @vietj would you happen to have any idea why this seemingly simple change to use the io.vertx:vertx-service-proxy annotationProcessor for @VertxGen @ProxyGen when lauched with ./gradlew build suprisingly breaks this previously building fine project with this unexpected error:

> Task :web:compileTestJava FAILED
/home/vorburger/dev/Minecraft/git/minecraft-storeys-maker/web/src/test/java/ch/vorburger/minecraft/storeys/web/SeleniumTest.java:66: error: cannot find symbol
    private static VertxStarter vertxStarter;
                   ^
  symbol:   class VertxStarter
  location: class SeleniumTest
1 error

where this VertxStarter class obviously is present, which is NOT even Vert.x annotated, is suddenly not built anymore by Gradle? When we comment this out in web/build.gradle:

// annotationProcessor "io.vertx:vertx-service-proxy:$vertxVersion:processor"

then the ./gradlew build build passes just fine again. It makes no sense to me how an APT processor could make an arbitrary Java source file suddenly not get compiled anymore. It's clearly there without your annotation processor, but disappears when this project is built by Gradle with it:

find . -name "VertxStarter.class" 
./web/build/classes/java/main/ch/vorburger/minecraft/storeys/web/VertxStarter.class

@vorburger
Copy link
Member Author

An upgrade from Gradle 4.6 to 4.7 (incl. "Incremental annotation processing") does not help.

@edewit FYI

@vorburger
Copy link
Member Author

but disappears when this project is built by Gradle with it:

whoa there's a bigger problem, it's not just that class (VertxStarter) that's missing, but it does not compile anything at all anymore when that annotation processor from Vert.x is active! The web/build/classes/java/main is just completely empty.

NB: We use the (new, since Gradle 4.6) annotationProcessor scope:

annotationProcessor "io.vertx:vertx-service-proxy:$vertxVersion:processor"

because wtih compile, like in the starter project produced by https://vertx-starter.jetdrone.xyz:

compile "io.vertx:vertx-service-proxy:$vertxVersion:processor"

it fails like this for us in this project:

$ ./gradlew build --stacktrace
Task :web:compileJava FAILED
warning: No SupportedSourceVersion annotation found on io.vertx.serviceproxy.ServiceProxyProcessor, returning RELEASE_6.
warning: Supported source version 'RELEASE_6' from annotation processor 'io.vertx.serviceproxy.ServiceProxyProcessor' less than -source '1.8'
2 warnings

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':web:compileJava'.
> java.lang.reflect.InvocationTargetException

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':web:compileJava'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:103)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73)
        at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
        at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
        at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
        at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
        at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:256)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:317)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:309)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:185)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:97)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:249)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:238)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:663)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:596)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: org.gradle.internal.UncheckedException: java.lang.reflect.InvocationTargetException
        at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:63)
        at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:40)
        at net.ltgt.gradle.errorprone.ErrorProneCompiler.execute(ErrorProneCompiler.java:69)
        at net.ltgt.gradle.errorprone.ErrorProneCompiler.execute(ErrorProneCompiler.java:23)
        at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.delegateAndHandleErrors(NormalizingJavaCompiler.java:98)
        at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:51)
        at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:37)
        at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:35)
        at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:25)
        at org.gradle.api.tasks.compile.JavaCompile.performCompilation(JavaCompile.java:156)
        at org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:141)
        at org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:114)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
        at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:50)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:124)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:317)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:309)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:185)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:97)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:113)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:95)
        ... 29 more
Caused by: java.lang.reflect.InvocationTargetException
        at net.ltgt.gradle.errorprone.ErrorProneCompiler.execute(ErrorProneCompiler.java:66)
        ... 50 more
Caused by: java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/sun/tools/javac/code/Type$AnnotatedType
        at com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:158)
        at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:96)
        at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:90)
        at com.google.errorprone.BaseErrorProneCompiler.run(BaseErrorProneCompiler.java:137)
        at com.google.errorprone.BaseErrorProneCompiler.run(BaseErrorProneCompiler.java:108)
        at com.google.errorprone.ErrorProneCompiler.run(ErrorProneCompiler.java:118)
        at com.google.errorprone.ErrorProneCompiler.compile(ErrorProneCompiler.java:65)
        ... 51 more
Caused by: java.lang.NoClassDefFoundError: com/sun/tools/javac/code/Type$AnnotatedType
        at io.vertx.codegen.type.TreeTypeInternal.isNullable(TreeTypeInternal.java:89)
        at io.vertx.codegen.type.TreeTypeInternal.access$000(TreeTypeInternal.java:20)
        at io.vertx.codegen.type.TreeTypeInternal$1.forParam(TreeTypeInternal.java:33)
        at io.vertx.codegen.type.TypeUse.createParamTypeUse(TypeUse.java:103)
        at io.vertx.codegen.ClassModel.getParams(ClassModel.java:910)
        at io.vertx.codegen.ClassModel.addMethod(ClassModel.java:774)
        at io.vertx.codegen.ClassModel.traverseType(ClassModel.java:646)
        at io.vertx.codegen.ClassModel.process(ClassModel.java:529)
        at io.vertx.codegen.CodeGen.getClassModel(CodeGen.java:167)
        at io.vertx.codegen.CodeGen.lambda$null$9(CodeGen.java:98)
        at io.vertx.codegen.CodeGen$ModelEntry.getValue(CodeGen.java:223)
        at io.vertx.codegen.CodeGen$ModelEntry.getValue(CodeGen.java:205)
        at io.vertx.codegen.CodeGenProcessor.lambda$process$6(CodeGenProcessor.java:209)
        at io.vertx.codegen.CodeGenProcessor.process(CodeGenProcessor.java:207)
        at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:968)
        at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:884)
        at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$2200(JavacProcessingEnvironment.java:108)
        at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1206)
        at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1315)
        at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1246)
        at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:922)
        at com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:100)
        at com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:142)
        ... 57 more
Caused by: java.lang.ClassNotFoundException: com.sun.tools.javac.code.Type$AnnotatedType
        ... 80 more

@vorburger
Copy link
Member Author

@pmlopes @vietj FYI @edewit and I just figured out that this is due to our use of Error Prone, see tbroyer/gradle-errorprone-plugin#70.

@vorburger
Copy link
Member Author

@pmlopes @vietj FYI @edewit I now believe this more a Vert.x than an Error Prone problem, see eclipse-vertx/vertx-codegen#181.

@vorburger vorburger self-assigned this May 19, 2018
@vorburger
Copy link
Member Author

#61 has the start of this ready for review now. Keeping this issue open until loose ends are resolved.

@vorburger
Copy link
Member Author

vorburger commented Jun 5, 2018

@edewit I don't suppose you would have any idea why what's now on branch issue53_codegen_opposite-direction (as of 60d7cc7) fails like this:

10% building modules 1/2 modules 1 active ...aft-storeys-maker/scratch/src/test.ts 10% building modules 2/4 modules 2 active . 10% building modules 5/5 modules 0 activeModuleNotFoundError: Module not found: Error: Can't resolve 'Minecraft-ts/command_registration-proxy' in '/home/vorburger/dev/Minecraft/git/minecraft-storeys-maker/api/build/classes/java/main/Minecraft-ts'

it's somehow related to this which is is (now) in api/build/classes/java/main/Minecraft-ts/minecraft-proxy.ts :

import { CommandRegistration } from 'Minecraft-ts/command_registration-proxy';

that is not found - but I'm really struggling to understand which path is relative to what here why it's not found. I initially thought that shouldn't contain Minecraft-ts because it's already in that folder, so manually edited that generated file to remove it, but that just leads to:

ModuleNotFoundError: Module not found: Error: Can't resolve 'command_registration-proxy' in '/home/vorburger/dev/Minecraft/git/minecraft-storeys-maker/api/build/classes/java/main/Minecraft-ts'

which is even weirder, because that is definitely there.

@vorburger
Copy link
Member Author

@edewit helped me figure that if we (manually) replace:

import { CommandRegistration } from 'Minecraft-ts/command_registration-proxy';

with:

import { CommandRegistration } from './command_registration-proxy';

and then npm run build:prod in our ./scratch/ (just because ../gradlew build re-generates the patched api/build/), it works. This does seem to really by a Vert.x JS/TS code generator bug... let's see what they say in vert-x3/vertx-lang-js#76 ...

@pmlopes
Copy link

pmlopes commented Jun 8, 2018

I see the issue, module resolution states that modules which path start with dot are relative to the current file. Modules not starting with dot then follow the node_modules lookup. So indeed the generator is broken.

@vorburger
Copy link
Member Author

Closing this issue, as we are currently not using Vert.x client code generation anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants