Add KotlinCompile.androidLayoutResources input

This input is used by 'android-extensions' subplugin to track changed
Android layout resource files.

^KT-32805 In Progress
This commit is contained in:
Yahor Berdnikau
2022-03-03 12:43:41 +01:00
committed by teamcity
parent f81e49f210
commit 6ee503f2b2
3 changed files with 21 additions and 1 deletions
@@ -125,6 +125,9 @@ abstract class KaptGenerateStubsTask @Inject constructor(
@get:Internal @get:Internal
override val scriptSources: FileCollection = objectFactory.fileCollection() override val scriptSources: FileCollection = objectFactory.fileCollection()
@get:Internal
override val androidLayoutResources: FileCollection = objectFactory.fileCollection()
override val incrementalProps: List<FileCollection> override val incrementalProps: List<FileCollection>
get() = listOf( get() = listOf(
sources, sources,
@@ -130,7 +130,7 @@ class AndroidSubplugin : KotlinCompilerPluginSupportPlugin {
) )
) )
kotlinCompilation.compileKotlinTaskProvider.configure { kotlinCompilation.compileKotlinTaskProvider.configure {
it.setSource(getLayoutDirectories(project, sourceSet.res.srcDirs)) it.androidLayoutResourceFiles.from(getLayoutDirectories(project, sourceSet.res.srcDirs))
} }
} }
@@ -743,6 +743,7 @@ abstract class KotlinCompile @Inject constructor(
sources, sources,
javaSources, javaSources,
scriptSources, scriptSources,
androidLayoutResources,
commonSourceSet, commonSourceSet,
classpathSnapshotProperties.classpath, classpathSnapshotProperties.classpath,
classpathSnapshotProperties.classpathSnapshot classpathSnapshotProperties.classpathSnapshot
@@ -987,6 +988,22 @@ abstract class KotlinCompile @Inject constructor(
.matching(::javaFilesPatternFilter) .matching(::javaFilesPatternFilter)
) )
@get:Internal
internal val androidLayoutResourceFiles = objectFactory.fileCollection()
/**
* This input is used by android-extensions plugin
*/
@get:Incremental
@get:InputFiles
@get:IgnoreEmptyDirectories
@get:PathSensitive(PathSensitivity.RELATIVE)
internal open val androidLayoutResources: FileCollection = androidLayoutResourceFiles
.asFileTree
.matching { patternFilterable ->
patternFilterable.include("xml".fileExtensionCasePermutations().map { "**/*.$it" })
}
// override setSource to track Java and script sources as well // override setSource to track Java and script sources as well
override fun setSource(source: Any) { override fun setSource(source: Any) {
javaSourceFiles.from(source) javaSourceFiles.from(source)