From 1fcd2f9769a529d90765d789633c5c8c1e92f6e4 Mon Sep 17 00:00:00 2001 From: Josh Suereth Date: Wed, 14 Jan 2015 16:20:38 -0500 Subject: [PATCH 1/2] Add missing notes for enhance bytecode feature. --- .../0.13.8/enhance-bytecode-feature.markdown | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 notes/0.13.8/enhance-bytecode-feature.markdown diff --git a/notes/0.13.8/enhance-bytecode-feature.markdown b/notes/0.13.8/enhance-bytecode-feature.markdown new file mode 100644 index 000000000..b720f9414 --- /dev/null +++ b/notes/0.13.8/enhance-bytecode-feature.markdown @@ -0,0 +1,35 @@ + [1714]: https://github.com/sbt/sbt/issues/1714 + + +### 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: + +1. `previousCompile`: This task returns the previously persisted `Analysis` object for this project. +2. `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. +3. `manipulateByteCode`: This is a stub task which takes the `compileIncremental` result 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. +4. `compile`: This task depends on `manipulateBytecode` and then persists the `Analysis` object 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][1714] for the full details of the implementation. + +### Bug fixes From 6587729fa96da8878d920825deb4c73e1b23b62e Mon Sep 17 00:00:00 2001 From: Josh Suereth Date: Wed, 14 Jan 2015 16:27:12 -0500 Subject: [PATCH 2/2] Fix from review. --- notes/0.13.8/enhance-bytecode-feature.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notes/0.13.8/enhance-bytecode-feature.markdown b/notes/0.13.8/enhance-bytecode-feature.markdown index b720f9414..3525f1638 100644 --- a/notes/0.13.8/enhance-bytecode-feature.markdown +++ b/notes/0.13.8/enhance-bytecode-feature.markdown @@ -7,7 +7,7 @@ ### Bytecode Enhancers -sbt 0.13.8 adds an extension point whereby users can effectively manipulate java bytecode (.class files) BEFORE the +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.