Merge "Update how common sources are computed" into androidx-main
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/checkapi/CompilationInputs.kt b/buildSrc/private/src/main/kotlin/androidx/build/checkapi/CompilationInputs.kt
index 981e29a..21793e5 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/checkapi/CompilationInputs.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/checkapi/CompilationInputs.kt
@@ -227,8 +227,6 @@
      */
     val sourceSets: Provider<List<SourceSetInputs>>,
     override val bootClasspath: FileCollection,
-    /** Source files from the KMP common module of this project */
-    val commonModuleSourcePaths: FileCollection,
 ) : CompilationInputs {
     // Aggregate sources and classpath from all source sets
     override val sourcePaths: ConfigurableFileCollection =
@@ -236,6 +234,15 @@
     override val dependencyClasspath: ConfigurableFileCollection =
         project.files(sourceSets.map { it.map { sourceSet -> sourceSet.dependencyClasspath } })
 
+    /** Source files from the KMP common module of this project */
+    val commonModuleSourcePaths: FileCollection =
+        project.files(
+            sourceSets.map {
+                it.filter { sourceSet -> sourceSet.dependsOnSourceSets.isEmpty() }
+                    .map { sourceSet -> sourceSet.sourcePaths }
+            }
+        )
+
     companion object {
         /** Creates inputs based on one compilation of a multiplatform project. */
         fun fromCompilation(
@@ -291,21 +298,6 @@
                 project,
                 sourceSets,
                 bootClasspath,
-                project.commonModuleSourcePaths(compilationProvider)
-            )
-        }
-
-        private fun Project.commonModuleSourcePaths(
-            kotlinCompilation: Provider<KotlinCompilation<*>>
-        ): ConfigurableFileCollection {
-            return project.files(
-                project.provider {
-                    kotlinCompilation
-                        .get()
-                        .allKotlinSourceSets
-                        .filter { it.dependsOn.isEmpty() }
-                        .flatMap { it.kotlin.sourceDirectories.files }
-                }
             )
         }
     }