Skip to content

Commit

Permalink
Revert previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
msgilligan committed Nov 27, 2023
1 parent 6792316 commit 438e782
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 64 deletions.
39 changes: 18 additions & 21 deletions cj-btc-cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@
*/
plugins {
id 'java-library'
// Instead of using 'org.graalvm.buildtools.native' directly we need to include
// the micronaut application plugin to avoid a Gradle bug:
// See: https://github.com/micronaut-projects/micronaut-gradle-plugin/issues/706
// and: https://github.com/gradle/gradle/issues/17559
//id 'org.graalvm.buildtools.native' version '0.9.28'
id("io.micronaut.application") version "${micronautAppGradlePluginVersion}"
}

ext.moduleName = 'org.consensusj.bitcoin.cli'
Expand All @@ -29,7 +23,7 @@ dependencies {
api project(':cj-btc-jsonrpc')

// Add SLF4J runtime adapter for JDK logging for GraalVM native-image build of bitcoin CLI tool
nativeImageClasspath "org.slf4j:slf4j-jdk14:${slf4jVersion}"
nativeToolImplementation "org.slf4j:slf4j-jdk14:${slf4jVersion}"

testImplementation "org.apache.groovy:groovy:${groovyVersion}"

Expand All @@ -47,22 +41,25 @@ jar {
}
}

graalvmNative {
binaries {
main {
mainClass = mainClassName
imageName = 'cj-bitcoin-cli'
}
test {
imageName = 'cj-bitcoin-cli-dbg'
}
}
binaries.all {
sharedLibrary = false
buildArgs.add('--verbose')
}

// Compile a native image using GraalVM's native-image tool
// Graal must be installed at $JAVA_HOME
tasks.register('nativeCompile', Exec) {
dependsOn jar
workingDir = projectDir
executable = "${System.env.JAVA_HOME}/bin/native-image"
args = ['--verbose',
'--no-fallback',
'-cp', "${-> configurations.nativeToolImplementation.asPath}", // Lazy configuration resolution
'-jar', jar.archiveFile.get(),
'-H:Path=build',
'-H:Name=cj-bitcoin-cli',
'-H:EnableURLProtocols=http,https',
'-H:+ReportUnsupportedElementsAtRuntime'
]
}


// Test Structure
sourceSets {
integrationTest {
Expand Down
41 changes: 19 additions & 22 deletions consensusj-jsonrpc-cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@
*/
plugins {
id 'java-library'
// Instead of using 'org.graalvm.buildtools.native' directly we need to include
// the micronaut application plugin to avoid a Gradle bug:
// See: https://github.com/micronaut-projects/micronaut-gradle-plugin/issues/706
// and: https://github.com/gradle/gradle/issues/17559
//id 'org.graalvm.buildtools.native' version '0.9.28'
id("io.micronaut.application") version "${micronautAppGradlePluginVersion}"
}

tasks.withType(JavaCompile).configureEach {
Expand All @@ -26,7 +20,7 @@ dependencies {
api 'commons-cli:commons-cli:1.6.0'

// Add SLF4J runtime adapter for JDK logging for GraalVM native-image build of jsonrpc tool
nativeImageClasspath "org.slf4j:slf4j-jdk14:${slf4jVersion}"
nativeToolImplementation "org.slf4j:slf4j-jdk14:${slf4jVersion}"

testImplementation "org.apache.groovy:groovy:${groovyVersion}"

Expand All @@ -45,19 +39,22 @@ jar {
}
}

graalvmNative {
binaries {
main {
mainClass = mainClassName
imageName = 'jsonrpc'
}
test {
imageName = 'jsonrpc-dbg'
}
}
binaries.all {
sharedLibrary = false
buildArgs.add('--initialize-at-build-time=com.fasterxml.jackson.annotation.JsonProperty$Access')
buildArgs.add('--verbose')
}
// Compile a native image using GraalVM's native-image tool
// Graal must be installed at $JAVA_HOME
tasks.register('nativeCompile', Exec) {
dependsOn jar
workingDir = projectDir
executable = "${System.env.JAVA_HOME}/bin/native-image"
args = ['--verbose',
'--no-fallback',
'-cp', "${-> configurations.nativeToolImplementation.asPath}", // Lazy configuration resolution
'-jar', jar.archiveFile.get(),
'-H:Path=build',
'-H:Name=jsonrpc',
'--initialize-at-build-time=com.fasterxml.jackson.annotation.JsonProperty$Access',
'-H:IncludeResources=logging.properties',
'-H:EnableURLProtocols=http,https',
'-H:+ReportUnsupportedElementsAtRuntime',
'-H:+ReportExceptionStackTraces'
]
}
38 changes: 17 additions & 21 deletions consensusj-jsonrpc/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
plugins {
id 'java-library'
// Instead of using 'org.graalvm.buildtools.native' directly we need to include
// the micronaut application plugin to avoid a Gradle bug:
// See: https://github.com/micronaut-projects/micronaut-gradle-plugin/issues/706
// and: https://github.com/gradle/gradle/issues/17559
//id 'org.graalvm.buildtools.native' version '0.9.28'
id("io.micronaut.application") version "${micronautAppGradlePluginVersion}"
}

configurations {
Expand All @@ -17,7 +11,7 @@ dependencies {
api "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}"

// Add SLF4J runtime adapter for JDK logging for GraalVM native-image build of MathService/Tool
nativeImageClasspath "org.slf4j:slf4j-jdk14:${slf4jVersion}"
nativeSampleImplementation "org.slf4j:slf4j-jdk14:${slf4jVersion}"

testImplementation project(':cj-btc-jsonrpc')

Expand Down Expand Up @@ -50,18 +44,20 @@ test {
}
}

graalvmNative {
binaries {
main {
mainClass = mainClassName
imageName = 'MathTool'
}
test {
imageName = 'MathTool-dbg'
}
}
binaries.all {
sharedLibrary = false
buildArgs.add('--verbose')
}
// Compile a native image of the MathService tool sample using Graal's native-image tool
// Graal must be installed at $JAVA_HOME
tasks.register('nativeCompile', Exec) {
dependsOn jar
workingDir = projectDir
executable = "${System.env.JAVA_HOME}/bin/native-image"
args = ['--verbose',
'--no-fallback',
'-cp', "${-> configurations.nativeSampleImplementation.asPath}", // Lazy configuration resolution
'-jar', jar.archiveFile.get(),
'-H:Path=build',
'-H:Name=MathTool',
'-H:+AllowIncompleteClasspath',
'-H:+ReportUnsupportedElementsAtRuntime',
'-H:+ReportExceptionStackTraces'
]
}

0 comments on commit 438e782

Please sign in to comment.