-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
95 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
kordex/src/main/kotlin/dev/kordex/gradle/plugins/kordex/Version.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package dev.kordex.gradle.plugins.kordex | ||
|
||
import com.unascribed.flexver.FlexVerComparator | ||
|
||
class Version(val version: String) { | ||
override fun toString(): String = | ||
version | ||
} | ||
|
||
operator fun Version?.compareTo(other: Version?): Int { | ||
if ((this == null) xor ( other == null)) { | ||
if (this == null) { | ||
return -1 | ||
} | ||
|
||
return 1 | ||
} else if (this == null && other == null) { | ||
return 0 | ||
} | ||
|
||
return FlexVerComparator.compare(this!!.version, other!!.version) | ||
} | ||
|
||
operator fun String?.compareTo(other: Version?): Int { | ||
if ((this == null) xor ( other == null)) { | ||
if (this == null) { | ||
return -1 | ||
} | ||
|
||
return 1 | ||
} else if (this == null && other == null) { | ||
return 0 | ||
} | ||
|
||
return FlexVerComparator.compare(this!!, other!!.version) | ||
} | ||
|
||
operator fun Version?.compareTo(other: String?): Int { | ||
if ((this == null) xor ( other == null)) { | ||
if (this == null) { | ||
return -1 | ||
} | ||
|
||
return 1 | ||
} else if (this == null && other == null) { | ||
return 0 | ||
} | ||
|
||
return FlexVerComparator.compare(this!!.version, other!!) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters