Compare commits
No commits in common. "27070dc3d978e7e1727b24101c0620a8ce66c92a" and "926c20e8b2b0014f763af366a2de0755714e515f" have entirely different histories.
27070dc3d9
...
926c20e8b2
7 changed files with 11 additions and 53 deletions
26
.github/workflows/bld.yml
vendored
26
.github/workflows/bld.yml
vendored
|
@ -9,13 +9,12 @@ env:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-bld-project:
|
build-bld-project:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
java-version: [17, 21, 24]
|
java-version: [17, 21, 24]
|
||||||
kotlin-version: [1.9.25, 2.1.20]
|
kotlin-version: [1.9.25, 2.1.20]
|
||||||
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout source repository
|
- name: Checkout source repository
|
||||||
|
@ -29,24 +28,6 @@ jobs:
|
||||||
distribution: "zulu"
|
distribution: "zulu"
|
||||||
java-version: ${{ matrix.java-version }}
|
java-version: ${{ matrix.java-version }}
|
||||||
|
|
||||||
- name: Download dependencies [bld example]
|
|
||||||
working-directory: examples/bld
|
|
||||||
run: ./bld download
|
|
||||||
|
|
||||||
- name: Compile and run [bld examples]
|
|
||||||
working-directory: examples/bld
|
|
||||||
run: |
|
|
||||||
./bld compile run
|
|
||||||
./bld run-java
|
|
||||||
|
|
||||||
- name: Run example [bld examples]
|
|
||||||
working-directory: examples/gradle
|
|
||||||
if: matrix.java-version != '24'
|
|
||||||
run: |
|
|
||||||
./gradlew run
|
|
||||||
./gradlew runJava
|
|
||||||
|
|
||||||
|
|
||||||
- name: Download dependencies
|
- name: Download dependencies
|
||||||
run: ./bld download
|
run: ./bld download
|
||||||
|
|
||||||
|
@ -58,12 +39,11 @@ jobs:
|
||||||
|
|
||||||
- name: Remove pom.xml
|
- name: Remove pom.xml
|
||||||
if: success() && matrix.java-version == env.COVERAGE_JDK && matrix.kotlin-version == env.COVERAGE_KOTLIN
|
if: success() && matrix.java-version == env.COVERAGE_JDK && matrix.kotlin-version == env.COVERAGE_KOTLIN
|
||||||
run: rm -rf pom.xmlAdd debug logging
|
run: rm -rf pom.xml
|
||||||
|
|
||||||
- name: SonarCloud Scan
|
- name: SonarCloud Scan
|
||||||
uses: sonarsource/sonarcloud-github-action@master
|
uses: sonarsource/sonarcloud-github-action@master
|
||||||
if: success() && matrix.java-version == env.COVERAGE_JDK && matrix.kotlin-version == env.COVERAGE_KOTLIN
|
if: success() && matrix.java-version == env.COVERAGE_JDK && matrix.kotlin-version == env.COVERAGE_KOTLIN
|
||||||
&& martix.os == 'unbuntu-latest'
|
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
bld.downloadExtensionJavadoc=false
|
bld.downloadExtensionJavadoc=false
|
||||||
bld.downloadExtensionSources=true
|
bld.downloadExtensionSources=true
|
||||||
bld.downloadLocation=
|
bld.downloadLocation=
|
||||||
bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.1.0-SNAPSHOT
|
bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.0.4
|
||||||
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
|
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
|
||||||
bld.sourceDirectories=
|
bld.sourceDirectories=
|
||||||
bld.version=2.2.1
|
bld.version=2.2.1
|
||||||
|
|
|
@ -15,7 +15,7 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("net.thauvin.erik:cryptoprice:1.0.3-SNAPSHOT")
|
implementation("net.thauvin.erik:cryptoprice:1.0.2")
|
||||||
implementation("org.json:json:20240303")
|
implementation("org.json:json:20240303")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
bld.downloadExtensionJavadoc=false
|
bld.downloadExtensionJavadoc=false
|
||||||
bld.downloadExtensionSources=true
|
bld.downloadExtensionSources=true
|
||||||
bld.downloadLocation=
|
bld.downloadLocation=
|
||||||
bld.extension-detekt=com.uwyn.rife2:bld-detekt:0.9.10-SNAPSHOT
|
bld.extension-detekt=com.uwyn.rife2:bld-detekt:0.9.9
|
||||||
bld.extension-dokka=com.uwyn.rife2:bld-dokka:1.0.4-SNAPSHOT
|
bld.extension-dokka=com.uwyn.rife2:bld-dokka:1.0.3
|
||||||
bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.10-SNAPSHOT
|
bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.9
|
||||||
bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.1.0-SNAPSHOT
|
bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.0.4
|
||||||
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
|
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
|
||||||
bld.sourceDirectories=
|
bld.sourceDirectories=
|
||||||
bld.version=2.2.1
|
bld.version=2.2.1
|
||||||
|
|
|
@ -121,9 +121,10 @@ public class CryptoPriceBuild extends Project {
|
||||||
@BuildCommand(summary = "Compiles the Kotlin project")
|
@BuildCommand(summary = "Compiles the Kotlin project")
|
||||||
@Override
|
@Override
|
||||||
public void compile() throws Exception {
|
public void compile() throws Exception {
|
||||||
|
final var options = new CompileOptions().jvmOptions("--enable-native-access=ALL-UNNAMED");
|
||||||
new CompileKotlinOperation()
|
new CompileKotlinOperation()
|
||||||
.fromProject(this)
|
.fromProject(this)
|
||||||
.compileOptions(new CompileOptions().verbose(true))
|
.compileOptions(options)
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,8 +42,6 @@ import java.math.BigDecimal
|
||||||
import java.text.NumberFormat
|
import java.text.NumberFormat
|
||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import java.util.logging.Level
|
|
||||||
import java.util.logging.Logger
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves and holds a cryptocurrency price.
|
* Retrieves and holds a cryptocurrency price.
|
||||||
|
@ -59,9 +57,6 @@ open class CryptoPrice(val base: String, val currency: String, val amount: BigDe
|
||||||
// Coinbase API URL
|
// Coinbase API URL
|
||||||
private const val COINBASE_API_URL = "https://api.coinbase.com/v2/"
|
private const val COINBASE_API_URL = "https://api.coinbase.com/v2/"
|
||||||
|
|
||||||
/** The logger instance. **/
|
|
||||||
val logger: Logger by lazy { Logger.getLogger(CryptoPrice::class.java.simpleName) }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts JSON data object to [CryptoPrice].
|
* Converts JSON data object to [CryptoPrice].
|
||||||
*
|
*
|
||||||
|
@ -110,9 +105,6 @@ open class CryptoPrice(val base: String, val currency: String, val amount: BigDe
|
||||||
id = "empty_response",
|
id = "empty_response",
|
||||||
message = "Empty response."
|
message = "Empty response."
|
||||||
)
|
)
|
||||||
if (logger.isLoggable(Level.FINE)) {
|
|
||||||
logger.fine(body)
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
val json = JSONObject(body)
|
val json = JSONObject(body)
|
||||||
if (response.isSuccessful) {
|
if (response.isSuccessful) {
|
||||||
|
|
|
@ -42,12 +42,9 @@ import net.thauvin.erik.crypto.CryptoPrice.Companion.sellPrice
|
||||||
import net.thauvin.erik.crypto.CryptoPrice.Companion.spotPrice
|
import net.thauvin.erik.crypto.CryptoPrice.Companion.spotPrice
|
||||||
import net.thauvin.erik.crypto.CryptoPrice.Companion.toPrice
|
import net.thauvin.erik.crypto.CryptoPrice.Companion.toPrice
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.junit.jupiter.api.BeforeAll
|
|
||||||
import java.math.BigDecimal
|
import java.math.BigDecimal
|
||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import java.util.logging.ConsoleHandler
|
|
||||||
import java.util.logging.Level
|
|
||||||
import kotlin.test.Test
|
import kotlin.test.Test
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
import kotlin.test.assertFailsWith
|
import kotlin.test.assertFailsWith
|
||||||
|
@ -242,16 +239,4 @@ class CryptoPriceTest {
|
||||||
assertEquals(json, price.toString(), "toString()")
|
assertEquals(json, price.toString(), "toString()")
|
||||||
assertEquals(price.toString(), price.toJson(""), "toString() = toJson('')")
|
assertEquals(price.toString(), price.toJson(""), "toString() = toJson('')")
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
|
||||||
@JvmStatic
|
|
||||||
@BeforeAll
|
|
||||||
fun beforeAll() {
|
|
||||||
with(CryptoPrice.logger) {
|
|
||||||
addHandler(ConsoleHandler().apply { level = Level.FINE })
|
|
||||||
level = Level.FINE
|
|
||||||
useParentHandlers = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue