@@ -7,31 +7,35 @@ import org.gradle.api.tasks.SourceSet
77 * Configures Kotlin/KAPT compilation tasks for Doma annotation processing.
88 */
99class KotlinCompileConfigurator {
10-
10+
1111 private static final String KOTLIN_KAPT_PLUGIN_ID = ' kotlin-kapt'
1212 private static final String KAPT_EXTENSION_NAME = ' kapt'
1313 private static final String SOURCE_PATH_OPTION = ' --source-path'
1414 private static final String PARAMETERS_OPTION = ' -parameters'
15-
15+
1616 private final Project project
17-
17+
1818 KotlinCompileConfigurator (Project project ) {
1919 this . project = Objects . requireNonNull(project)
2020 }
21-
21+
2222 void configure (SourceSet sourceSet ) {
2323 project. plugins. withId(KOTLIN_KAPT_PLUGIN_ID ) {
2424 configureKapt(sourceSet)
2525 }
2626 }
27-
27+
2828 private void configureKapt (SourceSet sourceSet ) {
2929 def kapt = project. extensions. getByName(KAPT_EXTENSION_NAME )
3030 def resourceDirs = sourceSet. resources. srcDirs
31- def sourcePath = resourceDirs. join(File . pathSeparator)
31+ def newSourcepath = resourceDirs. join(File . pathSeparator)
32+ def currentSourcepath = kapt. javacOptions[SOURCE_PATH_OPTION ]
33+ def sourcepath = currentSourcepath == null
34+ ? newSourcepath
35+ : currentSourcepath + File . pathSeparator + newSourcepath
3236
3337 kapt. javacOptions {
34- option SOURCE_PATH_OPTION , sourcePath
38+ option SOURCE_PATH_OPTION , sourcepath
3539 option PARAMETERS_OPTION , ' '
3640 }
3741 }
0 commit comments