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

Test release 4.1.0 #708

Merged
merged 18 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
72397ca
Dev docs: update C library update instructions
greenrobot-team Feb 3, 2025
a9aadcb
Update C library [4.0.2 -> 4.1.0]
greenrobot-team Feb 3, 2025
1848f64
Update objectbox-android [4.0.3 -> 4.1.0]
greenrobot-team Feb 3, 2025
b922b05
Update ObjectBox Swift [4.0.0 -> 4.0.1]
greenrobot-team Feb 3, 2025
427c6f5
Update C-API [4.0.2 -> 4.1.0]
greenrobot-team Feb 3, 2025
799529f
Sync credentials: check for error when setting user + password
greenrobot-team Feb 3, 2025
4ef8cd4
Sync credentials: support setting multiple #134
greenrobot-team Feb 3, 2025
51f4112
Sync credentials: add JWT credentials, test JWT auth #134
greenrobot-team Feb 3, 2025
0eaccf8
Sync server tests: always print server output
greenrobot-team Feb 4, 2025
3b39cbc
Sync server tests: more obvious message when online check times out
greenrobot-team Feb 4, 2025
4e1b1a2
JWT auth: supply auth via conf file #134
greenrobot-team Feb 4, 2025
8cc0c4d
JWT auth: tests require an already running server #134
greenrobot-team Feb 4, 2025
0d98007
Merge branch '134-jwt-and-multi-credentials' into 'main'
greenrobot-team Feb 4, 2025
8b6df59
VectorDistance: add new distance-type 'Geo', add vectorSearchCitiesGe…
Dec 18, 2024
282510d
Merge branch '129-add-new-distance-type-geo' into 'main'
greenrobot-team Feb 4, 2025
e22bc41
Follow-up: objectbox-android 4.1.0 requires Android 5.0 (API level 21)
greenrobot-team Feb 4, 2025
3522b2f
Prepare release 4.1.0
greenrobot-team Feb 4, 2025
48ca329
Prepare for next release
greenrobot-team Feb 4, 2025
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
76 changes: 66 additions & 10 deletions dev-doc/updating-c-library.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,96 @@ Dart won't error on C function signature mismatch, leading to obscure memory bug

## C libraries

For each:

- Update versions below
- Run update script
- Add [CHANGELOG](../objectbox/CHANGELOG.md) entry
- Commit changes

### Desktop, Scripts

For Dart Native and unit tests ([install.sh](../install.sh)),
for the binding update script (see below) and
for Flutter (`flutter_libs` and `sync_flutter_libs` plugins) on Linux and Windows:
for Flutter (`flutter_libs` and `sync_flutter_libs` plugins) on Linux and Windows:

```bash
./tool/set-c-version.sh 4.1.0
```
./tool/set-c-version.sh 4.0.2

```text
* Flutter for Linux/Windows, Dart Native: update to [objectbox-c 4.1.0](https://github.com/objectbox/objectbox-c/releases/tag/v4.1.0).
```

```text
Update C library [4.0.2 -> 4.1.0]
```

### Android

For the Flutter plugins on Android ([view releases](https://github.com/objectbox/objectbox-java/releases)):

```bash
./tool/set-android-version.sh 4.1.0
```

```text
* Flutter for Android: update to [objectbox-android 4.1.0](https://github.com/objectbox/objectbox-java/releases/tag/V4.1.0).
If your project is [using Admin](https://docs.objectbox.io/data-browser#admin-for-android), make sure to
update to `io.objectbox:objectbox-android-objectbrowser:4.1.0` in `android/app/build.gradle`.
```
./tool/set-android-version.sh 4.0.3

```text
Update objectbox-android [4.0.3 -> 4.1.0]

Bundled with C API 4.1.0 and ObjectBox 4.1.0-2025-01-28
```

Note: the embedded C API and ObjectBox version can be looked up
from the relevant objectbox repository release tag (like `java-4.1.0`).

### Apple OSs

For the Flutter plugins on iOS/macOS ([view releases](https://github.com/objectbox/objectbox-swift/releases))

```bash
./tool/set-swift-version.sh 4.1.0
```
./tool/set-swift-version.sh 4.0.1

```text
* Flutter for iOS/macOS: update to [objectbox-swift 4.1.0](https://github.com/objectbox/objectbox-swift/releases/tag/v4.1.0).
For existing projects, run `pod repo update` and `pod update ObjectBox` in the `ios` or `macos` directories.
```

```text
Update ObjectBox Swift [4.0.0 -> 4.0.1]

Bundled with C API 4.1.0 and ObjectBox 4.1.0-2025-01-30
```

For each, add an entry (see previous releases) to the [CHANGELOG](../objectbox/CHANGELOG.md).
Note: the embedded C API and ObjectBox version can be looked up
from the objectbox-swift release tag (like `v4.1.0`) and
the objectbox commit it points to (see `external/objectbox`).

## Dart C API bindings

To download the C library header files and generate bindings with ffigen (requires LLVM libraries,
see [ffigen docs](https://pub.dev/packages/ffigen#installing-llvm)
and the ffigen section in [pubspec.yaml](../objectbox/pubspec.yaml)):
```

```bash
./tool/update-c-binding.sh
```

Then manually:

- Copy/update enums that need to be exposed to users
from [objectbox_c.dart](../objectbox/lib/src/native/bindings/objectbox_c.dart)
to [enums.dart](../objectbox/lib/src/modelinfo/enums.dart).
- Check the changed files, make any required changes in the Dart library (like method signature changes).
- ⚠️ Update minimum C API and core version and notes as needed in [bindings.dart](../objectbox/lib/src/native/bindings/bindings.dart).

Note: the embedded C API and core version can be looked up
for Android from the relevant core repository release tag and
for Swift from its repos release tag and the core commit it points to.
- Commit as

```text
Update C-API [4.0.2 -> 4.1.0]
```
4 changes: 2 additions & 2 deletions flutter_libs/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ android {
}

defaultConfig {
minSdkVersion 19 // ObjectBox Android requires Android 4.4 (API level 19)
minSdkVersion 21 // ObjectBox Android requires Android 5.0 (API level 21)
}

dependencies {
// ObjectBox Android library that includes an ObjectBox C library version compatible with
// the C API binding of the ObjectBox Dart package.
// https://central.sonatype.com/search?q=g:io.objectbox%20objectbox-android
implementation "io.objectbox:objectbox-android:4.0.3"
implementation "io.objectbox:objectbox-android:4.1.0"
}
}
2 changes: 1 addition & 1 deletion flutter_libs/ios/objectbox_flutter_libs.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Pod::Spec.new do |s|
s.source_files = 'Classes/**/*'

s.dependency 'Flutter'
s.dependency 'ObjectBox', '4.0.1'
s.dependency 'ObjectBox', '4.1.0'

# Flutter.framework does not contain a i386 slice.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
Expand Down
2 changes: 1 addition & 1 deletion flutter_libs/linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::GTK)
# ----------------------------------------------------------------------
# Download and add objectbox-c prebuilt library.

set(OBJECTBOX_VERSION 4.0.2)
set(OBJECTBOX_VERSION 4.1.0)

set(OBJECTBOX_ARCH ${CMAKE_SYSTEM_PROCESSOR})
if (${OBJECTBOX_ARCH} MATCHES "x86_64")
Expand Down
2 changes: 1 addition & 1 deletion flutter_libs/macos/objectbox_flutter_libs.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Pod::Spec.new do |s|
s.source_files = 'Classes/**/*'

s.dependency 'FlutterMacOS'
s.dependency 'ObjectBox', '4.0.1'
s.dependency 'ObjectBox', '4.1.0'

s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
s.swift_version = '5.3'
Expand Down
4 changes: 2 additions & 2 deletions flutter_libs/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Superfast NoSQL Flutter / Dart database. This package contains Flut
# Link to actual directory in repository so file links on pub.dev work.
repository: https://github.com/objectbox/objectbox-dart/tree/main/flutter_libs
homepage: https://objectbox.io
version: 4.0.3
version: 4.1.0

environment:
sdk: '>=2.18.0 <4.0.0'
Expand All @@ -14,7 +14,7 @@ dependencies:
sdk: flutter
# This is here just to ensure compatibility between objectbox-dart code and the libraries used
# You should still depend on objectbox directly in your Flutter application.
objectbox: 4.0.3
objectbox: 4.1.0
path_provider: ^2.0.0

dev_dependencies:
Expand Down
2 changes: 1 addition & 1 deletion flutter_libs/windows/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ set(objectbox_flutter_libs_bundled_libraries
# ----------------------------------------------------------------------
# Download and add objectbox-c prebuilt library.

set(OBJECTBOX_VERSION 4.0.2)
set(OBJECTBOX_VERSION 4.1.0)

set(OBJECTBOX_ARCH ${CMAKE_SYSTEM_PROCESSOR})
if (${OBJECTBOX_ARCH} MATCHES "AMD64")
Expand Down
2 changes: 1 addition & 1 deletion generator/lib/src/version.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ class Version {
///
/// This string is updated by the /tool/set-version.sh script
/// as part of the release process.
static const String current = "4.0.3";
static const String current = "4.1.0";
}
4 changes: 2 additions & 2 deletions generator/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ description: ObjectBox Flutter / Dart database binding code generator - finds an
# Link to actual directory in repository so file links on pub.dev work.
repository: https://github.com/objectbox/objectbox-dart/tree/main/generator
homepage: https://objectbox.io
version: 4.0.3
version: 4.1.0

environment:
sdk: '>=2.18.0 <4.0.0'

dependencies:
objectbox: 4.0.3
objectbox: 4.1.0
analyzer: '>=5.2.0 <7.0.0' # 5.1.0 has a bug where DartType.element has been removed.
build: ^2.0.0
collection: ^1.15.0
Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -eu
# It's important that the generated dart bindings and the c-api library version match. Dart won't error on C function
# signature mismatch, leading to obscure memory bugs.
# For how to upgrade the version see dev-doc/updating-c-library.md
cLibVersion=4.0.2
cLibVersion=4.1.0
os=$(uname)
cLibArgs="$*"

Expand Down
19 changes: 19 additions & 0 deletions objectbox/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
## latest



## 4.1.0 (2025-02-04)

* Flutter for Android: requires Android 5.0 (API level 21).
* Vector Search: You can now use the new `VectorDistanceType.GEO` distance-type to perform vector searches on
geographical coordinates. This is particularly useful for location-based applications.
* Flutter for Linux/Windows, Dart Native: update to [objectbox-c 4.1.0](https://github.com/objectbox/objectbox-c/releases/tag/v4.1.0).
* Flutter for Android: update to [objectbox-android 4.1.0](https://github.com/objectbox/objectbox-java/releases/tag/V4.1.0).
If your project is [using Admin](https://docs.objectbox.io/data-browser#admin-for-android), make sure to
update to `io.objectbox:objectbox-android-objectbrowser:4.1.0` in `android/app/build.gradle`.
* Flutter for iOS/macOS: update to [objectbox-swift 4.1.0](https://github.com/objectbox/objectbox-swift/releases/tag/v4.1.0).
For existing projects, run `pod repo update` and `pod update ObjectBox` in the `ios` or `macos` directories.

### Sync

* Add [JWT authentication](https://sync.objectbox.io/sync-server-configuration/jwt-authentication).
* Sync clients can send multiple credentials for login.

## 4.0.3 (2024-10-17)

* Generator: replace cryptography library, allows to use newer versions of the transitive `js` dependency. [#638](https://github.com/objectbox/objectbox-dart/issues/638)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class City {

String? name;

@HnswIndex(dimensions: 2)
@HnswIndex(dimensions: 2, distanceType: VectorDistanceType.geo)
@Property(type: PropertyType.floatVector)
List<double>? location;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ environment:
sdk: ^2.18.6

dependencies:
objectbox: ^4.0.3
objectbox: ^4.1.0

dev_dependencies:
build_runner: ^2.4.9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies:
flutter:
sdk: flutter

objectbox: ^4.0.3
objectbox: ^4.1.0
objectbox_flutter_libs: any
intl: any

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies:
flutter:
sdk: flutter

objectbox: ^4.0.3
objectbox: ^4.1.0
objectbox_flutter_libs: any
intl: any

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ android {
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
// minSdkVersion flutter.minSdkVersion
minSdkVersion 19 // ObjectBox requires at least SDK 19 (Android 4.4)
minSdkVersion 21 // ObjectBox Android requires Android 5.0 (API level 21)
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand Down
2 changes: 1 addition & 1 deletion objectbox/example/flutter/objectbox_demo/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ environment:
dependencies:
flutter:
sdk: flutter
objectbox: ^4.0.3
objectbox: ^4.1.0
objectbox_flutter_libs: any
intl: any
path_provider: ^2.0.10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ android {
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
// minSdkVersion flutter.minSdkVersion
minSdkVersion 19 // ObjectBox requires at least SDK 19 (Android 4.4)
minSdkVersion 21 // ObjectBox Android requires Android 5.0 (API level 21)
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand Down Expand Up @@ -82,5 +82,5 @@ dependencies {
// Add objectbox-android-objectbrowser only for debug builds.
// Warning: when objectbox_flutter_libs updates check if version
// needs update, e.g. check https://github.com/objectbox/objectbox-dart/releases.
debugImplementation("io.objectbox:objectbox-android-objectbrowser:4.0.3")
debugImplementation("io.objectbox:objectbox-android-objectbrowser:4.1.0")
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ environment:
dependencies:
flutter:
sdk: flutter
objectbox: ^4.0.3
objectbox: ^4.1.0
objectbox_flutter_libs: any
intl: any
path_provider: ^2.0.10 # 2.0.11+ requires Flutter 2.8.0
Expand Down
2 changes: 1 addition & 1 deletion objectbox/example/flutter/objectbox_demo_sync/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ environment:
dependencies:
flutter:
sdk: flutter
objectbox: ^4.0.3
objectbox: ^4.1.0
objectbox_sync_flutter_libs: any # For Sync support use this instead of objectbox_flutter_libs.
intl: any
path_provider: ^2.0.10
Expand Down
13 changes: 12 additions & 1 deletion objectbox/lib/src/annotations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,18 @@ enum VectorDistanceType {
/// The more negative the dot product, the higher the distance is (the farther the vectors are).
///
/// Value range: 0.0 - 2.0 (nonlinear; 0.0: nearest, 1.0: orthogonal, 2.0: farthest)
dotProductNonNormalized
dotProductNonNormalized,

/// For geospatial coordinates aka latitude/longitude pairs.
///
/// Note, that the vector dimension must be 2, with the latitude being the first element and longitude the second.
/// If the vector has more than 2 dimensions, the first 2 dimensions are used.
/// If the vector has fewer than 2 dimensions, the distance is zero.
///
/// Internally, this uses haversine distance.
///
/// Value range: 0 km - 6371 * π km (approx. 20015.09 km; half the Earth's circumference)
geo
}

/// Flags as a part of the [HnswIndex] configuration.
Expand Down
2 changes: 2 additions & 0 deletions objectbox/lib/src/modelinfo/model_hnsw_params.dart
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ extension ModelVectorDistanceType on VectorDistanceType {
return OBXVectorDistanceType.DotProduct;
} else if (this == VectorDistanceType.dotProductNonNormalized) {
return OBXVectorDistanceType.DotProductNonNormalized;
} else if (this == VectorDistanceType.geo) {
return OBXVectorDistanceType.Geo;
} else {
throw ArgumentError.value(this, "distanceType");
}
Expand Down
15 changes: 8 additions & 7 deletions objectbox/lib/src/native/bindings/bindings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,16 @@ ObjectBoxC? _tryObjectBoxLibFile() {

// Require the minimum C API version of all supported platform-specific
// libraries.
// Library | C API version | Core version
// objectbox-c | 4.0.2 | 4.0.2-2024-10-15
// ObjectBox Swift 4.0.1 | 4.0.2 | 4.0.2-2024-10-15
// objectbox-android 4.0.3 | 4.0.1 | 4.0.2-2024-10-15
// Library | C API | Core
// ------------------------|-------|-----------------
// objectbox-c | 4.1.0 | 4.1.0-2025-01-28
// ObjectBox Swift 4.1.0 | 4.1.0 | 4.1.0-2025-01-30
// objectbox-android 4.1.0 | 4.1.0 | 4.1.0-2025-01-28
var _obxCminMajor = 4;
var _obxCminMinor = 0;
var _obxCminPatch = 1;
var _obxCminMinor = 1;
var _obxCminPatch = 0;
// Require minimum core version guaranteeing actual C API availability.
var _obxCoreMinVersion = "4.0.2-2024-10-15";
var _obxCoreMinVersion = "4.1.0-2025-01-28";

bool _isSupportedVersion(ObjectBoxC obxc) {
if (!obxc.version_is_at_least(_obxCminMajor, _obxCminMinor, _obxCminPatch)) {
Expand Down
Loading
Loading