summaryrefslogtreecommitdiff
path: root/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala
diff options
context:
space:
mode:
authorTin Pavlinic <tin.pavlinic@gmail.com>2017-12-08 12:03:51 +1100
committerTin Pavlinic <tin.pavlinic@gmail.com>2017-12-09 17:10:12 +1100
commita583f70966c6d5b0fbda0c9989803220b7292ac9 (patch)
tree0276b3e17ba391a1f49b83f98f9275eab3610ea8 /scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala
parent727e29290ef301ecce764d3416b0ea7b75f9f1e1 (diff)
downloadmill-a583f70966c6d5b0fbda0c9989803220b7292ac9.tar.gz
mill-a583f70966c6d5b0fbda0c9989803220b7292ac9.tar.bz2
mill-a583f70966c6d5b0fbda0c9989803220b7292ac9.zip
Add support for compiler plugins and enable acyclic plugin in build
Diffstat (limited to 'scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala')
-rw-r--r--scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala12
1 files changed, 10 insertions, 2 deletions
diff --git a/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala b/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala
index 4de2f416..802a881a 100644
--- a/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala
+++ b/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala
@@ -42,6 +42,7 @@ object ScalaModule{
compilerClasspath: Seq[Path],
compilerBridge: Seq[Path],
scalacOptions: Seq[String],
+ scalacPluginClasspath: Seq[Path],
javacOptions: Seq[String],
upstreamCompileOutput: Seq[CompilationResult])
(implicit ctx: Ctx): CompilationResult = {
@@ -117,7 +118,7 @@ object ScalaModule{
classpath = classesIODir +: compileClasspathFiles,
sources = sources.flatMap(ls.rec).filter(x => x.isFile && x.ext == "scala").map(_.toIO).toArray,
classesDirectory = classesIODir,
- scalacOptions = scalacOptions.toArray,
+ scalacOptions = (scalacPluginClasspath.map(jar => s"-Xplugin:${jar}") ++ scalacOptions).toArray,
javacOptions = javacOptions.toArray,
maxErrors = 10,
sourcePositionMappers = Array(),
@@ -247,6 +248,7 @@ trait ScalaModule extends Module with TaskModule{ outer =>
def scalaBinaryVersion = T{ scalaVersion().split('.').dropRight(1).mkString(".") }
def ivyDeps = T{ Seq[Dep]() }
def compileIvyDeps = T{ Seq[Dep]() }
+ def scalacPluginIvyDeps = T{ Seq[Dep]() }
def runIvyDeps = T{ Seq[Dep]() }
def basePath: Path
@@ -320,13 +322,18 @@ trait ScalaModule extends Module with TaskModule{ outer =>
)()
}
+ def scalacPluginClasspath: T[Seq[PathRef]] =
+ resolveDeps(
+ T.task{scalacPluginIvyDeps()}
+ )()
+
/**
* Classpath of the Scala Compiler & any compiler plugins
*/
def scalaCompilerClasspath: T[Seq[PathRef]] = T{
resolveDeps(
T.task{scalaCompilerIvyDeps(scalaVersion()) ++ scalaRuntimeIvyDeps(scalaVersion())},
- )()
+ )() ++ scalacPluginClasspath()
}
/**
@@ -353,6 +360,7 @@ trait ScalaModule extends Module with TaskModule{ outer =>
scalaCompilerClasspath().map(_.path),
compilerBridgeClasspath().map(_.path),
scalacOptions(),
+ scalacPluginClasspath().map(_.path),
javacOptions(),
upstreamCompileOutput()
)