Skip to content

Commit

Permalink
android: improve flutter version compare in gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed Aug 30, 2024
1 parent 6b6c2c1 commit 8fb6fd9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ def flutterSdkVersion = {
return version.text.trim()
}()

println "flutterSdkVersion: ${flutterSdkVersion}"

def preprocessJava(Map textMap) {
def f = file('src/main/java/com/mediadevkit/fvp/FvpPlugin.java')
assert f.exists(), path + "not found"
Expand All @@ -116,7 +114,10 @@ def preprocessJava(Map textMap) {
}
}
// VersionNumber is deprecated
if (Float.parseFloat(flutterSdkVersion.replaceAll('\\.[0-9]*$', '')) < 3.24) {
// 3.24.1, 3.24.0-1.0.pre.509 // Float.parseFloat(flutterSdkVersion.replaceAll('(\\d+\\.\\d+).*', '$1'))
def flutterSdkVersionInt = flutterSdkVersion.split('\\D')[[0, 1, 2]].inject(0, (a, b) -> 100*a + Integer.parseInt(b))
println "flutterSdkVersion: ${flutterSdkVersion}, ${flutterSdkVersionInt}"
if (flutterSdkVersionInt < 32400) {
println 'Impeller is not perfect for flutter < 3.24'
preprocessJava(['//// FLUTTER_3.24_BEGIN': '/\\*// FLUTTER_3.24_BEGIN-', '//// FLUTTER_3.24_END': '\\*/// FLUTTER_3.24_END-'])
} else {
Expand Down

0 comments on commit 8fb6fd9

Please sign in to comment.