Skip to content

Commit

Permalink
Merge pull request #26 from hyperledger/feature/upgrade_java
Browse files Browse the repository at this point in the history
update gradle and java
  • Loading branch information
NickSneo authored Apr 16, 2024
2 parents 54251d7 + 4f8a06b commit b8c7f2e
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@gtebrean @NickSneo
@conor10 @gtebrean @NickSneo
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 17
- name: Cache Gradle packages
uses: actions/cache@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 17
- name: Cache Gradle packages
uses: actions/cache@v2
with:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
registry.password: ${{ secrets.REGISTRY_PASSWORD }}
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 17
- name: Cache Gradle packages
uses: actions/cache@v2
with:
Expand All @@ -25,10 +25,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 17
- name: Cache Gradle packages
uses: actions/cache@v2
with:
Expand Down Expand Up @@ -62,10 +62,10 @@ jobs:
propagate_failure: true
trigger_workflow: true
wait_workflow: true
- name: Set up JDK 1.8
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 17
- name: Cache Gradle packages
uses: actions/cache@v2
with:
Expand Down
23 changes: 15 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.3.61'
ext.kotlin_version = '1.8.10'
repositories { jcenter() }

dependencies {
Expand All @@ -9,14 +9,19 @@ buildscript {
}

plugins {
id 'org.jetbrains.kotlin.jvm' version "1.3.61"
id 'idea'
id 'jacoco'
id "com.jfrog.bintray" version "1.8.4"
id "com.diffplug.gradle.spotless" version "3.25.0"
id "com.diffplug.gradle.spotless" version "4.5.1"
id 'io.codearte.nexus-staging' version '0.21.1'
id "de.marcphilipp.nexus-publish" version "0.4.0"
id "de.undercouch.download" version "4.0.0"
id 'org.jetbrains.kotlin.jvm' version '1.8.10'
id 'de.undercouch.download' version '4.1.2'
id 'org.jetbrains.kotlin.plugin.serialization' version '1.8.10'
}

jacoco {
toolVersion = "0.8.7"
}

description 'web3j-sokt - Kotlin-based wrapper for multiple installations of the solidity compiler (solc)'
Expand Down Expand Up @@ -44,7 +49,7 @@ apply {
}


apply plugin: 'kotlinx-serialization'
//apply plugin: 'kotlinx-serialization'

group 'org.web3j'

Expand All @@ -57,15 +62,17 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8",
"org.apache.commons:commons-lang3:3.0",
"com.github.zafarkhaja:java-semver:0.9.0",
"org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.14.0"
"org.jetbrains.kotlinx:kotlinx-serialization-core:1.3.3",
"org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.3",
"org.jetbrains.kotlin:kotlin-serialization:1.8.10"
testImplementation "org.junit.jupiter:junit-jupiter-engine:$junitVersion",
"org.junit.jupiter:junit-jupiter-api:$junitVersion",
"org.junit.jupiter:junit-jupiter-params:$junitVersion"
}

compileKotlin {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.jvmTarget = "17"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.jvmTarget = "17"
}
2 changes: 1 addition & 1 deletion gradle/jacoco/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ task jacocoRootTestReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
}

jacoco {
toolVersion = "0.8.4"
toolVersion = "0.8.10"
}

4 changes: 2 additions & 2 deletions gradle/java/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: 'java'

sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility = 17
targetCompatibility = 17

compileJava {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
Expand Down
2 changes: 1 addition & 1 deletion gradle/junit/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ext {
junitVersion = '5.5.2'
junitVersion = '5.9.3'
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Thu Mar 05 14:16:43 GMT 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
Expand Down
11 changes: 5 additions & 6 deletions src/main/kotlin/org/web3j/sokt/VersionResolver.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
package org.web3j.sokt

import com.github.zafarkhaja.semver.Version
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonConfiguration
import kotlinx.serialization.list
import java.io.BufferedReader
import java.io.InputStreamReader
import java.net.URL
Expand Down Expand Up @@ -51,13 +50,13 @@ class VersionResolver(private val directoryPath: String = ".web3j") {
val result = get("https://raw.githubusercontent.com/web3j/web3j-sokt/master/src/main/resources/releases.json")
versionsFile.parentFile.mkdirs()
versionsFile.writeText(result)
return Json(JsonConfiguration.Stable).parse(SolcRelease.serializer().list, result)
return Json.decodeFromString<List<SolcRelease>>(result)
} catch (e: Exception) {
return if (versionsFile.exists()) {
Json(JsonConfiguration.Stable).parse(SolcRelease.serializer().list, versionsFile.readText())
Json.decodeFromString<List<SolcRelease>>(versionsFile.readText())
} else {
var defaultReleases = ClassLoader.getSystemResource("releases.json").readText()
Json(JsonConfiguration.Stable).parse(SolcRelease.serializer().list, defaultReleases)
val defaultReleases = ClassLoader.getSystemResource("releases.json").readText()
Json.decodeFromString<List<SolcRelease>>(defaultReleases)
}
}
}
Expand Down

0 comments on commit b8c7f2e

Please sign in to comment.