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 992c4a4
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 10 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'
}
16 changes: 13 additions & 3 deletions secp-examples-kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,23 @@ kotlin {
}

application {
// mainClass = 'org.bitcoinj.secp.kotlin.examples.Ecdsa'
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"
systemProperty "java.library.path", javaLibraryPath
jvmArgs += '--enable-native-access=ALL-UNNAMED'
}

tasks.register('runEcdsa', JavaExec) {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(22)
}
systemProperty "java.library.path", javaLibraryPath
classpath = sourceSets.main.runtimeClasspath
mainClass = 'org.bitcoinj.secp.kotlin.examples.Ecdsa'
jvmArgs += '--enable-native-access=ALL-UNNAMED'
}

0 comments on commit 992c4a4

Please sign in to comment.