Last active
February 10, 2020 11:36
-
-
Save Noisyfox/24f7c335a351a6d40171d698f43aec41 to your computer and use it in GitHub Desktop.
Gradle generate web3j truffle wrapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
ext.WEB3J_VERSION = "4.5.14" | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
// Pull the web3j codegen lib | |
classpath group: 'org.web3j', name: 'codegen', version: WEB3J_VERSION | |
} | |
} | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
compile "org.web3j:core:$WEB3J_VERSION" | |
} | |
sourceSets { | |
main { | |
java { | |
// the contract wrapper files will be located in this directory | |
srcDir 'build/java' | |
} | |
} | |
} | |
import org.web3j.codegen.TruffleJsonFunctionWrapperGenerator | |
task("generateWrapper") { | |
doLast { | |
// Call the truffle generator from web3j codegen | |
TruffleJsonFunctionWrapperGenerator.run( | |
"generate", "--javaTypes", | |
"<path-to-your-truffle-json-file>", | |
"--package", "<package-name>", | |
"--outputDir", "<output-dir>" | |
) | |
} | |
} | |
// Generate contract wrapper before compile | |
compileJava.dependsOn "generateWrapper" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment