Skip to content
Prev Previous commit
Next Next commit
Formatting and quotes around compile sdk equals
  • Loading branch information
reidbaker committed Mar 25, 2025
commit 263d5f6bf8f29aef509c7ea9b8900c837fb1f4f9
9 changes: 5 additions & 4 deletions script/tool/lib/src/gradle_check_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -426,14 +426,15 @@ for more details.''';
final String? compileSdkLine = gradleLines
.firstWhereOrNull((String line) => linePattern.hasMatch(line));
if (compileSdkLine == null) {
// Equals regex not found check for method pattern.
// Equals regex not found check for method pattern.
final RegExp compileSpacePattern = RegExp(r'^\s*compileSdk');
final String? methodAssignmentLine = gradleLines
.firstWhereOrNull((String line) => compileSpacePattern.hasMatch(line));
final String? methodAssignmentLine = gradleLines.firstWhereOrNull(
(String line) => compileSpacePattern.hasMatch(line));
if (methodAssignmentLine == null) {
printError('${indentation}No compileSdk or compileSdkVersion found.');
} else {
printError('${indentation}No compileSdk = found. Please use property assignment.');
printError(
'${indentation}No "compileSdk =" found. Please use property assignment.');
}
return false;
}
Expand Down
5 changes: 3 additions & 2 deletions script/tool/test/gradle_check_command_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1110,7 +1110,8 @@ dependencies {
includeLanguageVersion: true, usePropertyAssignment: false);
writeFakeManifest(package);
final RepositoryPackage example = package.getExamples().first;
writeFakeExampleBuildGradles(example, pluginName: packageName, usePropertyAssignment: false);
writeFakeExampleBuildGradles(example,
pluginName: packageName, usePropertyAssignment: false);
writeFakeManifest(example, isApp: true);

Error? commandError;
Expand All @@ -1123,7 +1124,7 @@ dependencies {
expect(
output,
containsAllInOrder(<Matcher>[
contains('No compileSdk = found. Please use property assignment.'),
contains('No "compileSdk =" found. Please use property assignment.'),
]),
);
});
Expand Down