Skip to content

Commit f2cb379

Browse files
committed
update kotlin version handling in android build scripts for CI compatibility
1 parent 55ba4de commit f2cb379

3 files changed

Lines changed: 66 additions & 2 deletions

File tree

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Kotlin Version Compatibility
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- release/**
8+
pull_request:
9+
paths:
10+
- ".github/workflows/kotlin-version-compatibility.yml"
11+
- "packages/flutter/android/**"
12+
- "packages/flutter/example/android/**"
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
build-apk-kotlin-versions:
20+
name: "APK | Kotlin lang ${{ matrix.kotlin_language_version }}"
21+
runs-on: ubuntu-latest
22+
timeout-minutes: 30
23+
defaults:
24+
run:
25+
working-directory: packages/flutter/example
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
kotlin_language_version: ["1.7", "2.0", "2.3.0"]
30+
31+
env:
32+
KOTLIN_LANGUAGE_VERSION: ${{ matrix.kotlin_language_version }}
33+
34+
steps:
35+
- uses: actions/checkout@v5
36+
37+
- name: Setup Java
38+
uses: actions/setup-java@v4
39+
with:
40+
distribution: "temurin"
41+
java-version: "17"
42+
43+
- uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e # [email protected]
44+
with:
45+
channel: stable
46+
47+
- name: Flutter pub get
48+
run: flutter pub get
49+
50+
- name: Build APK with Kotlin language version ${{ matrix.kotlin_language_version }}
51+
run: flutter build apk --debug --target-platform=android-x64
52+
53+
- name: Verify build artifacts
54+
run: |
55+
if [ -f "build/app/outputs/flutter-apk/app-debug.apk" ]; then
56+
echo "APK build successful with Kotlin language version ${{ matrix.kotlin_language_version }}"
57+
ls -lh build/app/outputs/flutter-apk/app-debug.apk
58+
else
59+
echo "APK build failed - artifact not found"
60+
exit 1
61+
fi

packages/flutter/android/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ android {
5858
}
5959
kotlinOptions {
6060
jvmTarget = JavaVersion.VERSION_1_8
61-
languageVersion = "1.8"
6261
}
6362
}
6463

packages/flutter/example/android/app/build.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ android {
3434
}
3535
kotlinOptions {
3636
jvmTarget = JavaVersion.VERSION_1_8
37-
languageVersion = "1.8"
37+
// Allow CI to override Kotlin language version for compatibility testing
38+
def kotlinLanguageVersion = System.getenv("KOTLIN_LANGUAGE_VERSION")
39+
if (kotlinLanguageVersion != null) {
40+
languageVersion = kotlinLanguageVersion
41+
}
3842
}
3943

4044
compileSdkVersion 35

0 commit comments

Comments
 (0)