什么``=`在SBT中意味着什么?

Kno*_*uch 10 scala sbt

<<=在很多SBT代码中看到了这个符号,但我不知道它的作用.

我也尝试使用谷歌搜索这个符号,但我没有得到任何答案.

能否请您指出一些文档或一个清楚解释这个符号含义的例子以及它的作用?

Mik*_*378 1

哦,深层的解释是相当复杂的。

基本上,签名是:

def <<= (app: Initialize[Task[S]]): Setting[Task[S]]  =  macro std.TaskMacro.itaskAssignPosition[S] 
Run Code Online (Sandbox Code Playgroud)

所以就涉及到这个宏:

/* Implementations of <<= macro variations for tasks and settings. These just get the source position of the call site.*/

    def itaskAssignPosition[T: c.WeakTypeTag](c: Context)(app: c.Expr[Initialize[Task[T]]]): c.Expr[Setting[Task[T]]] =
        settingAssignPosition(c)(app)
Run Code Online (Sandbox Code Playgroud)

我在处理 AspectJ 编译时已经使用过这种运算符:

products in Compile <<= products in Aspectj
Run Code Online (Sandbox Code Playgroud)

基本上,这意味着:代码源基于 AspectJ 源文件(使用插件生成),而不是经典源文件。

我将其解释为一种“replaceAll/erase”:
用涉及 AspectJ 注释的文件替换要编译的一堆文件。

  • 太复杂了。它的意思是“依赖于 &lt;&lt;=(这里列出的所有内容)” (5认同)