diff --git a/.cirrus.yml b/.cirrus.yml index 9776d9a2ab31..da354c5a9b22 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -197,10 +197,6 @@ task: - export CIRRUS_CHANGE_MESSAGE="" - export CIRRUS_COMMIT_MESSAGE="" - ./script/tool_runner.sh lint-android # must come after build-examples - stable_channel_conditional_script: - - if [[ "$CHANNEL" == "stable" ]]; then - - dart ./ci/stable_conditional.dart - - fi native_unit_test_script: # Unsetting CIRRUS_CHANGE_MESSAGE and CIRRUS_COMMIT_MESSAGE as they # might include non-ASCII characters which makes Gradle crash. diff --git a/ci/stable_conditional.dart b/ci/stable_conditional.dart deleted file mode 100644 index 76643532bc9d..000000000000 --- a/ci/stable_conditional.dart +++ /dev/null @@ -1,67 +0,0 @@ -// 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. -// -// stable_conditional.dart -// -// Performs simple find and replace operations for conditional compilation -// before executing stable channel tests. -// -// Example input: -// int main() { -// // FLUTTER_STABLE_CONDITIONAL_IF_NOT_STABLE -// printf("hello world\n"); -// // FLUTTER_STABLE_CONDITIONAL_ELSE -// // printf("goodbye world\n"); -// // FLUTTER_STABLE_CONDITIONAL_ENDIF -// } -// -// Example output: -// int main() { -// printf("goodbye world\n"); -// } - -import 'dart:convert' show LineSplitter; -import 'dart:io' show FileSystemEntity, File; - -final List _filesToProcess = [ - 'packages/android_intent/android/src/test/java/io/flutter/plugins/androidintent/MethodCallHandlerImplTest.java', - 'packages/camera/camera/android/src/test/java/io/flutter/plugins/camera/DartMessengerTest.java', - 'packages/quick_actions/quick_actions/android/src/test/java/io/flutter/plugins/quickactions/QuickActionsTest.java', - 'packages/url_launcher/url_launcher/android/src/test/java/io/flutter/plugins/urllauncher/MethodCallHandlerImplTest.java', -]; - -final RegExp _replacer = RegExp( - r'^\s*// FLUTTER_STABLE_CONDITIONAL_IF_NOT_STABLE(.*?)^\s*// FLUTTER_STABLE_CONDITIONAL_ELSE(.*?)^\s*// FLUTTER_STABLE_CONDITIONAL_ENDIF', - multiLine: true, - dotAll: true); -final RegExp _commentRemover = RegExp(r'^(\s*)\/\/\s*(.*)'); -const String _newline = '\n'; - -void _process(FileSystemEntity entity) { - const LineSplitter splitter = LineSplitter(); - final String text = File(entity.path).readAsStringSync(); - String replaced = ''; - int index = 0; - for (final RegExpMatch match in _replacer.allMatches(text)) { - replaced += text.substring(index, match.start); - for (final String line in splitter.convert(match.group(2)!)) { - final RegExpMatch? commentRemoverMatch = _commentRemover.firstMatch(line); - if (commentRemoverMatch != null) { - replaced += commentRemoverMatch.group(1)! + - commentRemoverMatch.group(2)! + - _newline; - } - } - index = match.end; - } - if (replaced.isNotEmpty) { - replaced += text.substring(index, text.length); - File(entity.path).writeAsStringSync(replaced); - print('modified: ${entity.path}'); - } -} - -void main(List args) { - _filesToProcess.map((String path) => File(path)).forEach(_process); -} diff --git a/packages/android_intent/android/src/test/java/io/flutter/plugins/androidintent/MethodCallHandlerImplTest.java b/packages/android_intent/android/src/test/java/io/flutter/plugins/androidintent/MethodCallHandlerImplTest.java index 012cc9be9711..0ea03a0690f1 100644 --- a/packages/android_intent/android/src/test/java/io/flutter/plugins/androidintent/MethodCallHandlerImplTest.java +++ b/packages/android_intent/android/src/test/java/io/flutter/plugins/androidintent/MethodCallHandlerImplTest.java @@ -55,11 +55,7 @@ public void startListening_registersChannel() { methodCallHandler.startListening(messenger); verify(messenger, times(1)) - // FLUTTER_STABLE_CONDITIONAL_IF_NOT_STABLE - .setMessageHandler(eq(CHANNEL_NAME), any(BinaryMessageHandler.class), eq(null)); - // FLUTTER_STABLE_CONDITIONAL_ELSE - // .setMessageHandler(eq(CHANNEL_NAME), any(BinaryMessageHandler.class)); - // FLUTTER_STABLE_CONDITIONAL_ENDIF + .setMessageHandler(eq(CHANNEL_NAME), any(BinaryMessageHandler.class)); } @Test @@ -71,15 +67,9 @@ public void startListening_unregistersExistingChannel() { methodCallHandler.startListening(secondMessenger); // Unregisters the first and then registers the second. - // FLUTTER_STABLE_CONDITIONAL_IF_NOT_STABLE - verify(firstMessenger, times(1)).setMessageHandler(CHANNEL_NAME, null, null); + verify(firstMessenger, times(1)).setMessageHandler(CHANNEL_NAME, null); verify(secondMessenger, times(1)) - .setMessageHandler(eq(CHANNEL_NAME), any(BinaryMessageHandler.class), eq(null)); - // FLUTTER_STABLE_CONDITIONAL_ELSE - // verify(firstMessenger, times(1)).setMessageHandler(CHANNEL_NAME, null); - // verify(secondMessenger, times(1)) - // .setMessageHandler(eq(CHANNEL_NAME), any(BinaryMessageHandler.class)); - // FLUTTER_STABLE_CONDITIONAL_ENDIF + .setMessageHandler(eq(CHANNEL_NAME), any(BinaryMessageHandler.class)); } @Test @@ -89,11 +79,7 @@ public void stopListening_unregistersExistingChannel() { methodCallHandler.stopListening(); - // FLUTTER_STABLE_CONDITIONAL_IF_NOT_STABLE - verify(messenger, times(1)).setMessageHandler(CHANNEL_NAME, null, null); - // FLUTTER_STABLE_CONDITIONAL_ELSE - // verify(messenger, times(1)).setMessageHandler(CHANNEL_NAME, null); - // FLUTTER_STABLE_CONDITIONAL_ENDIF + verify(messenger, times(1)).setMessageHandler(CHANNEL_NAME, null); } @Test @@ -102,11 +88,7 @@ public void stopListening_doesNothingWhenUnset() { methodCallHandler.stopListening(); - // FLUTTER_STABLE_CONDITIONAL_IF_NOT_STABLE - verify(messenger, never()).setMessageHandler(CHANNEL_NAME, null, null); - // FLUTTER_STABLE_CONDITIONAL_ELSE - // verify(messenger, never()).setMessageHandler(CHANNEL_NAME, null); - // FLUTTER_STABLE_CONDITIONAL_ENDIF + verify(messenger, never()).setMessageHandler(CHANNEL_NAME, null); } @Test diff --git a/packages/camera/camera/android/src/test/java/io/flutter/plugins/camera/DartMessengerTest.java b/packages/camera/camera/android/src/test/java/io/flutter/plugins/camera/DartMessengerTest.java index 1ce04d6cc104..0a2fc43d03cb 100644 --- a/packages/camera/camera/android/src/test/java/io/flutter/plugins/camera/DartMessengerTest.java +++ b/packages/camera/camera/android/src/test/java/io/flutter/plugins/camera/DartMessengerTest.java @@ -12,7 +12,6 @@ import android.os.Handler; import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import io.flutter.embedding.engine.systemchannels.PlatformChannel; import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugin.common.MethodCall; @@ -32,15 +31,6 @@ public class DartMessengerTest { private static class FakeBinaryMessenger implements BinaryMessenger { private final List sentMessages = new ArrayList<>(); - // TODO(aaclarke): Remove when https://github.com/flutter/engine/pull/29147 is on stable. - // FLUTTER_STABLE_CONDITIONAL_IF_NOT_STABLE - @Override - public BinaryMessenger.TaskQueue makeBackgroundTaskQueue() { - return null; - } - // FLUTTER_STABLE_CONDITIONAL_ELSE - // FLUTTER_STABLE_CONDITIONAL_ENDIF - @Override public void send(@NonNull String channel, ByteBuffer message) { sentMessages.add(message); @@ -51,17 +41,8 @@ public void send(@NonNull String channel, ByteBuffer message, BinaryReply callba send(channel, message); } - // TODO(aaclarke): Remove when https://github.com/flutter/engine/pull/29147 is on stable. - // FLUTTER_STABLE_CONDITIONAL_IF_NOT_STABLE @Override - public void setMessageHandler( - @NonNull String channel, - BinaryMessageHandler handler, - @Nullable BinaryMessenger.TaskQueue taskQueue) {} - // FLUTTER_STABLE_CONDITIONAL_ELSE - // @Override - // public void setMessageHandler(@NonNull String channel, BinaryMessageHandler handler) {} - // FLUTTER_STABLE_CONDITIONAL_ENDIF + public void setMessageHandler(@NonNull String channel, BinaryMessageHandler handler) {} List getMessages() { return new ArrayList<>(sentMessages); diff --git a/packages/quick_actions/quick_actions/android/src/test/java/io/flutter/plugins/quickactions/QuickActionsTest.java b/packages/quick_actions/quick_actions/android/src/test/java/io/flutter/plugins/quickactions/QuickActionsTest.java index 2b6fb495f7c4..208a119efafe 100644 --- a/packages/quick_actions/quick_actions/android/src/test/java/io/flutter/plugins/quickactions/QuickActionsTest.java +++ b/packages/quick_actions/quick_actions/android/src/test/java/io/flutter/plugins/quickactions/QuickActionsTest.java @@ -33,15 +33,6 @@ public class QuickActionsTest { private static class TestBinaryMessenger implements BinaryMessenger { public MethodCall lastMethodCall; - // TODO(aaclarke): Remove when https://github.com/flutter/engine/pull/29147 is on stable. - // FLUTTER_STABLE_CONDITIONAL_IF_NOT_STABLE - @Override - public BinaryMessenger.TaskQueue makeBackgroundTaskQueue() { - return null; - } - // FLUTTER_STABLE_CONDITIONAL_ELSE - // FLUTTER_STABLE_CONDITIONAL_ENDIF - @Override public void send(@NonNull String channel, @Nullable ByteBuffer message) { send(channel, message, null); @@ -58,21 +49,10 @@ public void send( } } - // TODO(aaclarke): Remove when https://github.com/flutter/engine/pull/29147 is on stable. - // FLUTTER_STABLE_CONDITIONAL_IF_NOT_STABLE @Override - public void setMessageHandler( - @NonNull String channel, - @Nullable BinaryMessageHandler handler, - @Nullable BinaryMessenger.TaskQueue taskQueue) { + public void setMessageHandler(@NonNull String channel, @Nullable BinaryMessageHandler handler) { // Do nothing. } - // FLUTTER_STABLE_CONDITIONAL_ELSE - // @Override - // public void setMessageHandler( - // @NonNull String channel, - // @Nullable BinaryMessageHandler handler) {} - // FLUTTER_STABLE_CONDITIONAL_ENDIF } static final int SUPPORTED_BUILD = 25; diff --git a/packages/url_launcher/url_launcher/android/src/test/java/io/flutter/plugins/urllauncher/MethodCallHandlerImplTest.java b/packages/url_launcher/url_launcher/android/src/test/java/io/flutter/plugins/urllauncher/MethodCallHandlerImplTest.java index 6b544c7611c5..5e0811399ac6 100644 --- a/packages/url_launcher/url_launcher/android/src/test/java/io/flutter/plugins/urllauncher/MethodCallHandlerImplTest.java +++ b/packages/url_launcher/url_launcher/android/src/test/java/io/flutter/plugins/urllauncher/MethodCallHandlerImplTest.java @@ -44,11 +44,7 @@ public void startListening_registersChannel() { methodCallHandler.startListening(messenger); verify(messenger, times(1)) - // FLUTTER_STABLE_CONDITIONAL_IF_NOT_STABLE - .setMessageHandler(eq(CHANNEL_NAME), any(BinaryMessageHandler.class), eq(null)); - // FLUTTER_STABLE_CONDITIONAL_ELSE - // .setMessageHandler(eq(CHANNEL_NAME), any(BinaryMessageHandler.class)); - // FLUTTER_STABLE_CONDITIONAL_ENDIF + .setMessageHandler(eq(CHANNEL_NAME), any(BinaryMessageHandler.class)); } @Test @@ -60,15 +56,9 @@ public void startListening_unregistersExistingChannel() { methodCallHandler.startListening(secondMessenger); // Unregisters the first and then registers the second. - // FLUTTER_STABLE_CONDITIONAL_IF_NOT_STABLE - verify(firstMessenger, times(1)).setMessageHandler(CHANNEL_NAME, null, null); + verify(firstMessenger, times(1)).setMessageHandler(CHANNEL_NAME, null); verify(secondMessenger, times(1)) - .setMessageHandler(eq(CHANNEL_NAME), any(BinaryMessageHandler.class), eq(null)); - // FLUTTER_STABLE_CONDITIONAL_ELSE - // verify(firstMessenger, times(1)).setMessageHandler(CHANNEL_NAME, null); - // verify(secondMessenger, times(1)) - // .setMessageHandler(eq(CHANNEL_NAME), any(BinaryMessageHandler.class)); - // FLUTTER_STABLE_CONDITIONAL_ENDIF + .setMessageHandler(eq(CHANNEL_NAME), any(BinaryMessageHandler.class)); } @Test @@ -78,11 +68,7 @@ public void stopListening_unregistersExistingChannel() { methodCallHandler.stopListening(); - // FLUTTER_STABLE_CONDITIONAL_IF_NOT_STABLE - verify(messenger, times(1)).setMessageHandler(CHANNEL_NAME, null, null); - // FLUTTER_STABLE_CONDITIONAL_ELSE - // verify(messenger, times(1)).setMessageHandler(CHANNEL_NAME, null); - // FLUTTER_STABLE_CONDITIONAL_ENDIF + verify(messenger, times(1)).setMessageHandler(CHANNEL_NAME, null); } @Test @@ -91,11 +77,7 @@ public void stopListening_doesNothingWhenUnset() { methodCallHandler.stopListening(); - // FLUTTER_STABLE_CONDITIONAL_IF_NOT_STABLE - verify(messenger, never()).setMessageHandler(CHANNEL_NAME, null, null); - // FLUTTER_STABLE_CONDITIONAL_ELSE - // verify(messenger, never()).setMessageHandler(CHANNEL_NAME, null); - // FLUTTER_STABLE_CONDITIONAL_ENDIF + verify(messenger, never()).setMessageHandler(CHANNEL_NAME, null); } @Test