agpGradleCompatibility function
Implementation
Compatibility agpGradleCompatibility(String? agp, String? gradle) {
if (agp == null || gradle == null)
return const Compatibility(
'UNKNOWN', 'Compatibility could not be verified automatically.');
final rules = <String, String>{
'9.2': '9.4.1',
'9.1': '9.3.1',
'9.0': '9.1.0',
'8.13': '8.13',
'8.12': '8.13',
'8.11': '8.13',
'8.10': '8.11.1',
'8.9': '8.11.1',
'8.8': '8.10.2',
'8.7': '8.9',
'8.6': '8.7',
'8.5': '8.7',
'8.4': '8.6',
'8.3': '8.4',
'8.2': '8.2',
'8.1': '8.0',
'8.0': '8.0',
'7.4': '7.5',
'7.3': '7.4',
'7.2': '7.3.3',
'7.1': '7.2',
'7.0': '7.0'
};
final parts = agp.split('.');
final key = parts.length > 1 ? parts[0] + '.' + parts[1] : agp;
final required = rules[key];
if (required == null)
return const Compatibility(
'UNKNOWN', 'Compatibility could not be verified automatically.');
return _compare(gradle, required) >= 0
? const Compatibility('PASS', 'Compatible')
: Compatibility('ERROR', 'Required: Gradle >= ' + required);
}