summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Sviridov <keynmol@gmail.com>2018-05-18 22:18:13 +0100
committerLi Haoyi <haoyi.sg@gmail.com>2018-05-18 14:18:13 -0700
commite69ebcc92dc71f002119cebf4d9b61874bdd4a66 (patch)
treec25b21d5e1b6cb93f58dfa2f26ca7290eade8629
parentaba5be920974585d7c29bdb6987639ff3ce92595 (diff)
downloadmill-e69ebcc92dc71f002119cebf4d9b61874bdd4a66.tar.gz
mill-e69ebcc92dc71f002119cebf4d9b61874bdd4a66.tar.bz2
mill-e69ebcc92dc71f002119cebf4d9b61874bdd4a66.zip
Fixes #336: pass scalac options to ScalaDoc during docJar stage (#337)
-rw-r--r--scalalib/src/mill/scalalib/ScalaModule.scala4
-rw-r--r--scalalib/test/resources/hello-world-flags/core/src/Main.scala6
-rw-r--r--scalalib/test/src/mill/scalalib/HelloWorldTests.scala29
3 files changed, 36 insertions, 3 deletions
diff --git a/scalalib/src/mill/scalalib/ScalaModule.scala b/scalalib/src/mill/scalalib/ScalaModule.scala
index 68f60df1..0b501ffe 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 00000000..f8b63c04
--- /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 }
+}
diff --git a/scalalib/test/src/mill/scalalib/HelloWorldTests.scala b/scalalib/test/src/mill/scalalib/HelloWorldTests.scala
index f1342d04..46cf82de 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"