Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f027b71
Add UnifiedDiffReader.kt and actuals
michaelprichardson Dec 8, 2021
000129d
Add tests
michaelprichardson Dec 8, 2021
3b59325
Add BiConsumer
michaelprichardson Dec 8, 2021
1ec375a
Add test files
michaelprichardson Dec 8, 2021
349bdae
Comment out ios targets
michaelprichardson Dec 8, 2021
1de1ec9
Add reader expects
michaelprichardson Dec 8, 2021
7300438
Change from Reader to suspend function, add coroutines
michaelprichardson Dec 14, 2021
766af91
Remove Reader
michaelprichardson Dec 14, 2021
de55958
Extract coroutines version number
michaelprichardson Dec 15, 2021
6ce39c9
Fix expects and actuals
michaelprichardson Dec 15, 2021
0e0912d
Move UnifiedDiffReader into sub folder
michaelprichardson Dec 15, 2021
efbfa8b
Add new test libraries
michaelprichardson Dec 17, 2021
911b629
Fix tests to test suspending function
michaelprichardson Dec 17, 2021
2c30906
Fix tail for optional string
michaelprichardson Dec 17, 2021
d64bbe0
Add temp hack to respect new line
michaelprichardson Dec 17, 2021
9f0245e
Add another hack for new lines
michaelprichardson Dec 20, 2021
dfd86af
Add additions and deletions
michaelprichardson Dec 21, 2021
b9f3600
simplify expect/actual implementation
nbransby Jan 13, 2022
21c9e3e
add check for binary file changed and return null for /dev/null
michaelprichardson Jan 20, 2022
617e37e
remove redundant stdlib-commo import
michaelprichardson Jan 20, 2022
d960355
Merge branch 'update_1.3_version_to_latest_java_diff_utils' into add-…
michaelprichardson Mar 30, 2022
a1dcdfd
fix corountines dependency
nbransby Mar 30, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ kotlin {
}

js {
browser()
nodejs()
compilations.all {
kotlinOptions {
sourceMap = true
Expand All @@ -37,18 +39,25 @@ kotlin {
}
}

iosArm64()
iosX64()
// iosArm64()
// iosX64()

sourceSets {
val commonMain by getting {
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib")
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
val jsMain by getting {
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-js")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-js:${project.property("kotlinx-coroutines.version")}")
}
}
val jvmMain by getting {
Expand All @@ -58,8 +67,10 @@ kotlin {
}
val jvmTest by getting {
dependencies {
implementation(kotlin("test-junit"))
implementation("junit:junit:4.12")
implementation("org.assertj:assertj-core:3.11.1")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${project.property("kotlinx-coroutines.version")}")
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
version=4.11.3-kotlin1.5.32
kotlin_version = 1.5.32
kotlin.incremental.multiplatform=true
kotlin.js.compiler=both
kotlin.js.compiler=both
kotlinx-coroutines.version=1.5.2
8 changes: 5 additions & 3 deletions src/commonMain/kotlin/dev/gitlive/difflib/DiffUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ import dev.gitlive.difflib.patch.Patch
import dev.gitlive.difflib.patch.PatchFailedException

internal typealias Predicate<T> = (T) -> Boolean
internal typealias BiPredicate<T,R> = (T, R) -> Boolean
internal typealias BiPredicate<T, R> = (T, R) -> Boolean
internal typealias Consumer<T> = (T) -> Unit
internal typealias Function<T,R> = (T) -> R
internal typealias BiFunction<T, T2,R> = (T, T2) -> R
internal typealias Function<T, R> = (T) -> R
internal typealias BiFunction<T, T2, R> = (T, T2) -> R
internal typealias BiConsumer<T, U> = (T, U) -> Unit
internal typealias LineReader = suspend () -> String?

/**
* Implements the difference and patching engine
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class UnifiedDiff {
}

fun setTailTxt(tailTxt: String?) {
tail = tailTxt
tail = tailTxt.takeUnless { it.isNullOrEmpty() }
}

// @Throws(PatchFailedException::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class UnifiedDiffFile {
var deletedFileMode: String? = null
var patch = Patch<String>()
private set
var additions: Int? = null
var deletions: Int? = null
var isNoNewLineAtTheEndOfTheFile = false
var similarityIndex: Int? = null

Expand Down
Loading