From 88bed9923be52cea354bddcbb096598b8bfc1484 Mon Sep 17 00:00:00 2001 From: Graham Date: Thu, 14 May 2020 18:52:55 +0100 Subject: [PATCH] Update clikt This allows us to remove the cli module containing our clikt extensions, which are now supported by upstream. Signed-off-by: Graham --- buildSrc/src/main/java/Versions.kt | 2 +- cli/build.gradle.kts | 24 ----------- .../java/dev/openrs2/cli/OptionExtensions.kt | 41 ------------------- compress-cli/build.gradle.kts | 2 +- .../compress/cli/bzip2/Bunzip2Command.kt | 8 ++-- .../compress/cli/bzip2/Bzip2Command.kt | 8 ++-- .../compress/cli/deflate/DeflateCommand.kt | 8 ++-- .../compress/cli/deflate/InflateCommand.kt | 8 ++-- .../compress/cli/gzip/GunzipCommand.kt | 8 ++-- .../openrs2/compress/cli/gzip/GzipCommand.kt | 8 ++-- crc32/build.gradle.kts | 2 +- .../java/dev/openrs2/crc32/Crc32Command.kt | 4 +- settings.gradle.kts | 1 - 13 files changed, 29 insertions(+), 95 deletions(-) delete mode 100644 cli/build.gradle.kts delete mode 100644 cli/src/main/java/dev/openrs2/cli/OptionExtensions.kt diff --git a/buildSrc/src/main/java/Versions.kt b/buildSrc/src/main/java/Versions.kt index c254c13166..7cd208347b 100644 --- a/buildSrc/src/main/java/Versions.kt +++ b/buildSrc/src/main/java/Versions.kt @@ -1,7 +1,7 @@ object Versions { const val asm = "8.0.1" const val bouncyCastle = "1.65" - const val clikt = "2.6.0" + const val clikt = "2.7.0" const val commonsCompress = "1.20" const val dependencyLicenseReport = "1.14" const val dokka = "0.10.1" diff --git a/cli/build.gradle.kts b/cli/build.gradle.kts deleted file mode 100644 index 2d576f424a..0000000000 --- a/cli/build.gradle.kts +++ /dev/null @@ -1,24 +0,0 @@ -plugins { - `maven-publish` - kotlin("jvm") -} - -dependencies { - api("com.github.ajalt:clikt:${Versions.clikt}") -} - -publishing { - publications.create("maven") { - from(components["java"]) - - pom { - packaging = "jar" - name.set("OpenRS2 CLI") - description.set( - """ - Clikt extensions. - """.trimIndent() - ) - } - } -} diff --git a/cli/src/main/java/dev/openrs2/cli/OptionExtensions.kt b/cli/src/main/java/dev/openrs2/cli/OptionExtensions.kt deleted file mode 100644 index c08e1925a1..0000000000 --- a/cli/src/main/java/dev/openrs2/cli/OptionExtensions.kt +++ /dev/null @@ -1,41 +0,0 @@ -package dev.openrs2.cli - -import com.github.ajalt.clikt.parameters.options.NullableOption -import com.github.ajalt.clikt.parameters.options.OptionWithValues -import com.github.ajalt.clikt.parameters.options.RawOption -import com.github.ajalt.clikt.parameters.options.convert -import com.github.ajalt.clikt.parameters.options.default -import java.io.InputStream -import java.io.OutputStream -import java.nio.file.Files -import java.nio.file.Paths - -fun RawOption.inputStream(): NullableOption { - return convert("FILE") { - return@convert if (it == "-") { - System.`in` - } else { - Files.newInputStream(Paths.get(it)) - } - } -} - -fun NullableOption.defaultStdin(): OptionWithValues { - return default(System.`in`, "-") -} - -fun RawOption.outputStream(): NullableOption { - return convert("FILE") { - return@convert if (it == "-") { - System.out - } else { - Files.newOutputStream(Paths.get(it)) - } - } -} - -fun NullableOption.defaultStdout(): OptionWithValues { - - return default(System.out, "-") -} diff --git a/compress-cli/build.gradle.kts b/compress-cli/build.gradle.kts index 4da0b9ce70..31e8e2af4f 100644 --- a/compress-cli/build.gradle.kts +++ b/compress-cli/build.gradle.kts @@ -9,7 +9,7 @@ application { } dependencies { - api(project(":cli")) + api("com.github.ajalt:clikt:${Versions.clikt}") implementation(project(":compress")) } diff --git a/compress-cli/src/main/java/dev/openrs2/compress/cli/bzip2/Bunzip2Command.kt b/compress-cli/src/main/java/dev/openrs2/compress/cli/bzip2/Bunzip2Command.kt index fba13f0896..2bb6f56756 100644 --- a/compress-cli/src/main/java/dev/openrs2/compress/cli/bzip2/Bunzip2Command.kt +++ b/compress-cli/src/main/java/dev/openrs2/compress/cli/bzip2/Bunzip2Command.kt @@ -2,10 +2,10 @@ package dev.openrs2.compress.cli.bzip2 import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.parameters.options.option -import dev.openrs2.cli.defaultStdin -import dev.openrs2.cli.defaultStdout -import dev.openrs2.cli.inputStream -import dev.openrs2.cli.outputStream +import com.github.ajalt.clikt.parameters.types.defaultStdin +import com.github.ajalt.clikt.parameters.types.defaultStdout +import com.github.ajalt.clikt.parameters.types.inputStream +import com.github.ajalt.clikt.parameters.types.outputStream import dev.openrs2.compress.bzip2.Bzip2 class Bunzip2Command : CliktCommand(name = "bunzip2") { diff --git a/compress-cli/src/main/java/dev/openrs2/compress/cli/bzip2/Bzip2Command.kt b/compress-cli/src/main/java/dev/openrs2/compress/cli/bzip2/Bzip2Command.kt index f129a624df..932fc76b28 100644 --- a/compress-cli/src/main/java/dev/openrs2/compress/cli/bzip2/Bzip2Command.kt +++ b/compress-cli/src/main/java/dev/openrs2/compress/cli/bzip2/Bzip2Command.kt @@ -2,10 +2,10 @@ package dev.openrs2.compress.cli.bzip2 import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.parameters.options.option -import dev.openrs2.cli.defaultStdin -import dev.openrs2.cli.defaultStdout -import dev.openrs2.cli.inputStream -import dev.openrs2.cli.outputStream +import com.github.ajalt.clikt.parameters.types.defaultStdin +import com.github.ajalt.clikt.parameters.types.defaultStdout +import com.github.ajalt.clikt.parameters.types.inputStream +import com.github.ajalt.clikt.parameters.types.outputStream import dev.openrs2.compress.bzip2.Bzip2 class Bzip2Command : CliktCommand(name = "bzip2") { diff --git a/compress-cli/src/main/java/dev/openrs2/compress/cli/deflate/DeflateCommand.kt b/compress-cli/src/main/java/dev/openrs2/compress/cli/deflate/DeflateCommand.kt index 42c70f7f4f..e862ce0284 100644 --- a/compress-cli/src/main/java/dev/openrs2/compress/cli/deflate/DeflateCommand.kt +++ b/compress-cli/src/main/java/dev/openrs2/compress/cli/deflate/DeflateCommand.kt @@ -4,11 +4,11 @@ import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.parameters.options.default import com.github.ajalt.clikt.parameters.options.option import com.github.ajalt.clikt.parameters.options.validate +import com.github.ajalt.clikt.parameters.types.defaultStdin +import com.github.ajalt.clikt.parameters.types.defaultStdout +import com.github.ajalt.clikt.parameters.types.inputStream import com.github.ajalt.clikt.parameters.types.int -import dev.openrs2.cli.defaultStdin -import dev.openrs2.cli.defaultStdout -import dev.openrs2.cli.inputStream -import dev.openrs2.cli.outputStream +import com.github.ajalt.clikt.parameters.types.outputStream import java.util.zip.Deflater import java.util.zip.DeflaterOutputStream diff --git a/compress-cli/src/main/java/dev/openrs2/compress/cli/deflate/InflateCommand.kt b/compress-cli/src/main/java/dev/openrs2/compress/cli/deflate/InflateCommand.kt index b5aa25b31e..aefbb6d47e 100644 --- a/compress-cli/src/main/java/dev/openrs2/compress/cli/deflate/InflateCommand.kt +++ b/compress-cli/src/main/java/dev/openrs2/compress/cli/deflate/InflateCommand.kt @@ -2,10 +2,10 @@ package dev.openrs2.compress.cli.deflate import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.parameters.options.option -import dev.openrs2.cli.defaultStdin -import dev.openrs2.cli.defaultStdout -import dev.openrs2.cli.inputStream -import dev.openrs2.cli.outputStream +import com.github.ajalt.clikt.parameters.types.defaultStdin +import com.github.ajalt.clikt.parameters.types.defaultStdout +import com.github.ajalt.clikt.parameters.types.inputStream +import com.github.ajalt.clikt.parameters.types.outputStream import java.util.zip.Inflater import java.util.zip.InflaterInputStream diff --git a/compress-cli/src/main/java/dev/openrs2/compress/cli/gzip/GunzipCommand.kt b/compress-cli/src/main/java/dev/openrs2/compress/cli/gzip/GunzipCommand.kt index 26970c9ad0..5f2e16b4bb 100644 --- a/compress-cli/src/main/java/dev/openrs2/compress/cli/gzip/GunzipCommand.kt +++ b/compress-cli/src/main/java/dev/openrs2/compress/cli/gzip/GunzipCommand.kt @@ -2,10 +2,10 @@ package dev.openrs2.compress.cli.gzip import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.parameters.options.option -import dev.openrs2.cli.defaultStdin -import dev.openrs2.cli.defaultStdout -import dev.openrs2.cli.inputStream -import dev.openrs2.cli.outputStream +import com.github.ajalt.clikt.parameters.types.defaultStdin +import com.github.ajalt.clikt.parameters.types.defaultStdout +import com.github.ajalt.clikt.parameters.types.inputStream +import com.github.ajalt.clikt.parameters.types.outputStream import dev.openrs2.compress.gzip.Gzip class GunzipCommand : CliktCommand(name = "gunzip") { diff --git a/compress-cli/src/main/java/dev/openrs2/compress/cli/gzip/GzipCommand.kt b/compress-cli/src/main/java/dev/openrs2/compress/cli/gzip/GzipCommand.kt index 80bc35f9cc..86fe92367c 100644 --- a/compress-cli/src/main/java/dev/openrs2/compress/cli/gzip/GzipCommand.kt +++ b/compress-cli/src/main/java/dev/openrs2/compress/cli/gzip/GzipCommand.kt @@ -4,11 +4,11 @@ import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.parameters.options.default import com.github.ajalt.clikt.parameters.options.option import com.github.ajalt.clikt.parameters.options.validate +import com.github.ajalt.clikt.parameters.types.defaultStdin +import com.github.ajalt.clikt.parameters.types.defaultStdout +import com.github.ajalt.clikt.parameters.types.inputStream import com.github.ajalt.clikt.parameters.types.int -import dev.openrs2.cli.defaultStdin -import dev.openrs2.cli.defaultStdout -import dev.openrs2.cli.inputStream -import dev.openrs2.cli.outputStream +import com.github.ajalt.clikt.parameters.types.outputStream import dev.openrs2.compress.gzip.Gzip import java.util.zip.Deflater diff --git a/crc32/build.gradle.kts b/crc32/build.gradle.kts index ec0f5c71ee..a37a519c95 100644 --- a/crc32/build.gradle.kts +++ b/crc32/build.gradle.kts @@ -9,7 +9,7 @@ application { } dependencies { - api(project(":cli")) + api("com.github.ajalt:clikt:${Versions.clikt}") } publishing { diff --git a/crc32/src/main/java/dev/openrs2/crc32/Crc32Command.kt b/crc32/src/main/java/dev/openrs2/crc32/Crc32Command.kt index be7de02022..380b6e5aea 100644 --- a/crc32/src/main/java/dev/openrs2/crc32/Crc32Command.kt +++ b/crc32/src/main/java/dev/openrs2/crc32/Crc32Command.kt @@ -2,8 +2,8 @@ package dev.openrs2.crc32 import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.parameters.options.option -import dev.openrs2.cli.defaultStdin -import dev.openrs2.cli.inputStream +import com.github.ajalt.clikt.parameters.types.defaultStdin +import com.github.ajalt.clikt.parameters.types.inputStream import java.util.zip.CRC32 fun main(args: Array) = Crc32Command().main(args) diff --git a/settings.gradle.kts b/settings.gradle.kts index a75bb57e8d..15de302bfb 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -4,7 +4,6 @@ include( "all", "asm", "bundler", - "cli", "compress", "compress-cli", "conf",