Skip to content

Commit

Permalink
Add runEcdsa task to Java and Kotlin examples build.gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
msgilligan committed Aug 20, 2024
1 parent 453da0b commit b736655
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 11 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
run: nix profile install nixpkgs#secp256k1
- name: Build with Gradle
run: ./gradlew build
- name: Run Java (Schnorr) Example
run: ./gradlew secp-examples-java:run
- name: Run Kotlin (Schnorr) Example
run: ./gradlew secp-examples-kotlin:run
- name: Run Java Examples
run: ./gradlew secp-examples-java:run secp-examples-java:runEcdsa
- name: Run Kotlin Examples
run: ./gradlew secp-examples-kotlin:run secp-examples-kotlin:runEcdsa
18 changes: 15 additions & 3 deletions secp-examples-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,24 @@ jar {

application {
mainModule = 'org.bitcoinj.secp.examples'
// mainClass = 'org.bitcoinj.secp.examples.Ecdsa'
mainClass = 'org.bitcoinj.secp.examples.Schnorr'
}

def userHome = System.getProperty("user.home")
def javaLibraryPath = findProperty("javaPath") ?: "${userHome}/.nix-profile/lib"

run {
def userHome = System.getProperty("user.home")
systemProperty "java.library.path", findProperty("javaPath") ?: "${userHome}/.nix-profile/lib"
systemProperty "java.library.path", javaLibraryPath
jvmArgs += '--enable-native-access=org.bitcoinj.secp.ffm'
}

tasks.register('runEcdsa', JavaExec) {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(22)
}
systemProperty "java.library.path", javaLibraryPath
classpath = sourceSets.main.runtimeClasspath
mainModule = 'org.bitcoinj.secp.examples'
mainClass = 'org.bitcoinj.secp.examples.Ecdsa'
jvmArgs += '--enable-native-access=org.bitcoinj.secp.ffm'
}
21 changes: 17 additions & 4 deletions secp-examples-kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,26 @@ kotlin {
}

application {
// mainClass = 'org.bitcoinj.secp.kotlin.examples.Ecdsa'
mainModule = 'org.bitcoinj.secp.kotlin.examples'
mainClass = 'org.bitcoinj.secp.kotlin.examples.Schnorr'
}

def userHome = System.getProperty("user.home")
def javaLibraryPath = findProperty("javaPath") ?: "${userHome}/.nix-profile/lib"

run {
def userHome = System.getProperty("user.home")
systemProperty "java.library.path", findProperty("javaPath") ?: "${userHome}/.nix-profile/lib"
jvmArgs += '--enable-native-access=ALL-UNNAMED'
systemProperty "java.library.path", javaLibraryPath
jvmArgs += '--enable-native-access=org.bitcoinj.secp.ffm'
}

tasks.register('runEcdsa', JavaExec) {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(22)
}
systemProperty "java.library.path", javaLibraryPath
classpath = sourceSets.main.runtimeClasspath
// TODO: Make this run as a modular app (for some reason the `run` task works as modular, but this doesn't)
//mainModule = 'org.bitcoinj.secp.kotlin.examples'
mainClass = 'org.bitcoinj.secp.kotlin.examples.Ecdsa'
jvmArgs += '--enable-native-access=ALL-UNNAMED'
}

0 comments on commit b736655

Please sign in to comment.