Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
21 changes: 16 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
# Can not use env variables here, only within 'steps'.
# For available versions see https://dart.dev/get-dart/archive
- 3.7.2
- 2.18.6 # Use latest bugfix release to get tooling fixes
- 3.5.4 # Use latest bugfix release to get tooling fixes
runs-on: ${{ matrix.os }}
steps:
- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 # v1.6.5
Expand Down Expand Up @@ -110,20 +110,31 @@ jobs:
# Pick a concrete version instead of "latest" to avoid builds breaking due to changes in new SDKs.
# Can not use env variables here, only within 'steps'.
# For available versions see https://docs.flutter.dev/release/archive
# NOTE Also update versions for Ubuntu below!
- 3.29.2
- 3.7.12 # Use latest bugfix release to get tooling fixes
- 3.24.5 # Use latest bugfix release to get tooling fixes
include:
# Test building for Android with highest supported JDK on latest Flutter SDK,
# lowest supported JDK on lowest supported Flutter SDK. (Android is only built if a Linux
# OS is detected, see integration-test.sh)
- os: ubuntu-24.04
flutter-version: 3.29.2
jdk: 21
- os: ubuntu-24.04
flutter-version: 3.24.5 # Use latest bugfix release to get tooling fixes
jdk: 17
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 # v2.16.0
with:
flutter-version: ${{ matrix.flutter-version }}
cache: true
# windows-2022 defaults to Java 8, but Android Plugin requires at least 11.
- uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4.4.0
- if: ${{ matrix.jdk }}
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4.4.0
with:
distribution: 'temurin'
java-version: '17'
java-version: ${{ matrix.jdk }}
- run: echo $PATH
- run: flutter --version
# https://docs.flutter.dev/desktop#additional-linux-requirements
Expand Down
5 changes: 3 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ stages:
variables:
# Test latest available and lowest supported SDK (see dev-doc/updating-dart-flutter-and-dependencies.md).
# # Pick a concrete version instead of "latest" to avoid builds breaking due to changes in new
# SDKs. For available versions see https://hub.docker.com/_/dart?tab=tags
# SDKs.
# For available versions see https://hub.docker.com/_/dart/tags and https://dart.dev/get-dart/archive
DART_VERSION_LATEST: '3.7.2'
DART_VERSION_LOWEST: '2.18.6' # Use latest bugfix release to get tooling fixes
DART_VERSION_LOWEST: '3.5.4' # Use latest bugfix release to get tooling fixes
DART_VERSION: $DART_VERSION_LATEST # Also used for caching, see .cache template

.common:
Expand Down
32 changes: 24 additions & 8 deletions dev-doc/updating-examples.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
# Updating Flutter examples

First, make sure to switch your Flutter SDK to the lowest version the ObjectBox packages support
(see pubspec.yaml files).
First, make sure to switch your Flutter SDK to the lowest version that should be supported
(at minimum what the Flutter packages require, see their pubspec.yaml files; but typically higher
due to dependency or tooling requirements):

Then, in the example directory delete the platform-specific directories.
```shell
# Make sure to close IDEs or tools using the Flutter or Dart SDK first.
# Then, in the Flutter SDK directory:
git checkout 3.16.9
flutter doctor
```

Then, run `flutter create --platforms=android,ios,linux,macos,windows .` to re-create these files.
Then, for an example in its directory delete the platform-specific directories and the

Then, remove the created default test files and manually review the changes and commit what's necessary.
- `.gitignore`
- `analysis_options.yaml`
- `pubspec.yaml`

Check changes do not break the example in any way, make additional changes as required.
files.

Compare against a clean Flutter template (run `create` in an empty folder) to see if updates to
other files like pubspec.yaml are needed.
Then, run `flutter create --platforms=android,ios,linux,macos,windows .` to create empty example
files.

Then, remove the created default widget test file. Review the changes, restore any required changes
(like in Podfile, build scripts, project files, the files mentioned above...). This can be helped by
running `flutter pub upgrade` and `flutter run` on each platform (with the same Flutter SDK version!).

Then, commit only what's necessary.

Then, adjust the other examples accordingly.
3 changes: 2 additions & 1 deletion objectbox/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## latest


* Examples: demos are compatible with JDK 21 included with Android Studio Ladybug or later, require
Flutter SDK 3.24 (with Dart SDK 3.5) or newer.

## 4.1.0 (2025-02-04)

Expand Down
6 changes: 0 additions & 6 deletions objectbox/example/flutter/objectbox_demo/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,10 @@ migrate_working_dir/
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/

# Web related
lib/generated_plugin_registrant.dart

# Symbolication related
app.*.symbols

Expand All @@ -46,8 +42,6 @@ app.*.map.json
/android/app/profile
/android/app/release

objectbox

# Not checking in Podfile.lock to avoid updating it for every
# ObjectBox release and to always build with latest dependencies on CI.
ios/Podfile.lock
Expand Down
30 changes: 15 additions & 15 deletions objectbox/example/flutter/objectbox_demo/.metadata
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled.
# This file should be version controlled and should not be manually edited.

version:
revision: 135454af32477f815a7525073027a3ff9eff1bfd
channel: unknown
revision: "41456452f29d64e8deb623a3c927524bcf9f111b"
channel: "[user-branch]"

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
- platform: android
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
- platform: ios
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
- platform: linux
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
- platform: macos
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
- platform: windows
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b

# User provided section

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
# and their documentation is published at https://dart.dev/lints.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
Expand Down
28 changes: 15 additions & 13 deletions objectbox/example/flutter/objectbox_demo/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
Expand All @@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) {
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
Expand All @@ -21,13 +22,16 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
namespace "com.example.objectbox_demo"
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
// ObjectBox: Flutter defaults to NDK 23.1.7779620, but
// - objectbox_flutter_libs requires Android NDK 25.1.8937393
// - path_provider_android requires Android NDK 25.1.8937393
// Until Flutter uses a newer version (https://github.com/flutter/flutter/commit/919bed6e0a18bd5b76fb581ede10121f8c14a6f7)
// manually set the required one:
// ndkVersion flutter.ndkVersion
ndkVersion = "25.1.8937393"

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -46,8 +50,7 @@ android {
applicationId "com.example.objectbox_demo"
// 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 21 // ObjectBox Android requires Android 5.0 (API level 21)
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand All @@ -67,5 +70,4 @@ flutter {
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.objectbox_demo">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.objectbox_demo">
<application
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:label="objectbox_demo"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.objectbox_demo">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
buildscript {
ext.kotlin_version = '1.7.0'
ext.kotlin_version = '1.9.24' // 1.7.10 -> 1.9.24 to get 1.9 metadata version
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
org.gradle.jvmargs=-Xmx1536M
org.gradle.jvmargs=-Xmx4G
android.useAndroidX=true
android.enableJetifier=true
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
34 changes: 26 additions & 8 deletions objectbox/example/flutter/objectbox_demo/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
include ':app'
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}
settings.ext.flutterSdkPath = flutterSdkPath()

def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")

assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
repositories {
google()
mavenCentral()
gradlePluginPortal()
}

def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
plugins {
id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false
}
}

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.2.1" apply false // 7.3.0 -> 8.2.1 to support JDK 21
}

include ":app"
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
<string>12.0</string>
</dict>
</plist>
3 changes: 3 additions & 0 deletions objectbox/example/flutter/objectbox_demo/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ target 'Runner' do
use_modular_headers!

flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end

post_install do |installer|
Expand Down
Loading
Loading