File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
main/kotlin/com/tschuchort/compiletesting
test/kotlin/com/tschuchort/compiletesting Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -681,3 +681,15 @@ class KotlinCompilation : AbstractKotlinCompilation<K2JVMCompilerArguments>() {
681681 const val OPTION_KAPT_KOTLIN_GENERATED = " kapt.kotlin.generated"
682682 }
683683}
684+
685+ /* *
686+ * Adds the output directory of [previousResult] to the classpath of this compilation. This is a convenience for
687+ * ```
688+ * this.classpaths += previousResult.outputDirectory
689+ * ```
690+ */
691+ fun KotlinCompilation.addPreviousResultToClasspath (
692+ previousResult : KotlinCompilation .Result
693+ ): KotlinCompilation = apply {
694+ classpaths + = previousResult.outputDirectory
695+ }
Original file line number Diff line number Diff line change @@ -894,8 +894,8 @@ class KotlinCompilationTests {
894894 .apply {
895895 sources = listOf (kSource2)
896896 inheritClassPath = true
897- classpaths + = result.outputDirectory
898897 }
898+ .addPreviousResultToClasspath(result)
899899 .compile()
900900 .apply {
901901 assertThat(exitCode).isEqualTo(ExitCode .OK )
You can’t perform that action at this time.
0 commit comments