updateGradleFilesInDir function
Get a list of all .gradle files in the directory and subfolders.
Implementation
void updateGradleFilesInDir(Directory workDir) {
workDir
.listSync(recursive: true, followLinks: false)
.whereType<Directory>()
.where((directory) =>
directory.path.endsWith('/android') &&
!directory.path.contains('.dart'))
.where((directory) => !directory.path.contains('_deprecated'))
.forEach((androidFolder) async {
try {
final updated = await updateGradleFiles(androidFolder);
if (updated == Result.noAppBuildFile || updated == Result.updated) {
// Already updated or this is a plugin (should not be updated)
} else if (updated == Result.success) {
stdout.writeln('Updated ${androidFolder.path}');
} else {
stdout.writeln('NOT Updated ${androidFolder.path}');
}
} catch (error, st) {
stdout
..writeln('Error ${androidFolder.path}')
..writeln(error.toString())
..writeln(st.toString());
}
});
}