diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index fab89d1e..1536b528 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,7 +12,7 @@ on: jobs: test-ios: - runs-on: macos-13 + runs-on: macos-14 defaults: run: working-directory: "./example" @@ -21,11 +21,14 @@ jobs: - uses: actions/setup-node@v4 with: node-version-file: "./.tool-versions" - - run: sudo xcode-select -s /Applications/Xcode_15.2.app/Contents/Developer + # Xcode_16.2.app is available, but it does not have any simulator pre-installed. + # So it is not really usable. + # Let's use Xcode_16.1.app instead. + - run: sudo xcode-select -s /Applications/Xcode_16.1.app/Contents/Developer - uses: subosito/flutter-action@v2 with: # This has to be kept in sync with .tool-versions - flutter-version: '3.24.2' + flutter-version: '3.27.1' channel: 'stable' # This action takes 1m30s to finish. Enable cache to make it shorter. cache: true @@ -36,7 +39,7 @@ jobs: - run: flutter build ipa --no-codesign test-android: - runs-on: macos-13 + runs-on: macos-14 defaults: run: working-directory: "./example" @@ -45,14 +48,14 @@ jobs: - uses: actions/setup-node@v4 with: node-version-file: "./.tool-versions" - # https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#java + # https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md#java - name: Set java version run: | - echo "JAVA_HOME=$JAVA_HOME_17_X64" >> $GITHUB_ENV + echo "JAVA_HOME=$JAVA_HOME_21_arm64" >> $GITHUB_ENV - uses: subosito/flutter-action@v2 with: # This has to be kept in sync with .tool-versions - flutter-version: '3.24.2' + flutter-version: '3.27.1' channel: 'stable' # This action takes 1m30s to finish. Enable cache to make it shorter. cache: true @@ -71,7 +74,7 @@ jobs: - uses: subosito/flutter-action@v2 with: # This has to be kept in sync with .tool-versions - flutter-version: '3.24.2' + flutter-version: '3.27.1' channel: 'stable' # This action takes 1m30s to finish. Enable cache to make it shorter. cache: true @@ -93,9 +96,10 @@ jobs: publish_dir: ./doc/api deploy-ios: - runs-on: macos-13 + runs-on: macos-14 needs: ["test-ios"] - if: ${{ github.ref == 'refs/heads/main' }} + # We cannot build in PRs because secrets are not available in PRs. + if: ${{ github.repository == 'authgear/authgear-sdk-flutter' && github.ref == 'refs/heads/main' }} defaults: run: working-directory: "./example" @@ -104,12 +108,15 @@ jobs: - uses: actions/setup-node@v4 with: node-version-file: "./.tool-versions" - - run: sudo xcode-select -s /Applications/Xcode_15.2.app/Contents/Developer + # Xcode_16.2.app is available, but it does not have any simulator pre-installed. + # So it is not really usable. + # Let's use Xcode_16.1.app instead. + - run: sudo xcode-select -s /Applications/Xcode_16.1.app/Contents/Developer - run: npm install -g appcenter-cli - uses: subosito/flutter-action@v2 with: # This has to be kept in sync with .tool-versions - flutter-version: '3.24.2' + flutter-version: '3.27.1' channel: 'stable' # This action takes 1m30s to finish. Enable cache to make it shorter. cache: true @@ -119,23 +126,31 @@ jobs: - run: dart format --set-exit-if-changed lib - name: Prepare certificate and provisioning profile env: + IOS_CERTIFICATE_PASSWORD: ${{ secrets.IOS_CERTIFICATE_PASSWORD }} IOS_CERTIFICATE_BASE64: ${{ secrets.IOS_CERTIFICATE_BASE64 }} IOS_PROVISIONING_PROFILE_BASE64: ${{ secrets.IOS_PROVISIONING_PROFILE_BASE64 }} + IOS_KEYCHAIN_PASSWORD: ${{ secrets.IOS_KEYCHAIN_PASSWORD }} run: | CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db + # import certificate and provisioning profile from secrets echo -n "$IOS_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH + echo -n "$IOS_PROVISIONING_PROFILE_BASE64" | base64 --decode -o $PP_PATH - security create-keychain -p "" $KEYCHAIN_PATH - security set-keychain-settings $KEYCHAIN_PATH - security unlock-keychain -p "" $KEYCHAIN_PATH + # create temporary keychain + security create-keychain -p "$IOS_KEYCHAIN_PASSWORD" $KEYCHAIN_PATH + security set-keychain-settings -lut 21600 $KEYCHAIN_PATH + security unlock-keychain -p "$IOS_KEYCHAIN_PASSWORD" $KEYCHAIN_PATH - security import $CERTIFICATE_PATH -P "" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH + # import certificate to keychain + security import $CERTIFICATE_PATH -P "$IOS_CERTIFICATE_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH + security set-key-partition-list -S apple-tool:,apple: -k "$IOS_KEYCHAIN_PASSWORD" $KEYCHAIN_PATH security list-keychain -d user -s $KEYCHAIN_PATH + # apply provisioning profile mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles - name: Build .ipa @@ -148,9 +163,10 @@ jobs: run: appcenter distribute release --debug --silent --file "./build/ios/ipa/Authgear Flutter.ipa" --store "App Store Connect Users" --app "Oursky/Authgear-Demo-Flutter-iOS" --release-notes "no release notes" deploy-android: - runs-on: macos-13 + runs-on: macos-14 needs: ["test-android"] - if: ${{ github.ref == 'refs/heads/main' }} + # We cannot build in PRs because secrets are not available in PRs. + if: ${{ github.repository == 'authgear/authgear-sdk-flutter' && github.ref == 'refs/heads/main' }} defaults: run: working-directory: "./example" @@ -159,15 +175,15 @@ jobs: - uses: actions/setup-node@v4 with: node-version-file: "./.tool-versions" - # https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#java + # https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md#java - name: Set java version run: | - echo "JAVA_HOME=$JAVA_HOME_17_X64" >> $GITHUB_ENV + echo "JAVA_HOME=$JAVA_HOME_21_arm64" >> $GITHUB_ENV - run: npm install -g appcenter-cli - uses: subosito/flutter-action@v2 with: # This has to be kept in sync with .tool-versions - flutter-version: '3.24.2' + flutter-version: '3.27.1' channel: 'stable' # This action takes 1m30s to finish. Enable cache to make it shorter. cache: true diff --git a/.tool-versions b/.tool-versions index 20458b5e..0b3b8c0e 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,3 +1,3 @@ -flutter 3.24.2-stable -nodejs 20.17.0 -ruby 3.3.3 +flutter 3.27.1-stable +nodejs 20.18.1 +ruby 3.3.6 diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 8b2c2bf8..5a3913a4 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -1,40 +1,22 @@ -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -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' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' +plugins { + id "com.android.application" + id "kotlin-android" + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id "dev.flutter.flutter-gradle-plugin" } -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - android { - compileSdkVersion flutter.compileSdkVersion + namespace = "com.authgear.exampleapp.flutter" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = JavaVersion.VERSION_1_8 } sourceSets { @@ -42,14 +24,13 @@ android { } defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.authgear.exampleapp.flutter" + applicationId = "com.authgear.exampleapp.flutter" // minSdkVersion flutter.minSdkVersion // 21 is required to use androidx.security - minSdkVersion 21 - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName + minSdk = 21 + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName } signingConfigs { @@ -64,6 +45,7 @@ android { buildTypes { release { signingConfig signingConfigs.release + proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" } } } @@ -73,6 +55,5 @@ flutter { } dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "com.tencent.mm.opensdk:wechat-sdk-android:6.8.0" } diff --git a/example/android/app/proguard-rules.pro b/example/android/app/proguard-rules.pro new file mode 100644 index 00000000..cc7f9380 --- /dev/null +++ b/example/android/app/proguard-rules.pro @@ -0,0 +1,8 @@ +# When I run `flutter build apk ...`, it refuses to build and ask me to add these rules. +# So I did. +-dontwarn com.google.errorprone.annotations.CanIgnoreReturnValue +-dontwarn com.google.errorprone.annotations.CheckReturnValue +-dontwarn com.google.errorprone.annotations.Immutable +-dontwarn com.google.errorprone.annotations.RestrictedApi +-dontwarn javax.annotation.Nullable +-dontwarn javax.annotation.concurrent.GuardedBy diff --git a/example/android/app/src/debug/AndroidManifest.xml b/example/android/app/src/debug/AndroidManifest.xml index ebc6d234..16c8b173 100644 --- a/example/android/app/src/debug/AndroidManifest.xml +++ b/example/android/app/src/debug/AndroidManifest.xml @@ -1,4 +1,3 @@ - + diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index b932a1fd..76018b59 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ - + + diff --git a/example/android/build.gradle b/example/android/build.gradle index 79ce13b5..bc157bd1 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,19 +1,3 @@ -buildscript { - // Flutter 3.24.2 requires kotlin to be 1.7.x - // As of 2024-09-06, the latest kotlin 1.7.x is 1.7.21 - // See https://kotlinlang.org/docs/releases.html#release-details - ext.kotlin_version = '1.7.21' - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:7.3.1' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - allprojects { repositories { google() diff --git a/example/android/gradle.properties b/example/android/gradle.properties index 94adc3a3..25971708 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -1,3 +1,3 @@ -org.gradle.jvmargs=-Xmx1536M +org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError android.useAndroidX=true android.enableJetifier=true diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index cfe88f69..7bb2df6b 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Fri Jun 23 08:50:38 CEST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip diff --git a/example/android/settings.gradle b/example/android/settings.gradle index 44e62bcf..b9e43bd3 100644 --- a/example/android/settings.gradle +++ b/example/android/settings.gradle @@ -1,11 +1,25 @@ -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 + }() -def localPropertiesFile = new File(rootProject.projectDir, "local.properties") -def properties = new Properties() + includeBuild("$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-plugin-loader" version "1.0.0" + id "com.android.application" version "8.1.0" apply false + id "org.jetbrains.kotlin.android" version "1.8.22" apply false +} + +include ":app" diff --git a/example/pubspec.lock b/example/pubspec.lock index 20d09dec..4bcd90b7 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -37,10 +37,10 @@ packages: dependency: transitive description: name: collection - sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf url: "https://pub.dev" source: hosted - version: "1.18.0" + version: "1.19.0" crypto: dependency: transitive description: @@ -92,7 +92,7 @@ packages: path: ".." relative: true source: path - version: "1.7.0" + version: "1.8.0" flutter_lints: dependency: "direct dev" description: @@ -131,18 +131,18 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06" url: "https://pub.dev" source: hosted - version: "10.0.5" + version: "10.0.7" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379" url: "https://pub.dev" source: hosted - version: "3.0.5" + version: "3.0.8" leak_tracker_testing: dependency: transitive description: @@ -291,7 +291,7 @@ packages: dependency: transitive description: flutter source: sdk - version: "0.0.99" + version: "0.0.0" source_span: dependency: transitive description: @@ -304,10 +304,10 @@ packages: dependency: transitive description: name: stack_trace - sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377" url: "https://pub.dev" source: hosted - version: "1.11.1" + version: "1.12.0" stream_channel: dependency: transitive description: @@ -320,10 +320,10 @@ packages: dependency: transitive description: name: string_scanner - sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.0" term_glyph: dependency: transitive description: @@ -336,10 +336,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" + sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c" url: "https://pub.dev" source: hosted - version: "0.7.2" + version: "0.7.3" typed_data: dependency: transitive description: @@ -360,10 +360,10 @@ packages: dependency: transitive description: name: vm_service - sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" + sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b url: "https://pub.dev" source: hosted - version: "14.2.5" + version: "14.3.0" web: dependency: transitive description: diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..b03aadb3 --- /dev/null +++ b/flake.lock @@ -0,0 +1,64 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": [ + "systems" + ] + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1737525964, + "narHash": "sha256-3wFonKmNRWKq1himW9N3TllbeGIHFACI5vmLpk6moF8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5757bbb8bd7c0630a0cc4bb19c47e588db30b97c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "systems": "systems" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..56abda9c --- /dev/null +++ b/flake.nix @@ -0,0 +1,35 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + systems.url = "github:nix-systems/default"; + flake-utils = { + url = "github:numtide/flake-utils"; + inputs.systems.follows = "systems"; + }; + }; + + outputs = + { + nixpkgs, + flake-utils, + ... + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + devShells.default = pkgs.mkShell { + packages = [ + # 20.18.1 + pkgs.nodejs_20 + # 3.3.6 + pkgs.ruby_3_3 + # 3.27.1 + pkgs.flutter327 + ]; + }; + } + ); +} diff --git a/pubspec.yaml b/pubspec.yaml index 0852fca2..44598a74 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_authgear description: Authgear SDK for Flutter -version: 1.7.0 +version: 1.8.0 homepage: https://www.authgear.com repository: https://github.com/authgear/authgear-sdk-flutter documentation: https://authgear.github.io/authgear-sdk-flutter/