From f27911f7f43cc57f1c338a8d31a59f19a299ea9b Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Mon, 5 Oct 2020 17:01:55 -0700 Subject: [PATCH 01/12] Migrate plugin_platform_interface to null safety --- analysis_options.yaml | 2 ++ .../lib/plugin_platform_interface.dart | 2 +- packages/plugin_platform_interface/pubspec.yaml | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index b1261f36fac9..d771f8481ce5 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,5 +1,7 @@ include: package:pedantic/analysis_options.1.8.0.yaml analyzer: + enable-experiment: + - non-nullable exclude: # Ignore generated files - '**/*.g.dart' diff --git a/packages/plugin_platform_interface/lib/plugin_platform_interface.dart b/packages/plugin_platform_interface/lib/plugin_platform_interface.dart index be4871928686..cd87b04dc739 100644 --- a/packages/plugin_platform_interface/lib/plugin_platform_interface.dart +++ b/packages/plugin_platform_interface/lib/plugin_platform_interface.dart @@ -41,7 +41,7 @@ import 'package:meta/meta.dart'; /// [MockPlatformInterfaceMixin] for a sample of using Mockito to mock a platform interface. abstract class PlatformInterface { /// Pass a private, class-specific `const Object()` as the `token`. - PlatformInterface({@required Object token}) : _instanceToken = token; + PlatformInterface({required Object token}) : _instanceToken = token; final Object _instanceToken; diff --git a/packages/plugin_platform_interface/pubspec.yaml b/packages/plugin_platform_interface/pubspec.yaml index ae11b144ca8c..31e0149b1d21 100644 --- a/packages/plugin_platform_interface/pubspec.yaml +++ b/packages/plugin_platform_interface/pubspec.yaml @@ -17,7 +17,7 @@ version: 1.0.3 repository: https://github.com/flutter/plugins/tree/master/packages/plugin_platform_interface environment: - sdk: ">=2.1.0 <3.0.0" + sdk: '>=2.10.0-56.0.dev <3.0.0' dependencies: meta: ^1.0.0 From b8f17c27e8bc33b1f386a6dccb7a163078ffc66a Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Mon, 5 Oct 2020 17:30:59 -0700 Subject: [PATCH 02/12] Bump x --- packages/plugin_platform_interface/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugin_platform_interface/pubspec.yaml b/packages/plugin_platform_interface/pubspec.yaml index 31e0149b1d21..fd8dfd004ffe 100644 --- a/packages/plugin_platform_interface/pubspec.yaml +++ b/packages/plugin_platform_interface/pubspec.yaml @@ -12,7 +12,7 @@ description: Reusable base class for Flutter plugin platform interfaces. # be done when absolutely necessary and after the ecosystem has already migrated to 1.X.Y version # that is forward compatible with 2.0.0 (ideally the ecosystem have migrated to depend on: # `plugin_platform_interface: >=1.X.Y <3.0.0`). -version: 1.0.3 +version: 2.0.0-nullsafety repository: https://github.com/flutter/plugins/tree/master/packages/plugin_platform_interface From 739595d27bd0a7e2b1867e1fd0102be4923a8b20 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Mon, 5 Oct 2020 19:16:07 -0700 Subject: [PATCH 03/12] Update changelog --- packages/plugin_platform_interface/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/plugin_platform_interface/CHANGELOG.md b/packages/plugin_platform_interface/CHANGELOG.md index 01b5ff7d1252..38523ab9b1b9 100644 --- a/packages/plugin_platform_interface/CHANGELOG.md +++ b/packages/plugin_platform_interface/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.0-nullsafety + +* Migrate to null safety. + ## 1.0.3 * Fix homepage in `pubspec.yaml`. From 0b610f1e1bcf5a20f12ec68fb3cfb951ab8ea16d Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Mon, 5 Oct 2020 19:22:51 -0700 Subject: [PATCH 04/12] Pass enable-experiment to plugin tools --- script/incremental_build.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/script/incremental_build.sh b/script/incremental_build.sh index 30c166b4c666..e39c5087bf4b 100755 --- a/script/incremental_build.sh +++ b/script/incremental_build.sh @@ -43,7 +43,7 @@ PLUGIN_SHARDING=($PLUGIN_SHARDING) if [[ "${BRANCH_NAME}" == "master" ]]; then echo "Running for all packages" - (cd "$REPO_DIR" && $PUB global run flutter_plugin_tools "${ACTIONS[@]}" ${PLUGIN_SHARDING[@]}) + (cd "$REPO_DIR" && $PUB global run flutter_plugin_tools "${ACTIONS[@]}" ${PLUGIN_SHARDING[@]}) --enable-experiment=non-nullable else # Sets CHANGED_PACKAGES check_changed_packages @@ -51,11 +51,11 @@ else if [[ "$CHANGED_PACKAGES" == "" ]]; then echo "No changes detected in packages." echo "Running for all packages" - (cd "$REPO_DIR" && $PUB global run flutter_plugin_tools "${ACTIONS[@]}" ${PLUGIN_SHARDING[@]}) + (cd "$REPO_DIR" && $PUB global run flutter_plugin_tools "${ACTIONS[@]}" ${PLUGIN_SHARDING[@]}) --enable-experiment=non-nullable else echo running "${ACTIONS[@]}" (cd "$REPO_DIR" && $PUB global run flutter_plugin_tools "${ACTIONS[@]}" --plugins="$CHANGED_PACKAGES" ${PLUGIN_SHARDING[@]}) echo "Running version check for changed packages" - (cd "$REPO_DIR" && $PUB global run flutter_plugin_tools version-check --base_sha="$(get_branch_base_sha)") + (cd "$REPO_DIR" && $PUB global run flutter_plugin_tools version-check --base_sha="$(get_branch_base_sha)" --enable-experiment=non-nullable) fi fi From 043b2b5b4a59ec77302a5010316c726f96e56da5 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Wed, 7 Oct 2020 12:10:35 -0700 Subject: [PATCH 05/12] Retrigger checks From c188391ab910067ce1e6c456c5538f3fce7eec20 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Wed, 7 Oct 2020 12:38:53 -0700 Subject: [PATCH 06/12] Update cirrus config --- .cirrus.yml | 10 +++++----- script/incremental_build.sh | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 872cfc2316fa..756eb6e5dda2 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -37,7 +37,7 @@ task: # https://github.com/flutter/flutter/issues/42864 - if [[ "$CHANNEL" -eq "stable" ]]; then find . | grep _web$ | xargs rm -rf; fi - flutter channel $CHANNEL - - ./script/incremental_build.sh test + - ./script/incremental_build.sh test --enable-experiment=non-nullable - name: analyze script: ./script/incremental_build.sh analyze - name: build_all_plugins_apk @@ -87,13 +87,13 @@ task: - echo "$CIRRUS_COMMIT_MESSAGE" > /tmp/cirrus_commit_message.txt - export CIRRUS_CHANGE_MESSAGE="" - export CIRRUS_COMMIT_MESSAGE="" - - ./script/incremental_build.sh build-examples --apk + - ./script/incremental_build.sh build-examples --apk --enable-experiment=non-nullable - ./script/incremental_build.sh java-test # must come after apk build - if [[ $GCLOUD_FIREBASE_TESTLAB_KEY == ENCRYPTED* ]]; then - echo "This user does not have permission to run Firebase Test Lab tests." - else - echo $GCLOUD_FIREBASE_TESTLAB_KEY > ${HOME}/gcloud-service-key.json - - ./script/incremental_build.sh firebase-test-lab --device model=flame,version=29 --device model=starqlteue,version=26 + - ./script/incremental_build.sh firebase-test-lab --device model=flame,version=29 --device model=starqlteue,version=26 --enable-experiment=non-nullable - fi - export CIRRUS_CHANGE_MESSAGE=`cat /tmp/cirrus_change_message.txt` - export CIRRUS_COMMIT_MESSAGE=`cat /tmp/cirrus_commit_message.txt` @@ -177,8 +177,8 @@ task: # https://github.com/flutter/flutter/issues/42864 - if [[ "$CHANNEL" -eq "stable" ]]; then find . | grep _web$ | xargs rm -rf; fi - flutter channel $CHANNEL - - ./script/incremental_build.sh build-examples --ipa - - ./script/incremental_build.sh drive-examples + - ./script/incremental_build.sh build-examples --ipa --enable-experiment=non-nullable + - ./script/incremental_build.sh drive-examples --enable-experiment=non-nullable task: # don't run on release tags since it creates O(n^2) tasks where n is the number of plugins only_if: $CIRRUS_TAG == '' diff --git a/script/incremental_build.sh b/script/incremental_build.sh index e39c5087bf4b..30c166b4c666 100755 --- a/script/incremental_build.sh +++ b/script/incremental_build.sh @@ -43,7 +43,7 @@ PLUGIN_SHARDING=($PLUGIN_SHARDING) if [[ "${BRANCH_NAME}" == "master" ]]; then echo "Running for all packages" - (cd "$REPO_DIR" && $PUB global run flutter_plugin_tools "${ACTIONS[@]}" ${PLUGIN_SHARDING[@]}) --enable-experiment=non-nullable + (cd "$REPO_DIR" && $PUB global run flutter_plugin_tools "${ACTIONS[@]}" ${PLUGIN_SHARDING[@]}) else # Sets CHANGED_PACKAGES check_changed_packages @@ -51,11 +51,11 @@ else if [[ "$CHANGED_PACKAGES" == "" ]]; then echo "No changes detected in packages." echo "Running for all packages" - (cd "$REPO_DIR" && $PUB global run flutter_plugin_tools "${ACTIONS[@]}" ${PLUGIN_SHARDING[@]}) --enable-experiment=non-nullable + (cd "$REPO_DIR" && $PUB global run flutter_plugin_tools "${ACTIONS[@]}" ${PLUGIN_SHARDING[@]}) else echo running "${ACTIONS[@]}" (cd "$REPO_DIR" && $PUB global run flutter_plugin_tools "${ACTIONS[@]}" --plugins="$CHANGED_PACKAGES" ${PLUGIN_SHARDING[@]}) echo "Running version check for changed packages" - (cd "$REPO_DIR" && $PUB global run flutter_plugin_tools version-check --base_sha="$(get_branch_base_sha)" --enable-experiment=non-nullable) + (cd "$REPO_DIR" && $PUB global run flutter_plugin_tools version-check --base_sha="$(get_branch_base_sha)") fi fi From b29b55f7da5f5bee22f713e6bff971163dbe7502 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Wed, 7 Oct 2020 17:03:50 -0700 Subject: [PATCH 07/12] Update dependencies --- packages/plugin_platform_interface/pubspec.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/plugin_platform_interface/pubspec.yaml b/packages/plugin_platform_interface/pubspec.yaml index fd8dfd004ffe..b65ef70df86f 100644 --- a/packages/plugin_platform_interface/pubspec.yaml +++ b/packages/plugin_platform_interface/pubspec.yaml @@ -6,12 +6,12 @@ description: Reusable base class for Flutter plugin platform interfaces. # # This package is used as a second level dependency for many plugins, a major version bump here # is guaranteed to lead the ecosystem to a version lock (the first plugin that upgrades to version -# 2 of this package cannot be used with any other plugin that have not yet migrated). +# 3 of this package cannot be used with any other plugin that have not yet migrated). # # Please consider carefully before bumping the major version of this package, ideally it should only -# be done when absolutely necessary and after the ecosystem has already migrated to 1.X.Y version -# that is forward compatible with 2.0.0 (ideally the ecosystem have migrated to depend on: -# `plugin_platform_interface: >=1.X.Y <3.0.0`). +# be done when absolutely necessary and after the ecosystem has already migrated to 2.X.Y version +# that is forward compatible with 3.0.0 (ideally the ecosystem have migrated to depend on: +# `plugin_platform_interface: >=2.X.Y <4.0.0`). version: 2.0.0-nullsafety repository: https://github.com/flutter/plugins/tree/master/packages/plugin_platform_interface @@ -20,9 +20,9 @@ environment: sdk: '>=2.10.0-56.0.dev <3.0.0' dependencies: - meta: ^1.0.0 + meta: ^1.3.0-nullsafety.3 dev_dependencies: mockito: ^4.1.1 - test: ^1.9.4 - pedantic: ^1.8.0 + test: ^1.10.0-nullsafety.1 + pedantic: ^1.10.0-nullsafety.1 From c8908ec1bc038da078ae83a5123d0d256b9e72a7 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Wed, 7 Oct 2020 17:21:41 -0700 Subject: [PATCH 08/12] Opt-out test --- .../test/plugin_platform_interface_test.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/plugin_platform_interface/test/plugin_platform_interface_test.dart b/packages/plugin_platform_interface/test/plugin_platform_interface_test.dart index 0488c20f3efb..d45606aeea86 100644 --- a/packages/plugin_platform_interface/test/plugin_platform_interface_test.dart +++ b/packages/plugin_platform_interface/test/plugin_platform_interface_test.dart @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// ignore: todo +// TODO(egarciad): Remove once Mockito is migrated to null. +// @dart = 2.9 import 'package:mockito/mockito.dart'; import 'package:test/test.dart'; From e1f7ce3e7e07b3ae7dd89fd4f2f60ea0f04105cc Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Wed, 7 Oct 2020 17:22:30 -0700 Subject: [PATCH 09/12] Typo --- .../test/plugin_platform_interface_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugin_platform_interface/test/plugin_platform_interface_test.dart b/packages/plugin_platform_interface/test/plugin_platform_interface_test.dart index d45606aeea86..5b79a65d83d9 100644 --- a/packages/plugin_platform_interface/test/plugin_platform_interface_test.dart +++ b/packages/plugin_platform_interface/test/plugin_platform_interface_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. // ignore: todo -// TODO(egarciad): Remove once Mockito is migrated to null. +// TODO(egarciad): Remove once Mockito is migrated to null safety. // @dart = 2.9 import 'package:mockito/mockito.dart'; import 'package:test/test.dart'; From d62ac1805f021574f5813eac9136b33f5da348aa Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Fri, 9 Oct 2020 10:04:46 -0700 Subject: [PATCH 10/12] Bump y instead of x --- packages/plugin_platform_interface/CHANGELOG.md | 2 +- packages/plugin_platform_interface/pubspec.yaml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/plugin_platform_interface/CHANGELOG.md b/packages/plugin_platform_interface/CHANGELOG.md index 38523ab9b1b9..f8e848537c70 100644 --- a/packages/plugin_platform_interface/CHANGELOG.md +++ b/packages/plugin_platform_interface/CHANGELOG.md @@ -1,4 +1,4 @@ -## 2.0.0-nullsafety +## 1.1.0-nullsafety * Migrate to null safety. diff --git a/packages/plugin_platform_interface/pubspec.yaml b/packages/plugin_platform_interface/pubspec.yaml index b65ef70df86f..d79dbb8db3a6 100644 --- a/packages/plugin_platform_interface/pubspec.yaml +++ b/packages/plugin_platform_interface/pubspec.yaml @@ -6,13 +6,13 @@ description: Reusable base class for Flutter plugin platform interfaces. # # This package is used as a second level dependency for many plugins, a major version bump here # is guaranteed to lead the ecosystem to a version lock (the first plugin that upgrades to version -# 3 of this package cannot be used with any other plugin that have not yet migrated). +# 2 of this package cannot be used with any other plugin that have not yet migrated). # # Please consider carefully before bumping the major version of this package, ideally it should only -# be done when absolutely necessary and after the ecosystem has already migrated to 2.X.Y version -# that is forward compatible with 3.0.0 (ideally the ecosystem have migrated to depend on: -# `plugin_platform_interface: >=2.X.Y <4.0.0`). -version: 2.0.0-nullsafety +# be done when absolutely necessary and after the ecosystem has already migrated to 1.X.Y version +# that is forward compatible with 2.0.0 (ideally the ecosystem have migrated to depend on: +# `plugin_platform_interface: >=1.X.Y <3.0.0`). +version: 1.1.0-nullsafety repository: https://github.com/flutter/plugins/tree/master/packages/plugin_platform_interface From 1c66485ed2264e5cdc542569a002dd4499701dfc Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Fri, 9 Oct 2020 10:12:32 -0700 Subject: [PATCH 11/12] Supress todo ignore --- .../test/plugin_platform_interface_test.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/plugin_platform_interface/test/plugin_platform_interface_test.dart b/packages/plugin_platform_interface/test/plugin_platform_interface_test.dart index 5b79a65d83d9..b07dd4dcede1 100644 --- a/packages/plugin_platform_interface/test/plugin_platform_interface_test.dart +++ b/packages/plugin_platform_interface/test/plugin_platform_interface_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// ignore: todo // TODO(egarciad): Remove once Mockito is migrated to null safety. // @dart = 2.9 import 'package:mockito/mockito.dart'; From ce74341501c50db788b5f72d10e6371bb6e1e4b8 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Fri, 9 Oct 2020 11:08:53 -0700 Subject: [PATCH 12/12] Add publish_to:none --- packages/plugin_platform_interface/pubspec.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/plugin_platform_interface/pubspec.yaml b/packages/plugin_platform_interface/pubspec.yaml index d79dbb8db3a6..b1454bb82d1e 100644 --- a/packages/plugin_platform_interface/pubspec.yaml +++ b/packages/plugin_platform_interface/pubspec.yaml @@ -19,6 +19,9 @@ repository: https://github.com/flutter/plugins/tree/master/packages/plugin_platf environment: sdk: '>=2.10.0-56.0.dev <3.0.0' +# Don't publish this package until null safety is stable or the package is in the allow list. +publish_to: none + dependencies: meta: ^1.3.0-nullsafety.3