random-maven / scalor-maven-plugin

Build integrator for Java, Scala, Scala.macro, Scala.js, Scala.native, Eclipse and Maven.
https://random-maven.github.io/scalor-maven-plugin/2.12/plugin-info.html
Other
50 stars 6 forks source link

validate compile phases #15

Closed m50d closed 6 years ago

m50d commented 6 years ago

NPE when adding nonexistent argument (-Xprint-phases) to zincOptionsScala in 1.4.0

Minor but I misspelled a compiler argument while testing, and got an NPE rather than a clear error:

[ERROR] [compile-main] [FAIL] ## Exception when compiling 6 sources to C:\Users\md401\eclipse-workspace\tierney-aggregator\core\target\classes
[ERROR] C:\Users\md401\eclipse-workspace\tierney-aggregator\core\pom.xml [1:1]: Execution failure
java.lang.NullPointerException
    at xsbt.ZincCompiler.phaseDescriptors$lzycompute (CallbackGlobal.scala:121)
    at xsbt.ZincCompiler.phaseDescriptors (CallbackGlobal.scala:119)
    at scala.tools.nsc.Global$Run.<init> (Global.scala:1186)
    at scala.tools.nsc.Global.phaseNames$lzycompute (Global.scala:708)
    at scala.tools.nsc.Global.phaseNames (Global.scala:707)
    at scala.tools.nsc.Global.phaseHelp (Global.scala:739)
    at scala.tools.nsc.Global.phaseDescriptions (Global.scala:713)
    at scala.tools.nsc.CompilerCommand.getInfoMessage (CompilerCommand.scala:99)
    at xsbt.CachedCompiler0.run (CompilerInterface.scala:121)
    at xsbt.CachedCompiler0.run (CompilerInterface.scala:105)
    at xsbt.CompilerInterface.run (CompilerInterface.scala:31)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:564)
    at sbt.internal.inc.AnalyzingCompiler.call (AnalyzingCompiler.scala:237)
    at sbt.internal.inc.AnalyzingCompiler.compile (AnalyzingCompiler.scala:111)
    at sbt.internal.inc.AnalyzingCompiler.compile (AnalyzingCompiler.scala:90)
    at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$3 (MixedAnalyzingCompiler.scala:83)
    at scala.runtime.java8.JFunction0$mcV$sp.apply (JFunction0$mcV$sp.java:12)
    at sbt.internal.inc.MixedAnalyzingCompiler.timed (MixedAnalyzingCompiler.scala:134)
    at sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1 (MixedAnalyzingCompiler.scala:74)
    at sbt.internal.inc.MixedAnalyzingCompiler.compile (MixedAnalyzingCompiler.scala:117)
    at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1 (IncrementalCompilerImpl.scala:305)
    at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted (IncrementalCompilerImpl.scala:305)
    at sbt.internal.inc.Incremental$.doCompile (Incremental.scala:101)
    at sbt.internal.inc.Incremental$.$anonfun$compile$4 (Incremental.scala:82)
    at sbt.internal.inc.IncrementalCommon.recompileClasses (IncrementalCommon.scala:110)
    at sbt.internal.inc.IncrementalCommon.cycle (IncrementalCommon.scala:57)
    at sbt.internal.inc.Incremental$.$anonfun$compile$3 (Incremental.scala:84)
    at sbt.internal.inc.Incremental$.manageClassfiles (Incremental.scala:129)
    at sbt.internal.inc.Incremental$.compile (Incremental.scala:75)
    at sbt.internal.inc.IncrementalCompile$.apply (Compile.scala:61)
    at sbt.internal.inc.IncrementalCompilerImpl.compileInternal (IncrementalCompilerImpl.scala:309)
    at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1 (IncrementalCompilerImpl.scala:267)
    at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError (IncrementalCompilerImpl.scala:158)
    at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally (IncrementalCompilerImpl.scala:237)
    at sbt.internal.inc.IncrementalCompilerImpl.compile (IncrementalCompilerImpl.scala:68)
    at com.carrotgarden.maven.scalor.zinc.Compiler.zincPerformCompile (Compiler.scala:356)
    at com.carrotgarden.maven.scalor.zinc.Compiler.zincPerformCompile$ (Compiler.scala:282)
    at com.carrotgarden.maven.scalor.CompileMainMojo.zincPerformCompile (CompileMojo.scala:112)
    at com.carrotgarden.maven.scalor.CompileAnyMojo.performCompile (CompileMojo.scala:37)
    at com.carrotgarden.maven.scalor.CompileAnyMojo.performCompile$ (CompileMojo.scala:36)
    at com.carrotgarden.maven.scalor.CompileMainMojo.performCompile (CompileMojo.scala:112)
    at com.carrotgarden.maven.scalor.CompileAnyMojo.perform (CompileMojo.scala:45)
    at com.carrotgarden.maven.scalor.CompileAnyMojo.perform$ (CompileMojo.scala:40)
    at com.carrotgarden.maven.scalor.CompileMainMojo.perform (CompileMojo.scala:112)
    at com.carrotgarden.maven.scalor.base.Mojo.execute (Mojo.scala:65)
    at com.carrotgarden.maven.scalor.base.Mojo.execute$ (Mojo.scala:50)
    at com.carrotgarden.maven.scalor.CompileMainMojo.execute (CompileMojo.scala:112)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:564)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Andrei-Pozolotin commented 6 years ago

compile phases are determined late, including plugin contributions https://github.com/scala/scala/blob/2.12.x/src/compiler/scala/tools/nsc/Global.scala#L668

let me know if you see an easy way to validate that w/o actual compile start

otherwise it is a wont fix

m50d commented 6 years ago

Yeah I wouldn't expect the plugin to determine phases. Rhe issue is that I misspelled the argument (-Xprint-phases rather than-Xshow-phases) and got an NPE, whereas I would expect that to give a specific error message saying which argument was wrong.

Andrei-Pozolotin commented 6 years ago

resolved https://github.com/random-maven/scalor-maven-plugin/releases/tag/1.4.0.20180329174003