Knows Not Much Knows Not Much - 1 month ago 4
Scala Question

What does `<<=` mean in SBT?

I see this

symbol in lot of SBT code, but I don't what it does.

I tried googling for this symbol as well but I did not get any answers.

Can you please point me to some documentation or an example which clearly explains what does this symbol mean and what does it do?


Oh, the deep explanation is quite complicated.

Basically, the signature is:

def <<= (app: Initialize[Task[S]]): Setting[Task[S]]  =  macro std.TaskMacro.itaskAssignPosition[S] 

So it involves this macro:

/* 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]]] =

I already used this kind of operator when dealing with AspectJ compilation:

products in Compile <<= products in Aspectj

Basically, it means: base the code source on the AspectJ source files (generated with a plugin), not the classical ones.

I interpret it as a kind of "replaceAll/erase":
Replace bunch of files to compile by the files involving AspectJ annotations.