Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ allowed_hosts = [
]

deps = {
'src': 'https://github.com/flutter/buildroot.git' + '@' + '71c54fdf2bcb63c70217c0beb8deec73787439b4',
'src': 'https://github.com/flutter/buildroot.git' + '@' + 'e32b5c320d36bdb7a21ecfc7a2f86787f63e8dd6',

# Fuchsia compatibility
#
Expand Down
1 change: 1 addition & 0 deletions ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,7 @@ FILE: ../../../flutter/shell/platform/android/platform_view_android.cc
FILE: ../../../flutter/shell/platform/android/platform_view_android.h
FILE: ../../../flutter/shell/platform/android/platform_view_android_jni.cc
FILE: ../../../flutter/shell/platform/android/platform_view_android_jni.h
FILE: ../../../flutter/shell/platform/android/robolectric.properties
FILE: ../../../flutter/shell/platform/android/vsync_waiter_android.cc
FILE: ../../../flutter/shell/platform/android/vsync_waiter_android.h
FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/basic_message_channel_unittests.cc
Expand Down
6 changes: 6 additions & 0 deletions shell/platform/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -454,23 +454,29 @@ action("robolectric_tests") {
jar_path + ".md5.stamp",
]

additional_jar_files = [ "robolectric.properties" ]

_jar_dependencies = [
android_sdk_jar,
embedding_jar_path,
] + embedding_dependencies_jars

inputs = _jar_dependencies

_rebased_current_path = rebase_path(".")
_rebased_jar_path = rebase_path(jar_path, root_build_dir)
_rebased_depfile = rebase_path(depfile, root_build_dir)
_rebased_classpath = rebase_path(_jar_dependencies, root_build_dir)
_rebased_srcjars = rebase_path(_jar_dependencies, root_build_dir)
_rebased_additional_files = rebase_path(additional_jar_files, root_build_dir)

args = [
"--depfile=$_rebased_depfile",
"--jar-path=$_rebased_jar_path",
"--classpath=$_rebased_classpath",
"--jar-source-base-dir=$_rebased_current_path",
"--java-srcjars=$_rebased_srcjars",
"--additional-jar-files=$_rebased_additional_files",
]

args += rebase_path(sources, root_build_dir)
Expand Down
8 changes: 5 additions & 3 deletions shell/platform/android/embedding_bundle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ Once you have updated the dependencies, you can upload a new version by running
`cipd create --pkg-def cipd.yaml`. For more, see the Chromium instructions on ["Updating a CIPD
dependency"](https://chromium.googlesource.com/chromium/src/+/master/docs/cipd.md#Updating-a-CIPD-dependency) for how to upload a package update to CIPD.

Once you've uploaded the new version, also make sure to tag it with the updated
timestamp and robolectric version (most likely still 3.8, unless you've migrated
all the packages to 4+).
On successful upload, you will receive a hash for the upload such as

`cipd: successfully uploaded and verified flutter/android/embedding_bundle:NZvE-rL3E66nHQZb5Vyl9-1Y_1MWEX7KURgOHqX2cYcC`

Let's further annotate the new upload with the current timestamp.

$ cipd set-tag flutter/android/embedding_bundle --version=<new_version_hash> -tag=last_updated:<timestamp>

Expand Down
12 changes: 8 additions & 4 deletions shell/platform/android/embedding_bundle/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ configurations {
embedding
// Use any of these configurations for dependencies required for testing the embedding.
embeddingTesting
embeddingTesting_duplicated
embeddingTesting_v16
}

android {
Expand All @@ -49,9 +49,13 @@ android {
embedding "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"

// Testing
// TODO(xster): remove these android-all compile time dependencies.
// Use https://github.com/robolectric/robolectric/blob/master/robolectric/src/main/java/org/robolectric/plugins/LegacyDependencyResolver.java#L24
// and specify them as runtime dependencies.
embeddingTesting "org.robolectric:android-all:8.1.0-robolectric-4611349"
// This is required by the robolectric test.
embeddingTesting_duplicated "org.robolectric:android-all:4.1.2_r1-robolectric-r1"
// Get robolectric shadows for SDK=16 used by PlatformPluginTest.
embeddingTesting_v16 "org.robolectric:android-all:4.1.2_r1-robolectric-r1"
embeddingTesting "androidx.fragment:fragment-testing:1.1.0"
embeddingTesting "org.mockito:mockito-all:1.10.19"
embeddingTesting ("org.robolectric:robolectric:4.3") {
// org.hamcrest is added by org.mockito:mockito-all
Expand All @@ -71,7 +75,7 @@ task updateDependencies() {
copy {
from configurations.embedding
from configurations.embeddingTesting
from configurations.embeddingTesting_duplicated
from configurations.embeddingTesting_v16
into destinationDir
}
doLast {
Expand Down
2 changes: 2 additions & 0 deletions shell/platform/android/robolectric.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Match the value at shell/platform/android/embedding_bundle/build.gradle.
sdk=29
8 changes: 0 additions & 8 deletions shell/platform/android/test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@ integration tests in other repos.

## Q&A

### Why are we using Robolectric 3.8 when Robolectric 4+ is current?

Robolectric 4+ uses the AndroidX libraries, and the engine sources use the
deprecated android.support ones. See
[flutter/flutter#23586](https://github.com/flutter/flutter/issues/23586). If
this is an issue we could use Jetifier on `flutter.jar` first and _then_ run
the tests, but it would add an extra point of failure.

### My new test won't run. There's a "ClassNotFoundException".

See [Updating Embedding Dependencies](../embedding_bundle).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,9 @@
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;

// TODO(xster): we have 2 versions of robolectric Android shadows in
// shell/platform/android/embedding_bundle/build.gradle. Remove the older
// org.robolectric:android-all:4.1.2_r1-robolectric-r1 which doesn't have the right shadow
// behaviors.
@Config(manifest = Config.NONE, sdk = 27)
@Config(manifest = Config.NONE)
@RunWith(RobolectricTestRunner.class)
@TargetApi(27)
@TargetApi(29)
public class FlutterViewTest {
@Mock FlutterJNI mockFlutterJni;
@Mock FlutterLoader mockFlutterLoader;
Expand Down