Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 025e2d8

Browse files
author
Emmanuel Garcia
authored
Migrate embedding to AndroidX (#17075)
1 parent cedddb7 commit 025e2d8

File tree

106 files changed

+454
-551
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+454
-551
lines changed

DEPS

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -497,11 +497,11 @@ deps = {
497497
'dep_type': 'cipd',
498498
},
499499

500-
'src/third_party/robolectric': {
500+
'src/third_party/android_embedding_dependencies': {
501501
'packages': [
502502
{
503-
'package': 'flutter/android/robolectric_bundle',
504-
'version': 'last_updated:2019-09-09T16:47:38-0700'
503+
'package': 'flutter/android/embedding_bundle',
504+
'version': 'last_updated:2020-03-13T15:42:26-0700'
505505
}
506506
],
507507
'condition': 'download_android_deps',
@@ -593,15 +593,6 @@ hooks = [
593593
'pattern': '.',
594594
'action': ['python', 'src/build/vs_toolchain.py', 'update'],
595595
},
596-
{
597-
'name': 'download_android_support',
598-
'pattern': '.',
599-
'condition': 'download_android_deps',
600-
'action': [
601-
'python',
602-
'src/flutter/tools/android_support/download_android_support.py',
603-
],
604-
},
605596
{
606597
'name': 'generate_package_files',
607598
'pattern': '.',

ci/licenses_golden/licenses_fuchsia

Lines changed: 145 additions & 145 deletions
Large diffs are not rendered by default.

ci/licenses_golden/tool_signature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Signature: 9ad4afaa43bd81d0e6a011688ca40377
1+
Signature: c182c713338fa4bfd82bfab82778038b
22

shell/platform/android/BUILD.gn

Lines changed: 18 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -228,15 +228,14 @@ android_java_sources = [
228228
"io/flutter/view/VsyncWaiter.java",
229229
]
230230

231-
android_support_jars = [
232-
"//third_party/android_support/android_support_compat.jar",
233-
"//third_party/android_support/android_support_annotations.jar",
234-
"//third_party/android_support/android_support_fragment.jar",
235-
"//third_party/android_support/android_arch_lifecycle_common.jar",
236-
"//third_party/android_support/android_arch_lifecycle_common_java8.jar",
237-
"//third_party/android_support/android_arch_lifecycle_runtime.jar",
238-
"//third_party/android_support/android_arch_lifecycle_viewmodel.jar",
239-
]
231+
list_script = rebase_path("//build/ls.py", ".", "//")
232+
embedding_dependencies_jars =
233+
exec_script(list_script,
234+
[
235+
"--target-directory",
236+
rebase_path("//third_party/android_embedding_dependencies"),
237+
],
238+
"list lines")
240239

241240
action("flutter_shell_java") {
242241
script = "//build/android/gyp/javac.py"
@@ -256,18 +255,15 @@ action("flutter_shell_java") {
256255
source_jar_path,
257256
source_jar_path + ".md5.stamp",
258257
]
259-
inputs = [
260-
android_sdk_jar,
261-
]
262-
inputs += android_support_jars
258+
inputs = [ android_sdk_jar ] + embedding_dependencies_jars
263259

264260
_rebased_current_path = rebase_path(".")
265261
_rebased_jar_path = rebase_path(jar_path, root_build_dir)
266262
_rebased_source_jar_path = rebase_path(source_jar_path, root_build_dir)
267263
_rebased_depfile = rebase_path(depfile, root_build_dir)
268264
_rebased_android_sdk_jar = rebase_path(android_sdk_jar, root_build_dir)
269265
_rebased_classpath = [ _rebased_android_sdk_jar ] +
270-
rebase_path(android_support_jars, root_build_dir)
266+
rebase_path(embedding_dependencies_jars, root_build_dir)
271267

272268
args = [
273269
"--depfile=$_rebased_depfile",
@@ -357,10 +353,10 @@ action("android_jar") {
357353
}
358354

359355
action("pom_libflutter") {
360-
script = "//flutter/tools/android_support/generate_pom_file.py"
356+
script = "//flutter/tools/androidx/generate_pom_file.py"
361357

362358
inputs = [
363-
"//flutter/tools/android_support/files.json",
359+
"//flutter/tools/androidx/files.json",
364360
]
365361

366362
artifact_id =
@@ -381,10 +377,10 @@ action("pom_libflutter") {
381377
}
382378

383379
action("pom_embedding") {
384-
script = "//flutter/tools/android_support/generate_pom_file.py"
380+
script = "//flutter/tools/androidx/generate_pom_file.py"
385381

386382
inputs = [
387-
"//flutter/tools/android_support/files.json",
383+
"//flutter/tools/androidx/files.json",
388384
]
389385

390386
artifact_id = "flutter_embedding_$flutter_runtime_mode"
@@ -451,21 +447,9 @@ action("robolectric_tests") {
451447
]
452448

453449
_jar_dependencies = [
454-
android_sdk_jar,
455-
embedding_jar_path,
456-
"//third_party/robolectric/lib/junit-3.8.jar",
457-
"//third_party/robolectric/lib/junit-4.13-beta-3.jar",
458-
"//third_party/robolectric/lib/robolectric-3.8.jar",
459-
"//third_party/robolectric/lib/shadows-framework-3.8.jar",
460-
"//third_party/robolectric/lib/annotations-3.8.jar",
461-
"//third_party/robolectric/lib/shadowapi-3.8.jar",
462-
"//third_party/robolectric/lib/runtime-1.1.1.jar",
463-
"//third_party/robolectric/lib/common-1.1.1.jar",
464-
"//third_party/robolectric/lib/common-java8-1.1.1.jar",
465-
"//third_party/robolectric/lib/support-annotations-28.0.0.jar",
466-
"//third_party/robolectric/lib/support-fragment-25.2.0.jar",
467-
"//third_party/robolectric/lib/mockito-all-1.10.19.jar",
468-
]
450+
android_sdk_jar,
451+
embedding_jar_path,
452+
] + embedding_dependencies_jars
469453

470454
inputs = _jar_dependencies
471455

@@ -532,7 +516,7 @@ zip_bundle("android") {
532516
# https://github.com/flutter/flutter/issues/42400
533517
action("gen_android_javadoc") {
534518
script = "//flutter/tools/gen_javadoc.py"
535-
sources = android_java_sources + android_support_jars
519+
sources = android_java_sources + embedding_dependencies_jars
536520

537521
outputs = [
538522
"$target_gen_dir/javadocs",
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Don't include the jars in the engine repo.
2+
lib/
3+
.gradle

shell/platform/android/embedding_bundle/build.gradle

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,27 +44,23 @@ android {
4444
embedding "androidx.fragment:fragment:1.1.0"
4545

4646
def lifecycle_version = "2.2.0"
47-
embedding "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version"
48-
embedding "androidx.lifecycle:lifecycle-livedata:$lifecycle_version"
4947
embedding "androidx.lifecycle:lifecycle-runtime:$lifecycle_version"
50-
embedding "androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version"
51-
embedding "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"
48+
embedding "androidx.lifecycle:lifecycle-common:$lifecycle_version"
5249
embedding "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
53-
embedding "androidx.lifecycle:lifecycle-service:$lifecycle_version"
54-
embedding "androidx.lifecycle:lifecycle-process:$lifecycle_version"
55-
embedding "androidx.lifecycle:lifecycle-reactivestreams:$lifecycle_version"
5650

5751
// Testing
58-
embeddingTesting "androidx.arch.core:core-testing:2.1.0"
5952
embeddingTesting "org.robolectric:android-all:8.1.0-robolectric-4611349"
6053
// This is required by the robolectric test.
6154
embeddingTesting_duplicated "org.robolectric:android-all:4.1.2_r1-robolectric-r1"
62-
embeddingTesting "org.robolectric:robolectric:3.8"
63-
embeddingTesting "org.robolectric:junit:3.8"
64-
embeddingTesting "org.robolectric:shadows-framework:3.8"
65-
embeddingTesting "org.robolectric:resources:3.8"
6655
embeddingTesting "org.mockito:mockito-all:1.10.19"
67-
embeddingTesting "junit:junit:4.13-beta-3"
56+
embeddingTesting ("org.robolectric:robolectric:4.3") {
57+
// org.hamcrest is added by org.mockito:mockito-all
58+
exclude group: "org.hamcrest", module:"hamcrest-core"
59+
}
60+
embeddingTesting ("junit:junit:4.13") {
61+
// org.hamcrest is added by org.mockito:mockito-all
62+
exclude group: "org.hamcrest", module:"hamcrest-core"
63+
}
6864
}
6965
}
7066

shell/platform/android/io/flutter/Log.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
package io.flutter;
66

7-
import android.support.annotation.NonNull;
7+
import androidx.annotation.NonNull;
88

99
/**
1010
* Port of {@link android.util.Log} that only logs in {@link io.flutter.BuildConfig#DEBUG} mode and

shell/platform/android/io/flutter/app/FlutterActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import android.content.Intent;
1010
import android.content.res.Configuration;
1111
import android.os.Bundle;
12-
import android.support.annotation.NonNull;
12+
import androidx.annotation.NonNull;
1313
import io.flutter.app.FlutterActivityDelegate.ViewFactory;
1414
import io.flutter.plugin.common.PluginRegistry;
1515
import io.flutter.view.FlutterNativeView;

shell/platform/android/io/flutter/app/FlutterApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import android.app.Activity;
88
import android.app.Application;
9-
import android.support.annotation.CallSuper;
9+
import androidx.annotation.CallSuper;
1010
import io.flutter.view.FlutterMain;
1111

1212
/**

shell/platform/android/io/flutter/app/FlutterFragmentActivity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import android.content.Intent;
99
import android.content.res.Configuration;
1010
import android.os.Bundle;
11-
import android.support.v4.app.FragmentActivity;
11+
import androidx.fragment.app.FragmentActivity;
1212
import io.flutter.app.FlutterActivityDelegate.ViewFactory;
1313
import io.flutter.plugin.common.PluginRegistry;
1414
import io.flutter.view.FlutterNativeView;
@@ -25,7 +25,7 @@
2525
* app to ensure that {@link FragmentActivity} is available at runtime.
2626
*
2727
* @see <a target="_new"
28-
* href="https://developer.android.com/topic/libraries/support-library/setup.html">https://developer.android.com/topic/libraries/support-library/setup.html</a>
28+
* href="https://developer.android.com/training/testing/set-up-project">https://developer.android.com/training/testing/set-up-project</a>
2929
*/
3030
public class FlutterFragmentActivity extends FragmentActivity
3131
implements FlutterView.Provider, PluginRegistry, ViewFactory {

0 commit comments

Comments
 (0)