Skip to content

Commit

Permalink
Add Graal native-image build in bitcoinj-cli
Browse files Browse the repository at this point in the history
The executable doesn’t run correctly due to an apparent
bug in Graal, but the build seems to work.
  • Loading branch information
msgilligan committed Apr 22, 2018
1 parent 3b9f9d5 commit 683a1f8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
17 changes: 17 additions & 0 deletions bitcoinj-cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,23 @@ shadowJar {
classifier = ''
}

// Compile a native image using Graal's native-image tool
// Graal must be installed at $GRAAL_HOME
task graalNativeImage(type:Exec, dependsOn: jar) {
workingDir = projectDir
executable = "${System.env.GRAAL_HOME}/bin/native-image"
args = [ '--verbose',
'-cp', configurations.runtime.asPath,
'-jar', jar.archivePath,
'-H:Path=build',
'-H:Name=cj-bitcoin-cli',
'-H:ReflectionConfigurationFiles=graal-reflection-config.json',
'-H:EnableURLProtocols=http',
'-H:+ReportUnsupportedElementsAtRuntime'
]
}


// Test Structure
sourceSets {
integrationTest {
Expand Down
17 changes: 17 additions & 0 deletions bitcoinj-cli/graal-reflection-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[
{
"name" : "org.consensusj.jsonrpc.JsonRpcRequest",
"allDeclaredMethods" : true,
"allPublicMethods" : true
},
{
"name" : "java.lang.Object",
"allDeclaredMethods" : true,
"allPublicMethods" : true
},
{
"name" : "java.util.List",
"allDeclaredMethods" : true,
"allPublicMethods" : true
}
]

0 comments on commit 683a1f8

Please sign in to comment.