Skip to content

Commit

Permalink
Fix gradle for linux
Browse files Browse the repository at this point in the history
  • Loading branch information
sbihel committed Jan 12, 2024
1 parent 46340a8 commit a902a68
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions WalletSdkRs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.build
14 changes: 11 additions & 3 deletions kotlin/walletsdkrs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,25 @@ afterEvaluate {
}
}

import org.apache.tools.ant.taskdefs.condition.Os
tasks.register('bindGen', Exec) {
def outDir = "${projectDir}/src/main/java"
workingDir "../../"
if (System.getProperty('os.name').toLowerCase().contains('windows')) {
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine("cmd", "/c",
"cargo run --bin uniffi-bindgen generate --library target\\debug\\libwallet_sdk_rs.dylib " + "--language kotlin " + "--out-dir " + outDir.replace('/', '\\'))
"cargo build && " + "cargo run --bin uniffi-bindgen generate --library target\\debug\\libwallet_sdk_rs.dll " + "--language kotlin " + "--out-dir " + outDir.replace('/', '\\'))
} else {
def extension
if (Os.isFamily(Os.FAMILY_MAC)) {
extension = "dylib"
} else {
extension = "so"
}
commandLine("sh", "-c",
"""\
cargo build && \
cargo run --bin uniffi-bindgen generate \
--library target/debug/libwallet_sdk_rs.dylib \
--library target/debug/libwallet_sdk_rs.$extension \
--language kotlin \
--out-dir $outDir
""")
Expand Down

0 comments on commit a902a68

Please sign in to comment.