Main

object Main extends Driver

Main object for SBT.

See process.

class Driver
class Object
trait Matchable
class Any
Main.type

Value members

Concrete methods

override def process(args: Array[String], rootCtx: Context): Reporter

Actual entrypoint from SBT.

Actual entrypoint from SBT.

Internal SBT code for sbt doc locates this precise method with reflection, and passes to us both args and rootCtx. "Internal" here means that it's painful to modify this code with a plugin.

args contains arguments both for us and for the compiler (see code on how they're split).

Definition Classes
Driver

Inherited methods

def main(args: Array[String]): Unit
Inherited from:
Driver
final def process(args: Array[String]): Reporter

Entry point to the compiler with no optional arguments.

Entry point to the compiler with no optional arguments.

This overload is provided for compatibility reasons: the RawCompiler of sbt expects this method to exist and calls it using reflection. Keeping it means that we can change the other overloads without worrying about breaking compatibility with sbt.

Inherited from:
Driver
final def process(args: Array[String], reporter: Reporter | Null, callback: CompilerCallback | Null): Reporter

Principal entry point to the compiler.

Principal entry point to the compiler.

Usage example: https://github.com/lampepfl/dotty/tree/master/compiler/test/dotty/tools/dotc/EntryPointsTest.scala.disabled in method runCompiler

Value parameters:
args

Arguments to pass to the compiler.

callback

Used to execute custom code during the compilation process. No callbacks will be executed if this is null.

reporter

Used to log errors, warnings, and info messages. The default reporter is used if this is null.

Returns:

The Reporter used. Use Reporter#hasErrors to check if compilation succeeded.

Inherited from:
Driver
final def process(args: Array[String], simple: SimpleReporter | Null, callback: CompilerCallback | Null): ReporterResult

Entry point to the compiler that can be conveniently used with Java reflection.

Entry point to the compiler that can be conveniently used with Java reflection.

This entry point can easily be used without depending on the dotty package, you only need to depend on dotty-interfaces and call this method using reflection. This allows you to write code that will work against multiple versions of dotty without recompilation.

The trade-off is that you can only pass a SimpleReporter to this method and not a normal Reporter which is more powerful.

Usage example: https://github.com/lampepfl/dotty/tree/master/compiler/test/dotty/tools/dotc/InterfaceEntryPointTest.scala

Value parameters:
args

Arguments to pass to the compiler.

callback

Used to execute custom code during the compilation process. No callbacks will be executed if this is null.

simple

Used to log errors, warnings, and info messages. The default reporter is used if this is null.

Inherited from:
Driver
def setup(args: Array[String], rootCtx: Context): Option[(List[AbstractFile], Context)]

Setup context with initialized settings from CLI arguments, then check if there are any settings that would change the default behaviour of the compiler.

Setup context with initialized settings from CLI arguments, then check if there are any settings that would change the default behaviour of the compiler.

Returns:

If there is no setting like -help preventing us from continuing compilation, this method returns a list of files to compile and an updated Context. If compilation should be interrupted, this method returns None.

Inherited from:
Driver