Skip to content

Commit 5e7cb8c

Browse files
committed
ci: add AGP9 compatibility checks in CI
1 parent a7eec5a commit 5e7cb8c

2 files changed

Lines changed: 52 additions & 0 deletions

File tree

.github/workflows/android.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,29 @@ jobs:
143143
path: |
144144
~/.android/avd/*
145145
~/.android/adb*
146+
147+
agp9-compatibility:
148+
runs-on: ubuntu-latest
149+
timeout-minutes: 30
150+
steps:
151+
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
152+
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b
153+
with:
154+
distribution: 'temurin'
155+
java-version: '21'
156+
- uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff
157+
with:
158+
channel: 'stable'
159+
cache: true
160+
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:"
161+
pub-cache-key: "flutter-pub-:os:-:channel:-:version:-:arch:-:hash:"
162+
- uses: bluefireteam/melos-action@705015c3d2bc4ab94201ac24accb2bbe070cf533
163+
with:
164+
run-bootstrap: false
165+
melos-version: '5.3.0'
166+
- name: 'Bootstrap tests package'
167+
run: melos bootstrap --scope tests
168+
- name: Gradle cache
169+
uses: gradle/actions/setup-gradle@v4
170+
- name: 'Build tests app with AGP 9'
171+
run: bash ./.github/workflows/scripts/agp9-compatibility.sh
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
AGP_VERSION="${AGP_VERSION:-9.0.1}"
5+
GRADLE_VERSION="${GRADLE_VERSION:-9.1.0}"
6+
7+
TEST_ANDROID_DIR="tests/android"
8+
9+
perl -0pi -e "s/id \"com\.android\.application\" version \"[^\"]+\" apply false/id \"com.android.application\" version \"$AGP_VERSION\" apply false/" \
10+
"$TEST_ANDROID_DIR/settings.gradle"
11+
12+
perl -0pi -e "s#distributionUrl=https\\\\://services.gradle.org/distributions/gradle-[^-]+-all.zip#distributionUrl=https\\\\://services.gradle.org/distributions/gradle-$GRADLE_VERSION-all.zip#" \
13+
"$TEST_ANDROID_DIR/gradle/wrapper/gradle-wrapper.properties"
14+
15+
# AGP 9 has built-in Kotlin support. Keep the compatibility check focused on
16+
# FlutterFire plugins by applying the same migration to the test app at runtime.
17+
perl -0pi -e 's/\n\s*id "kotlin-android"\n/\n/' "$TEST_ANDROID_DIR/app/build.gradle"
18+
perl -0pi -e 's/\n\s*kotlinOptions \{\n\s*jvmTarget = JavaVersion\.VERSION_17\n\s*\}\n/\n/' "$TEST_ANDROID_DIR/app/build.gradle"
19+
20+
grep -q "id \"com.android.application\" version \"$AGP_VERSION\" apply false" "$TEST_ANDROID_DIR/settings.gradle"
21+
grep -q "gradle-$GRADLE_VERSION-all.zip" "$TEST_ANDROID_DIR/gradle/wrapper/gradle-wrapper.properties"
22+
! grep -q 'id "kotlin-android"' "$TEST_ANDROID_DIR/app/build.gradle"
23+
! grep -q 'kotlinOptions' "$TEST_ANDROID_DIR/app/build.gradle"
24+
25+
cd tests
26+
flutter build apk --debug --dart-define=CI=true --no-android-gradle-daemon

0 commit comments

Comments
 (0)