Created
September 26, 2018 23:14
-
-
Save retronym/1969e361157a17b73608862991dec3a8 to your computer and use it in GitHub Desktop.
This file contains 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