In SBT, how do you redefine compilation to run arbitrary code afterwards?

I am trying to use SBT to create a project that depends on improving the bytecode. Basically, I need to run some code after compile, using the class path in the current area (so that the team can find the classes to change), and then make sure it compiledoesn't start again after that to cancel the extension.

I use SBT 0.13.12 if that matters.

+4
source share
1 answer

I believe that you will want to create a new sbt task and depend on its compilation. Then use this, not compile.

    lazy val bytecodeEnhancedCompile = taskKey[Unit]("bytecode Enhance")

    bytecodeEnhancedCompile <<= bytecodeEnhancedCompile dependsOn (compile in Compile)

    bytecodeEnhancedCompile  := {
       ....
    }
0
source

Source: https://habr.com/ru/post/1655101/


All Articles