AA: collect .kts source files too

This commit is contained in:
Jinseong Jeon
2023-06-01 00:31:39 -07:00
committed by Ilya Kirillov
parent 4be7ac930b
commit 3f22044275
@@ -28,6 +28,7 @@ import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.config.JVMConfigurationKeys
import org.jetbrains.kotlin.idea.KotlinFileType
import org.jetbrains.kotlin.js.resolve.JsPlatformAnalyzerServices
import org.jetbrains.kotlin.parsing.KotlinParserDefinition
import org.jetbrains.kotlin.wasm.resolve.WasmPlatformAnalyzerServices
import org.jetbrains.kotlin.platform.TargetPlatform
import org.jetbrains.kotlin.platform.isCommon
@@ -86,7 +87,7 @@ internal fun getSourceFilePaths(
* Collect source file path from the given [root] store them in [result].
*
* E.g., for `project/app/src` as a [root], this will walk the file tree and
* collect all `.kt` and `.java` files under that folder.
* collect all `.kt`, `.kts`, and `.java` files under that folder.
*
* Note that this util gracefully skips [IOException] during file tree traversal.
*/
@@ -110,7 +111,10 @@ private fun collectSourceFilePaths(
if (!Files.isRegularFile(file) || !Files.isReadable(file))
return FileVisitResult.CONTINUE
val ext = getFileExtension(file.fileName.toString())
if (ext == KotlinFileType.EXTENSION || ext == JavaFileType.DEFAULT_EXTENSION) {
if (ext == KotlinFileType.EXTENSION ||
ext == KotlinParserDefinition.STD_SCRIPT_SUFFIX ||
ext == JavaFileType.DEFAULT_EXTENSION
) {
result.add(file.toString())
}
return FileVisitResult.CONTINUE