Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to 4.10.1 Web3J #97

Merged
merged 7 commits into from
Jun 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import java.text.SimpleDateFormat

plugins {
id 'org.jetbrains.kotlin.jvm' version '1.3.72'
id 'org.jetbrains.kotlin.jvm' version '1.6.21'
id "application"
id "distribution"
id "idea"
Expand All @@ -19,7 +19,7 @@ mainClassName = 'org.web3j.console.Web3j'
applicationName = 'web3j'

ext {
web3jVersion = '4.9.4'
web3jVersion = '4.10.1'
picocli = '4.6.0'
slf4jVersion = '1.7.30'
junitVersion = '5.8.2'
Expand Down Expand Up @@ -61,6 +61,7 @@ apply {
repositories {
jcenter()
mavenCentral()
mavenLocal()
maven { url "https://dl.bintray.com/ethereum/maven/" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url 'https://repo.gradle.org/gradle/libs-releases' }
Expand Down Expand Up @@ -153,13 +154,13 @@ sourceSets {
}

compileKotlin {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.jvmTarget = "17"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.jvmTarget = "17"
}

sourceCompatibility = 1.8
sourceCompatibility = 17

def generatedResources = "$buildDir/generated-resources/main"

Expand All @@ -179,3 +180,6 @@ task generateVersionProperties {
generated.append("timestamp=${System.currentTimeMillis()}\n")
}
}

tasks.named("spotlessJava").configure { dependsOn("javadoc","sourcesJar","compileTestJava","compileTestKotlin") }
tasks.named("spotlessKotlin").configure { dependsOn("compileKotlin","sourcesJar","compileTestKotlin") }
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version=1.4.2
version=1.5.0
group=org.web3j.console
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
1 change: 1 addition & 0 deletions gradle/repositories/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven { url 'https://oss.sonatype.org/content/repositories/releases/' }
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
2 changes: 1 addition & 1 deletion src/main/java/org/web3j/console/project/ProjectRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void run() {
protected abstract void createProject();

public void buildProject(ProjectStructure projectStructure, ProgressCounter progressCounter)
throws IOException, InterruptedException {
throws IOException, InterruptedException, ClassNotFoundException {
ProjectCreationUtils.generateWrappers(projectStructure.getProjectRoot());
if (withTests) {
new JavaTestCLIRunner(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
*/
package org.web3j.console.project.java;

import org.web3j.commons.JavaVersion;
import org.web3j.console.openapi.project.erc777.CopyUtils;
import org.web3j.console.openapi.utils.PrettyPrinter;
import org.web3j.console.openapi.utils.SimpleFileLogger;
Expand Down Expand Up @@ -51,10 +50,7 @@ protected void createProject() {
.withGradleSettings("project/settings.gradle.template")
.withWrapperGradleSettings("project/gradlew-wrapper.properties.template")
.withGradlewWrapperJar("gradle-wrapper.jar")
.withGradleBuild(
JavaVersion.getJavaVersionAsDouble() < 11
? "project/erc20/build.gradleErc20.template"
: "project/erc20/build.gradleErc20Java11.template")
.withGradleBuild("project/erc20/build.gradleErc20.template")
.withMainJavaClass("project/erc20/JavaErc20.template")
.build()
.generateFiles(projectStructure);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
*/
package org.web3j.console.project.java;

import org.web3j.commons.JavaVersion;
import org.web3j.console.openapi.project.erc777.CopyUtils;
import org.web3j.console.openapi.utils.PrettyPrinter;
import org.web3j.console.openapi.utils.SimpleFileLogger;
Expand Down Expand Up @@ -52,10 +51,7 @@ protected void createProject() {
.withGradleSettings("project/settings.gradle.template")
.withWrapperGradleSettings("project/gradlew-wrapper.properties.template")
.withGradlewWrapperJar("gradle-wrapper.jar")
.withGradleBuild(
JavaVersion.getJavaVersionAsDouble() < 11
? "project/erc777/build.gradleErc777.template"
: "project/erc777/build.gradleErc777Java11.template")
.withGradleBuild("project/erc777/build.gradleErc777.template")
.withMainJavaClass("project/erc777/JavaErc777.template")
.withReadme("project/erc777/README.erc777.md")
.build()
Expand Down
11 changes: 2 additions & 9 deletions src/main/java/org/web3j/console/project/java/JavaProject.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import java.io.IOException;

import org.web3j.commons.JavaVersion;
import org.web3j.console.project.AbstractProject;
import org.web3j.console.project.Project;
import org.web3j.console.project.ProjectStructure;
Expand Down Expand Up @@ -58,18 +57,12 @@ public JavaTemplateProvider getTemplateProvider() {

if (command.equals("new")) {
templateBuilder
.withGradleBuild(
JavaVersion.getJavaVersionAsDouble() < 11
? "project/build.gradle.template"
: "project/build.gradleJava11.template")
.withGradleBuild("project/build.gradle.template")
.withSolidityProject("contracts/HelloWorld.sol");

} else if (command.equals("import")) {
templateBuilder
.withGradleBuild(
JavaVersion.getJavaVersionAsDouble() < 11
? "project/build.gradleImport.template"
: "project/build.gradleImportJava11.template")
.withGradleBuild("project/build.gradleImport.template")
.withPathToSolidityFolder(solidityImportPath);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import java.io.IOException;

import org.web3j.commons.JavaVersion;
import org.web3j.console.project.AbstractProject;
import org.web3j.console.project.Project;
import org.web3j.console.project.ProjectStructure;
Expand Down Expand Up @@ -59,18 +58,12 @@ public KotlinTemplateProvider getTemplateProvider() {

if (command.equals("new")) {
templateBuilder
.withGradleBuild(
JavaVersion.getJavaVersionAsDouble() < 11
? "project/build.gradle.template"
: "project/build.gradleJava11.template")
.withGradleBuild("project/build.gradle.template")
.withSolidityProject("contracts/HelloWorld.sol");

} else if (command.equals("import")) {
templateBuilder
.withGradleBuild(
JavaVersion.getJavaVersionAsDouble() < 11
? "project/build.gradleImport.template"
: "project/build.gradleImportJava11.template")
.withGradleBuild("project/build.gradleImport.template")
.withPathToSolidityFolder(solidityImportPath);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class JarOpenApiCommand : AbstractOpenApiCommand() {
* Path to the `.web3j` folder
*/
private val web3jHomeFolder: Path =
Paths.get(System.getenv(if (System.getProperty("os.name").toLowerCase().startsWith("win")) "USERPROFILE" else "HOME"), ".web3j")
Paths.get(System.getenv(if (System.getProperty("os.name").lowercase().startsWith("win")) "USERPROFILE" else "HOME"), ".web3j")

override fun generate(projectFolder: File) {
if (solidityImportPath == null) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/project/Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
FROM ubuntu as Build
COPY . /root/app
RUN apt-get update && apt-get install -y \
curl bash openjdk-11-jre \
curl bash openjdk-17-jre \
&& rm -rf /var/cache/apk/* \
&& curl -L get.web3j.io | sh \
&& /root/.web3j/web3j \
Expand All @@ -11,7 +11,7 @@ RUN apt-get update && apt-get install -y \

FROM alpine
COPY --from=Build /root /root/
RUN apk add --no-cache bash openjdk11-jre\
RUN apk add --no-cache bash openjdk17-jre\
&& rm -rf /var/cache/apk/* \
&& mkdir /opt/app
WORKDIR /root/app
Expand Down
39 changes: 29 additions & 10 deletions src/main/resources/project/build.gradle.template
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.3.61'
id 'org.jetbrains.kotlin.jvm' version '1.6.21'
id 'application'
id "com.github.johnrengelman.shadow" version "5.2.0"
id 'org.web3j' version '4.9.4'
id 'org.web3j' version '4.10.1'
}


group '<package_name>'
version '0.1.0'

sourceCompatibility = 1.8
sourceCompatibility = 17

repositories {
mavenLocal()
mavenCentral()
maven { url "https://hyperledger.jfrog.io/hyperledger/besu-maven" }
maven { url "https://artifacts.consensys.net/public/maven/maven/" }
maven { url "https://splunk.jfrog.io/splunk/ext-releases-local" }
maven { url "https://dl.cloudsmith.io/public/consensys/quorum-mainnet-launcher/maven/"}
}

web3j {
Expand All @@ -30,9 +30,13 @@ node {
}

ext {
web3jVersion = '4.9.4'
web3jVersion = '4.10.1'
logbackVersion = '1.2.3'
klaxonVersion = '5.5'
besuPluginVersion = '23.4.0'
besuInternalVersion = '23.4.0'
besuInternalCryptoVersion = '23.1.3'
besuCryptoDepVersion = '0.7.1'
}

dependencies {
Expand All @@ -45,6 +49,21 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.3.1'

implementation "org.hyperledger.besu:plugin-api:$besuPluginVersion"
implementation "org.hyperledger.besu.internal:besu:$besuInternalVersion"
implementation "org.hyperledger.besu.internal:api:$besuInternalVersion"
implementation "org.hyperledger.besu:evm:$besuPluginVersion"
implementation "org.hyperledger.besu.internal:config:$besuInternalVersion"
implementation "org.hyperledger.besu.internal:core:$besuInternalVersion"
implementation "org.hyperledger.besu.internal:crypto:$besuInternalCryptoVersion"
implementation "org.hyperledger.besu.internal:rlp:$besuInternalVersion"
implementation "org.hyperledger.besu.internal:kvstore:$besuInternalVersion"
implementation "org.hyperledger.besu.internal:metrics-core:$besuInternalVersion"
implementation "org.hyperledger.besu.internal:trie:$besuInternalVersion"
implementation "org.hyperledger.besu.internal:util:$besuInternalVersion"
implementation "org.hyperledger.besu:bls12-381:$besuCryptoDepVersion"
implementation "org.hyperledger.besu:secp256k1:$besuCryptoDepVersion"
}

jar {
Expand All @@ -65,13 +84,13 @@ test {
}

compileKotlin {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.jvmTarget = "17"
}

compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.jvmTarget = "17"
}




shadowJar {
zip64 = true
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
plugins {
id "org.web3j.openapi" version "4.9.4"
id "org.web3j.openapi" version "4.10.1"
}

group '<package_name>'
version '1.0-SNAPSHOT'

repositories {
mavenLocal()
mavenCentral()
}

Expand Down
37 changes: 32 additions & 5 deletions src/main/resources/project/build.gradleImport.template
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.3.61'
id 'org.jetbrains.kotlin.jvm' version '1.6.21'
id 'application'
id "com.github.johnrengelman.shadow" version "5.2.0"
id 'org.web3j' version '4.9.4'
id 'org.web3j' version '4.10.1'
}


group '<package_name>'
version '0.1.0'

sourceCompatibility = 1.8
sourceCompatibility = 17

repositories {
mavenLocal()
mavenCentral()
maven { url "https://hyperledger.jfrog.io/artifactory/besu-maven/" }
maven { url "https://artifacts.consensys.net/public/maven/maven/" }
maven { url "https://splunk.jfrog.io/splunk/ext-releases-local" }
jcenter()
}

Expand All @@ -26,9 +30,13 @@ node {
}

ext {
web3jVersion = '4.9.4'
besuPluginVersion = '23.4.0'
besuInternalVersion = '23.4.0'
besuInternalCryptoVersion = '23.1.3'
web3jVersion = '4.10.1'
logbackVersion = '1.2.3'
klaxonVersion = '5.5'
besuCryptoDepVersion = '0.7.1'
}

dependencies {
Expand All @@ -41,6 +49,21 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.3.1'

implementation "org.hyperledger.besu:plugin-api:$besuPluginVersion"
implementation "org.hyperledger.besu.internal:besu:$besuInternalVersion"
implementation "org.hyperledger.besu.internal:api:$besuInternalVersion"
implementation "org.hyperledger.besu:evm:$besuPluginVersion"
implementation "org.hyperledger.besu.internal:config:$besuInternalVersion"
implementation "org.hyperledger.besu.internal:core:$besuInternalVersion"
implementation "org.hyperledger.besu.internal:crypto:$besuInternalCryptoVersion"
implementation "org.hyperledger.besu.internal:rlp:$besuInternalVersion"
implementation "org.hyperledger.besu.internal:kvstore:$besuInternalVersion"
implementation "org.hyperledger.besu.internal:metrics-core:$besuInternalVersion"
implementation "org.hyperledger.besu.internal:trie:$besuInternalVersion"
implementation "org.hyperledger.besu.internal:util:$besuInternalVersion"
implementation "org.hyperledger.besu:bls12-381:$besuCryptoDepVersion"
implementation "org.hyperledger.besu:secp256k1:$besuCryptoDepVersion"
}

jar {
Expand All @@ -61,7 +84,11 @@ test {
}

compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.jvmTarget = "17"
}

shadowJar {
zip64 = true
}


Loading