diff --git a/.github/workflows/bld.yml b/.github/workflows/bld.yml index 639d0d6..08a73b4 100644 --- a/.github/workflows/bld.yml +++ b/.github/workflows/bld.yml @@ -4,17 +4,17 @@ on: [push, pull_request, workflow_dispatch] env: COVERAGE_JDK: "21" - COVERAGE_KOTLIN: "2.0.21" + COVERAGE_KOTLIN: "2.0.0" + KOTLIN_HOME: /usr/share/kotlinc jobs: build-bld-project: + runs-on: ubuntu-latest + strategy: matrix: - java-version: [17, 21, 24] - kotlin-version: [ 1.9.25, 2.0.21, 2.1.20 ] - os: [ ubuntu-latest, windows-latest, macos-latest ] - - runs-on: ${{ matrix.os }} + java-version: [17, 21, 23] + kotlin-version: [1.9.25, 2.1.10] steps: - name: Checkout source repository @@ -28,23 +28,6 @@ jobs: distribution: "zulu" java-version: ${{ matrix.java-version }} - - name: Download dependencies [bld example] - working-directory: examples/bld - run: ./bld download - - - name: Compile and run examples [bld example] - working-directory: examples/bld - run: | - ./bld compile - ./bld run --args='https://www.example.com https://is.gd/Pt2sET' - ./bld run-java --args='https://www.example.com https://is.gd/Pt2sET' - - - name: Run examples [gradle example] - working-directory: examples/gradle - run: | - ./gradlew run --args='https://www.example.com https://is.gd/Pt2sET' - ./gradlew runJava --args='https://www.example.com https://is.gd/Pt2sET' - - name: Download dependencies run: ./bld download @@ -56,13 +39,11 @@ jobs: - name: Remove pom.xml if: success() && matrix.java-version == env.COVERAGE_JDK && matrix.kotlin-version == env.COVERAGE_KOTLIN - && matrix.os == 'ubuntu-latest' run: rm -rf pom.xml - name: SonarCloud Scan uses: sonarsource/sonarcloud-github-action@master if: success() && matrix.java-version == env.COVERAGE_JDK && matrix.kotlin-version == env.COVERAGE_KOTLIN - && matrix.os == 'ubuntu-latest' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index 94f28ea..1e01b48 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -4,6 +4,5 @@ - \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml deleted file mode 100644 index 9d6ea82..0000000 --- a/.idea/kotlinc.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/README.md b/README.md index 7bff2fb..61d61d5 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ [![License (3-Clause BSD)](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](https://opensource.org/licenses/BSD-3-Clause) -[![Kotlin](https://img.shields.io/badge/kotlin-2.1.20-7f52ff)](https://kotlinlang.org/) +[![Kotlin](https://img.shields.io/badge/kotlin-2.1.10-7f52ff)](https://kotlinlang.org/) [![bld](https://img.shields.io/badge/2.2.1-FA9052?label=bld&labelColor=2392FF)](https://rife2.com/bld) [![release](https://img.shields.io/github/release/ethauvin/isgd-shorten.svg)](https://github.com/ethauvin/isgd-shorten/releases/latest) [![Maven Central](https://img.shields.io/maven-central/v/net.thauvin.erik/isgd-shorten.svg?color=blue)](https://central.sonatype.com/artifact/net.thauvin.erik/isgd-shorten) @@ -19,7 +19,7 @@ A simple implementation of the [is.gd](https://is.gd/) URL shortening and lookup ```kotlin import net.thauvin.erik.isgd.Isgd -// ... +... Isgd.shorten("https://www.example.com/") // returns https://is.gd/Pt2sET Isgd.lookup("https://is.gd/Pt2sET") // returns https://www.example.com @@ -72,7 +72,7 @@ scope(compile) .include("net.thauvin.erik:isgd-shorten:1.1.0"); ``` -## Gradle, Maven, etc... +## Gradle To use with [Gradle](https://gradle.org/), include the following dependency in your [build](https://github.com/ethauvin/isgd-shorten/blob/master/examples/gradle/build.gradle.kts) file: diff --git a/examples/bld/lib/bld/bld-wrapper.properties b/examples/bld/lib/bld/bld-wrapper.properties index 1156265..f1887e4 100644 --- a/examples/bld/lib/bld/bld-wrapper.properties +++ b/examples/bld/lib/bld/bld-wrapper.properties @@ -1,8 +1,8 @@ bld.downloadExtensionJavadoc=false bld.downloadExtensionSources=true bld.downloadLocation= -bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.10 -bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.1.0-SNAPSHOT +bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.9 +bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.0.4 bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES bld.sourceDirectories= bld.version=2.2.1 diff --git a/examples/bld/src/bld/java/com/example/ExampleBuild.java b/examples/bld/src/bld/java/com/example/ExampleBuild.java index 172466e..e43a7d4 100644 --- a/examples/bld/src/bld/java/com/example/ExampleBuild.java +++ b/examples/bld/src/bld/java/com/example/ExampleBuild.java @@ -24,7 +24,7 @@ public class ExampleBuild extends BaseProject { repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, SONATYPE_SNAPSHOTS_LEGACY); scope(compile) - .include(dependency("net.thauvin.erik:isgd-shorten:1.1.1-SNAPSHOT")); + .include(dependency("net.thauvin.erik:isgd-shorten:1.1.0")); } public static void main(String[] args) { diff --git a/examples/gradle/build.gradle.kts b/examples/gradle/build.gradle.kts index 989a94e..fcdbf8b 100644 --- a/examples/gradle/build.gradle.kts +++ b/examples/gradle/build.gradle.kts @@ -3,7 +3,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { id("application") id("com.github.ben-manes.versions") version "0.51.0" - kotlin("jvm") version "2.1.20" + kotlin("jvm") version "2.1.10" } repositories { @@ -13,7 +13,7 @@ repositories { } dependencies { - implementation("net.thauvin.erik:isgd-shorten:1.1.1-SNAPSHOT") + implementation("net.thauvin.erik:isgd-shorten:1.1.0") } java { diff --git a/examples/gradle/gradle/wrapper/gradle-wrapper.jar b/examples/gradle/gradle/wrapper/gradle-wrapper.jar index 1b33c55..9bbc975 100644 Binary files a/examples/gradle/gradle/wrapper/gradle-wrapper.jar and b/examples/gradle/gradle/wrapper/gradle-wrapper.jar differ diff --git a/examples/gradle/gradle/wrapper/gradle-wrapper.properties b/examples/gradle/gradle/wrapper/gradle-wrapper.properties index ca025c8..37f853b 100644 --- a/examples/gradle/gradle/wrapper/gradle-wrapper.properties +++ b/examples/gradle/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/examples/gradle/gradlew b/examples/gradle/gradlew index 23d15a9..faf9300 100755 --- a/examples/gradle/gradlew +++ b/examples/gradle/gradlew @@ -114,7 +114,7 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH="\\\"\\\"" +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -213,7 +213,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ -classpath "$CLASSPATH" \ - -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ + org.gradle.wrapper.GradleWrapperMain \ "$@" # Stop when "xargs" is not available. diff --git a/examples/gradle/gradlew.bat b/examples/gradle/gradlew.bat index db3a6ac..9d21a21 100644 --- a/examples/gradle/gradlew.bat +++ b/examples/gradle/gradlew.bat @@ -70,11 +70,11 @@ goto fail :execute @rem Setup the command line -set CLASSPATH= +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/lib/bld/bld-wrapper.properties b/lib/bld/bld-wrapper.properties index 751133d..154abb0 100644 --- a/lib/bld/bld-wrapper.properties +++ b/lib/bld/bld-wrapper.properties @@ -1,10 +1,10 @@ bld.downloadExtensionJavadoc=false bld.downloadExtensionSources=true bld.downloadLocation= -bld.extension-detekt=com.uwyn.rife2:bld-detekt:0.9.10-SNAPSHOT -bld.extension-dokka=com.uwyn.rife2:bld-dokka:1.0.4-SNAPSHOT -bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.10 -bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.1.0-SNAPSHOT +bld.extension-detekt=com.uwyn.rife2:bld-detekt:0.9.9 +bld.extension-dokka=com.uwyn.rife2:bld-dokka:1.0.3 +bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.9 +bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.0.4 bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES bld.sourceDirectories= bld.version=2.2.1 diff --git a/pom.xml b/pom.xml index 33a16b9..88cfd2e 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 net.thauvin.erik isgd-shorten - 1.1.1-SNAPSHOT + 1.1.0 isgd-shorten A simple implementation of the is.gd URL shortening and lookup APIs https://github.com/ethauvin/isgd-shorten @@ -18,7 +18,7 @@ org.jetbrains.kotlin kotlin-stdlib - 2.1.20 + 2.1.10 compile diff --git a/src/bld/java/net/thauvin/erik/IsgdShortenBuild.java b/src/bld/java/net/thauvin/erik/IsgdShortenBuild.java index 49abd79..9e8d31b 100644 --- a/src/bld/java/net/thauvin/erik/IsgdShortenBuild.java +++ b/src/bld/java/net/thauvin/erik/IsgdShortenBuild.java @@ -39,7 +39,6 @@ import rife.bld.extension.DokkaOperation; import rife.bld.extension.JacocoReportOperation; import rife.bld.extension.dokka.LoggingLevel; import rife.bld.extension.dokka.OutputFormat; -import rife.bld.extension.kotlin.CompileOptions; import rife.bld.operations.exceptions.ExitStatusException; import rife.bld.publish.PomBuilder; import rife.bld.publish.PublishDeveloper; @@ -50,9 +49,6 @@ import rife.tools.exceptions.FileUtilsErrorException; import java.io.File; import java.io.IOException; import java.util.List; -import java.util.logging.ConsoleHandler; -import java.util.logging.Level; -import java.util.logging.Logger; import static rife.bld.dependencies.Repository.*; import static rife.bld.dependencies.Scope.compile; @@ -64,7 +60,7 @@ public class IsgdShortenBuild extends Project { public IsgdShortenBuild() { pkg = "net.thauvin.erik"; name = "isgd-shorten"; - version = version(1, 1, 1, "SNAPSHOT"); + version = version(1, 1, 0); javaRelease = 11; downloadSources = true; @@ -72,15 +68,14 @@ public class IsgdShortenBuild extends Project { repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL); - final var kotlin = version(2, 1, 20); + final var kotlin = version(2, 1, 10); scope(compile) .include(dependency("org.jetbrains.kotlin", "kotlin-stdlib", kotlin)) .include(dependency("net.thauvin.erik.urlencoder", "urlencoder-lib-jvm", version(1, 6, 0))); scope(test) .include(dependency("org.jetbrains.kotlin", "kotlin-test-junit5", kotlin)) - .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 12, 2))) - .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 12, 2))) - .include(dependency("org.junit.platform", "junit-platform-launcher", version(1, 12, 2))) + .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 12, 1))) + .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 12, 1))) .include(dependency("com.willowtreeapps.assertk", "assertk-jvm", version(0, 28, 1))); publishOperation() @@ -116,16 +111,6 @@ public class IsgdShortenBuild extends Project { } public static void main(String[] args) { - // Enable detailed logging for the extensions - var level = Level.ALL; - var logger = Logger.getLogger("rife.bld.extension"); - var consoleHandler = new ConsoleHandler(); - - consoleHandler.setLevel(level); - logger.addHandler(consoleHandler); - logger.setLevel(level); - logger.setUseParentHandlers(false); - new IsgdShortenBuild().start(args); } @@ -134,7 +119,6 @@ public class IsgdShortenBuild extends Project { public void compile() throws Exception { new CompileKotlinOperation() .fromProject(this) - .compileOptions(new CompileOptions().verbose(true)) .execute(); } diff --git a/src/main/kotlin/net/thauvin/erik/isgd/Isgd.kt b/src/main/kotlin/net/thauvin/erik/isgd/Isgd.kt index 9157567..c48609c 100644 --- a/src/main/kotlin/net/thauvin/erik/isgd/Isgd.kt +++ b/src/main/kotlin/net/thauvin/erik/isgd/Isgd.kt @@ -33,7 +33,7 @@ package net.thauvin.erik.isgd import net.thauvin.erik.urlencoder.UrlEncoderUtil import java.net.HttpURLConnection -import java.net.URI +import java.net.URL /** * See the [is.gd API](https://is.gd/apishorteningreference.php). @@ -50,7 +50,7 @@ fun String.encode(): String = UrlEncoderUtil.encode(this) class Isgd private constructor() { companion object { private fun callApi(url: String): String { - val connection = URI(url).toURL().openConnection() as HttpURLConnection + val connection = URL(url).openConnection() as HttpURLConnection try { connection.setRequestProperty( "User-Agent",