CompilationHelper
object CompilationHelper
Compiles generated Kotlin FileSpec objects at test time and provides a ClassLoader for loading the compiled classes.
This helper uses the embedded K2JVMCompiler already available as a test dependency. For classes that implement interfaces from the :api module, stub interfaces/types are automatically generated in the same compilation unit so the generated code compiles against valid supertypes.
Since
1.0
Types
Link copied to clipboard
class CompilationResult(val classLoader: URLClassLoader, outputDir: Path, sourceTmpDir: File) : AutoCloseable
Result of a successful compilation.
Functions
Link copied to clipboard
fun compile(fileSpecs: List<FileSpec>, includeGraphQLVariablesStub: Boolean = false, includeGraphQLStubs: Boolean = false): CompilationHelper.CompilationResult
Compiles the given set of fileSpecs and returns a CompilationResult with a classloader for the compiled classes.
Link copied to clipboard
fun compileSingle(fileSpec: FileSpec, includeGraphQLVariablesStub: Boolean = false, includeGraphQLStubs: Boolean = false): CompilationHelper.CompilationResult
Convenience overload that compiles a single FileSpec.