jkabrg jkabrg - 2 months ago 6
Scala Question

Elementary syntax for (project in file(".")) in SBT

Is

project in file(".")
in SBT "short" for
project.in(file("."))
?

If I'm right, I'd like to know what the
in
method does.

Answer

Is project in file(".") in SBT "short" for project.in(file("."))

Yes, it is (it's actually not "short", it's called infix notation).

All the in method does is set the base directory for the project you're creating with a bunch of configurations and definitions:

/** Sets the base directory for this project.*/
def in(dir: File): Project = copy(base = dir)

And finally it ends up creating a new project definition for you (inside the Project.unresolved method):

new ProjectDef[ProjectReference](
  id, base, aggregate, dependencies, delegates,
  settings, configurations, auto, plugins, autoPlugins) with Project

And on top of that, you apply a bunch of settings and dependencies.