diff --git a/build.gradle.kts b/build.gradle.kts index b8f6db14..410cd109 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,7 +7,6 @@ plugins { `maven-publish` signing kotlin("multiplatform") version "1.5.32" - kotlin("native.cocoapods") version "1.5.32" } repositories { diff --git a/kotlin_diff_utils.podspec b/kotlin_diff_utils.podspec deleted file mode 100644 index aada94c3..00000000 --- a/kotlin_diff_utils.podspec +++ /dev/null @@ -1,45 +0,0 @@ -Pod::Spec.new do |spec| - spec.name = 'kotlin_diff_utils' - spec.version = '4.11.3-kotlin1.5.32' - spec.homepage = '' - spec.source = { :git => "Not Published", :tag => "Cocoapods/#{spec.name}/#{spec.version}" } - spec.authors = '' - spec.license = '' - spec.summary = '' - - spec.vendored_frameworks = "build/cocoapods/framework/kotlin_diff_utils.framework" - spec.libraries = "c++" - spec.module_name = "#{spec.name}_umbrella" - - - - - - spec.pod_target_xcconfig = { - 'KOTLIN_PROJECT_PATH' => ':', - 'PRODUCT_MODULE_NAME' => 'kotlin_diff_utils', - } - - spec.script_phases = [ - { - :name => 'Build kotlin_diff_utils', - :execution_position => :before_compile, - :shell_path => '/bin/sh', - :script => <<-SCRIPT - if [ "YES" = "$COCOAPODS_SKIP_KOTLIN_BUILD" ]; then - echo "Skipping Gradle build task invocation due to COCOAPODS_SKIP_KOTLIN_BUILD environment variable set to \"YES\"" - exit 0 - fi - set -ev - REPO_ROOT="$PODS_TARGET_SRCROOT" - "$REPO_ROOT/gradlew" -p "$REPO_ROOT" $KOTLIN_PROJECT_PATH:syncFramework \ - -Pkotlin.native.cocoapods.platform=$PLATFORM_NAME \ - -Pkotlin.native.cocoapods.archs="$ARCHS" \ - -Pkotlin.native.cocoapods.configuration=$CONFIGURATION \ - -Pkotlin.native.cocoapods.cflags="$OTHER_CFLAGS" \ - -Pkotlin.native.cocoapods.paths.headers="$HEADER_SEARCH_PATHS" \ - -Pkotlin.native.cocoapods.paths.frameworks="$FRAMEWORK_SEARCH_PATHS" - SCRIPT - } - ] -end \ No newline at end of file diff --git a/src/commonMain/kotlin/dev/gitlive/difflib/UnifiedDiffUtils.kt b/src/commonMain/kotlin/dev/gitlive/difflib/UnifiedDiffUtils.kt index d49ba2f1..3a2c3ad9 100644 --- a/src/commonMain/kotlin/dev/gitlive/difflib/UnifiedDiffUtils.kt +++ b/src/commonMain/kotlin/dev/gitlive/difflib/UnifiedDiffUtils.kt @@ -190,7 +190,7 @@ object UnifiedDiffUtils { ) ret.addAll(curBlock) deltas.clear() - deltas.add(nextDelta!!) + deltas.add(nextDelta) } delta = nextDelta } diff --git a/src/commonMain/kotlin/dev/gitlive/difflib/patch/AbstractDelta.kt b/src/commonMain/kotlin/dev/gitlive/difflib/patch/AbstractDelta.kt index 23840a59..c1d92db6 100644 --- a/src/commonMain/kotlin/dev/gitlive/difflib/patch/AbstractDelta.kt +++ b/src/commonMain/kotlin/dev/gitlive/difflib/patch/AbstractDelta.kt @@ -52,17 +52,17 @@ abstract class AbstractDelta(val type: DeltaType, val source: Chunk, val t return Triple(this.source, this.target, this.type).hashCode() } - override fun equals(obj: Any?): Boolean { - if (this === obj) { + override fun equals(other: Any?): Boolean { + if (this === other) { return true } - if (obj == null) { + if (other == null) { return false } - if (this::class != obj::class) { + if (this::class != other::class) { return false } - val other = obj as AbstractDelta<*> + val other = other as AbstractDelta<*> if (source != other.source) { return false } diff --git a/src/commonMain/kotlin/dev/gitlive/difflib/patch/Chunk.kt b/src/commonMain/kotlin/dev/gitlive/difflib/patch/Chunk.kt index a36422c0..6ff21b7a 100644 --- a/src/commonMain/kotlin/dev/gitlive/difflib/patch/Chunk.kt +++ b/src/commonMain/kotlin/dev/gitlive/difflib/patch/Chunk.kt @@ -120,22 +120,18 @@ class Chunk { return Triple(lines, position, size()).hashCode() } - override fun equals(obj: Any?): Boolean { - if (this === obj) { + override fun equals(other: Any?): Boolean { + if (this === other) { return true } - if (obj == null) { + if (other == null) { return false } - if (this::class != obj::class) { + if (this::class != other::class) { return false } - val other = obj as Chunk<*>? - if (lines == null) { - if (other!!.lines != null) { - return false - } - } else if (lines != other!!.lines) { + val other = other as Chunk<*>? + if (lines != other!!.lines) { return false } return position == other.position diff --git a/src/commonMain/kotlin/dev/gitlive/difflib/text/DiffRow.kt b/src/commonMain/kotlin/dev/gitlive/difflib/text/DiffRow.kt index 5ffb00b2..734a973c 100644 --- a/src/commonMain/kotlin/dev/gitlive/difflib/text/DiffRow.kt +++ b/src/commonMain/kotlin/dev/gitlive/difflib/text/DiffRow.kt @@ -46,36 +46,24 @@ class DiffRow( return Triple(newLine, oldLine, tag).hashCode() } - override fun equals(obj: Any?): Boolean { - if (this === obj) { + override fun equals(other: Any?): Boolean { + if (this === other) { return true } - if (obj == null) { + if (other == null) { return false } - if (this::class != obj::class) { + if (this::class != other::class) { return false } - val other = obj as DiffRow - if (newLine == null) { - if (other.newLine != null) { - return false - } - } else if (newLine != other.newLine) { + val other = other as DiffRow + if (newLine != other.newLine) { return false } - if (oldLine == null) { - if (other.oldLine != null) { - return false - } - } else if (oldLine != other.oldLine) { + if (oldLine != other.oldLine) { return false } - if (tag == null) { - if (other.tag != null) { - return false - } - } else if (tag != other.tag) { + if (tag != other.tag) { return false } return true diff --git a/src/commonMain/kotlin/dev/gitlive/difflib/text/StringUtils.kt b/src/commonMain/kotlin/dev/gitlive/difflib/text/StringUtils.kt index 2ac12728..06a81271 100644 --- a/src/commonMain/kotlin/dev/gitlive/difflib/text/StringUtils.kt +++ b/src/commonMain/kotlin/dev/gitlive/difflib/text/StringUtils.kt @@ -45,7 +45,6 @@ internal object StringUtils { * @param columnWidth the given column * @return the wrapped text */ - @OptIn(ExperimentalStdlibApi::class) @kotlin.jvm.JvmStatic fun wrapText(line: String, columnWidth: Int): String { require(columnWidth >= 0) { "columnWidth may not be less 0" } diff --git a/src/commonMain/kotlin/dev/gitlive/difflib/unifieddiff/UnifiedDiff.kt b/src/commonMain/kotlin/dev/gitlive/difflib/unifieddiff/UnifiedDiff.kt index 3cc0daec..9486fdb5 100644 --- a/src/commonMain/kotlin/dev/gitlive/difflib/unifieddiff/UnifiedDiff.kt +++ b/src/commonMain/kotlin/dev/gitlive/difflib/unifieddiff/UnifiedDiff.kt @@ -36,7 +36,7 @@ class UnifiedDiff { } fun setTailTxt(tailTxt: String?) { - tail = tailTxt.takeUnless { it.isNullOrEmpty() } + tail = tailTxt } // @Throws(PatchFailedException::class) diff --git a/src/commonMain/kotlin/dev/gitlive/difflib/unifieddiff/UnifiedDiffReader.kt b/src/commonMain/kotlin/dev/gitlive/difflib/unifieddiff/UnifiedDiffReader.kt index 64a8f223..94ef600c 100644 --- a/src/commonMain/kotlin/dev/gitlive/difflib/unifieddiff/UnifiedDiffReader.kt +++ b/src/commonMain/kotlin/dev/gitlive/difflib/unifieddiff/UnifiedDiffReader.kt @@ -182,16 +182,18 @@ class UnifiedDiffReader internal constructor(lineReader: LineReader) { } } - var tailTxt = "" line = nextLine() - while (line != null) { - if (tailTxt.isNotEmpty()) { - tailTxt += "\n" + if(line != null) { + var tailTxt = "" + while (line != null) { + if (tailTxt.isNotEmpty()) { + tailTxt += "\n" + } + tailTxt += line + line = nextLine() } - tailTxt += line - line = nextLine() + data.setTailTxt(tailTxt) } - data.setTailTxt(tailTxt) return data }