如何在 0.13 中声明任务对任务的依赖? [英] How to declare task dependency on tasks in 0.13?

查看:16
本文介绍了如何在 0.13 中声明任务对任务的依赖?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 sbt 0.12 中,您可以指定一个任务在没有实际使用输入任务的输出的情况下依赖于另一个. 所以你只是在指定任务的顺序:

In sbt 0.12, you could specify that one task depended upon another without actually using the output from the input tasks. So you were specifying purely an ordering on the tasks:

unitTask <<= Seq(stringTask, sampleTask).dependOn

在 sbt 0.13 的任务文档中没有这样的示例.指定所述依赖项的新语法是什么?

There is no such example in the Tasks documentation for sbt 0.13. What's the new syntax for specifying said dependency?

推荐答案

使用标准语法,但忽略所用任务的结果:

Use the standard syntax, but ignore the results of the tasks used:

unitTask := {
  val x = stringTask.value
  val y = sampleTask.value
  ()
}

由于 scalac 中的错误,您必须使用虚拟名称,否则你可以只使用 val _ = ....

Because of a bug in scalac, you have to use dummy names, otherwise you could just use val _ = ....

另外,我更喜欢上面更明确的方式,但它相当于这个较短的版本,因为没有使用结果:

Also, I prefer the more explicit way above, but it is equivalent to this shorter version because the results aren't used:

unitTask := {
  stringTask.value
  sampleTask.value
}

这篇关于如何在 0.13 中声明任务对任务的依赖?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆