简体   繁体   English

如何创建具有动态依赖关系的设置?

[英]How to create settings with dynamic dependencies?

I want a setting to depend on settings of a dynamic list of other projects (well, executed at SBT setting start up, but dynamic in the sense that it is not hard-coded). 我想要一个设置取决于其他项目的动态列表的设置(好吧,在SBT设置启动时执行,但是在某种意义上说它不是硬编码的,因此是动态的)。

I have Def.dynTask to produce a task with a dynamic dependency on other tasks. 我让Def.dynTask产生一个对其他任务具有动态依赖性的任务。

Is there a similar way to do this for settings, ie produce a setting with a dynamic dependency on other settings? 是否有类似的方法可以对设置执行此操作,即生成一个动态依赖于其他设置的设置?


Or perhaps I misunderstand settings. 也许我误会了设置。 FYI, my understanding is that settings are computed once at start up; 仅供参考,我的理解是,设置是在启动时计算一次; tasks are computed whenever they are requested. 任务在请求时进行计算。

Setting is actually initialized only one per sbt session. 实际上,每个sbt会话仅初始化一次设置。 The good explanation about that can be found here 可以在这里找到关于它的很好的解释

If I got your idea in right way, you can do that with TaskKeys and the sbt.Extracted.append method. 如果我以正确的方式得到了您的想法,则可以使用TaskKeys和sbt.Extracted.append方法来实现。 Be careful, I have faced strange think like this 要小心,我都面临着奇怪认为像这样

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM