File tree Expand file tree Collapse file tree
kfc/kfc-gradle-plugin/src/main/kotlin/io/github/turansky/kfc/gradle/plugin Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import org.gradle.api.file.Directory
44import org.gradle.api.file.FileSystemOperations
55import org.gradle.api.file.RegularFile
66import org.gradle.api.provider.Provider
7+ import java.io.File
78
89// WA for https://github.com/gradle/gradle/issues/1643
910fun FileSystemOperations.syncFile (
@@ -25,7 +26,7 @@ fun FileSystemOperations.syncFile(
2526 " Unable to sync unexisted file: `$sourceFile `"
2627 }
2728
28- if (targetFile.exists() && targetFile.readText() == sourceFile.readText( )) {
29+ if (targetFile.exists() && hasEqualContent( sourceFile, targetFile )) {
2930 return
3031 }
3132
@@ -35,6 +36,14 @@ fun FileSystemOperations.syncFile(
3536 }
3637}
3738
39+ private fun hasEqualContent (
40+ fileA : File ,
41+ fileB : File ,
42+ ): Boolean {
43+ return fileA.readBytes()
44+ .contentEquals(fileB.readBytes())
45+ }
46+
3847enum class SyncFileStrategy {
3948 REQUIRED_SOURCE ,
4049 OPTIONAL_SOURCE ,
You can’t perform that action at this time.
0 commit comments