diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 6e571bc14b06..32e197c1ff80 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -18,9 +18,55 @@ updates: - "autosubmit" - package-ecosystem: "gradle" - directory: "/packages/animations/example/android/app" - commit-message: - prefix: "[animations]" + directories: + - /packages/animations/example/android/app + - /packages/camera/camera_android/example/android/app + - /packages/camera/camera_android_camerax/example/android/app + - /packages/camera/camera/example/android/app + - /packages/espresso/example/android/app + - /packages/extension_google_sign_in_as_googleapis_auth/example/android/app + - /packages/file_selector/file_selector/example/android/app + - /packages/file_selector/file_selector_android/example/android/app + - /packages/flutter_adaptive_scaffold/example/android/app + - /packages/flutter_image/example/android/app + - /packages/flutter_markdown/example/android/app + - /packages/flutter_plugin_android_lifecycle/example/android/app + - /packages/go_router/example/android/app + - /packages/google_maps_flutter/google_maps_flutter/example/android/app + - /packages/google_maps_flutter/google_maps_flutter_android/example/android/app + - /packages/google_sign_in/google_sign_in/example/android/app + - /packages/google_sign_in/google_sign_in_android/example/android/app + - /packages/in_app_purchase/in_app_purchase_android/example/android/app + - /packages/in_app_purchase/in_app_purchase/example/android/app + - /packages/interactive_media_ads/example/android/app + - /packages/image_picker/image_picker/example/android/app + - /packages/image_picker/image_picker_android/example/android/app + - /packages/local_auth/local_auth_android/example/android/app + - /packages/local_auth/local_auth/example/android/app + - /packages/palette_generator/example/android/app + - /packages/path_provider/path_provider/example/android/app + - /packages/path_provider/path_provider_android/example/android/app + - /packages/platform/example/android/app + - /packages/pigeon/example/app/android/app + - /packages/pigeon/platform_tests/test_plugin/example/android/app + - /packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/app + - /packages/quick_actions/quick_actions_android/example/android/app + - /packages/quick_actions/quick_actions/example/android/app + - /packages/rfw/example/hello/android/app + - /packages/rfw/example/local/android/app + - /packages/rfw/example/remote/android/app + - /packages/shared_preferences/shared_preferences/example/android/app + - /packages/shared_preferences/shared_preferences_android/example/android/app + - /packages/two_dimensional_scrollables/example/android/app + - /packages/url_launcher/url_launcher_android/example/android/app + - /packages/url_launcher/url_launcher/example/android/app + - /packages/video_player/video_player/example/android/app + - /packages/video_player/video_player_android/example/android/app + - /packages/webview_flutter/webview_flutter/example/android/app + - /packages/webview_flutter/webview_flutter_android/example/android/app + - /third_party/packages/flutter_svg/example/android/app + commit-message: + prefix: "[gradle]" schedule: interval: "weekly" open-pull-requests-limit: 10 @@ -47,17 +93,6 @@ updates: - dependency-name: "org.robolectric:*" update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" - directory: "/packages/camera/camera_android/example/android/app" - commit-message: - prefix: "[camera]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" directory: "/packages/camera/camera_android_camerax/android" commit-message: @@ -77,28 +112,6 @@ updates: - dependency-name: "org.robolectric:*" update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" - directory: "/packages/camera/camera_android_camerax/example/android/app" - commit-message: - prefix: "[camera]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - - package-ecosystem: "gradle" - directory: "/packages/camera/camera/example/android/app" - commit-message: - prefix: "[camera]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" directory: "/packages/espresso/android" commit-message: @@ -118,39 +131,6 @@ updates: - dependency-name: "org.robolectric:*" update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" - directory: "/packages/espresso/example/android/app" - commit-message: - prefix: "[espresso]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - - package-ecosystem: "gradle" - directory: "/packages/extension_google_sign_in_as_googleapis_auth/example/android/app" - commit-message: - prefix: "[ext_sign_in]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - - package-ecosystem: "gradle" - directory: "/packages/file_selector/file_selector/example/android/app" - commit-message: - prefix: "[file_selector]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" directory: "/packages/file_selector/file_selector_android/android" commit-message: @@ -170,50 +150,6 @@ updates: - dependency-name: "org.robolectric:*" update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" - directory: "/packages/file_selector/file_selector_android/example/android/app" - commit-message: - prefix: "[file_selector]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - - package-ecosystem: "gradle" - directory: "/packages/flutter_adaptive_scaffold/example/android/app" - commit-message: - prefix: "[scaffold]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - - package-ecosystem: "gradle" - directory: "/packages/flutter_image/example/android/app" - commit-message: - prefix: "[flutter_image]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - - package-ecosystem: "gradle" - directory: "/packages/flutter_markdown/example/android/app" - commit-message: - prefix: "[markdown]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" directory: "/packages/flutter_plugin_android_lifecycle/android" commit-message: @@ -233,39 +169,6 @@ updates: - dependency-name: "org.robolectric:*" update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" - directory: "/packages/flutter_plugin_android_lifecycle/example/android/app" - commit-message: - prefix: "[lifecycle]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - - package-ecosystem: "gradle" - directory: "/packages/go_router/example/android/app" - commit-message: - prefix: "[go_router]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - - package-ecosystem: "gradle" - directory: "/packages/google_maps_flutter/google_maps_flutter/example/android/app" - commit-message: - prefix: "[google_maps]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" directory: "/packages/google_maps_flutter/google_maps_flutter_android/android" commit-message: @@ -285,28 +188,6 @@ updates: - dependency-name: "org.robolectric:*" update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" - directory: "/packages/google_maps_flutter/google_maps_flutter_android/example/android/app" - commit-message: - prefix: "[google_maps]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - - package-ecosystem: "gradle" - directory: "/packages/google_sign_in/google_sign_in/example/android/app" - commit-message: - prefix: "[sign_in]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" directory: "/packages/google_sign_in/google_sign_in_android/android" commit-message: @@ -326,17 +207,6 @@ updates: - dependency-name: "org.robolectric:*" update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" - directory: "/packages/google_sign_in/google_sign_in_android/example/android/app" - commit-message: - prefix: "[sign_in]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" directory: "/packages/in_app_purchase/in_app_purchase_android/android" commit-message: @@ -356,28 +226,6 @@ updates: - dependency-name: "org.robolectric:*" update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" - directory: "/packages/in_app_purchase/in_app_purchase_android/example/android/app" - commit-message: - prefix: "[in_app_pur]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - - package-ecosystem: "gradle" - directory: "/packages/in_app_purchase/in_app_purchase/example/android/app" - commit-message: - prefix: "[in_app_pur]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" directory: "/packages/interactive_media_ads/android" commit-message: @@ -395,28 +243,6 @@ updates: - dependency-name: "androidx.test:*" update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" - directory: "/packages/interactive_media_ads/example/android/app" - commit-message: - prefix: "[interactive_media_ads]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - - package-ecosystem: "gradle" - directory: "/packages/image_picker/image_picker/example/android/app" - commit-message: - prefix: "[image_picker]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" directory: "/packages/image_picker/image_picker_android/android" commit-message: @@ -436,17 +262,6 @@ updates: - dependency-name: "org.robolectric:*" update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" - directory: "/packages/image_picker/image_picker_android/example/android/app" - commit-message: - prefix: "[image_picker]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" directory: "/packages/local_auth/local_auth_android/android" commit-message: @@ -466,50 +281,6 @@ updates: - dependency-name: "org.robolectric:*" update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" - directory: "/packages/local_auth/local_auth_android/example/android/app" - commit-message: - prefix: "[local_auth]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - - package-ecosystem: "gradle" - directory: "/packages/local_auth/local_auth/example/android/app" - commit-message: - prefix: "[local_auth]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - - package-ecosystem: "gradle" - directory: "/packages/palette_generator/example/android/app" - commit-message: - prefix: "[palette_gen]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - - package-ecosystem: "gradle" - directory: "/packages/path_provider/path_provider/example/android/app" - commit-message: - prefix: "[path_provider]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" directory: "/packages/path_provider/path_provider_android/android" commit-message: @@ -529,47 +300,6 @@ updates: - dependency-name: "org.robolectric:*" update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" - directory: "/packages/path_provider/path_provider_android/example/android/app" - commit-message: - prefix: "[path_provider]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - - package-ecosystem: "gradle" - directory: "/packages/pigeon/example/app/android/app" - commit-message: - prefix: "[pigeon]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "com.android.tools.build:gradle" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - dependency-name: "junit:junit" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - dependency-name: "org.mockito:*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - dependency-name: "androidx.test:*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - dependency-name: "org.robolectric:*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - - package-ecosystem: "gradle" - directory: "/packages/platform/example/android/app" - commit-message: - prefix: "[platform]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" directory: "/packages/pigeon/platform_tests/test_plugin/android" commit-message: @@ -589,17 +319,6 @@ updates: - dependency-name: "org.robolectric:*" update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" - directory: "/packages/pigeon/platform_tests/test_plugin/example/android/app" - commit-message: - prefix: "[pigeon]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" directory: "/packages/pigeon/platform_tests/alternate_language_test_plugin/android" commit-message: @@ -619,17 +338,6 @@ updates: - dependency-name: "org.robolectric:*" update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" - directory: "/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/app" - commit-message: - prefix: "[pigeon]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" directory: "/packages/quick_actions/quick_actions_android/android" commit-message: @@ -649,72 +357,6 @@ updates: - dependency-name: "org.robolectric:*" update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" - directory: "/packages/quick_actions/quick_actions_android/example/android/app" - commit-message: - prefix: "[quick_actions]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - - package-ecosystem: "gradle" - directory: "/packages/quick_actions/quick_actions/example/android/app" - commit-message: - prefix: "[quick_actions]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - - package-ecosystem: "gradle" - directory: "/packages/rfw/example/hello/android/app" - commit-message: - prefix: "[rfw]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - - package-ecosystem: "gradle" - directory: "/packages/rfw/example/local/android/app" - commit-message: - prefix: "[rfw]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - - package-ecosystem: "gradle" - directory: "/packages/rfw/example/remote/android/app" - commit-message: - prefix: "[rfw]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - - package-ecosystem: "gradle" - directory: "/packages/shared_preferences/shared_preferences/example/android/app" - commit-message: - prefix: "[shared_pref]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" directory: "/packages/shared_preferences/shared_preferences_android/android" commit-message: @@ -734,28 +376,6 @@ updates: - dependency-name: "org.robolectric:*" update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" - directory: "/packages/shared_preferences/shared_preferences_android/example/android/app" - commit-message: - prefix: "[shared_pref]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - - package-ecosystem: "gradle" - directory: "/packages/two_dimensional_scrollables/example/android/app" - commit-message: - prefix: "[2D_scrollables]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: [ "version-update:semver-minor", "version-update:semver-patch" ] - - package-ecosystem: "gradle" directory: "/packages/url_launcher/url_launcher_android/android" commit-message: @@ -775,39 +395,6 @@ updates: - dependency-name: "org.robolectric:*" update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" - directory: "/packages/url_launcher/url_launcher_android/example/android/app" - commit-message: - prefix: "[url_launcher]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - - package-ecosystem: "gradle" - directory: "/packages/url_launcher/url_launcher/example/android/app" - commit-message: - prefix: "[url_launcher]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - - package-ecosystem: "gradle" - directory: "/packages/video_player/video_player/example/android/app" - commit-message: - prefix: "[video_player]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" directory: "/packages/video_player/video_player_android/android" commit-message: @@ -827,28 +414,6 @@ updates: - dependency-name: "org.robolectric:*" update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" - directory: "/packages/video_player/video_player_android/example/android/app" - commit-message: - prefix: "[video_player]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - - package-ecosystem: "gradle" - directory: "/packages/webview_flutter/webview_flutter/example/android/app" - commit-message: - prefix: "[webview]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - package-ecosystem: "gradle" directory: "/packages/webview_flutter/webview_flutter_android/android" commit-message: @@ -867,25 +432,3 @@ updates: update-types: ["version-update:semver-minor", "version-update:semver-patch"] - dependency-name: "org.robolectric:*" update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - - package-ecosystem: "gradle" - directory: "/packages/webview_flutter/webview_flutter_android/example/android/app" - commit-message: - prefix: "[webview]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] - - - package-ecosystem: "gradle" - directory: "/third_party/packages/flutter_svg/example/android/app" - commit-message: - prefix: "[flutter_svg]" - schedule: - interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-minor", "version-update:semver-patch"] diff --git a/script/tool/lib/src/dependabot_check_command.dart b/script/tool/lib/src/dependabot_check_command.dart index fc3238a76996..b4674a5cc0bf 100644 --- a/script/tool/lib/src/dependabot_check_command.dart +++ b/script/tool/lib/src/dependabot_check_command.dart @@ -56,10 +56,20 @@ class DependabotCheckCommand extends PackageLoopingCommand { const String typeKey = 'package-ecosystem'; const String dirKey = 'directory'; - _gradleDirs = entries + const String dirsKey = 'directories'; + final Iterable gradleEntries = entries .cast() - .where((YamlMap entry) => entry[typeKey] == 'gradle') - .map((YamlMap entry) => entry[dirKey] as String) + .where((YamlMap entry) => entry[typeKey] == 'gradle'); + final Iterable directoryEntries = + gradleEntries.map((YamlMap entry) => entry[dirKey] as String?); + final Iterable directoriesEntries = gradleEntries + .map((YamlMap entry) => entry[dirsKey] as YamlList?) + .expand((YamlList? list) => list?.nodes ?? []) + .cast() + .map((YamlScalar entry) => entry.value as String); + _gradleDirs = directoryEntries + .followedBy(directoriesEntries) + .whereType() .toSet(); } diff --git a/script/tool/test/dependabot_check_command_test.dart b/script/tool/test/dependabot_check_command_test.dart index 5a8e91d117fb..08a10ae6cc97 100644 --- a/script/tool/test/dependabot_check_command_test.dart +++ b/script/tool/test/dependabot_check_command_test.dart @@ -38,21 +38,32 @@ void main() { void setDependabotCoverage({ Iterable gradleDirs = const [], + bool useDirectoriesKey = false, }) { - final Iterable gradleEntries = - gradleDirs.map((String directory) => ''' + final String gradleEntries; + if (useDirectoriesKey) { + gradleEntries = ''' + - package-ecosystem: "gradle" + directories: +${gradleDirs.map((String directory) => ' - /$directory').join('\n')} + schedule: + interval: "daily" +'''; + } else { + gradleEntries = gradleDirs.map((String directory) => ''' - package-ecosystem: "gradle" directory: "/$directory" schedule: interval: "daily" -'''); +''').join('\n'); + } final File configFile = root.childDirectory('.github').childFile('dependabot.yml'); configFile.createSync(recursive: true); configFile.writeAsStringSync(''' version: 2 updates: -${gradleEntries.join('\n')} +$gradleEntries '''); } @@ -121,7 +132,7 @@ ${gradleEntries.join('\n')} ])); }); - test('passes for correct Gradle coverage', () async { + test('passes for correct Gradle coverage with single directory', () async { setDependabotCoverage(gradleDirs: [ 'packages/a_plugin/android', 'packages/a_plugin/example/android/app', @@ -142,4 +153,30 @@ ${gradleEntries.join('\n')} expect(output, containsAllInOrder([contains('Ran for 2 package(s)')])); }); + + test('passes for correct Gradle coverage with multiple directories', + () async { + setDependabotCoverage( + gradleDirs: [ + 'packages/a_plugin/android', + 'packages/a_plugin/example/android/app', + ], + useDirectoriesKey: true, + ); + final RepositoryPackage plugin = createFakePlugin('a_plugin', packagesDir); + // Test the plugin. + plugin.directory.childDirectory('android').createSync(recursive: true); + // And its example app. + plugin.directory + .childDirectory('example') + .childDirectory('android') + .childDirectory('app') + .createSync(recursive: true); + + final List output = + await runCapturingPrint(runner, ['dependabot-check']); + + expect(output, + containsAllInOrder([contains('Ran for 2 package(s)')])); + }); }