summaryrefslogtreecommitdiff
path: root/scripts/deploy
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/deploy')
-rw-r--r--scripts/deploy/cbindgen.ps118
-rwxr-xr-xscripts/deploy/cbindgen.sh16
2 files changed, 34 insertions, 0 deletions
diff --git a/scripts/deploy/cbindgen.ps1 b/scripts/deploy/cbindgen.ps1
new file mode 100644
index 0000000..4dd9eb9
--- /dev/null
+++ b/scripts/deploy/cbindgen.ps1
@@ -0,0 +1,18 @@
+$originalLocation = Get-Location
+Set-Location (Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path))
+
+if (-not (Get-Command cbindgen -ErrorAction SilentlyContinue)) {
+ cargo install cbindgen
+}
+
+if (Test-Path ffi/.temp/jvlib.h) {
+ Remove-Item ffi/.temp/jvlib.h
+}
+$env:RUSTUP_TOOLCHAIN = "nightly"
+cbindgen `
+ --config cbindgen.toml `
+ ffi `
+ --output ffi/.temp/jvlib.h `
+ --quiet
+
+Set-Location $originalLocation
diff --git a/scripts/deploy/cbindgen.sh b/scripts/deploy/cbindgen.sh
new file mode 100755
index 0000000..2be2328
--- /dev/null
+++ b/scripts/deploy/cbindgen.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+cd "$(dirname "$(readlink -f "$0")")/../.."
+
+if ! command -v cbindgen &> /dev/null; then
+ cargo install cbindgen
+fi
+
+rm ffi/.temp/jvlib.h
+RUSTUP_TOOLCHAIN=nightly \
+cbindgen \
+ --config cbindgen.toml \
+ ffi \
+ --output ffi/.temp/jvlib.h \
+ --quiet
+
+cd -