Skip to content

Commit

Permalink
Attempt fix for Gradle 8.3 failure
Browse files Browse the repository at this point in the history
  • Loading branch information
3flex committed Aug 23, 2023
1 parent 3c8a544 commit cf581ec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Expand Up @@ -13,6 +13,7 @@ import org.jetbrains.kotlin.resolve.jvm.extensions.AnalysisHandlerExtension
import java.nio.file.FileSystems
import java.nio.file.Path
import kotlin.io.path.Path
import kotlin.io.path.relativeTo

class DetektAnalysisExtension(
private val log: MessageCollector,
Expand All @@ -32,7 +33,7 @@ class DetektAnalysisExtension(
}
val matchers = excludes.map { FileSystems.getDefault().getPathMatcher("glob:$it") }
val (includedFiles, excludedFiles) = files.partition { file ->
matchers.none { it.matches(rootPath.relativize(Path(file.virtualFilePath))) }
matchers.none { it.matches(Path(file.virtualFilePath).relativeTo(rootPath)) }
}
log.info("Running detekt on module '${module.name.asString()}'")
excludedFiles.forEach { log.info("File excluded by filter: ${it.virtualFilePath}") }
Expand Down
Expand Up @@ -13,6 +13,7 @@ import kotlin.io.path.absolute
import kotlin.io.path.isRegularFile
import kotlin.io.path.name
import kotlin.io.path.readText
import kotlin.io.path.relativeTo

open class KtCompiler(
protected val environment: KotlinCoreEnvironment = createKotlinCoreEnvironment(printStream = System.err)
Expand Down Expand Up @@ -42,7 +43,7 @@ open class KtCompiler(
this.lineSeparator = lineSeparator
val normalizedBasePath = basePath.absolute().normalize()
this.basePath = normalizedBasePath.absolute()
this.relativePath = normalizedBasePath.relativize(normalizedAbsolutePath)
this.relativePath = normalizedAbsolutePath.relativeTo(normalizedBasePath)
}
}
}
Expand Down

0 comments on commit cf581ec

Please sign in to comment.