Skip to content

Commit

Permalink
Merge branch 'master' into add_zoom_to_android_webview
Browse files Browse the repository at this point in the history
* master:
  Implement Android WebView api with pigeon (Java portion) (flutter#4441)
  [in_app_purchase] Update to the latest pkg:json_serializable (flutter#4434)
  Implement Android WebView api with pigeon (Dart portion)  (flutter#4435)
  upgraded usage of BinaryMessenger (flutter#4451)
  [flutter_plugin_tools] Fix pubspec-check on Windows (flutter#4428)
  Use OpenJDK 11 in CI jobs  (flutter#4419)
  [google_sign_in] remove the commented out code in tests (flutter#4442)
  • Loading branch information
NickalasB committed Oct 27, 2021
2 parents 955440d + 42364e4 commit 7fd7879
Show file tree
Hide file tree
Showing 77 changed files with 8,738 additions and 929 deletions.
4 changes: 0 additions & 4 deletions .ci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ FROM cirrusci/flutter:2.2.2

RUN apt-get update -y

# Required by Roboeletric and the Android SDK.
RUN apt-get install -y openjdk-8-jdk
ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64

RUN apt-get install -y --no-install-recommends gnupg

# Add repo for gcloud sdk and install it
Expand Down
4 changes: 4 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ 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.
Expand Down
67 changes: 67 additions & 0 deletions ci/stable_conditional.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// 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<String> _filesToProcess = <String>[
'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<String> args) {
_filesToProcess.map((String path) => File(path)).forEach(_process);
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ public void startListening_registersChannel() {
methodCallHandler.startListening(messenger);

verify(messenger, times(1))
.setMessageHandler(eq(CHANNEL_NAME), any(BinaryMessageHandler.class));
// 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
}

@Test
Expand All @@ -67,9 +71,15 @@ public void startListening_unregistersExistingChannel() {
methodCallHandler.startListening(secondMessenger);

// Unregisters the first and then registers the second.
verify(firstMessenger, times(1)).setMessageHandler(CHANNEL_NAME, null);
// FLUTTER_STABLE_CONDITIONAL_IF_NOT_STABLE
verify(firstMessenger, times(1)).setMessageHandler(CHANNEL_NAME, null, null);
verify(secondMessenger, times(1))
.setMessageHandler(eq(CHANNEL_NAME), any(BinaryMessageHandler.class));
.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
}

@Test
Expand All @@ -79,7 +89,11 @@ public void stopListening_unregistersExistingChannel() {

methodCallHandler.stopListening();

verify(messenger, times(1)).setMessageHandler(CHANNEL_NAME, null);
// 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
}

@Test
Expand All @@ -88,7 +102,11 @@ public void stopListening_doesNothingWhenUnset() {

methodCallHandler.stopListening();

verify(messenger, never()).setMessageHandler(CHANNEL_NAME, null);
// 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
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

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;
Expand All @@ -31,6 +32,15 @@ public class DartMessengerTest {
private static class FakeBinaryMessenger implements BinaryMessenger {
private final List<ByteBuffer> 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);
Expand All @@ -41,8 +51,17 @@ 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) {}
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

List<ByteBuffer> getMessages() {
return new ArrayList<>(sentMessages);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ flutter {
}

dependencies {
testImplementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.13'
testImplementation 'org.robolectric:robolectric:4.4'
testImplementation 'org.mockito:mockito-core:3.5.13'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
testImplementation 'org.robolectric:robolectric:3.8'
testImplementation 'org.mockito:mockito-core:3.5.13'
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.android.tools.build:gradle:7.0.1'
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,6 @@ void main() {

expect(auth.accessToken, '456');
expect(auth.idToken, '123');
// fix deprecated_member_use_from_same_package
// expect(auth.serverAuthCode, '789');
expect(
log,
<Matcher>[
Expand Down
7 changes: 0 additions & 7 deletions packages/in_app_purchase/in_app_purchase/build.yaml

This file was deleted.

6 changes: 6 additions & 0 deletions packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
## 0.1.6

* Require Dart SDK >= 2.14.
* Update `json_annotation` dependency to `^4.3.0`.

## 0.1.5+1

* Fix a broken link in the README.

## 0.1.5

* Introduced the `SkuDetailsWrapper.introductoryPriceAmountMicros` field of the correct type (`int`) and deprecated the `SkuDetailsWrapper.introductoryPriceMicros` field.
Expand Down
3 changes: 2 additions & 1 deletion packages/in_app_purchase/in_app_purchase_android/build.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# See https://pub.dev/packages/build_config
targets:
$default:
builders:
json_serializable:
options:
any_map: true
create_to_json: true
create_to_json: false
Loading

0 comments on commit 7fd7879

Please sign in to comment.