I am writing a Plugin for SBT that will generate the configuration files needed to create an Azure Function from a Scala program. My efforts are on github (https://github.com/code-star/sbt-azure-functions-plugin/tree/develop), and as can be read in the readme, I want to automatically trigger the assembly
task whenever the user issues sbt azfunCreateZipFile
.
Users of my plugin, can be achieve this by adding the following line to their build.sbt
:
azfunCreateZipFile := (azfunCreateZipFile dependsOn assembly).value
I would like that task wiring to be already included in my plugin definition. How can I do this?
I know Tasks can be made dependent on other Tasks by using otherTask.value
in the task definition, so I tried adding such a line to the azfunCreateZipFile
task definition (see ./plugin/src/main/scala/sbtazurefunctions/AzureFunctions.scala
):
azfunGenerateFunctionJsons := {
// depend on assembly step
val _ = assembly.value
... <actual task definition code>
azfunTargetFolder.value
}
But then I get an error that assembly is not found:
[IJ]sbt:root> compile
[info] Compiling 1 Scala source to /home/jml/work/scala/azure/sbt-azure-functions- plugin/plugin/target/scala-2.12/sbt-1.0/classes ...
[error] /home/jml/work/scala/azure/sbt-azure-functions-plugin/plugin/src/main/scala/sbtazurefunctions/AzureFunctions.scala:113:15: not found: value assembly
[error] val _ = assembly.value
[error] ^
[error] one error found
[error] (plugin / Compile / compileIncremental) Compilation failed
[error] Total time: 1 s, completed Jan 3, 2021, 4:41:56 PM
[IJ]sbt:root>
I have tried many imports, but none were successful:
import sbtassembly.AssemblyPlugin._ (and variations using AssemblyKeys and the AutoImport object)
import sbt.Keys._
What can I do to fix this?