mirror of https://github.com/sbt/sbt.git
1.7 KiB
1.7 KiB
Fixes with compatibility implications
Improvements
Bytecode Enhancers
sbt 0.13.8 adds an extension point whereby users can effectively manipulate java bytecode (.class files) before the incremental compiler attempts to cache the classfile hashes. This allows libraries like ebean to function with sbt without corrupting the compiler cache and rerunning compile every few seconds.
This splits the compile task into several subTasks:
previousCompile: This task returns the previously persistedAnalysisobject for this project.compileIncremental: This is the core logic of compiling Scala/Java files together. This task actually does the work of compiling a project incrementally, including ensuring a minimum number of source files are compiled. After this method, all .class files that would be generated by scalac + javac will be available.manipulateByteCode: This is a stub task which takes thecompileIncrementalresult and returns it. Plugins which need to manipulate bytecode are expected to override this task with their own implementation, ensuring to call the previous behavior.compile: This task depends onmanipulateBytecodeand then persists theAnalysisobject containing all incremental compiler information.
Here's an example of how to hook the new manipulateBytecode key in your own plugin:
manipulateBytecode in Compile := {
val previous = (manipulateBytecode in Compile).value
doManipulateBytecode(previous) // Note: This must return a new Compiler.CompileResult with our changes.
}
See #1714 for the full details of the implementation.