Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle Build: look for secp256k1 in ~/.nix-profile/lib #15

Merged
merged 1 commit into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,15 @@ We are currently using a Nix flake to install the native `libsecp256k1` and usin

If necessary copy updated, extracted headers into `src/main/java/org/consensusj/secp256k1/`

Make sure you have installed the current version of `secp256k1` with `nix profile install nixpkgs#secp256k1`

. `./gradlew build`

== Running with Gradle Wrapper

(This assumes a specific hash/version of secp256k1 was installed with nixpkgs)

. `./gradlew -PjavaPath="/nix/store/j9mf1fh4wbb8c3x1zwqfs218bhml1rbw-secp256k1-0.4.0/lib/" secp256k1-examples-java:run`
. `./gradlew secp256k1-examples-java:run`

== Building with Nix

Expand Down
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ subprojects {

test {
useJUnitPlatform()
systemProperty "java.library.path", findProperty("javaPath") ?: "/nix/store/j9mf1fh4wbb8c3x1zwqfs218bhml1rbw-secp256k1-0.4.0/lib/"
def userHome = System.getProperty("user.home")
systemProperty "java.library.path", findProperty("javaPath") ?: "${userHome}/.nix-profile/lib"
jvmArgs += '--enable-preview'
jvmArgs += '--enable-native-access=ALL-UNNAMED'
}
Expand Down
3 changes: 2 additions & 1 deletion secp256k1-examples-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ application {
}

run {
systemProperty "java.library.path", findProperty("javaPath") ?: ""
def userHome = System.getProperty("user.home")
systemProperty "java.library.path", findProperty("javaPath") ?: "${userHome}/.nix-profile/lib"
}
3 changes: 2 additions & 1 deletion secp256k1-examples-kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ application {
}

run {
systemProperty "java.library.path", findProperty("javaPath") ?: ""
def userHome = System.getProperty("user.home")
systemProperty "java.library.path", findProperty("javaPath") ?: "${userHome}/.nix-profile/lib"
}