-
-
Save xuwei-k/5d385ca8491bc8d9e8511b3e8b4c4ed0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.github.retronym | |
import sbt._ | |
import Keys._ | |
object RawCompile extends AutoPlugin { | |
override def trigger = allRequirements | |
override def requires = sbt.plugins.JvmPlugin | |
val compileRaw = taskKey[Unit]("Compile directly, bypassing the incremental compiler") | |
val cleanClasses = taskKey[Unit]("clean the classes directory") | |
override lazy val projectSettings = List(Compile, Test).flatMap(c => inConfig(c)(Seq( | |
addCompileRaw, | |
cleanClasses := IO.delete(classDirectory.value) | |
))) | |
def addCompileRaw = compileRaw := { | |
val compiler = new sbt.compiler.RawCompiler(scalaInstance.value, sbt.ClasspathOptions.auto, streams.value.log) | |
classDirectory.value.mkdirs() | |
compiler.apply(sources.value, classDirectory.value +: dependencyClasspath.value.map(_.data), classDirectory.value, scalacOptions.value) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment