diff --git a/.circleci/config.yml b/.circleci/config.yml
index 09d8896..17b50f1 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -1,4 +1,8 @@
-version: 2
+version: 2.1
+
+orbs:
+ sdkman: joshdholtz/sdkman@0.2.0
+
defaults: &defaults
working_directory: ~/repo
environment:
@@ -6,18 +10,31 @@ defaults: &defaults
TERM: dumb
CI_NAME: "CircleCI"
-defaults_bld: &defaults_bld
- steps:
- - checkout
- - run:
- name: Download the bld dependencies
- command: ./bld download
- - run:
- name: Compile source with bld
- command: ./bld compile
- - run:
- name: Run tests with bld
- command: ./bld test
+commands:
+ build_and_test:
+ parameters:
+ reports-dir:
+ type: string
+ default: "build/reports/test_results"
+ steps:
+ - checkout
+ - sdkman/setup-sdkman
+ - sdkman/sdkman-install:
+ candidate: kotlin
+ version: 2.0.0
+ - run:
+ name: Download dependencies
+ command: ./bld download
+ - run:
+ name: Compile source
+ command: ./bld compile
+ - run:
+ name: Run tests
+ command: ./bld jacoco -reports-dir=<< parameters.reports-dir >>
+ - store_test_results:
+ path: << parameters.reports-dir >>
+ - store_artifacts:
+ path: build/reports/jacoco/test/html
jobs:
bld_jdk17:
@@ -26,7 +43,8 @@ jobs:
docker:
- image: cimg/openjdk:17.0
- <<: *defaults_bld
+ steps:
+ - build_and_test
bld_jdk20:
<<: *defaults
@@ -34,10 +52,10 @@ jobs:
docker:
- image: cimg/openjdk:20.0
- <<: *defaults_bld
+ steps:
+ - build_and_test
workflows:
- version: 2
bld:
jobs:
- bld_jdk17
diff --git a/.github/workflows/bld.yml b/.github/workflows/bld.yml
index 19a51fd..690e191 100644
--- a/.github/workflows/bld.yml
+++ b/.github/workflows/bld.yml
@@ -2,16 +2,19 @@ name: bld-ci
on: [push, pull_request, workflow_dispatch]
+env:
+ COVERAGE_JDK: "21"
+ COVERAGE_KOTLIN: "2.0.0"
+ KOTLIN_HOME: /usr/share/kotlinc
+
jobs:
build-bld-project:
runs-on: ubuntu-latest
- env:
- COVERAGE_SDK: "17"
-
strategy:
matrix:
- java-version: [17, 21, 22]
+ java-version: [ 17, 21, 22 ]
+ kotlin-version: [ 1.9.24, 2.0.0 ]
steps:
- name: Checkout source repository
@@ -19,31 +22,28 @@ jobs:
with:
fetch-depth: 0
- - name: Set up JDK ${{ matrix.java-version }}
+ - name: Set up JDK ${{ matrix.java-version }} with Kotlin ${{ matrix.kotlin-version }}
uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: ${{ matrix.java-version }}
- - name: Grant bld execute permission
- run: chmod +x bld
-
- - name: Download the bld dependencies
+ - name: Download dependencies
run: ./bld download
- - name: Compile source with bld
+ - name: Compile source
run: ./bld compile
- - name: Run tests with bld
+ - name: Run tests
run: ./bld jacoco
- name: Remove pom.xml
- if: success() && matrix.java-version == env.COVERAGE_SDK
+ if: success() && matrix.java-version == env.COVERAGE_JDK && matrix.kotlin-version == env.COVERAGE_KOTLIN
run: rm -rf pom.xml
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
- if: success() && matrix.java-version == env.COVERAGE_SDK
+ if: success() && matrix.java-version == env.COVERAGE_JDK && matrix.kotlin-version == env.COVERAGE_KOTLIN
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
diff --git a/.gitignore b/.gitignore
index 9c35a25..ea86fe8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -54,4 +54,4 @@ atlassian-ide-plugin.xml
# Editor-based Rest Client
.idea/httpRequests
-local.properties
\ No newline at end of file
+local.properties
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 052df48..10b9b0f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,11 +1,24 @@
-image: openjdk:17
+image: fedora:latest
+
+variables:
+ CI_NAME: "GitLab CI"
stages:
- test
+before_script:
+ - dnf -qy update && dnf -y install zip
+ - curl -s "https://get.sdkman.io" | bash
+ - echo sdkman_auto_answer=true > $HOME/.sdkman/etc/config
+ - echo sdkman_auto_selfupdate=true >> $HOME/.sdkman/etc/config
+ - source "$HOME/.sdkman/bin/sdkman-init.sh"
+ - sdk install java
+ - sdk install kotlin
+ - source "$HOME/.sdkman/bin/sdkman-init.sh"
+
test:
stage: test
script:
- - ./bld download
- - ./bld compile
- - ./bld test
+ - ./bld download
+ - ./bld compile
+ - ./bld test
diff --git a/.idea/bld.xml b/.idea/bld.xml
new file mode 100644
index 0000000..6600cee
--- /dev/null
+++ b/.idea/bld.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/bld.xml b/.idea/libraries/bld.xml
index a2969be..5c4010c 100644
--- a/.idea/libraries/bld.xml
+++ b/.idea/libraries/bld.xml
@@ -2,12 +2,12 @@
-
+
-
+
diff --git a/.idea/libraries/compile.xml b/.idea/libraries/compile.xml
index 9bd86aa..99cc0c0 100644
--- a/.idea/libraries/compile.xml
+++ b/.idea/libraries/compile.xml
@@ -7,7 +7,7 @@
-
-
+
+
\ No newline at end of file
diff --git a/.idea/libraries/runtime.xml b/.idea/libraries/runtime.xml
index 2ae5c4b..d4069f2 100644
--- a/.idea/libraries/runtime.xml
+++ b/.idea/libraries/runtime.xml
@@ -8,7 +8,7 @@
-
-
+
+
\ No newline at end of file
diff --git a/.idea/libraries/test.xml b/.idea/libraries/test.xml
index b80486a..57ed5ef 100644
--- a/.idea/libraries/test.xml
+++ b/.idea/libraries/test.xml
@@ -8,7 +8,7 @@
-
-
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index 66a15d8..f53a6b7 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
[](https://opensource.org/licenses/BSD-3-Clause)
-[](https://kotlinlang.org/)
-[](https://rife2.com/bld)
+[](https://kotlinlang.org/)
+[](https://rife2.com/bld)
[](https://github.com/ethauvin/cryptoprice/releases/latest)
[](https://central.sonatype.com/artifact/net.thauvin.erik/cryptoprice)
[](https://oss.sonatype.org/content/repositories/snapshots/net/thauvin/erik/cryptoprice/)
diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml
index 7c85194..ace99d2 100644
--- a/bitbucket-pipelines.yml
+++ b/bitbucket-pipelines.yml
@@ -1,10 +1,20 @@
-image: openjdk:17
+image: ubuntu:latest
pipelines:
default:
- step:
name: Test with bld
script:
+ # Install latest Java & Kotlin via SDKMAN!
+ - apt-get update -qq && apt-get install -y curl zip
+ - curl -s "https://get.sdkman.io" | bash
+ - echo sdkman_auto_answer=true > $HOME/.sdkman/etc/config
+ - echo sdkman_auto_selfupdate=true >> $HOME/.sdkman/etc/config
+ - source "$HOME/.sdkman/bin/sdkman-init.sh"
+ - sdk install java
+ - sdk install kotlin
+ - source "$HOME/.sdkman/bin/sdkman-init.sh"
+ # Download, compile and test with bld
- ./bld download
- ./bld compile
- ./bld test
diff --git a/examples/bld/.idea/libraries/bld.xml b/examples/bld/.idea/libraries/bld.xml
index cb3eddb..ffb935c 100644
--- a/examples/bld/.idea/libraries/bld.xml
+++ b/examples/bld/.idea/libraries/bld.xml
@@ -2,11 +2,11 @@
-
+
-
+
diff --git a/examples/bld/.idea/libraries/compile.xml b/examples/bld/.idea/libraries/compile.xml
index 9bd86aa..99cc0c0 100644
--- a/examples/bld/.idea/libraries/compile.xml
+++ b/examples/bld/.idea/libraries/compile.xml
@@ -7,7 +7,7 @@
-
-
+
+
\ No newline at end of file
diff --git a/examples/bld/.idea/libraries/runtime.xml b/examples/bld/.idea/libraries/runtime.xml
index 2ae5c4b..d4069f2 100644
--- a/examples/bld/.idea/libraries/runtime.xml
+++ b/examples/bld/.idea/libraries/runtime.xml
@@ -8,7 +8,7 @@
-
-
+
+
\ No newline at end of file
diff --git a/examples/bld/.idea/libraries/test.xml b/examples/bld/.idea/libraries/test.xml
index b80486a..57ed5ef 100644
--- a/examples/bld/.idea/libraries/test.xml
+++ b/examples/bld/.idea/libraries/test.xml
@@ -8,7 +8,7 @@
-
-
+
+
\ No newline at end of file
diff --git a/examples/bld/.vscode/settings.json b/examples/bld/.vscode/settings.json
index d136e4d..4c33beb 100644
--- a/examples/bld/.vscode/settings.json
+++ b/examples/bld/.vscode/settings.json
@@ -9,7 +9,7 @@
],
"java.configuration.updateBuildConfiguration": "automatic",
"java.project.referencedLibraries": [
- "${HOME}/.bld/dist/bld-1.9.1.jar",
+ "${HOME}/.bld/dist/bld-2.1.0.jar",
"lib/**/*.jar"
]
}
diff --git a/examples/bld/lib/bld/bld-wrapper.jar b/examples/bld/lib/bld/bld-wrapper.jar
index 36c0b74..eec65f5 100644
Binary files a/examples/bld/lib/bld/bld-wrapper.jar and b/examples/bld/lib/bld/bld-wrapper.jar differ
diff --git a/examples/bld/lib/bld/bld-wrapper.properties b/examples/bld/lib/bld/bld-wrapper.properties
index 8c08ccc..949f84f 100644
--- a/examples/bld/lib/bld/bld-wrapper.properties
+++ b/examples/bld/lib/bld/bld-wrapper.properties
@@ -1,7 +1,7 @@
bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true
-bld.extensions=com.uwyn.rife2:bld-kotlin:0.9.8
-bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.downloadLocation=
+bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.0.1
+bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.sourceDirectories=
-bld.version=1.9.1
+bld.version=2.1.0
diff --git a/examples/gradle/.gitignore b/examples/gradle/.gitignore
index 1b6985c..44369dd 100644
--- a/examples/gradle/.gitignore
+++ b/examples/gradle/.gitignore
@@ -3,3 +3,5 @@
# Ignore Gradle build output directory
build
+
+bin
diff --git a/examples/gradle/bin/main/com/example/CryptoPriceExample.kt b/examples/gradle/bin/main/com/example/CryptoPriceExample.kt
deleted file mode 100644
index 5c670a8..0000000
--- a/examples/gradle/bin/main/com/example/CryptoPriceExample.kt
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.example
-
-import net.thauvin.erik.crypto.CryptoException
-import net.thauvin.erik.crypto.CryptoPrice.Companion.apiCall
-import net.thauvin.erik.crypto.CryptoPrice.Companion.buyPrice
-import net.thauvin.erik.crypto.CryptoPrice.Companion.sellPrice
-import net.thauvin.erik.crypto.CryptoPrice.Companion.spotPrice
-import org.json.JSONObject
-import java.io.IOException
-
-fun main(args: Array) {
- try {
- if (args.isNotEmpty()) {
- val price = if (args.size == 2) spotPrice(args[0], args[1]) else spotPrice(args[0])
- println("The current ${price.base} price is ${price.toCurrency()}")
- } else {
- // Get current Bitcoin spot price.
- val price = spotPrice("BTC")
- println("The current Bitcoin price is ${price.toCurrency()}")
-
- println()
-
- // Get current Ethereum sell price in Pound sterling.
- val gbpPrice = sellPrice("ETH", "GBP")
- println("The current Ethereum sell price is ${gbpPrice.toCurrency()}")
-
- // Get current Litecoin buy price in Euro.
- val euroPrice = buyPrice("LTC", "EUR")
- println("The current Litecoin buy price is ${euroPrice.toCurrency()}")
-
- println()
-
- // Get exchange rate using API.
- // See: https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-exchange-rates
- val response = apiCall(listOf("exchange-rates"), mapOf("currency" to "usd"))
- val rates = JSONObject(response).getJSONObject("data").getJSONObject("rates")
- println("The USD-EUR exchange rate is: ${rates.getString("EUR")}")
- }
- } catch (e: CryptoException) {
- System.err.println("HTTP Status Code: ${e.statusCode}")
- System.err.println(e.message)
- } catch (ignore: IllegalArgumentException) {
- System.err.println("Could not display the specified currency: ${args[1]}")
- } catch (e: IOException) {
- System.err.println(e.message)
- }
-}
diff --git a/examples/gradle/bin/main/com/example/CryptoPriceSample.class b/examples/gradle/bin/main/com/example/CryptoPriceSample.class
deleted file mode 100644
index feb8e49..0000000
Binary files a/examples/gradle/bin/main/com/example/CryptoPriceSample.class and /dev/null differ
diff --git a/examples/gradle/build.gradle.kts b/examples/gradle/build.gradle.kts
index 054402a..7d109c6 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.0.0"
+ kotlin("jvm") version "2.0.20"
}
defaultTasks(ApplicationPlugin.TASK_RUN_NAME)
diff --git a/examples/gradle/gradle/wrapper/gradle-wrapper.jar b/examples/gradle/gradle/wrapper/gradle-wrapper.jar
index e644113..a4b76b9 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 b82aa23..0aaefbc 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.7-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
diff --git a/examples/gradle/gradlew b/examples/gradle/gradlew
index 1aa94a4..f5feea6 100755
--- a/examples/gradle/gradlew
+++ b/examples/gradle/gradlew
@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+# SPDX-License-Identifier: Apache-2.0
+#
##############################################################################
#
@@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
-# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
-APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
+APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
+' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
diff --git a/examples/gradle/gradlew.bat b/examples/gradle/gradlew.bat
index 25da30d..9d21a21 100644
--- a/examples/gradle/gradlew.bat
+++ b/examples/gradle/gradlew.bat
@@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
+@rem SPDX-License-Identifier: Apache-2.0
+@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
diff --git a/lib/bld/bld-wrapper.jar b/lib/bld/bld-wrapper.jar
index 76333db..a8a4ccd 100644
Binary files a/lib/bld/bld-wrapper.jar and b/lib/bld/bld-wrapper.jar differ
diff --git a/lib/bld/bld-wrapper.properties b/lib/bld/bld-wrapper.properties
index 26274e0..0849dd2 100644
--- a/lib/bld/bld-wrapper.properties
+++ b/lib/bld/bld-wrapper.properties
@@ -1,9 +1,10 @@
bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true
-bld.extension.jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.5
-bld.extensions=com.uwyn.rife2:bld-kotlin:0.9.8
-bld.extension-detekt=com.uwyn.rife2:bld-detekt:0.9.4
-bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.downloadLocation=
+bld.extension-detekt=com.uwyn.rife2:bld-detekt:0.9.7
+bld.extension-dokka=com.uwyn.rife2:bld-dokka:1.0.1
+bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.8
+bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.0.1
+bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.sourceDirectories=
-bld.version=1.9.1
+bld.version=2.1.0
diff --git a/src/bld/java/net/thauvin/erik/crypto/CryptoPriceBuild.java b/src/bld/java/net/thauvin/erik/crypto/CryptoPriceBuild.java
index af7e86f..41f47b6 100644
--- a/src/bld/java/net/thauvin/erik/crypto/CryptoPriceBuild.java
+++ b/src/bld/java/net/thauvin/erik/crypto/CryptoPriceBuild.java
@@ -35,8 +35,8 @@ import rife.bld.BuildCommand;
import rife.bld.Project;
import rife.bld.extension.CompileKotlinOperation;
import rife.bld.extension.DetektOperation;
+import rife.bld.extension.DokkaOperation;
import rife.bld.extension.JacocoReportOperation;
-import rife.bld.extension.dokka.DokkaOperation;
import rife.bld.extension.dokka.LoggingLevel;
import rife.bld.extension.dokka.OutputFormat;
import rife.bld.operations.exceptions.ExitStatusException;
@@ -69,7 +69,7 @@ public class CryptoPriceBuild extends Project {
autoDownloadPurge = true;
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL);
- final var kotlin = version(2, 0, 0);
+ final var kotlin = version(2, 0, 20);
scope(compile)
.include(dependency("org.jetbrains.kotlin", "kotlin-stdlib", kotlin))
.include(dependency("org.json", "json", "20240303"))
@@ -77,8 +77,8 @@ public class CryptoPriceBuild extends Project {
scope(test)
.include(dependency("com.willowtreeapps.assertk", "assertk-jvm", version(0, 28, 1)))
.include(dependency("org.jetbrains.kotlin", "kotlin-test-junit5", kotlin))
- .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 2)))
- .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 2)));
+ .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 11, 0)))
+ .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 11, 0)));
publishOperation()
.repository(version.isSnapshot() ? repository(SONATYPE_SNAPSHOTS_LEGACY.location())
@@ -90,23 +90,20 @@ public class CryptoPriceBuild extends Project {
.artifactId(name)
.description("Retrieve cryptocurrencies prices")
.url("https://github.com/ethauvin/" + name)
- .developer(
- new PublishDeveloper()
- .id("ethauvin")
- .name("Erik C. Thauvin")
- .email("erik@thauvin.net")
- .url("https://erik.thauvin.net/")
+ .developer(new PublishDeveloper()
+ .id("ethauvin")
+ .name("Erik C. Thauvin")
+ .email("erik@thauvin.net")
+ .url("https://erik.thauvin.net/")
)
- .license(
- new PublishLicense()
- .name("BSD 3-Clause")
- .url("https://opensource.org/licenses/BSD-3-Clause")
+ .license(new PublishLicense()
+ .name("BSD 3-Clause")
+ .url("https://opensource.org/licenses/BSD-3-Clause")
)
- .scm(
- new PublishScm()
- .connection("scm:git:https://github.com/ethauvin/" + name + ".git")
- .developerConnection("scm:git:git@github.com:ethauvin/" + name + ".git")
- .url("https://github.com/ethauvin/" + name)
+ .scm(new PublishScm()
+ .connection("scm:git:https://github.com/ethauvin/" + name + ".git")
+ .developerConnection("scm:git:git@github.com:ethauvin/" + name + ".git")
+ .url("https://github.com/ethauvin/" + name)
)
.signKey(property("sign.key"))
.signPassphrase(property("sign.passphrase"));
@@ -120,7 +117,7 @@ public class CryptoPriceBuild extends Project {
@BuildCommand(summary = "Compiles the Kotlin project")
@Override
- public void compile() throws IOException {
+ public void compile() throws Exception {
new CompileKotlinOperation()
.fromProject(this)
.execute();
@@ -143,7 +140,7 @@ public class CryptoPriceBuild extends Project {
}
@BuildCommand(summary = "Generates JaCoCo Reports")
- public void jacoco() throws IOException {
+ public void jacoco() throws Exception {
new JacocoReportOperation()
.fromProject(this)
.sourceFiles(srcMainKotlin)