获取 SettingKey[T] 的值 [英] Getting the value of a SettingKey[T]

查看:54
本文介绍了获取 SettingKey[T] 的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个用于文档生成的插件.我想将所有生成的文件输出到我选择的目录.这个目录,可以是SBT的target目录的子目录,如下:

I'm working on a plugin for document generation. I'd like to output all generated files to a directory of my choosing. This directory, can be a subdirectory of SBT's target directory, as follows:

val newTargetDirectory = SettingKey[File]("document-target-dir")
newTargetDirectory <<= target( _ / "new_output_folder")

如果我无法从这个新设置创建"一个 File 对象,我该如何利用它?

If I cannot 'create' a File object from this new setting, how do I utilise it?

推荐答案

通常情况下,您不会获取设置的值",而是根据您的设置进行另一个设置或任务,这会导致配置系统在适当的时候为其他东西提供价值.SBT wiki 关于更多关于设置""自定义设置和任务"处理细节和许多简单的例子,特别是更多关于"页面中的具有依赖关系的设置"和具有依赖关系的任务"部分.

Ordinarily, you don't "get the value of a setting", you make another setting or a task depend on your setting, which causes the configuration system to provide that other thing with the value at the appropriate time. The sections of the SBT wiki on "more about settings" and "custom settings and tasks" have a great deal of detail and many simple examples on this, especially the "Settings with dependencies" and "Tasks with dependencies" sections in the "more about" page.

这篇关于获取 SettingKey[T] 的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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