diff --git a/scalalib/src/mill/scalalib/ScalaModule.scala b/scalalib/src/mill/scalalib/ScalaModule.scala index c499dda5e0e..adc22bf4f73 100644 --- a/scalalib/src/mill/scalalib/ScalaModule.scala +++ b/scalalib/src/mill/scalalib/ScalaModule.scala @@ -130,7 +130,7 @@ trait ScalaModule extends JavaModule { outer => } yield p.toNIO.toString val pluginOptions = scalacPluginClasspath().map(pluginPathRef => s"-Xplugin:${pluginPathRef.path}") - val options = Seq("-d", javadocDir.toNIO.toString, "-usejavacp") ++ pluginOptions + val options = Seq("-d", javadocDir.toNIO.toString, "-usejavacp") ++ pluginOptions ++ scalacOptions() if (files.nonEmpty) subprocess( "scala.tools.nsc.ScalaDoc", @@ -193,5 +193,3 @@ trait ScalaModule extends JavaModule { outer => override def artifactId: T[String] = artifactName() + artifactSuffix() } - - diff --git a/scalalib/test/resources/hello-world-flags/core/src/Main.scala b/scalalib/test/resources/hello-world-flags/core/src/Main.scala new file mode 100644 index 00000000000..c23ee8eda9a --- /dev/null +++ b/scalalib/test/resources/hello-world-flags/core/src/Main.scala @@ -0,0 +1,6 @@ +import scala.collection.immutable.SortedMap + +object Main extends App { + def foo[F[_], A](fa: F[A]): String = fa.toString + foo { x: Int => x * 2 } +} \ No newline at end of file diff --git a/scalalib/test/src/mill/scalalib/HelloWorldTests.scala b/scalalib/test/src/mill/scalalib/HelloWorldTests.scala index f1342d04ba9..46cf82de84b 100644 --- a/scalalib/test/src/mill/scalalib/HelloWorldTests.scala +++ b/scalalib/test/src/mill/scalalib/HelloWorldTests.scala @@ -130,6 +130,16 @@ object HelloWorldTests extends TestSuite { } } + object HelloWorldFlags extends HelloBase{ + object core extends ScalaModule { + def scalaVersion = "2.12.4" + + def scalacOptions = super.scalacOptions() ++ Seq( + "-Ypartial-unification" + ) + } + } + object HelloScalacheck extends HelloBase{ object foo extends ScalaModule { def scalaVersion = "2.12.4" @@ -523,6 +533,25 @@ object HelloWorldTests extends TestSuite { } } + 'flags - { + // make sure flags are passed when compiling/running + 'runMain - workspaceTest( + HelloWorldFlags, + resourcePath = pwd / 'scalalib / 'test / 'resources / "hello-world-flags" + ){ eval => + val Right((_, evalCount)) = eval.apply(HelloWorldFlags.core.runMain("Main")) + assert(evalCount > 0) + } + // make sure flags are passed during ScalaDoc generation + 'docJar - workspaceTest( + HelloWorldFlags, + resourcePath = pwd / 'scalalib / 'test / 'resources / "hello-world-flags" + ){ eval => + val Right((_, evalCount)) = eval.apply(HelloWorldFlags.core.docJar) + assert(evalCount > 0) + } + } + 'scalacheck - workspaceTest( HelloScalacheck, resourcePath = pwd / 'scalalib / 'test / 'resources / "hello-scalacheck"