diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1196fc193..5e00b46ed 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 @@ -110,8 +110,19 @@ 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 @@ -119,11 +130,11 @@ jobs: 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 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 209986ed8..980eaa8ee 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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: diff --git a/dev-doc/updating-examples.md b/dev-doc/updating-examples.md index 79663e947..d82e45dc2 100644 --- a/dev-doc/updating-examples.md +++ b/dev-doc/updating-examples.md @@ -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. diff --git a/objectbox/CHANGELOG.md b/objectbox/CHANGELOG.md index 910addf0a..8dd3f2cd4 100644 --- a/objectbox/CHANGELOG.md +++ b/objectbox/CHANGELOG.md @@ -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) diff --git a/objectbox/example/flutter/objectbox_demo/.gitignore b/objectbox/example/flutter/objectbox_demo/.gitignore index 30378e1a7..da6e72113 100644 --- a/objectbox/example/flutter/objectbox_demo/.gitignore +++ b/objectbox/example/flutter/objectbox_demo/.gitignore @@ -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 @@ -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 diff --git a/objectbox/example/flutter/objectbox_demo/.metadata b/objectbox/example/flutter/objectbox_demo/.metadata index 89866adfa..ef4bc2c73 100644 --- a/objectbox/example/flutter/objectbox_demo/.metadata +++ b/objectbox/example/flutter/objectbox_demo/.metadata @@ -1,11 +1,11 @@ # 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 @@ -13,23 +13,23 @@ project_type: app 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 diff --git a/objectbox/example/flutter/objectbox_demo/analysis_options.yaml b/objectbox/example/flutter/objectbox_demo/analysis_options.yaml index 61b6c4de1..0d2902135 100644 --- a/objectbox/example/flutter/objectbox_demo/analysis_options.yaml +++ b/objectbox/example/flutter/objectbox_demo/analysis_options.yaml @@ -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 diff --git a/objectbox/example/flutter/objectbox_demo/android/app/build.gradle b/objectbox/example/flutter/objectbox_demo/android/app/build.gradle index cb51c6ca8..74a66cd61 100644 --- a/objectbox/example/flutter/objectbox_demo/android/app/build.gradle +++ b/objectbox/example/flutter/objectbox_demo/android/app/build.gradle @@ -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()) { @@ -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' @@ -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 @@ -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 @@ -67,5 +70,4 @@ flutter { } dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } diff --git a/objectbox/example/flutter/objectbox_demo/android/app/src/debug/AndroidManifest.xml b/objectbox/example/flutter/objectbox_demo/android/app/src/debug/AndroidManifest.xml index 0357bd34b..399f6981d 100644 --- a/objectbox/example/flutter/objectbox_demo/android/app/src/debug/AndroidManifest.xml +++ b/objectbox/example/flutter/objectbox_demo/android/app/src/debug/AndroidManifest.xml @@ -1,5 +1,4 @@ - +