Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting the value of a SettingKey[T]

Tags:

scala

sbt

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")

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

like image 758
Didia Avatar asked Jan 24 '12 15:01

Didia


1 Answers

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.

like image 195
RM. Avatar answered Oct 22 '22 13:10

RM.