From 2b1cc574eaf701ce28fcd3fa87776896e84b548c Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Thu, 27 May 2021 20:54:06 -0700 Subject: [PATCH] Add pubspec convention checks (#3984) --- .cirrus.yml | 1 + .../example/pubspec.yaml | 8 +- packages/android_alarm_manager/pubspec.yaml | 25 +- packages/android_intent/example/pubspec.yaml | 8 +- packages/android_intent/pubspec.yaml | 11 +- packages/battery/battery/example/pubspec.yaml | 8 +- packages/battery/battery/pubspec.yaml | 11 +- .../battery_platform_interface/pubspec.yaml | 11 +- packages/camera/camera/example/pubspec.yaml | 8 +- .../connectivity/example/pubspec.yaml | 8 +- .../connectivity/connectivity/pubspec.yaml | 11 +- .../connectivity_for_web/pubspec.yaml | 9 +- .../connectivity_macos/example/pubspec.yaml | 8 +- .../connectivity_macos/pubspec.yaml | 11 +- .../pubspec.yaml | 11 +- .../device_info/example/pubspec.yaml | 8 +- packages/device_info/device_info/pubspec.yaml | 11 +- .../pubspec.yaml | 11 +- .../example/pubspec.yaml | 6 +- .../google_maps_flutter_web/pubspec.yaml | 2 +- .../google_sign_in/example/pubspec.yaml | 8 +- .../image_picker/example/pubspec.yaml | 8 +- .../in_app_purchase/example/pubspec.yaml | 8 +- .../example/pubspec.yaml | 8 +- .../in_app_purchase_ios/example/pubspec.yaml | 8 +- .../ios_platform_images/example/pubspec.yaml | 1 - packages/local_auth/example/pubspec.yaml | 8 +- packages/package_info/example/pubspec.yaml | 8 +- packages/package_info/pubspec.yaml | 11 +- .../path_provider/example/pubspec.yaml | 8 +- .../path_provider_macos/example/pubspec.yaml | 8 +- .../example/pubspec.yaml | 8 +- .../plugin_platform_interface/pubspec.yaml | 7 +- .../quick_actions/example/pubspec.yaml | 8 +- packages/sensors/example/pubspec.yaml | 8 +- packages/sensors/pubspec.yaml | 11 +- packages/share/example/pubspec.yaml | 8 +- packages/share/pubspec.yaml | 11 +- .../shared_preferences/example/pubspec.yaml | 8 +- .../example/pubspec.yaml | 8 +- .../example/pubspec.yaml | 8 +- .../url_launcher/example/pubspec.yaml | 8 +- .../url_launcher_linux/example/pubspec.yaml | 8 +- .../url_launcher_macos/example/pubspec.yaml | 8 +- .../url_launcher_windows/example/pubspec.yaml | 8 +- .../video_player/example/pubspec.yaml | 8 +- .../wifi_info_flutter/pubspec.yaml | 21 +- .../pubspec.yaml | 3 +- script/tool/CHANGELOG.md | 4 + script/tool/lib/src/main.dart | 15 +- .../tool/lib/src/pubspec_check_command.dart | 178 ++++++++++ script/tool/pubspec.yaml | 2 +- .../test/build_examples_command_test.dart | 14 - .../test/drive_examples_command_test.dart | 14 - .../tool/test/pubspec_check_command_test.dart | 334 ++++++++++++++++++ 55 files changed, 747 insertions(+), 234 deletions(-) create mode 100644 script/tool/lib/src/pubspec_check_command.dart create mode 100644 script/tool/test/pubspec_check_command_test.dart diff --git a/.cirrus.yml b/.cirrus.yml index cd67b2ad341b..f09c3a9419c9 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -51,6 +51,7 @@ task: - ./script/tool_runner.sh publish-check - name: format format_script: ./script/tool_runner.sh format --fail-on-change + pubspec_script: ./script/tool_runner.sh pubspec-check license_script: - dart script/tool/lib/src/main.dart license-check - name: test diff --git a/packages/android_alarm_manager/example/pubspec.yaml b/packages/android_alarm_manager/example/pubspec.yaml index b2a3838df958..821440c49659 100644 --- a/packages/android_alarm_manager/example/pubspec.yaml +++ b/packages/android_alarm_manager/example/pubspec.yaml @@ -2,6 +2,10 @@ name: android_alarm_manager_example description: Demonstrates how to use the android_alarm_manager plugin. publish_to: none +environment: + sdk: '>=2.12.0 <3.0.0' + flutter: ">=1.20.0" + dependencies: flutter: sdk: flutter @@ -27,7 +31,3 @@ dev_dependencies: flutter: uses-material-design: true - -environment: - sdk: '>=2.12.0 <3.0.0' - flutter: ">=1.20.0" diff --git a/packages/android_alarm_manager/pubspec.yaml b/packages/android_alarm_manager/pubspec.yaml index 8de81e400837..450fb914b739 100644 --- a/packages/android_alarm_manager/pubspec.yaml +++ b/packages/android_alarm_manager/pubspec.yaml @@ -1,17 +1,13 @@ name: android_alarm_manager description: Flutter plugin for accessing the Android AlarmManager service, and running Dart code in the background when alarms fire. +repository: https://github.com/flutter/plugins/tree/master/packages/android_alarm_manager +issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+android_alarm_manager%22 version: 2.0.2 -homepage: https://github.com/flutter/plugins/tree/master/packages/android_alarm_manager -dependencies: - flutter: - sdk: flutter - -dev_dependencies: - flutter_test: - sdk: flutter - pedantic: ^1.10.0 +environment: + sdk: '>=2.12.0 <3.0.0' + flutter: ">=1.20.0" flutter: plugin: @@ -20,6 +16,11 @@ flutter: package: io.flutter.plugins.androidalarmmanager pluginClass: AndroidAlarmManagerPlugin -environment: - sdk: '>=2.12.0 <3.0.0' - flutter: ">=1.20.0" +dependencies: + flutter: + sdk: flutter + +dev_dependencies: + flutter_test: + sdk: flutter + pedantic: ^1.10.0 diff --git a/packages/android_intent/example/pubspec.yaml b/packages/android_intent/example/pubspec.yaml index fc976088d610..42e59930ce64 100644 --- a/packages/android_intent/example/pubspec.yaml +++ b/packages/android_intent/example/pubspec.yaml @@ -2,6 +2,10 @@ name: android_intent_example description: Demonstrates how to use the android_intent plugin. publish_to: none +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.20.0" + dependencies: flutter: sdk: flutter @@ -23,7 +27,3 @@ dev_dependencies: # The following section is specific to Flutter. flutter: uses-material-design: true - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.20.0" diff --git a/packages/android_intent/pubspec.yaml b/packages/android_intent/pubspec.yaml index 1dcde33a6d27..793f82d4762d 100644 --- a/packages/android_intent/pubspec.yaml +++ b/packages/android_intent/pubspec.yaml @@ -1,8 +1,13 @@ name: android_intent description: Flutter plugin for launching Android Intents. Not supported on iOS. -homepage: https://github.com/flutter/plugins/tree/master/packages/android_intent +repository: https://github.com/flutter/plugins/tree/master/packages/android_intent +issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+android_intent%22 version: 2.0.2 +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.20.0" + flutter: plugin: platforms: @@ -22,7 +27,3 @@ dev_dependencies: sdk: flutter pedantic: ^1.10.0 build_runner: ^1.11.1 - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.20.0" diff --git a/packages/battery/battery/example/pubspec.yaml b/packages/battery/battery/example/pubspec.yaml index 15ba3ea829d6..e33dda9b86a3 100644 --- a/packages/battery/battery/example/pubspec.yaml +++ b/packages/battery/battery/example/pubspec.yaml @@ -2,6 +2,10 @@ name: battery_example description: Demonstrates how to use the battery plugin. publish_to: none +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.12.13+hotfix.5" + dependencies: flutter: sdk: flutter @@ -22,7 +26,3 @@ dev_dependencies: flutter: uses-material-design: true - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.12.13+hotfix.5" diff --git a/packages/battery/battery/pubspec.yaml b/packages/battery/battery/pubspec.yaml index 3fa7f8c3a762..05226e3f8029 100644 --- a/packages/battery/battery/pubspec.yaml +++ b/packages/battery/battery/pubspec.yaml @@ -1,9 +1,14 @@ name: battery description: Flutter plugin for accessing information about the battery state (full, charging, discharging) on Android and iOS. -homepage: https://github.com/flutter/plugins/tree/master/packages/battery/battery +repository: https://github.com/flutter/plugins/tree/master/packages/battery/battery +issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+battery%22 version: 2.0.3 +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.12.13+hotfix.5" + flutter: plugin: platforms: @@ -27,7 +32,3 @@ dev_dependencies: sdk: flutter pedantic: ^1.10.0 test: ^1.16.3 - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.12.13+hotfix.5" diff --git a/packages/battery/battery_platform_interface/pubspec.yaml b/packages/battery/battery_platform_interface/pubspec.yaml index 82f1bc798d84..461cd0bd88ea 100644 --- a/packages/battery/battery_platform_interface/pubspec.yaml +++ b/packages/battery/battery_platform_interface/pubspec.yaml @@ -1,10 +1,15 @@ name: battery_platform_interface description: A common platform interface for the battery plugin. -homepage: https://github.com/flutter/plugins/tree/master/packages/battery +repository: https://github.com/flutter/plugins/tree/master/packages/battery/battery_platform_interface +issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+battery%22 # NOTE: We strongly prefer non-breaking changes, even at the expense of a # less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes version: 2.0.1 +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.20.0" + dependencies: flutter: sdk: flutter @@ -16,7 +21,3 @@ dev_dependencies: sdk: flutter mockito: ^5.0.0 pedantic: ^1.10.0 - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.20.0" diff --git a/packages/camera/camera/example/pubspec.yaml b/packages/camera/camera/example/pubspec.yaml index 9375a973337d..eb8995e2f354 100644 --- a/packages/camera/camera/example/pubspec.yaml +++ b/packages/camera/camera/example/pubspec.yaml @@ -2,6 +2,10 @@ name: camera_example description: Demonstrates how to use the camera plugin. publish_to: none +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.22.0" + dependencies: camera: # When depending on this package from a real application you should use: @@ -26,7 +30,3 @@ dev_dependencies: flutter: uses-material-design: true - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.22.0" diff --git a/packages/connectivity/connectivity/example/pubspec.yaml b/packages/connectivity/connectivity/example/pubspec.yaml index 756d16b45e15..1707d3482a98 100644 --- a/packages/connectivity/connectivity/example/pubspec.yaml +++ b/packages/connectivity/connectivity/example/pubspec.yaml @@ -2,6 +2,10 @@ name: connectivity_example description: Demonstrates how to use the connectivity plugin. publish_to: none +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.12.13+hotfix.5" + dependencies: flutter: sdk: flutter @@ -23,7 +27,3 @@ dev_dependencies: flutter: uses-material-design: true - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.12.13+hotfix.5" diff --git a/packages/connectivity/connectivity/pubspec.yaml b/packages/connectivity/connectivity/pubspec.yaml index e96865d8919a..16e179cfa085 100644 --- a/packages/connectivity/connectivity/pubspec.yaml +++ b/packages/connectivity/connectivity/pubspec.yaml @@ -1,9 +1,14 @@ name: connectivity description: Flutter plugin for discovering the state of the network (WiFi & mobile/cellular) connectivity on Android and iOS. -homepage: https://github.com/flutter/plugins/tree/master/packages/connectivity/connectivity +repository: https://github.com/flutter/plugins/tree/master/packages/connectivity/connectivity +issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+connectivity%22 version: 3.0.6 +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.12.13+hotfix.5" + flutter: plugin: platforms: @@ -33,7 +38,3 @@ dev_dependencies: plugin_platform_interface: ^2.0.0 pedantic: ^1.10.0 test: ^1.16.3 - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.12.13+hotfix.5" diff --git a/packages/connectivity/connectivity_for_web/pubspec.yaml b/packages/connectivity/connectivity_for_web/pubspec.yaml index 5ece5ca7ab1f..5b05dd80d088 100644 --- a/packages/connectivity/connectivity_for_web/pubspec.yaml +++ b/packages/connectivity/connectivity_for_web/pubspec.yaml @@ -1,8 +1,13 @@ name: connectivity_for_web description: An implementation for the web platform of the Flutter `connectivity` plugin. This uses the NetworkInformation Web API, with a fallback to Navigator.onLine. repository: https://github.com/flutter/plugins/tree/master/packages/connectivity/connectivity_for_web +issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+connectivity%22 version: 0.4.0 +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.20.0" + flutter: plugin: platforms: @@ -20,7 +25,3 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.20.0" diff --git a/packages/connectivity/connectivity_macos/example/pubspec.yaml b/packages/connectivity/connectivity_macos/example/pubspec.yaml index c697d87e6123..0af2e1587b00 100644 --- a/packages/connectivity/connectivity_macos/example/pubspec.yaml +++ b/packages/connectivity/connectivity_macos/example/pubspec.yaml @@ -2,6 +2,10 @@ name: connectivity_example description: Demonstrates how to use the connectivity plugin. publish_to: none +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.10.0" + dependencies: flutter: sdk: flutter @@ -23,7 +27,3 @@ dev_dependencies: flutter: uses-material-design: true - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.10.0" diff --git a/packages/connectivity/connectivity_macos/pubspec.yaml b/packages/connectivity/connectivity_macos/pubspec.yaml index 437e5f4fa574..1e8842c7417a 100644 --- a/packages/connectivity/connectivity_macos/pubspec.yaml +++ b/packages/connectivity/connectivity_macos/pubspec.yaml @@ -1,7 +1,12 @@ name: connectivity_macos description: macOS implementation of the connectivity plugin. +repository: https://github.com/flutter/plugins/tree/master/packages/connectivity/connectivity_macos +issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+connectivity%22 version: 0.2.1+1 -homepage: https://github.com/flutter/plugins/tree/master/packages/connectivity/connectivity_macos + +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.20.0" flutter: plugin: @@ -10,10 +15,6 @@ flutter: macos: pluginClass: ConnectivityPlugin -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.20.0" - dependencies: flutter: sdk: flutter diff --git a/packages/connectivity/connectivity_platform_interface/pubspec.yaml b/packages/connectivity/connectivity_platform_interface/pubspec.yaml index 0a8df8a3331a..2003fdde6eeb 100644 --- a/packages/connectivity/connectivity_platform_interface/pubspec.yaml +++ b/packages/connectivity/connectivity_platform_interface/pubspec.yaml @@ -1,10 +1,15 @@ name: connectivity_platform_interface description: A common platform interface for the connectivity plugin. -homepage: https://github.com/flutter/plugins/tree/master/packages/connectivity/connectivity_platform_interface +repository: https://github.com/flutter/plugins/tree/master/packages/connectivity/connectivity_platform_interface +issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+connectivity%22 # NOTE: We strongly prefer non-breaking changes, even at the expense of a # less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes version: 2.0.1 +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.12.13+hotfix.5" + dependencies: flutter: sdk: flutter @@ -15,7 +20,3 @@ dev_dependencies: flutter_test: sdk: flutter pedantic: ^1.10.0 - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.12.13+hotfix.5" diff --git a/packages/device_info/device_info/example/pubspec.yaml b/packages/device_info/device_info/example/pubspec.yaml index 90462444609b..c4e84f60de5e 100644 --- a/packages/device_info/device_info/example/pubspec.yaml +++ b/packages/device_info/device_info/example/pubspec.yaml @@ -2,6 +2,10 @@ name: device_info_example description: Demonstrates how to use the device_info plugin. publish_to: none +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.12.13+hotfix.5" + dependencies: flutter: sdk: flutter @@ -22,7 +26,3 @@ dev_dependencies: flutter: uses-material-design: true - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.12.13+hotfix.5" diff --git a/packages/device_info/device_info/pubspec.yaml b/packages/device_info/device_info/pubspec.yaml index bb76b265eb2c..c5830f401039 100644 --- a/packages/device_info/device_info/pubspec.yaml +++ b/packages/device_info/device_info/pubspec.yaml @@ -1,9 +1,14 @@ name: device_info description: Flutter plugin providing detailed information about the device (make, model, etc.), and Android or iOS version the app is running on. -homepage: https://github.com/flutter/plugins/tree/master/packages/device_info +repository: https://github.com/flutter/plugins/tree/master/packages/device_info/device_info +issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+device_info%22 version: 2.0.2 +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.12.13+hotfix.5" + flutter: plugin: platforms: @@ -22,7 +27,3 @@ dev_dependencies: flutter_test: sdk: flutter pedantic: ^1.10.0 - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.12.13+hotfix.5" diff --git a/packages/device_info/device_info_platform_interface/pubspec.yaml b/packages/device_info/device_info_platform_interface/pubspec.yaml index 5123ffb4576e..cf3e50f98422 100644 --- a/packages/device_info/device_info_platform_interface/pubspec.yaml +++ b/packages/device_info/device_info_platform_interface/pubspec.yaml @@ -1,10 +1,15 @@ name: device_info_platform_interface description: A common platform interface for the device_info plugin. -homepage: https://github.com/flutter/plugins/tree/master/packages/device_info +repository: https://github.com/flutter/plugins/tree/master/packages/device_info/device_info_platform_interface +issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+device_info%22 # NOTE: We strongly prefer non-breaking changes, even at the expense of a # less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes version: 2.0.1 +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.9.1+hotfix.4" + dependencies: flutter: sdk: flutter @@ -16,7 +21,3 @@ dev_dependencies: sdk: flutter test: ^1.16.3 pedantic: ^1.10.0 - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.9.1+hotfix.4" diff --git a/packages/flutter_plugin_android_lifecycle/example/pubspec.yaml b/packages/flutter_plugin_android_lifecycle/example/pubspec.yaml index d2f271d3844f..6dc8d366e82b 100644 --- a/packages/flutter_plugin_android_lifecycle/example/pubspec.yaml +++ b/packages/flutter_plugin_android_lifecycle/example/pubspec.yaml @@ -2,6 +2,9 @@ name: flutter_plugin_android_lifecycle_example description: Demonstrates how to use the flutter_plugin_android_lifecycle plugin. publish_to: none +environment: + sdk: ">=2.12.0 <3.0.0" + dependencies: flutter: sdk: flutter @@ -20,8 +23,5 @@ dev_dependencies: sdk: flutter pedantic: ^1.8.0 -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: uses-material-design: true diff --git a/packages/google_maps_flutter/google_maps_flutter_web/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_web/pubspec.yaml index 9ef3fa94242c..47e6c530dfe3 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_web/pubspec.yaml @@ -1,6 +1,6 @@ name: google_maps_flutter_web description: Web platform implementation of google_maps_flutter -repository: https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter +repository: https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter/google_maps_flutter_web issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22 version: 0.3.0 diff --git a/packages/google_sign_in/google_sign_in/example/pubspec.yaml b/packages/google_sign_in/google_sign_in/example/pubspec.yaml index 4f10b4a55eb3..8ecfbb6c4369 100644 --- a/packages/google_sign_in/google_sign_in/example/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in/example/pubspec.yaml @@ -2,6 +2,10 @@ name: google_sign_in_example description: Example of Google Sign-In plugin. publish_to: none +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.12.13+hotfix.4" + dependencies: flutter: sdk: flutter @@ -23,7 +27,3 @@ dev_dependencies: flutter: uses-material-design: true - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.12.13+hotfix.4" diff --git a/packages/image_picker/image_picker/example/pubspec.yaml b/packages/image_picker/image_picker/example/pubspec.yaml index 9f2f5fd2dc43..422bd5a4120d 100755 --- a/packages/image_picker/image_picker/example/pubspec.yaml +++ b/packages/image_picker/image_picker/example/pubspec.yaml @@ -2,6 +2,10 @@ name: image_picker_example description: Demonstrates how to use the image_picker plugin. publish_to: none +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.10.0" + dependencies: video_player: ^2.1.4 flutter: @@ -24,7 +28,3 @@ dev_dependencies: flutter: uses-material-design: true - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.10.0" diff --git a/packages/in_app_purchase/in_app_purchase/example/pubspec.yaml b/packages/in_app_purchase/in_app_purchase/example/pubspec.yaml index fa5da799697d..a75aaa689eea 100644 --- a/packages/in_app_purchase/in_app_purchase/example/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase/example/pubspec.yaml @@ -2,6 +2,10 @@ name: in_app_purchase_example description: Demonstrates how to use the in_app_purchase plugin. publish_to: none +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.20.0" + dependencies: flutter: sdk: flutter @@ -25,7 +29,3 @@ dev_dependencies: flutter: uses-material-design: true - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.20.0" diff --git a/packages/in_app_purchase/in_app_purchase_android/example/pubspec.yaml b/packages/in_app_purchase/in_app_purchase_android/example/pubspec.yaml index 29da00ef31ec..f27261669438 100644 --- a/packages/in_app_purchase/in_app_purchase_android/example/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase_android/example/pubspec.yaml @@ -2,6 +2,10 @@ name: in_app_purchase_android_example description: Demonstrates how to use the in_app_purchase_android plugin. publish_to: none +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.9.1+hotfix.2" + dependencies: flutter: sdk: flutter @@ -25,7 +29,3 @@ dev_dependencies: flutter: uses-material-design: true - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.9.1+hotfix.2" diff --git a/packages/in_app_purchase/in_app_purchase_ios/example/pubspec.yaml b/packages/in_app_purchase/in_app_purchase_ios/example/pubspec.yaml index b0287fc021fc..b916990d3979 100644 --- a/packages/in_app_purchase/in_app_purchase_ios/example/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase_ios/example/pubspec.yaml @@ -2,6 +2,10 @@ name: in_app_purchase_ios_example description: Demonstrates how to use the in_app_purchase_ios plugin. publish_to: none +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.9.1+hotfix.2" + dependencies: flutter: sdk: flutter @@ -25,7 +29,3 @@ dev_dependencies: flutter: uses-material-design: true - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.9.1+hotfix.2" diff --git a/packages/ios_platform_images/example/pubspec.yaml b/packages/ios_platform_images/example/pubspec.yaml index c3b5729d82cc..e45e7694cc2b 100644 --- a/packages/ios_platform_images/example/pubspec.yaml +++ b/packages/ios_platform_images/example/pubspec.yaml @@ -1,7 +1,6 @@ name: ios_platform_images_example description: Demonstrates how to use the ios_platform_images plugin. publish_to: none -homepage: https://github.com/flutter/plugins/tree/master/packages/ios_platform_images/ios_platform_images environment: sdk: ">=2.12.0 <3.0.0" diff --git a/packages/local_auth/example/pubspec.yaml b/packages/local_auth/example/pubspec.yaml index e7cc7a226d86..ff7a27203019 100644 --- a/packages/local_auth/example/pubspec.yaml +++ b/packages/local_auth/example/pubspec.yaml @@ -2,6 +2,10 @@ name: local_auth_example description: Demonstrates how to use the local_auth plugin. publish_to: none +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.12.13+hotfix.5" + dependencies: flutter: sdk: flutter @@ -22,7 +26,3 @@ dev_dependencies: flutter: uses-material-design: true - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.12.13+hotfix.5" diff --git a/packages/package_info/example/pubspec.yaml b/packages/package_info/example/pubspec.yaml index 46e95e7b9db8..9c1c3cd0ad6e 100644 --- a/packages/package_info/example/pubspec.yaml +++ b/packages/package_info/example/pubspec.yaml @@ -2,6 +2,10 @@ name: package_info_example description: Demonstrates how to use the package_info plugin. publish_to: none +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.12.13+hotfix.5" + dependencies: flutter: sdk: flutter @@ -22,7 +26,3 @@ dev_dependencies: flutter: uses-material-design: true - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.12.13+hotfix.5" diff --git a/packages/package_info/pubspec.yaml b/packages/package_info/pubspec.yaml index e3b976f83685..dd9de6f14808 100644 --- a/packages/package_info/pubspec.yaml +++ b/packages/package_info/pubspec.yaml @@ -1,9 +1,14 @@ name: package_info description: Flutter plugin for querying information about the application package, such as CFBundleVersion on iOS or versionCode on Android. -homepage: https://github.com/flutter/plugins/tree/master/packages/package_info +repository: https://github.com/flutter/plugins/tree/master/packages/package_info +issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+package_info%22 version: 2.0.2 +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.12.13+hotfix.5" + flutter: plugin: platforms: @@ -27,7 +32,3 @@ dev_dependencies: integration_test: sdk: flutter pedantic: ^1.10.0 - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.12.13+hotfix.5" diff --git a/packages/path_provider/path_provider/example/pubspec.yaml b/packages/path_provider/path_provider/example/pubspec.yaml index 975def4332e2..61f50ae97262 100644 --- a/packages/path_provider/path_provider/example/pubspec.yaml +++ b/packages/path_provider/path_provider/example/pubspec.yaml @@ -2,6 +2,10 @@ name: path_provider_example description: Demonstrates how to use the path_provider plugin. publish_to: none +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.12.13+hotfix.5" + dependencies: flutter: sdk: flutter @@ -22,7 +26,3 @@ dev_dependencies: flutter: uses-material-design: true - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.12.13+hotfix.5" diff --git a/packages/path_provider/path_provider_macos/example/pubspec.yaml b/packages/path_provider/path_provider_macos/example/pubspec.yaml index 8442451cc10f..d8b93545ed53 100644 --- a/packages/path_provider/path_provider_macos/example/pubspec.yaml +++ b/packages/path_provider/path_provider_macos/example/pubspec.yaml @@ -2,6 +2,10 @@ name: path_provider_example description: Demonstrates how to use the path_provider plugin. publish_to: none +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.20.0" + dependencies: flutter: sdk: flutter @@ -23,7 +27,3 @@ dev_dependencies: flutter: uses-material-design: true - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.20.0" diff --git a/packages/path_provider/path_provider_windows/example/pubspec.yaml b/packages/path_provider/path_provider_windows/example/pubspec.yaml index c55bf0bcf279..26a796fca90c 100644 --- a/packages/path_provider/path_provider_windows/example/pubspec.yaml +++ b/packages/path_provider/path_provider_windows/example/pubspec.yaml @@ -2,6 +2,10 @@ name: path_provider_example description: Demonstrates how to use the path_provider plugin. publish_to: none +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.20.0" + dependencies: flutter: sdk: flutter @@ -22,7 +26,3 @@ dev_dependencies: flutter: uses-material-design: true - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.20.0" diff --git a/packages/plugin_platform_interface/pubspec.yaml b/packages/plugin_platform_interface/pubspec.yaml index 7456253415cc..a59a81481fe2 100644 --- a/packages/plugin_platform_interface/pubspec.yaml +++ b/packages/plugin_platform_interface/pubspec.yaml @@ -1,9 +1,7 @@ name: plugin_platform_interface description: Reusable base class for Flutter plugin platform interfaces. repository: https://github.com/flutter/plugins/tree/master/packages/plugin_platform_interface - -environment: - sdk: ">=2.12.0 <3.0.0" +issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+plugin_platform_interface%22 # DO NOT MAKE A BREAKING CHANGE TO THIS PACKAGE # DO NOT INCREASE THE MAJOR VERSION OF THIS PACKAGE @@ -18,6 +16,9 @@ environment: # `plugin_platform_interface: >=1.X.Y <3.0.0`). version: 2.0.0 +environment: + sdk: ">=2.12.0 <3.0.0" + dependencies: meta: ^1.3.0 diff --git a/packages/quick_actions/quick_actions/example/pubspec.yaml b/packages/quick_actions/quick_actions/example/pubspec.yaml index 5eecc6c20766..eaf3de4b56e0 100644 --- a/packages/quick_actions/quick_actions/example/pubspec.yaml +++ b/packages/quick_actions/quick_actions/example/pubspec.yaml @@ -2,6 +2,10 @@ name: quick_actions_example description: Demonstrates how to use the quick_actions plugin. publish_to: none +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.9.1+hotfix.2" + dependencies: flutter: sdk: flutter @@ -22,7 +26,3 @@ dev_dependencies: flutter: uses-material-design: true - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.9.1+hotfix.2" diff --git a/packages/sensors/example/pubspec.yaml b/packages/sensors/example/pubspec.yaml index 3b25a6dd50cd..fee7bd61f736 100644 --- a/packages/sensors/example/pubspec.yaml +++ b/packages/sensors/example/pubspec.yaml @@ -2,6 +2,10 @@ name: sensors_example description: Demonstrates how to use the sensors plugin. publish_to: none +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.20.0" + dependencies: flutter: sdk: flutter @@ -22,7 +26,3 @@ dev_dependencies: flutter: uses-material-design: true - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.20.0" diff --git a/packages/sensors/pubspec.yaml b/packages/sensors/pubspec.yaml index d1f3a82cb8a9..b26819b64df0 100644 --- a/packages/sensors/pubspec.yaml +++ b/packages/sensors/pubspec.yaml @@ -1,9 +1,14 @@ name: sensors description: Flutter plugin for accessing the Android and iOS accelerometer and gyroscope sensors. -homepage: https://github.com/flutter/plugins/tree/master/packages/sensors +repository: https://github.com/flutter/plugins/tree/master/packages/sensors +issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+sensors%22 version: 2.0.3 +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.12.13+hotfix.5" + flutter: plugin: platforms: @@ -25,7 +30,3 @@ dev_dependencies: sdk: flutter mockito: ^5.0.0 pedantic: ^1.10.0 - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.12.13+hotfix.5" diff --git a/packages/share/example/pubspec.yaml b/packages/share/example/pubspec.yaml index 37f02b8fa714..8a28b43d46e4 100644 --- a/packages/share/example/pubspec.yaml +++ b/packages/share/example/pubspec.yaml @@ -2,6 +2,10 @@ name: share_example description: Demonstrates how to use the share plugin. publish_to: none +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.9.1+hotfix.2" + dependencies: flutter: sdk: flutter @@ -23,7 +27,3 @@ dev_dependencies: flutter: uses-material-design: true - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.9.1+hotfix.2" diff --git a/packages/share/pubspec.yaml b/packages/share/pubspec.yaml index 6ab43e814117..4735995fff8a 100644 --- a/packages/share/pubspec.yaml +++ b/packages/share/pubspec.yaml @@ -1,9 +1,14 @@ name: share description: Flutter plugin for sharing content via the platform share UI, using the ACTION_SEND intent on Android and UIActivityViewController on iOS. -homepage: https://github.com/flutter/plugins/tree/master/packages/share +repository: https://github.com/flutter/plugins/tree/master/packages/share +issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+share%22 version: 2.0.4 +environment: + flutter: ">=1.12.13+hotfix.5" + sdk: ">=2.12.0 <3.0.0" + flutter: plugin: platforms: @@ -25,7 +30,3 @@ dev_dependencies: integration_test: sdk: flutter pedantic: ^1.10.0 - -environment: - flutter: ">=1.12.13+hotfix.5" - sdk: ">=2.12.0 <3.0.0" diff --git a/packages/shared_preferences/shared_preferences/example/pubspec.yaml b/packages/shared_preferences/shared_preferences/example/pubspec.yaml index a2493aa04ce9..8f14d5c1ec5b 100644 --- a/packages/shared_preferences/shared_preferences/example/pubspec.yaml +++ b/packages/shared_preferences/shared_preferences/example/pubspec.yaml @@ -2,6 +2,10 @@ name: shared_preferences_example description: Demonstrates how to use the shared_preferences plugin. publish_to: none +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.9.1+hotfix.2" + dependencies: flutter: sdk: flutter @@ -22,7 +26,3 @@ dev_dependencies: flutter: uses-material-design: true - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.9.1+hotfix.2" diff --git a/packages/shared_preferences/shared_preferences_linux/example/pubspec.yaml b/packages/shared_preferences/shared_preferences_linux/example/pubspec.yaml index 340314a5f18b..d34973b9dde6 100644 --- a/packages/shared_preferences/shared_preferences_linux/example/pubspec.yaml +++ b/packages/shared_preferences/shared_preferences_linux/example/pubspec.yaml @@ -2,6 +2,10 @@ name: shared_preferences_linux_example description: Demonstrates how to use the shared_preferences_linux plugin. publish_to: none +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.20.0" + dependencies: flutter: sdk: flutter @@ -22,7 +26,3 @@ dev_dependencies: flutter: uses-material-design: true - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.20.0" diff --git a/packages/shared_preferences/shared_preferences_macos/example/pubspec.yaml b/packages/shared_preferences/shared_preferences_macos/example/pubspec.yaml index b5a88511118a..e6bf972cf5b4 100644 --- a/packages/shared_preferences/shared_preferences_macos/example/pubspec.yaml +++ b/packages/shared_preferences/shared_preferences_macos/example/pubspec.yaml @@ -2,6 +2,10 @@ name: shared_preferences_example description: Demonstrates how to use the shared_preferences plugin. publish_to: none +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.12.8" + dependencies: flutter: sdk: flutter @@ -23,7 +27,3 @@ dev_dependencies: flutter: uses-material-design: true - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.12.8" diff --git a/packages/url_launcher/url_launcher/example/pubspec.yaml b/packages/url_launcher/url_launcher/example/pubspec.yaml index 3268b9043c1b..643c53f9a6cb 100644 --- a/packages/url_launcher/url_launcher/example/pubspec.yaml +++ b/packages/url_launcher/url_launcher/example/pubspec.yaml @@ -2,6 +2,10 @@ name: url_launcher_example description: Demonstrates how to use the url_launcher plugin. publish_to: none +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.12.13+hotfix.5" + dependencies: flutter: sdk: flutter @@ -24,7 +28,3 @@ dev_dependencies: flutter: uses-material-design: true - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.12.13+hotfix.5" diff --git a/packages/url_launcher/url_launcher_linux/example/pubspec.yaml b/packages/url_launcher/url_launcher_linux/example/pubspec.yaml index 8ae4c5bc0c5b..b0ef2e6eddbf 100644 --- a/packages/url_launcher/url_launcher_linux/example/pubspec.yaml +++ b/packages/url_launcher/url_launcher_linux/example/pubspec.yaml @@ -2,6 +2,10 @@ name: url_launcher_example description: Demonstrates how to use the url_launcher plugin. publish_to: none +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.20.0" + dependencies: flutter: sdk: flutter @@ -23,7 +27,3 @@ dev_dependencies: flutter: uses-material-design: true - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.20.0" diff --git a/packages/url_launcher/url_launcher_macos/example/pubspec.yaml b/packages/url_launcher/url_launcher_macos/example/pubspec.yaml index 6f842d6a8a0e..6d12b75819b0 100644 --- a/packages/url_launcher/url_launcher_macos/example/pubspec.yaml +++ b/packages/url_launcher/url_launcher_macos/example/pubspec.yaml @@ -2,6 +2,10 @@ name: url_launcher_example description: Demonstrates how to use the url_launcher plugin. publish_to: none +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.20.0" + dependencies: flutter: sdk: flutter @@ -23,7 +27,3 @@ dev_dependencies: flutter: uses-material-design: true - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.20.0" diff --git a/packages/url_launcher/url_launcher_windows/example/pubspec.yaml b/packages/url_launcher/url_launcher_windows/example/pubspec.yaml index fff33e40e63b..11be3e84f03b 100644 --- a/packages/url_launcher/url_launcher_windows/example/pubspec.yaml +++ b/packages/url_launcher/url_launcher_windows/example/pubspec.yaml @@ -2,6 +2,10 @@ name: url_launcher_example description: Demonstrates the Windows implementation of the url_launcher plugin. publish_to: none +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.20.0" + dependencies: flutter: sdk: flutter @@ -23,7 +27,3 @@ dev_dependencies: flutter: uses-material-design: true - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.20.0" diff --git a/packages/video_player/video_player/example/pubspec.yaml b/packages/video_player/video_player/example/pubspec.yaml index 9cdedd9ff67e..63f179a06211 100644 --- a/packages/video_player/video_player/example/pubspec.yaml +++ b/packages/video_player/video_player/example/pubspec.yaml @@ -2,6 +2,10 @@ name: video_player_example description: Demonstrates how to use the video_player plugin. publish_to: none +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.12.13+hotfix.5" + dependencies: flutter: sdk: flutter @@ -29,7 +33,3 @@ flutter: - assets/flutter-mark-square-64.png - assets/Butterfly-209.mp4 - assets/bumble_bee_captions.srt - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.12.13+hotfix.5" diff --git a/packages/wifi_info_flutter/wifi_info_flutter/pubspec.yaml b/packages/wifi_info_flutter/wifi_info_flutter/pubspec.yaml index 15eb82e13d8a..cbda364aa35e 100644 --- a/packages/wifi_info_flutter/wifi_info_flutter/pubspec.yaml +++ b/packages/wifi_info_flutter/wifi_info_flutter/pubspec.yaml @@ -1,21 +1,13 @@ name: wifi_info_flutter description: A new flutter plugin project. -homepage: https://github.com/flutter/plugins/tree/master/packages/wifi_info_flutter/wifi_info_flutter +repository: https://github.com/flutter/plugins/tree/master/packages/wifi_info_flutter/wifi_info_flutter +issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+wifi_info_flutter%22 version: 2.0.2 environment: sdk: ">=2.12.0 <3.0.0" flutter: ">=1.20.0" -dependencies: - flutter: - sdk: flutter - wifi_info_flutter_platform_interface: ^2.0.0 - -dev_dependencies: - flutter_test: - sdk: flutter - flutter: plugin: platforms: @@ -24,3 +16,12 @@ flutter: pluginClass: WifiInfoFlutterPlugin ios: pluginClass: WifiInfoFlutterPlugin + +dependencies: + flutter: + sdk: flutter + wifi_info_flutter_platform_interface: ^2.0.0 + +dev_dependencies: + flutter_test: + sdk: flutter diff --git a/packages/wifi_info_flutter/wifi_info_flutter_platform_interface/pubspec.yaml b/packages/wifi_info_flutter/wifi_info_flutter_platform_interface/pubspec.yaml index 5043b0451f7b..14ca643aa045 100644 --- a/packages/wifi_info_flutter/wifi_info_flutter_platform_interface/pubspec.yaml +++ b/packages/wifi_info_flutter/wifi_info_flutter_platform_interface/pubspec.yaml @@ -1,9 +1,10 @@ name: wifi_info_flutter_platform_interface description: A common platform interface for the wifi_info_flutter plugin. +repository: https://github.com/flutter/plugins/tree/master/packages/wifi_info_flutter/wifi_info_flutter_platform_interface +issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+wifi_info_flutter%22 version: 2.0.1 # NOTE: We strongly prefer non-breaking changes, even at the expense of a # less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes -homepage: https://github.com/flutter/plugins/tree/master/packages/wifi_info_flutter/wifi_info_flutter_platform_interface environment: sdk: ">=2.12.0 <3.0.0" diff --git a/script/tool/CHANGELOG.md b/script/tool/CHANGELOG.md index d7e58dcfba5f..6250e2a7273b 100644 --- a/script/tool/CHANGELOG.md +++ b/script/tool/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.1.4 + +- Add a `pubspec-check` command + ## 0.1.3 - Cosmetic fix to `publish-check` output diff --git a/script/tool/lib/src/main.dart b/script/tool/lib/src/main.dart index 4b0e85704b24..a3fbc34ae8ab 100644 --- a/script/tool/lib/src/main.dart +++ b/script/tool/lib/src/main.dart @@ -9,8 +9,6 @@ import 'dart:io' as io; import 'package:args/command_runner.dart'; import 'package:file/file.dart'; import 'package:file/local.dart'; -import 'package:flutter_plugin_tools/src/publish_check_command.dart'; -import 'package:flutter_plugin_tools/src/publish_plugin_command.dart'; import 'package:path/path.dart' as p; import 'analyze_command.dart'; @@ -24,6 +22,9 @@ import 'java_test_command.dart'; import 'license_check_command.dart'; import 'lint_podspecs_command.dart'; import 'list_command.dart'; +import 'publish_check_command.dart'; +import 'publish_plugin_command.dart'; +import 'pubspec_check_command.dart'; import 'test_command.dart'; import 'version_check_command.dart'; import 'xctest_command.dart'; @@ -58,12 +59,20 @@ void main(List args) { ..addCommand(ListCommand(packagesDir, fileSystem)) ..addCommand(PublishCheckCommand(packagesDir, fileSystem)) ..addCommand(PublishPluginCommand(packagesDir, fileSystem)) + ..addCommand(PubspecCheckCommand(packagesDir, fileSystem)) ..addCommand(TestCommand(packagesDir, fileSystem)) ..addCommand(VersionCheckCommand(packagesDir, fileSystem)) ..addCommand(XCTestCommand(packagesDir, fileSystem)); commandRunner.run(args).catchError((Object e) { final ToolExit toolExit = e as ToolExit; - io.exit(toolExit.exitCode); + int exitCode = toolExit.exitCode; + // This should never happen; this check is here to guarantee that a ToolExit + // never accidentally has code 0 thus causing CI to pass. + if (exitCode == 0) { + assert(false); + exitCode = 255; + } + io.exit(exitCode); }, test: (Object e) => e is ToolExit); } diff --git a/script/tool/lib/src/pubspec_check_command.dart b/script/tool/lib/src/pubspec_check_command.dart new file mode 100644 index 000000000000..fadcfbc56deb --- /dev/null +++ b/script/tool/lib/src/pubspec_check_command.dart @@ -0,0 +1,178 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:async'; + +import 'package:file/file.dart'; +import 'package:git/git.dart'; +import 'package:path/path.dart' as p; +import 'package:pubspec_parse/pubspec_parse.dart'; + +import 'common.dart'; + +/// A command to enforce pubspec conventions across the repository. +/// +/// This both ensures that repo best practices for which optional fields are +/// used are followed, and that the structure is consistent to make edits +/// across multiple pubspec files easier. +class PubspecCheckCommand extends PluginCommand { + /// Creates an instance of the version check command. + PubspecCheckCommand( + Directory packagesDir, + FileSystem fileSystem, { + ProcessRunner processRunner = const ProcessRunner(), + GitDir? gitDir, + }) : super(packagesDir, fileSystem, + processRunner: processRunner, gitDir: gitDir); + + // Section order for plugins. Because the 'flutter' section is critical + // information for plugins, and usually small, it goes near the top unlike in + // a normal app or package. + static const List _majorPluginSections = [ + 'environment:', + 'flutter:', + 'dependencies:', + 'dev_dependencies:', + ]; + + static const List _majorPackageSections = [ + 'environment:', + 'dependencies:', + 'dev_dependencies:', + 'flutter:', + ]; + + static const String _expectedIssueLinkFormat = + 'https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A'; + + @override + final String name = 'pubspec-check'; + + @override + final String description = + 'Checks that pubspecs follow repository conventions.'; + + @override + Future run() async { + final List failingPackages = []; + await for (final Directory package in getPackages()) { + final String relativePackagePath = + p.relative(package.path, from: packagesDir.path); + print('Checking $relativePackagePath...'); + final File pubspec = package.childFile('pubspec.yaml'); + final bool passesCheck = !pubspec.existsSync() || + await _checkPubspec(pubspec, packageName: package.basename); + if (!passesCheck) { + failingPackages.add(relativePackagePath); + } + } + + if (failingPackages.isNotEmpty) { + print('The following packages have pubspec issues:'); + for (final String package in failingPackages) { + print(' $package'); + } + throw ToolExit(1); + } + + print('\nNo pubspec issues found!'); + } + + Future _checkPubspec( + File pubspecFile, { + required String packageName, + }) async { + const String indentation = ' '; + final String contents = pubspecFile.readAsStringSync(); + final Pubspec? pubspec = _tryParsePubspec(contents); + if (pubspec == null) { + return false; + } + + final List pubspecLines = contents.split('\n'); + final List sectionOrder = pubspecLines.contains(' plugin:') + ? _majorPluginSections + : _majorPackageSections; + bool passing = _checkSectionOrder(pubspecLines, sectionOrder); + if (!passing) { + print('${indentation}Major sections should follow standard ' + 'repository ordering:'); + final String listIndentation = indentation * 2; + print('$listIndentation${sectionOrder.join('\n$listIndentation')}'); + } + + if (pubspec.publishTo != 'none') { + final List repositoryErrors = + _checkForRepositoryLinkErrors(pubspec, packageName: packageName); + if (repositoryErrors.isNotEmpty) { + for (final String error in repositoryErrors) { + print('$indentation$error'); + } + passing = false; + } + + if (!_checkIssueLink(pubspec)) { + print( + '${indentation}A package should have an "issue_tracker" link to a ' + 'search for open flutter/flutter bugs with the relevant label:\n' + '${indentation * 2}$_expectedIssueLinkFormat'); + passing = false; + } + } + + return passing; + } + + Pubspec? _tryParsePubspec(String pubspecContents) { + try { + return Pubspec.parse(pubspecContents); + } on Exception catch (exception) { + print(' Cannot parse pubspec.yaml: $exception'); + } + return null; + } + + bool _checkSectionOrder( + List pubspecLines, List sectionOrder) { + int previousSectionIndex = 0; + for (final String line in pubspecLines) { + final int index = sectionOrder.indexOf(line); + if (index == -1) { + continue; + } + if (index < previousSectionIndex) { + return false; + } + previousSectionIndex = index; + } + return true; + } + + List _checkForRepositoryLinkErrors( + Pubspec pubspec, { + required String packageName, + }) { + final List errorMessages = []; + if (pubspec.repository == null) { + errorMessages.add('Missing "repository"'); + } else if (!pubspec.repository!.path.endsWith(packageName)) { + errorMessages + .add('The "repository" link should end with the package name.'); + } + + if (pubspec.homepage != null) { + errorMessages + .add('Found a "homepage" entry; only "repository" should be used.'); + } + + return errorMessages; + } + + bool _checkIssueLink(Pubspec pubspec) { + return pubspec.issueTracker + ?.toString() + .startsWith(_expectedIssueLinkFormat) == + true; + } +} diff --git a/script/tool/pubspec.yaml b/script/tool/pubspec.yaml index 8ea735f2b675..ab422daf8ed5 100644 --- a/script/tool/pubspec.yaml +++ b/script/tool/pubspec.yaml @@ -1,7 +1,7 @@ name: flutter_plugin_tools description: Productivity utils for flutter/plugins and flutter/packages repository: https://github.com/flutter/plugins/tree/master/script/tool -version: 0.1.3 +version: 0.1.4 dependencies: args: ^2.1.0 diff --git a/script/tool/test/build_examples_command_test.dart b/script/tool/test/build_examples_command_test.dart index 7a8aa85fc8be..44634c251752 100644 --- a/script/tool/test/build_examples_command_test.dart +++ b/script/tool/test/build_examples_command_test.dart @@ -59,7 +59,6 @@ void main() { ]), ); - print(processRunner.recordedCalls); // Output should be empty since running build-examples --macos with no macos // implementation is a no-op. expect(processRunner.recordedCalls, orderedEquals([])); @@ -96,7 +95,6 @@ void main() { ]), ); - print(processRunner.recordedCalls); expect( processRunner.recordedCalls, orderedEquals([ @@ -142,7 +140,6 @@ void main() { ]), ); - print(processRunner.recordedCalls); // Output should be empty since running build-examples --linux with no // Linux implementation is a no-op. expect(processRunner.recordedCalls, orderedEquals([])); @@ -175,7 +172,6 @@ void main() { ]), ); - print(processRunner.recordedCalls); expect( processRunner.recordedCalls, orderedEquals([ @@ -211,7 +207,6 @@ void main() { ]), ); - print(processRunner.recordedCalls); // Output should be empty since running build-examples --macos with no macos // implementation is a no-op. expect(processRunner.recordedCalls, orderedEquals([])); @@ -245,7 +240,6 @@ void main() { ]), ); - print(processRunner.recordedCalls); expect( processRunner.recordedCalls, orderedEquals([ @@ -280,7 +274,6 @@ void main() { ]), ); - print(processRunner.recordedCalls); // Output should be empty since running build-examples --macos with no macos // implementation is a no-op. expect(processRunner.recordedCalls, orderedEquals([])); @@ -314,7 +307,6 @@ void main() { ]), ); - print(processRunner.recordedCalls); expect( processRunner.recordedCalls, orderedEquals([ @@ -353,7 +345,6 @@ void main() { ]), ); - print(processRunner.recordedCalls); // Output should be empty since running build-examples --macos with no macos // implementation is a no-op. expect(processRunner.recordedCalls, orderedEquals([])); @@ -386,7 +377,6 @@ void main() { ]), ); - print(processRunner.recordedCalls); expect( processRunner.recordedCalls, orderedEquals([ @@ -425,7 +415,6 @@ void main() { ]), ); - print(processRunner.recordedCalls); // Output should be empty since running build-examples --macos with no macos // implementation is a no-op. expect(processRunner.recordedCalls, orderedEquals([])); @@ -462,7 +451,6 @@ void main() { ]), ); - print(processRunner.recordedCalls); expect( processRunner.recordedCalls, orderedEquals([ @@ -492,7 +480,6 @@ void main() { '--enable-experiment=exp1' ]); - print(processRunner.recordedCalls); expect( processRunner.recordedCalls, orderedEquals([ @@ -522,7 +509,6 @@ void main() { '--no-macos', '--enable-experiment=exp1' ]); - print(processRunner.recordedCalls); expect( processRunner.recordedCalls, orderedEquals([ diff --git a/script/tool/test/drive_examples_command_test.dart b/script/tool/test/drive_examples_command_test.dart index 6fb8b8d3355f..b4d6a25154c5 100644 --- a/script/tool/test/drive_examples_command_test.dart +++ b/script/tool/test/drive_examples_command_test.dart @@ -63,7 +63,6 @@ void main() { final String deviceTestPath = p.join('test', 'plugin.dart'); final String driverTestPath = p.join('test_driver', 'plugin_test.dart'); - print(processRunner.recordedCalls); expect( processRunner.recordedCalls, orderedEquals([ @@ -109,7 +108,6 @@ void main() { final String deviceTestPath = p.join('test_driver', 'plugin.dart'); final String driverTestPath = p.join('test_driver', 'plugin_test.dart'); - print(processRunner.recordedCalls); expect( processRunner.recordedCalls, orderedEquals([ @@ -197,7 +195,6 @@ void main() { final String driverTestPath = p.join('test_driver', 'integration_test.dart'); - print(processRunner.recordedCalls); expect( processRunner.recordedCalls, orderedEquals([ @@ -252,7 +249,6 @@ void main() { ]), ); - print(processRunner.recordedCalls); // Output should be empty since running drive-examples --linux on a non-Linux // plugin is a no-op. expect(processRunner.recordedCalls, []); @@ -287,7 +283,6 @@ void main() { final String deviceTestPath = p.join('test_driver', 'plugin.dart'); final String driverTestPath = p.join('test_driver', 'plugin_test.dart'); - print(processRunner.recordedCalls); expect( processRunner.recordedCalls, orderedEquals([ @@ -332,7 +327,6 @@ void main() { ]), ); - print(processRunner.recordedCalls); // Output should be empty since running drive-examples --macos with no macos // implementation is a no-op. expect(processRunner.recordedCalls, []); @@ -367,7 +361,6 @@ void main() { final String deviceTestPath = p.join('test_driver', 'plugin.dart'); final String driverTestPath = p.join('test_driver', 'plugin_test.dart'); - print(processRunner.recordedCalls); expect( processRunner.recordedCalls, orderedEquals([ @@ -414,7 +407,6 @@ void main() { ]), ); - print(processRunner.recordedCalls); // Output should be empty since running drive-examples --web on a non-web // plugin is a no-op. expect(processRunner.recordedCalls, []); @@ -449,7 +441,6 @@ void main() { final String deviceTestPath = p.join('test_driver', 'plugin.dart'); final String driverTestPath = p.join('test_driver', 'plugin_test.dart'); - print(processRunner.recordedCalls); expect( processRunner.recordedCalls, orderedEquals([ @@ -498,7 +489,6 @@ void main() { ]), ); - print(processRunner.recordedCalls); // Output should be empty since running drive-examples --windows on a // non-Windows plugin is a no-op. expect(processRunner.recordedCalls, []); @@ -533,7 +523,6 @@ void main() { final String deviceTestPath = p.join('test_driver', 'plugin.dart'); final String driverTestPath = p.join('test_driver', 'plugin_test.dart'); - print(processRunner.recordedCalls); expect( processRunner.recordedCalls, orderedEquals([ @@ -579,7 +568,6 @@ void main() { ]), ); - print(processRunner.recordedCalls); // Output should be empty since running drive-examples --macos with no macos // implementation is a no-op. expect(processRunner.recordedCalls, []); @@ -600,7 +588,6 @@ void main() { ]), ); - print(processRunner.recordedCalls); // Output should be empty since running drive-examples --macos with no macos // implementation is a no-op. expect(processRunner.recordedCalls, []); @@ -627,7 +614,6 @@ void main() { final String deviceTestPath = p.join('test', 'plugin.dart'); final String driverTestPath = p.join('test_driver', 'plugin_test.dart'); - print(processRunner.recordedCalls); expect( processRunner.recordedCalls, orderedEquals([ diff --git a/script/tool/test/pubspec_check_command_test.dart b/script/tool/test/pubspec_check_command_test.dart new file mode 100644 index 000000000000..aee3f7a20310 --- /dev/null +++ b/script/tool/test/pubspec_check_command_test.dart @@ -0,0 +1,334 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:args/command_runner.dart'; +import 'package:file/file.dart'; +import 'package:file/memory.dart'; +import 'package:flutter_plugin_tools/src/common.dart'; +import 'package:flutter_plugin_tools/src/pubspec_check_command.dart'; +import 'package:test/test.dart'; + +import 'util.dart'; + +void main() { + group('test pubspec_check_command', () { + late CommandRunner runner; + late RecordingProcessRunner processRunner; + late FileSystem fileSystem; + late Directory packagesDir; + + setUp(() { + fileSystem = MemoryFileSystem(); + packagesDir = fileSystem.currentDirectory.childDirectory('packages'); + initializeFakePackages(parentDir: packagesDir.parent); + processRunner = RecordingProcessRunner(); + final PubspecCheckCommand command = PubspecCheckCommand( + packagesDir, fileSystem, + processRunner: processRunner); + + runner = CommandRunner( + 'pubspec_check_command', 'Test for pubspec_check_command'); + runner.addCommand(command); + }); + + String headerSection( + String name, { + bool isPlugin = false, + bool includeRepository = true, + bool includeHomepage = false, + bool includeIssueTracker = true, + }) { + final String repoLink = 'https://github.com/flutter/' + '${isPlugin ? 'plugins' : 'packages'}/tree/master/packages/$name'; + final String issueTrackerLink = + 'https://github.com/flutter/flutter/issues?' + 'q=is%3Aissue+is%3Aopen+label%3A%22p%3A+$name%22'; + return ''' +name: $name +${includeRepository ? 'repository: $repoLink' : ''} +${includeHomepage ? 'homepage: $repoLink' : ''} +${includeIssueTracker ? 'issue_tracker: $issueTrackerLink' : ''} +version: 1.0.0 +'''; + } + + String environmentSection() { + return ''' +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=2.0.0" +'''; + } + + String flutterSection({bool isPlugin = false}) { + const String pluginEntry = ''' + plugin: + platforms: +'''; + return ''' +flutter: +${isPlugin ? pluginEntry : ''} +'''; + } + + String dependenciesSection() { + return ''' +dependencies: + flutter: + sdk: flutter +'''; + } + + String devDependenciesSection() { + return ''' +dev_dependencies: + flutter_test: + sdk: flutter +'''; + } + + test('passes for a plugin following conventions', () async { + final Directory pluginDirectory = createFakePlugin('plugin', + withSingleExample: true, packagesDirectory: packagesDir); + + pluginDirectory.childFile('pubspec.yaml').writeAsStringSync(''' +${headerSection('plugin', isPlugin: true)} +${environmentSection()} +${flutterSection(isPlugin: true)} +${dependenciesSection()} +${devDependenciesSection()} +'''); + + final List output = await runCapturingPrint(runner, [ + 'pubspec-check', + ]); + + expect( + output, + containsAllInOrder([ + 'Checking plugin...', + 'Checking plugin/example...', + '\nNo pubspec issues found!', + ]), + ); + }); + + test('passes for a Flutter package following conventions', () async { + final Directory pluginDirectory = createFakePlugin('plugin', + withSingleExample: true, packagesDirectory: packagesDir); + + pluginDirectory.childFile('pubspec.yaml').writeAsStringSync(''' +${headerSection('plugin')} +${environmentSection()} +${dependenciesSection()} +${devDependenciesSection()} +${flutterSection()} +'''); + + final List output = await runCapturingPrint(runner, [ + 'pubspec-check', + ]); + + expect( + output, + containsAllInOrder([ + 'Checking plugin...', + 'Checking plugin/example...', + '\nNo pubspec issues found!', + ]), + ); + }); + + test('passes for a minimal package following conventions', () async { + final Directory packageDirectory = packagesDir.childDirectory('package'); + packageDirectory.createSync(recursive: true); + + packageDirectory.childFile('pubspec.yaml').writeAsStringSync(''' +${headerSection('package')} +${environmentSection()} +${dependenciesSection()} +'''); + + final List output = await runCapturingPrint(runner, [ + 'pubspec-check', + ]); + + expect( + output, + containsAllInOrder([ + 'Checking package...', + '\nNo pubspec issues found!', + ]), + ); + }); + + test('fails when homepage is included', () async { + final Directory pluginDirectory = createFakePlugin('plugin', + withSingleExample: true, packagesDirectory: packagesDir); + + pluginDirectory.childFile('pubspec.yaml').writeAsStringSync(''' +${headerSection('plugin', isPlugin: true, includeHomepage: true)} +${environmentSection()} +${flutterSection(isPlugin: true)} +${dependenciesSection()} +${devDependenciesSection()} +'''); + + final Future> result = + runCapturingPrint(runner, ['pubspec-check']); + + await expectLater( + result, + throwsA(const TypeMatcher()), + ); + }); + + test('fails when repository is missing', () async { + final Directory pluginDirectory = createFakePlugin('plugin', + withSingleExample: true, packagesDirectory: packagesDir); + + pluginDirectory.childFile('pubspec.yaml').writeAsStringSync(''' +${headerSection('plugin', isPlugin: true, includeRepository: false)} +${environmentSection()} +${flutterSection(isPlugin: true)} +${dependenciesSection()} +${devDependenciesSection()} +'''); + + final Future> result = + runCapturingPrint(runner, ['pubspec-check']); + + await expectLater( + result, + throwsA(const TypeMatcher()), + ); + }); + + test('fails when homepage is given instead of repository', () async { + final Directory pluginDirectory = createFakePlugin('plugin', + withSingleExample: true, packagesDirectory: packagesDir); + + pluginDirectory.childFile('pubspec.yaml').writeAsStringSync(''' +${headerSection('plugin', isPlugin: true, includeHomepage: true, includeRepository: false)} +${environmentSection()} +${flutterSection(isPlugin: true)} +${dependenciesSection()} +${devDependenciesSection()} +'''); + + final Future> result = + runCapturingPrint(runner, ['pubspec-check']); + + await expectLater( + result, + throwsA(const TypeMatcher()), + ); + }); + + test('fails when issue tracker is missing', () async { + final Directory pluginDirectory = createFakePlugin('plugin', + withSingleExample: true, packagesDirectory: packagesDir); + + pluginDirectory.childFile('pubspec.yaml').writeAsStringSync(''' +${headerSection('plugin', isPlugin: true, includeIssueTracker: false)} +${environmentSection()} +${flutterSection(isPlugin: true)} +${dependenciesSection()} +${devDependenciesSection()} +'''); + + final Future> result = + runCapturingPrint(runner, ['pubspec-check']); + + await expectLater( + result, + throwsA(const TypeMatcher()), + ); + }); + + test('fails when environment section is out of order', () async { + final Directory pluginDirectory = createFakePlugin('plugin', + withSingleExample: true, packagesDirectory: packagesDir); + + pluginDirectory.childFile('pubspec.yaml').writeAsStringSync(''' +${headerSection('plugin', isPlugin: true)} +${flutterSection(isPlugin: true)} +${dependenciesSection()} +${devDependenciesSection()} +${environmentSection()} +'''); + + final Future> result = + runCapturingPrint(runner, ['pubspec-check']); + + await expectLater( + result, + throwsA(const TypeMatcher()), + ); + }); + + test('fails when flutter section is out of order', () async { + final Directory pluginDirectory = createFakePlugin('plugin', + withSingleExample: true, packagesDirectory: packagesDir); + + pluginDirectory.childFile('pubspec.yaml').writeAsStringSync(''' +${headerSection('plugin', isPlugin: true)} +${flutterSection(isPlugin: true)} +${environmentSection()} +${dependenciesSection()} +${devDependenciesSection()} +'''); + + final Future> result = + runCapturingPrint(runner, ['pubspec-check']); + + await expectLater( + result, + throwsA(const TypeMatcher()), + ); + }); + + test('fails when dependencies section is out of order', () async { + final Directory pluginDirectory = createFakePlugin('plugin', + withSingleExample: true, packagesDirectory: packagesDir); + + pluginDirectory.childFile('pubspec.yaml').writeAsStringSync(''' +${headerSection('plugin', isPlugin: true)} +${environmentSection()} +${flutterSection(isPlugin: true)} +${devDependenciesSection()} +${dependenciesSection()} +'''); + + final Future> result = + runCapturingPrint(runner, ['pubspec-check']); + + await expectLater( + result, + throwsA(const TypeMatcher()), + ); + }); + + test('fails when devDependencies section is out of order', () async { + final Directory pluginDirectory = createFakePlugin('plugin', + withSingleExample: true, packagesDirectory: packagesDir); + + pluginDirectory.childFile('pubspec.yaml').writeAsStringSync(''' +${headerSection('plugin', isPlugin: true)} +${environmentSection()} +${devDependenciesSection()} +${flutterSection(isPlugin: true)} +${dependenciesSection()} +'''); + + final Future> result = + runCapturingPrint(runner, ['pubspec-check']); + + await expectLater( + result, + throwsA(const TypeMatcher()), + ); + }); + }); +}