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

Native driver based on the Rust SDK #84

Merged
merged 157 commits into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
157 commits
Select commit Hold shift + click to select a range
26ff77a
Initial commit
emmanuel-keller Jun 17, 2024
2d3614c
Initial skeleton
emmanuel-keller Jun 17, 2024
58aed28
Add gh workflow
emmanuel-keller Jun 17, 2024
d3a47f4
Successful test
emmanuel-keller Jun 17, 2024
a95ee01
Error management
emmanuel-keller Jun 17, 2024
444a29c
Add distribution
emmanuel-keller Jun 17, 2024
5a01e46
Restore toolchain
emmanuel-keller Jun 17, 2024
64c703f
Fix assertion
emmanuel-keller Jun 17, 2024
2f0d0bc
Disable fail fast
emmanuel-keller Jun 17, 2024
b3893ba
Update versions
emmanuel-keller Jun 17, 2024
fd1876f
Cache + RuntimeException
emmanuel-keller Jun 17, 2024
3afe75b
Better exception handling
emmanuel-keller Jun 17, 2024
5c48e85
Purge pending exceptions
emmanuel-keller Jun 17, 2024
a0e09ea
Wip on exceptions
emmanuel-keller Jun 18, 2024
5c263e6
Remove unchecked methods
emmanuel-keller Jun 18, 2024
77d7f40
Add logs
emmanuel-keller Jun 18, 2024
476e466
Improve logs
emmanuel-keller Jun 18, 2024
f739776
Return jobject
emmanuel-keller Jun 18, 2024
83f236a
Add autoclose
emmanuel-keller Jun 18, 2024
791b2d1
Add gradle
emmanuel-keller Jun 18, 2024
b856025
Add wrapper
emmanuel-keller Jun 18, 2024
7ac60c9
Set source compatibility
emmanuel-keller Jun 18, 2024
ede3849
Upgrade gradle to 8.8
emmanuel-keller Jun 18, 2024
4385bd9
Add ci workflow
emmanuel-keller Jun 18, 2024
682f92e
Add build/test workflows
emmanuel-keller Jun 18, 2024
82e65b0
Fix report
emmanuel-keller Jun 18, 2024
b41901d
Update README
emmanuel-keller Jun 18, 2024
fbf3155
Add cross compilation
emmanuel-keller Jun 18, 2024
8cdb736
Add docker
emmanuel-keller Jun 18, 2024
2c0fc2f
Wip on cross compilation
emmanuel-keller Jun 18, 2024
0235127
Build jar
emmanuel-keller Jun 18, 2024
e84ea94
Fix build-aggregated-jar collection
emmanuel-keller Jun 18, 2024
35ea60d
Update pathes
emmanuel-keller Jun 18, 2024
397ff40
Update native pathes
emmanuel-keller Jun 18, 2024
0e57393
Filter files
emmanuel-keller Jun 18, 2024
0d6e864
Fix dll/so
emmanuel-keller Jun 18, 2024
ed6e413
Add integration tests
emmanuel-keller Jun 19, 2024
af0a4c3
Update min coverage level
emmanuel-keller Jun 19, 2024
274045c
Upload lib before testing
emmanuel-keller Jun 19, 2024
c2b817f
Set logger to debug
emmanuel-keller Jun 19, 2024
261678c
Fixes wrong path with linux amd
emmanuel-keller Jun 19, 2024
9f52165
Better cross compilation
emmanuel-keller Jun 19, 2024
b123add
Wip on cross build
emmanuel-keller Jun 19, 2024
cda897c
Add windows arm
emmanuel-keller Jun 19, 2024
31c44e6
Revert windows arm
emmanuel-keller Jun 19, 2024
ca5e4a0
Add mac and windows integration tests
emmanuel-keller Jun 19, 2024
f41884e
Fix wrong dep name
emmanuel-keller Jun 19, 2024
024bd48
Replace loader
emmanuel-keller Jun 19, 2024
e2e5cf8
Wip on int tests
emmanuel-keller Jun 19, 2024
6dc0cee
Disable coverage check
emmanuel-keller Jun 19, 2024
13baa5f
Fix resource path
emmanuel-keller Jun 19, 2024
19ecdd8
Fix test.yml
emmanuel-keller Jun 19, 2024
e9b979e
Remove dep
emmanuel-keller Jun 19, 2024
0316553
Wip
emmanuel-keller Jun 19, 2024
1b63a0c
Recognize arch amd64
emmanuel-keller Jun 19, 2024
e855e7d
Fix integration tests
emmanuel-keller Jun 19, 2024
051cdb4
Wip integration test
emmanuel-keller Jun 19, 2024
2fc501b
Improve loader
emmanuel-keller Jun 19, 2024
b0322f1
Add android
emmanuel-keller Jun 19, 2024
d371a08
Fix cross syntax
emmanuel-keller Jun 19, 2024
3f39887
Make Android optional
emmanuel-keller Jun 19, 2024
66aa797
Disable android
emmanuel-keller Jun 19, 2024
8daa21c
Fixes windows integration test
emmanuel-keller Jun 19, 2024
d0f3887
Fix test for windows
emmanuel-keller Jun 19, 2024
7e39814
Use head for cross compile on Android
emmanuel-keller Jun 20, 2024
d76504a
Introduce SurrealDBException
emmanuel-keller Jun 20, 2024
b77de7c
Use ptr
emmanuel-keller Jun 21, 2024
97f2a7f
Implements Response/Result/Value model (JAVA side)
emmanuel-keller Jun 21, 2024
fdf3145
Wip on Value implementation
emmanuel-keller Jun 21, 2024
9ed1365
Fix integration tests
emmanuel-keller Jun 21, 2024
0d08886
Restore Android upload
emmanuel-keller Jun 21, 2024
f2f1cbd
Implements thing,id,uuid,long
emmanuel-keller Jun 22, 2024
31a4f05
Implements Geometry point
emmanuel-keller Jun 22, 2024
d9e2cc7
Introduce Native abstract class
emmanuel-keller Jun 23, 2024
bb8a0dd
Split tests
emmanuel-keller Jun 23, 2024
07a4fe9
Implement Object iterator and synchronized iterator
emmanuel-keller Jun 23, 2024
9b46f9f
Implements reflection
emmanuel-keller Jun 23, 2024
ebfea91
Introduce ClassValueConverter
emmanuel-keller Jun 23, 2024
4d1a43a
Cleanup existing files
emmanuel-keller Jun 23, 2024
2e78022
Merge remote-tracking branch 'new-repo/main' into emmanuel/jni
emmanuel-keller Jun 23, 2024
d431aa9
Cleanup + update .md files
emmanuel-keller Jun 24, 2024
7239438
Rust code cleanup
emmanuel-keller Jun 24, 2024
c771706
Wip in ValueBuilder
emmanuel-keller Jun 24, 2024
59add18
Implements Create(resource, content)
emmanuel-keller Jun 24, 2024
f1f6b9a
Implements Select/Thing
emmanuel-keller Jun 24, 2024
fb53b7f
Privatize package protected methods
emmanuel-keller Jun 24, 2024
4bd5423
Implements createTableSelectRecords
emmanuel-keller Jun 24, 2024
e472a14
Implements Select + Iterators
emmanuel-keller Jun 25, 2024
2147a57
Implements Number types
emmanuel-keller Jun 25, 2024
410805f
Implements Duration and Datetime/ZoneDateTime
emmanuel-keller Jun 25, 2024
8ad19ff
Fmt Rust
emmanuel-keller Jun 25, 2024
eada8d2
Add create tests
emmanuel-keller Jun 25, 2024
b0cdfe9
Prepare update and delete
emmanuel-keller Jun 25, 2024
9743538
Implements Delete
emmanuel-keller Jun 25, 2024
115043a
Add targets parsing
emmanuel-keller Jun 25, 2024
8f1e753
Reorganise tests
emmanuel-keller Jun 25, 2024
d12a167
Implements updates
emmanuel-keller Jun 26, 2024
b41fccd
cargo fmt
emmanuel-keller Jun 26, 2024
1055b51
Check buiding 32 bits platforms
emmanuel-keller Jun 26, 2024
ca79f54
Fixes needs in cross.yml
emmanuel-keller Jun 26, 2024
33ed9c3
Fix matrix syntx
emmanuel-keller Jun 26, 2024
de1162c
Restore cross matrix
emmanuel-keller Jun 26, 2024
17f5413
Try to disable kv-mem for 32 bits platforms
emmanuel-keller Jun 26, 2024
d278913
Add optional on 32bits builds
emmanuel-keller Jun 26, 2024
1f52a45
Make failures optional
emmanuel-keller Jun 26, 2024
ab786e2
Use armv7 for android
emmanuel-keller Jun 26, 2024
93dc38a
Try independent windows built
emmanuel-keller Jun 26, 2024
f3cd348
Update windows built
emmanuel-keller Jun 26, 2024
c2866f5
Alternative ming64 install
emmanuel-keller Jun 26, 2024
3d138e8
Use pacboy
emmanuel-keller Jun 26, 2024
00cc0ba
Install gcc
emmanuel-keller Jun 26, 2024
e778005
Right package
emmanuel-keller Jun 26, 2024
9a29e92
Use toolchain
emmanuel-keller Jun 26, 2024
c954af2
Add missing packages
emmanuel-keller Jun 26, 2024
635ab85
Wip
emmanuel-keller Jun 26, 2024
f622a70
Wip on cross compilation
emmanuel-keller Jun 26, 2024
20eebfa
Fixes combinations
emmanuel-keller Jun 26, 2024
7e795fd
Fix msystem
emmanuel-keller Jun 26, 2024
52acc99
Check msvc
emmanuel-keller Jun 26, 2024
502a34e
Add linux strategy
emmanuel-keller Jun 26, 2024
4985385
Wip on linux cross compile
emmanuel-keller Jun 26, 2024
5a7af29
Add missing target
emmanuel-keller Jun 26, 2024
e06ebce
Add android
emmanuel-keller Jun 26, 2024
ae1650c
Fix int test matrix
emmanuel-keller Jun 26, 2024
d56ebd7
Check ndk
emmanuel-keller Jun 26, 2024
0da2fe5
Wip on Android
emmanuel-keller Jun 26, 2024
98c15d3
Use cargo ndk
emmanuel-keller Jun 26, 2024
d411e4b
Wip on android
emmanuel-keller Jun 26, 2024
d4376e5
Update the loader with the new 32 bits architectures.
emmanuel-keller Jun 26, 2024
d7c0e87
Remove redundant integration test
emmanuel-keller Jun 26, 2024
c470e12
Add SurrealKV
emmanuel-keller Jun 26, 2024
7293eb3
Add surreal unstable
emmanuel-keller Jun 26, 2024
f3ff8ec
Update to sdk 2.0
emmanuel-keller Sep 23, 2024
688f011
Temporary use branch for SurrealDB
emmanuel-keller Sep 24, 2024
153d5c2
Add database and namespace authentication
emmanuel-keller Sep 24, 2024
5a621bd
Bump SurrealDB to 2.0.2
emmanuel-keller Sep 25, 2024
9c9d942
Implements insert, insertRelation and relate JAVA API
emmanuel-keller Sep 25, 2024
312e88d
Implements Relation tests
emmanuel-keller Sep 27, 2024
7fdc8d9
Implements indexRelation Java API
emmanuel-keller Sep 27, 2024
6be5301
Tests InsertRelation(s)
emmanuel-keller Sep 27, 2024
de73608
Wip
emmanuel-keller Sep 27, 2024
608915f
Add debug allocator
emmanuel-keller Sep 30, 2024
f6f9b35
Implements relate
emmanuel-keller Sep 30, 2024
29a397f
Cleanup
emmanuel-keller Sep 30, 2024
ed65165
Add upsert
emmanuel-keller Oct 1, 2024
dd1b1c4
Add code example
emmanuel-keller Oct 1, 2024
fcbc489
Rename Think to RecordId
emmanuel-keller Oct 1, 2024
45b42ff
Wip on what/target SDK compliances
emmanuel-keller Oct 1, 2024
a977a94
Check that single target string are tables
emmanuel-keller Oct 2, 2024
b0737aa
Rename targets argument in create methods
emmanuel-keller Oct 3, 2024
d793860
Add test checking the target is a table
emmanuel-keller Oct 3, 2024
6237d56
Bump SurrealDB to 2.0.3
emmanuel-keller Oct 4, 2024
4ddab15
Remove jni extension from the jar file
emmanuel-keller Oct 4, 2024
de3efb1
Add publish to cross
emmanuel-keller Oct 4, 2024
c927788
Add github package publishing
emmanuel-keller Oct 4, 2024
8e3414a
Align with other drivers
emmanuel-keller Oct 4, 2024
3324069
Replace getFirst with get(0)
emmanuel-keller Oct 4, 2024
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
17 changes: 5 additions & 12 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
# EditorConfig coding styles definitions. For more information about the
# properties used in this file, please see the EditorConfig documentation:
# http://editorconfig.org/
# EditorConfig: https://EditorConfig.org

root = true

[*]
# Java files
[*.java]
charset = utf-8
end_of_line = LF
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.{yml,json}]
indent_size = 2
indent_style = space

[*.{md,diff}]
trim_trailing_whitespace = false
max_line_length = 100
354 changes: 354 additions & 0 deletions .github/workflows/cross.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,354 @@
name: Cross-Compile

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:

android:
strategy:
matrix:
include:
- target: x86_64-linux-android
ndk: x86_64
- target: aarch64-linux-android
ndk: arm64-v8a
- target: i686-linux-android
ndk: x86
- target: armv7-linux-androideabi
ndk: armeabi-v7a

runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Cache Rust
uses: Swatinem/rust-cache@v2

- name: Install dependencies
run: sudo apt-get update -y

- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.target }}

- name: Install cargo-ndk
run: cargo install cargo-ndk

- name: Build
env:
RUSTFLAGS: '--cfg surrealdb_unstable'
run: cargo ndk -t ${{ matrix.ndk }} build --release

- name: Upload so lib
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: target/${{ matrix.target }}/release/*.so

linux:
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
linker: CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=gcc
apt-get: gcc
- target: aarch64-unknown-linux-gnu
linker: CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc
apt-get: gcc-aarch64-linux-gnu
- target: i686-unknown-linux-gnu
linker: CARGO_TARGET_I686_UNKNOWN_LINUX_GNU_LINKER=gcc
apt-get: gcc-multilib
- target: armv7-unknown-linux-gnueabihf
linker: CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc
apt-get: gcc-arm-linux-gnueabihf

runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Cache Rust
uses: Swatinem/rust-cache@v2

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y ${{ matrix.apt-get }}

- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.target }}

- name: Build
env:
RUSTFLAGS: '--cfg surrealdb_unstable'
run: |
export ${{ matrix.linker }}
cargo build --target ${{ matrix.target }} --release

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: target/${{ matrix.target }}/release/*.so

windows:
strategy:
matrix:
arch: [ x86_64, i686 ]
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Cache Rust
uses: Swatinem/rust-cache@v2

- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: ${{ matrix.arch }}-pc-windows-msvc

- name: Build
env:
RUSTFLAGS: '--cfg surrealdb_unstable'
run: cargo build --target ${{ matrix.arch }}-pc-windows-msvc --release

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.arch }}-pc-windows-msvc
path: target/${{ matrix.arch }}-pc-windows-msvc/release/*.dll

macos:
strategy:
matrix:
include:
- arch: x86_64
runs-on: macos-12
- arch: aarch64
runs-on: macos-latest
runs-on: ${{ matrix.runs-on }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Cache Rust
uses: Swatinem/rust-cache@v2

- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable

- name: Build
env:
RUSTFLAGS: '--cfg surrealdb_unstable'
run: cargo build --target ${{ matrix.arch }}-apple-darwin --release

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.arch }}-apple-darwin
path: target/${{ matrix.arch }}-apple-darwin/release/*.dylib

aggregated-jar:
runs-on: ubuntu-latest
needs:
- android
- windows
- macos
steps:
- name: Install dependencies
run: sudo apt-get update

- name: Checkout repository
uses: actions/checkout@v4

- name: Set up JDK 22
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 22

- name: Gradle
run: chmod +x gradlew

- name: Create directories for artifacts
run: |
mkdir -p src/main/resources/natives/android_64
mkdir -p src/main/resources/natives/android_32
mkdir -p src/main/resources/natives/android_arm64
mkdir -p src/main/resources/natives/android_arm32
mkdir -p src/main/resources/natives/linux_64
mkdir -p src/main/resources/natives/linux_32
mkdir -p src/main/resources/natives/linux_arm64
mkdir -p src/main/resources/natives/linux_arm32
mkdir -p src/main/resources/natives/osx_64
mkdir -p src/main/resources/natives/osx_arm64
mkdir -p src/main/resources/natives/windows_64
mkdir -p src/main/resources/natives/windows_32

- name: Download Android 64 intel
uses: actions/download-artifact@v4
with:
name: x86_64-linux-android
path: src/main/resources/natives/android_64

- name: Download Android 32 intel
uses: actions/download-artifact@v4
with:
name: i686-linux-android
path: src/main/resources/natives/android_32

- name: Download Android 64 arm
uses: actions/download-artifact@v4
with:
name: aarch64-linux-android
path: src/main/resources/natives/android_arm64

- name: Download Android 32 arm
uses: actions/download-artifact@v4
with:
name: armv7-linux-androideabi
path: src/main/resources/natives/android_arm32

- name: Download Linux 64 intel
uses: actions/download-artifact@v4
with:
name: x86_64-unknown-linux-gnu
path: src/main/resources/natives/linux_64

- name: Download Linux 32 intel
uses: actions/download-artifact@v4
with:
name: i686-unknown-linux-gnu
path: src/main/resources/natives/linux_32

- name: Download Linux 64 arm
uses: actions/download-artifact@v4
with:
name: aarch64-unknown-linux-gnu
path: src/main/resources/natives/linux_arm64

- name: Download Linux 32 arm
uses: actions/download-artifact@v4
with:
name: armv7-unknown-linux-gnueabihf
path: src/main/resources/natives/linux_arm32

- name: Download Darwin 64 intel
uses: actions/download-artifact@v4
with:
name: x86_64-apple-darwin
path: src/main/resources/natives/osx_64

- name: Download Darwin 64 arm
uses: actions/download-artifact@v4
with:
name: aarch64-apple-darwin
path: src/main/resources/natives/osx_arm64

- name: Download Windows 64 intel
uses: actions/download-artifact@v4
with:
name: x86_64-pc-windows-msvc
path: src/main/resources/natives/windows_64

- name: Download Windows 32 intel
uses: actions/download-artifact@v4
with:
name: i686-pc-windows-msvc
path: src/main/resources/natives/windows_32

- name: Build JAR
run: ./gradlew jar

- name: Upload JAR artifact
uses: actions/upload-artifact@v4
with:
name: surrealdb
path: build/libs/surrealdb-0.2-SNAPSHOT.jar

- name: Linux Integration Test
run: ./gradlew -i integrationTest

integration-tests:
strategy:
matrix:
os: [ macos-12, macos-latest, windows-latest, ubuntu-latest ]

runs-on: ${{ matrix.os }}
needs:
- aggregated-jar
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up JDK 22
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 22

- name: Gradle
run: chmod +x gradlew

- name: Create directory build/libs
run: mkdir -p build/libs

- name: Download JAR
uses: actions/download-artifact@v4
with:
name: surrealdb
path: build/libs

- name: Tests
run: ./gradlew -i integrationTest

publish:
needs:
- aggregated-jar
- integration-tests
if: github.event_name == 'release' && github.event.action == 'created'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4

- name: Set up JDK 22
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 22

- name: Download JAR
uses: actions/download-artifact@v4
with:
name: surrealdb
path: build/libs

- name: Publish release package
uses: softprops/action-gh-release@v2
with:
name: "Release ${{ github.ref_name }}"
files: |
LICENSE
build/libs/*.jar

- name: Publish Jar (Maven)
run: ./gradlew publish
Loading
Loading