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

Create empty class to enforce resolving ivy deps by mill for dummy modules #1374

Merged
merged 1 commit into from
Sep 20, 2022

Conversation

lwronski
Copy link
Contributor

When IntelliJ import Scala CLI BSP project, it throws:

Result: null
Error: {
  "code": -32603,
  "message": "Internal error.",
  "data": "java.util.concurrent.CompletionException: java.lang.Exception: Failure during task evaluation: dummy.amm[2.13.4].bspCompileClassesPath java.lang.NullPointerException: Cannot invoke \"mill.scalalib.api.CompilationResult.classes()\" because the return value of \"scala.collection.immutable.Seq.apply(int)\" is null\n    mill.scalalib.ScalaModule.$anonfun$bspCompileClassesPath$4(ScalaModule.scala:232)\n    mill.define.Task$TraverseCtx.evaluate(Task.scala:380)\n\tat java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:332)\n\tat java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:347)\n\tat java.base/java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:708)\n\tat java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)\n\tat java.base/java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2162)\n\tat mill.bsp.MillBuildServer.$anonfun$completable$1(MillBuildServer.scala:722)\n\tat mill.bsp.MillBuildServer.$anonfun$completable$1$adapted(MillBuildServer.scala:710)\n\tat scala.concurrent.impl.Promise$Transformation.run(Promise.scala:484)\n\tat java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395)\n\tat java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)\n\tat java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)\n\tat java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)\n\tat java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)\n\tat java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)\nCaused by: java.lang.Exception: Failure during task evaluation: dummy.amm[2.13.4].bspCompileClassesPath java.lang.NullPointerException: Cannot invoke \"mill.scalalib.api.CompilationResult.classes()\" because the return value of \"scala.collection.immutable.Seq.apply(int)\" is null\n    mill.scalalib.ScalaModule.$anonfun$bspCompileClassesPath$4(ScalaModule.scala:232)\n    mill.define.Task$TraverseCtx.evaluate(Task.scala:380)\n\tat mill.eval.Evaluator$.$anonfun$evalOrThrow$default$2$1(Evaluator.scala:1001)\n\tat mill.eval.Evaluator$EvalOrThrow.apply(Evaluator.scala:990)\n\tat mill.bsp.MillBuildServer.targetTasks(MillBuildServer.scala:683)\n\tat mill.bsp.MillScalaBuildServer.$anonfun$buildTargetScalacOptions$1(MillScalaBuildServer.scala:35)\n\tat mill.bsp.MillBuildServer.$anonfun$completable$1(MillBuildServer.scala:713)\n\t... 8 more\n"
}

To fix it, scala-cli creates dummy class to enforce compiling module by mill

… modules

When IntelliJ import scala-cli BSP project, it throws dummy.amm[2.13.4].bspCompileClassesPath java.lang.NullPointerException. To fix it, scala-cli creates dummy class to enforce compiling module by mill
@lwronski lwronski marked this pull request as ready for review September 19, 2022 14:45
@lwronski lwronski merged commit fee5492 into VirtusLab:main Sep 20, 2022
@romanowski
Copy link
Member

@lwronski shouldn't we report a bug for Scala Plugin? It shouldn't be needed

@lwronski
Copy link
Contributor Author

I think the root of the problem is that scala-cli returned null for compile method in mill module. IMO it is our bug, not Scala Plugin.

def compile = T {
       resolvedRunIvyDeps()
       null: mill.scalalib.api.CompilationResult
     }

@Gedochao Gedochao added the DX Dev experience label Sep 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX Dev experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants