in ruler-common/src/main/java/com/spotify/ruler/common/attribution/Attributor.kt [45:61]
fun attribute(files: List<AppFile>, dependencies: Dependencies): Map<DependencyComponent, List<AppFile>> {
val components = mutableMapOf<DependencyComponent, MutableList<AppFile>>()
val sortedDependenciesMap = sortStaticDependenciesMap()
files.forEach { file ->
val component = when (file.type) {
FileType.CLASS -> getComponentForClass(file.name, dependencies)
FileType.RESOURCE -> getComponentForResource(file.name, dependencies)
FileType.ASSET -> getComponentForAsset(file.name, dependencies)
FileType.NATIVE_LIB -> getComponentForNativeLib(file.name, dependencies)
FileType.NATIVE_FILE -> getComponentFromStaticDependenciesMap(sortedDependenciesMap, file.name)
FileType.OTHER -> getComponentForFile(file.name, dependencies)
} ?: getComponentFromStaticDependenciesMap(sortedDependenciesMap, file.name) ?: defaultComponent
components.getOrPut(component) { ArrayList() }.add(file)
}
return components
}