diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index ebc9220..13bacbc 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -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 diff --git a/secp-examples-java/build.gradle b/secp-examples-java/build.gradle index 6b922fd..c14c62a 100644 --- a/secp-examples-java/build.gradle +++ b/secp-examples-java/build.gradle @@ -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' } diff --git a/secp-examples-kotlin/build.gradle b/secp-examples-kotlin/build.gradle index 725a133..f58c26b 100644 --- a/secp-examples-kotlin/build.gradle +++ b/secp-examples-kotlin/build.gradle @@ -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' +}