- 1. Desktop (electron)
- 2. Android
- 3. iOS (ffi)
- 4. Web
- NPM scripts using LibParsec needs cargo to work : https://doc.rust-lang.org/cargo/getting-started/installation.html
- To develop on Windows, you need to install VS BuildTools 2019 :
- Download the installer here : https://visualstudio.microsoft.com/fr/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16
- Select in the individual modules : "MSVC v142 - VS 2019 C++ x64/x86 Build Tools"
Install electron dependencies and build:
# In /bindings/electron
npm install
npm run build # Generate libparsec.node (basically a .so that node can load)
Note:
../client/electron
project automatically doesnpm build
and copylibparsec.node
where needed.
You can either install Android Studio
or Android tools
-
Download Android studio at https://developer.android.com/studio#android-studio-downloads
-
Install Android Studio
-
In
File > Settings > Appearance & Behavior > System Settings > Android SDK > SDK Platform > Show Package Details
:- Install Android SDK
30.0.3
- Install Android NDK
23.2.8568313
(see variable.gradle for the up to date version to use) - Android SDK Command-line Tools
- Install Android SDK
-
Python command should be available in PATH environment variable (used by
rust-android-gradle
plugin)
-
Create a writable folder to store
android sdk
tools & packages.mkdir ~/.android-sdk
-
Configure the env variable
export ANDROID_HOME=~/.android-sdk export ANDROID_SDK_ROOT=~/.android-sdk
-
Download android tools at https://developer.android.com/studio#command-line-tools-only
-
Extract the archive to a temporary folder
# TEMP_DIR=$(mktemp -d) # You can use this command to get a temp folder. unzip -d "$TEMP_DIR" <cmdline-tools.zip>
-
Find the latest version of
cmdline-tools
$ $TEMP_DIR/cmdline-tools/bin/sdkmanager --sdk_root=$ANDROID_HOME --list | grep cmdline-tools cmdline-tools;1.0 | 1.0 | Android SDK Command-line Tools cmdline-tools;2.1 | 2.1 | Android SDK Command-line Tools cmdline-tools;3.0 | 3.0 | Android SDK Command-line Tools cmdline-tools;4.0 | 4.0 | Android SDK Command-line Tools cmdline-tools;5.0 | 5.0 | Android SDK Command-line Tools cmdline-tools;6.0 | 6.0 | Android SDK Command-line Tools cmdline-tools;7.0 | 7.0 | Android SDK Command-line Tools cmdline-tools;8.0 | 8.0 | Android SDK Command-line Tools cmdline-tools;9.0 | 9.0 | Android SDK Command-line Tools cmdline-tools;latest | 9.0 | Android SDK Command-line Tools (latest)
-
Install
cmdline-tools
$TEMP_DIR/cmdline-tools/bin/sdkmanager --install "cmdline-tools;latest"
Note: using
latest
may not allow reproductible build on different dev env. But you can replace the value by another one (0.9
for example). -
Update your
PATH
variableexport PATH="$PATH:$ANDROID_HOME/cmdline-tools/latest/bin"
Note: the path is
latest/bin
because we installcmdline-tools
a the taglatest
. For9.0
, it will be9.0/bin
for example. -
Install Android
SDK-30.0.3
andNDK-23.2.8568313
(see variable.gradle for the up to date version to use) by runningsdkmanager --install "ndk;<ndk version>" "build-tools;<build tool version>"
Install Rust targets for cross compilation:
rustup target add \
armv7-linux-androideabi \
i686-linux-android \
aarch64-linux-android \
x86_64-linux-android \
The
bindings/android
directory is a valid Android project to generate a libparsec AAR. However the AAR doesn't have to be built when using../client/android
project (given it depends explicitly on thebindings/android/libparsec
).
Install the latest LTS of openjdk
:
- Install the latest java LTS development kit (currently
JDK-17
). - If need to be, update your
JAVA_HOME
to point to the installed jdk version folder.
To regenerate the lock file use:
bash ./gradlew dependencies --write-locks
If you want to update a specific list of dependencies use:
bash ./gradlew classes --update-locks <dependencies comma separated>
For both command above, if you want to update the dependencies lock for a specific module use: -p <module-path>
A more detailed documentation can be found here Gradle - locking dependencies
bash ./gradle --write-verification-metadata sha256 help
It you want to update the verification metadata for a specific module use:
-p <module-path>
A more detailed documentation can be found here Gradle - dependency verification
In most languages pinning dependency version and storing each dependency checksum is a single step (e.g. see Cargo.lock
, poetry.lock
), but with Gradle this is divided into two steps:
- Dependency locking consists of pinning the list of dependencies (including transitive ones) used by the project. It ensure that the transitive dependencies don't update unexpectedly (outside of PR that bump a dependency version).
- Verification metadata contains the list of dependency checksums (still with transitive ones). The dependency metadata (verification metadata) ensure that a dependency isn't tempered by comparing it's checksum.
When updating a dependency, you will need to update the lock & metadata
bash ./gradlew assembleRelease
<WIP>
Install wasm dependencies and build:
Requirements:
- wasm-pack:
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
Build:
# In /bindings/web
wasm-pack build