Skip to content

Commit f1bf939

Browse files
committed
Add OS specific handling to affectsAllModules
1 parent 3d1b6f1 commit f1bf939

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/AffectedModuleDetector.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import com.dropbox.affectedmoduledetector.AffectedModuleDetector.Companion.DEPEN
2626
import com.dropbox.affectedmoduledetector.AffectedModuleDetector.Companion.ENABLE_ARG
2727
import com.dropbox.affectedmoduledetector.AffectedModuleDetector.Companion.MODULES_ARG
2828
import com.dropbox.affectedmoduledetector.commitshaproviders.CommitShaProvider
29+
import com.dropbox.affectedmoduledetector.util.toPathSections
2930
import org.gradle.api.GradleException
3031
import org.gradle.api.Project
3132
import org.gradle.api.Task
@@ -496,9 +497,13 @@ class AffectedModuleDetectorImpl constructor(
496497
}
497498
}
498499

499-
private fun affectsAllModules(file: String): Boolean {
500+
private fun affectsAllModules(relativeFilePath: String): Boolean {
500501
logger?.info("Paths affecting all modules: ${config.pathsAffectingAllModules}")
501-
return config.pathsAffectingAllModules.any { file.startsWith(it) }
502+
503+
val pathSections = relativeFilePath.toPathSections(rootProject.projectDir, git.getGitRoot())
504+
val projectRelativePath = pathSections.joinToString(File.separatorChar.toString())
505+
506+
return config.pathsAffectingAllModules.any { projectRelativePath.startsWith(it) }
502507
}
503508

504509
private fun findContainingProject(filePath: String): Project? {

0 commit comments

Comments
 (0)