compile¶
context(session: KaSession)
fun compile(file: KtFile, options: KaCompilationOptions): KaCompilationResult
Compiles the given file in-memory using the specified options.
The function rethrows exceptions from the compiler, wrapped in KaCodeCompilationException. The implementation should wrap the compile() call into a try/catch block when necessary.
Parameters¶
-
file: A file to compile. The file must be either a source module file, or a
KtCodeFragment. For aKtCodeFragment, a source module context, a compiled library source context, or an empty context (null) are supported. -
options: The compilation options created via
createCompilationOptions.