This repository has been archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[package_info] Support the v2 Android embedder (with e2e tests) #2160
Merged
collinjackson
merged 55 commits into
flutter:master
from
collinjackson:migrate_package_info
Oct 17, 2019
Merged
Changes from 28 commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
85172df
Support the v2 Android embedder
collinjackson 17bd422
Move to dev namespace
collinjackson fe8d3a8
Add enableR8
collinjackson 83dd9f0
reformat
collinjackson 0946eeb
Include testing
collinjackson ab5be52
Add a unit test and migrate to e2e test binding
collinjackson a4fc6ba
Fix bugs uncovered by e2e tests
collinjackson 4cb7bf2
Convert to androidX, move some things around
collinjackson a9866da
Add a unit test
collinjackson 0639c46
Rename test to be more descriptive
collinjackson 55813be
Reformat
collinjackson e7d4f21
Update CHANGELOG
collinjackson ff1e2cf
Add an integration test of the example app
collinjackson 1c6448c
Add e2e extension
collinjackson 1e9cc06
Fix analyzer issues
collinjackson 502e72f
reformat
collinjackson e3107bf
jetify
collinjackson 2a0c3cc
Return exit code
collinjackson f7717af
enableR8
collinjackson f9c7d16
Update to point to e2e package
collinjackson 7c928fc
Amir CR feedback
collinjackson a624929
Bump min version to 1.6.7
collinjackson 6c996fb
Merge remote-tracking branch 'origin/master' into migrate_package_info
collinjackson 45a6d9d
Move test location
collinjackson 397395d
Fix analyzer failures
collinjackson c44fed0
reformat
collinjackson e276af0
Add copyrights
collinjackson ba5ea93
Remove backtick
collinjackson 83db9b7
Test using plugin_tools from a branch
collinjackson fd15c6d
Fix package name
collinjackson 6160d81
Update to new package conventions
collinjackson 0bd7375
Add build.gradle
collinjackson 2af8457
Fix package names
collinjackson 0121e9e
Fix activity launch
collinjackson e5a370b
Update https checkout
collinjackson 4f2ab2f
Update to point to latest e2e plugin, add E2E plugin to example, clea…
collinjackson ced1f8d
Fix temporary cirrus command
collinjackson 054b1a0
Remove singleTop from AndroidManifest.xml
collinjackson 91be486
Merge remote-tracking branch 'origin/master' into migrate_package_info
collinjackson 265127f
Add missing import
collinjackson 1e8f811
Revert cirrus changes
collinjackson e497d95
Add comment
collinjackson f21476a
reformat
collinjackson a2bca9c
Enable Firebase Test Lab test
collinjackson 77d22f3
Revert file that shouldn’t have been modified
collinjackson a0c5273
Temporary commit to try out flutter_plugin_tools changes
collinjackson b6c0ceb
Set Firebase Test Lab key in .cirrus.yml
collinjackson d95a8c5
Add gcloud to Dockerfile
collinjackson d1b8e10
add some sudo
collinjackson 881c1c9
Add gpg-agent package
collinjackson a42674b
reorder commands
collinjackson 64e3352
Reorder commands again
collinjackson 491234f
add more install commands
collinjackson a16cfd2
remove extraneous &&
collinjackson 1e84ad0
Remove changes not intended to be landed
collinjackson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
org.gradle.jvmargs=-Xmx1536M | ||
android.enableJetifier=true | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
android.enableJetifier=true | ||
android.useAndroidX=true | ||
android.useAndroidX=true | ||
android.enableR8=true |
15 changes: 15 additions & 0 deletions
15
...oid/app/src/androidTest/java/dev/flutter/plugins/packageinfoexample/MainActivityTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright 2019 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
package dev.flutter.plugins.packageinfoexample; | ||
|
||
import androidx.test.rule.ActivityTestRule; | ||
import dev.flutter.plugins.instrumentationadapter.FlutterRunner; | ||
collinjackson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
import org.junit.Rule; | ||
import org.junit.runner.RunWith; | ||
|
||
@RunWith(FlutterRunner.class) | ||
public class MainActivityTest { | ||
@Rule public ActivityTestRule<MainActivity> rule = new ActivityTestRule<>(MainActivity.class); | ||
} |
15 changes: 15 additions & 0 deletions
15
...roid/app/src/androidTest/java/io/flutter/plugins/packageinfoexample/MainActivityTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright 2019 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
package io.flutter.plugins.packageinfoexample; | ||
|
||
import androidx.test.rule.ActivityTestRule; | ||
import dev.flutter.plugins.instrumentationadapter.FlutterRunner; | ||
import org.junit.Rule; | ||
import org.junit.runner.RunWith; | ||
|
||
@RunWith(FlutterRunner.class) | ||
public class MainActivityTest { | ||
@Rule public ActivityTestRule<MainActivity> rule = new ActivityTestRule<>(MainActivity.class); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...xample/android/app/src/main/java/dev/flutter/plugins/packageinfoexample/MainActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2017 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
package dev.flutter.plugins.packageinfoexample; | ||
|
||
import dev.flutter.plugins.packageinfo.PackageInfoPlugin; | ||
import io.flutter.embedding.android.FlutterActivity; | ||
import io.flutter.embedding.engine.FlutterEngine; | ||
|
||
public class MainActivity extends FlutterActivity { | ||
@Override | ||
public void configureFlutterEngine(FlutterEngine flutterEngine) { | ||
flutterEngine.getPlugins().add(new PackageInfoPlugin()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
org.gradle.jvmargs=-Xmx1536M | ||
android.enableJetifier=true | ||
android.enableR8=true | ||
android.useAndroidX=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ dev_dependencies: | |
flutter_driver: | ||
sdk: flutter | ||
test: any | ||
e2e: "^0.2.0" | ||
|
||
flutter: | ||
uses-material-design: true |
31 changes: 0 additions & 31 deletions
31
packages/package_info/example/test_driver/package_info.dart
This file was deleted.
Oops, something went wrong.
51 changes: 51 additions & 0 deletions
51
packages/package_info/example/test_driver/package_info_e2e.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright 2019, the Chromium project authors. Please see the AUTHORS file | ||
collinjackson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// for details. 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:io'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:e2e/e2e.dart'; | ||
import 'package:package_info/package_info.dart'; | ||
import 'package:package_info_example/main.dart'; | ||
|
||
void main() { | ||
E2EWidgetsFlutterBinding.ensureInitialized(); | ||
|
||
testWidgets('fromPlatform', (WidgetTester tester) async { | ||
final PackageInfo info = await PackageInfo.fromPlatform(); | ||
// These tests are based on the example app. The tests should be updated if any related info changes. | ||
if (Platform.isAndroid) { | ||
expect(info.appName, 'package_info_example'); | ||
expect(info.buildNumber, '1'); | ||
expect(info.packageName, 'io.flutter.plugins.packageinfoexample'); | ||
expect(info.version, '1.0'); | ||
} else if (Platform.isIOS) { | ||
expect(info.appName, 'Package Info Example'); | ||
expect(info.buildNumber, '1'); | ||
expect(info.packageName, 'io.flutter.plugins.packageInfoExample'); | ||
expect(info.version, '1.0'); | ||
} else { | ||
throw (UnsupportedError('platform not supported')); | ||
} | ||
}); | ||
|
||
testWidgets('example', (WidgetTester tester) async { | ||
await tester.pumpWidget(MyApp()); | ||
await tester.pumpAndSettle(); | ||
if (Platform.isAndroid) { | ||
expect(find.text('package_info_example'), findsOneWidget); | ||
expect(find.text('1'), findsOneWidget); | ||
expect( | ||
find.text('io.flutter.plugins.packageinfoexample'), findsOneWidget); | ||
expect(find.text('1.0'), findsOneWidget); | ||
} else if (Platform.isIOS) { | ||
expect(find.text('Package Info Example'), findsOneWidget); | ||
expect(find.text('1'), findsOneWidget); | ||
expect( | ||
find.text('io.flutter.plugins.packageInfoExample'), findsOneWidget); | ||
expect(find.text('1.0'), findsOneWidget); | ||
} else { | ||
throw (UnsupportedError('platform not supported')); | ||
} | ||
}); | ||
} |
15 changes: 15 additions & 0 deletions
15
packages/package_info/example/test_driver/package_info_e2e_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright 2019, the Chromium project authors. Please see the AUTHORS file | ||
// for details. 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:io'; | ||
|
||
import 'package:flutter_driver/flutter_driver.dart'; | ||
|
||
Future<void> main() async { | ||
final FlutterDriver driver = await FlutterDriver.connect(); | ||
final String result = | ||
await driver.requestData(null, timeout: const Duration(minutes: 1)); | ||
driver.close(); | ||
exit(result == 'pass' ? 0 : 1); | ||
} |
10 changes: 0 additions & 10 deletions
10
packages/package_info/example/test_driver/package_info_test.dart
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright 2019 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:flutter/services.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:package_info/package_info.dart'; | ||
|
||
void main() { | ||
TestWidgetsFlutterBinding.ensureInitialized(); | ||
|
||
const MethodChannel channel = | ||
MethodChannel('plugins.flutter.io/package_info'); | ||
List<MethodCall> log; | ||
|
||
channel.setMockMethodCallHandler((MethodCall methodCall) async { | ||
log.add(methodCall); | ||
switch (methodCall.method) { | ||
case 'getAll': | ||
return <String, dynamic>{ | ||
'appName': 'package_info_example', | ||
'buildNumber': '1', | ||
'packageName': 'io.flutter.plugins.packageinfoexample', | ||
'version': '1.0', | ||
}; | ||
default: | ||
assert(false); | ||
return null; | ||
} | ||
}); | ||
|
||
setUp(() { | ||
log = <MethodCall>[]; | ||
}); | ||
|
||
test('fromPlatform', () async { | ||
final PackageInfo info = await PackageInfo.fromPlatform(); | ||
expect(info.appName, 'package_info_example'); | ||
expect(info.buildNumber, '1'); | ||
expect(info.packageName, 'io.flutter.plugins.packageinfoexample'); | ||
expect(info.version, '1.0'); | ||
expect( | ||
log, | ||
<Matcher>[ | ||
isMethodCall('getAll', arguments: null), | ||
], | ||
); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
org.gradle.jvmargs=-Xmx1536M | ||
android.enableR8=true |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the affect of adding this to a plugin's gradle file? Does this setting gets propagated to all apps who are using the plugin?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the name, I'm hoping that
enableJetifier
does not implyenableAndroidX
, so it should reduce compilation errors without causing compilation errors.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this has any meaning without
enableAndroidX
, and if it does I think it would also implicitly turn AndroidX on. If AndroidX is enabled and this flag is true, Gradle will attempt to run Jetifier to convert any support references to AndroidX ones. I'm not sure how Gradle handles just this flag withenableAndroidX
being undefined.I'm pretty sure that putting this here means that this subproject and only this subproject would be affected, but there may be some weirdness here on account of our build system.