Upgrade Android build infra (#3095)

Summary:
This includes a bunch of different things which I wanted to do separately, but it's all a massive Jenga Tower and you cannot remove a single piece.

- Litho upgrade
- Gradle plugin upgrade
- Remove storage permission as it apparently doesn't do anything above Android 10
- Upgraded build target to Android 12 because the new support lib/Kotlin stdlib required this which then caused the issue below to pop up
- Added "export=true" everywhere as this is now a blocking issue if you don't have it
- Upgraded to the LeakCanary2 plugin as version one no longer builds with an Android 12 target for the export reason
- Make CI run on JRE 11 because that's required by the new Gradle plugin
- Update internal CI to no longer define the SDK twice and use Java 11

Pull Request resolved: https://github.com/facebook/flipper/pull/3095

Test Plan: Built Android Sample and Tutorial app, connected to Flipper.

Reviewed By: lblasa

Differential Revision: D32644410

Pulled By: passy

fbshipit-source-id: 8978f158d9c642b3bbd9dbbd7321eb20098a7a53
This commit is contained in:
Pascal Hartig
2021-11-25 12:20:55 -08:00
committed by Facebook GitHub Bot
parent c9daf81098
commit 8ccae8a7ac
10 changed files with 28 additions and 26 deletions

View File

@@ -9,10 +9,10 @@ jobs:
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: set up JDK 1.8 - name: set up JDK
uses: actions/setup-java@v1 uses: actions/setup-java@v1
with: with:
java-version: 1.8 java-version: 11
- name: Compute build cache - name: Compute build cache
run: ./scripts/checksum-android.sh checksum-android.txt run: ./scripts/checksum-android.sh checksum-android.txt
- uses: actions/cache@v2 - uses: actions/cache@v2

View File

@@ -18,10 +18,10 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: set up JDK 1.8 - name: set up JDK
uses: actions/setup-java@v1 uses: actions/setup-java@v1
with: with:
java-version: 1.8 java-version: 11
- name: Write GPG Sec Ring - name: Write GPG Sec Ring
run: echo '${{ secrets.GPG_KEY_CONTENTS }}' | base64 -d > /tmp/secring.gpg run: echo '${{ secrets.GPG_KEY_CONTENTS }}' | base64 -d > /tmp/secring.gpg
- name: Update gradle.properties - name: Update gradle.properties

View File

@@ -8,9 +8,9 @@
--> -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.facebook.flipper.sample"> xmlns:tools="http://schemas.android.com/tools"
package="com.facebook.flipper.sample">
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application <application
android:name=".FlipperSampleApplication" android:name=".FlipperSampleApplication"
@@ -18,8 +18,10 @@
android:icon="@drawable/ic_launcher" android:icon="@drawable/ic_launcher"
android:allowBackup="false" android:allowBackup="false"
android:theme="@style/NoTitleBarWhiteBG" android:theme="@style/NoTitleBarWhiteBG"
android:debuggable="true"> android:debuggable="true"
<activity android:name=".MainActivity"> tools:ignore="HardcodedDebugMode">
<activity android:name=".MainActivity"
android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER"/>
@@ -31,7 +33,8 @@
<data android:scheme="flipper" android:host="demo_page" /> <data android:scheme="flipper" android:host="demo_page" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".DeepLinkActivity"> <activity android:name=".DeepLinkActivity"
android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
@@ -39,7 +42,8 @@
<data android:scheme="flipper" android:host="deep_link_activity" /> <data android:scheme="flipper" android:host="deep_link_activity" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".LayoutTestActivity"> <activity android:name=".LayoutTestActivity"
android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
@@ -47,7 +51,8 @@
<data android:scheme="flipper" android:host="layout_test_activity" /> <data android:scheme="flipper" android:host="layout_test_activity" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".FragmentTestActivity"> <activity android:name=".FragmentTestActivity"
android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />

View File

@@ -72,6 +72,5 @@ dependencies {
debugImplementation project(':fresco-plugin') debugImplementation project(':fresco-plugin')
debugImplementation project(':network-plugin') debugImplementation project(':network-plugin')
debugImplementation project(':litho-plugin') debugImplementation project(':litho-plugin')
debugImplementation project(':leakcanary-plugin')
releaseImplementation project(':noop') releaseImplementation project(':noop')
} }

View File

@@ -15,7 +15,6 @@ import com.facebook.flipper.plugins.example.ExampleFlipperPlugin;
import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin; import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin;
import com.facebook.flipper.plugins.inspector.DescriptorMapping; import com.facebook.flipper.plugins.inspector.DescriptorMapping;
import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
import com.facebook.flipper.plugins.leakcanary.LeakCanaryFlipperPlugin;
import com.facebook.flipper.plugins.navigation.NavigationFlipperPlugin; import com.facebook.flipper.plugins.navigation.NavigationFlipperPlugin;
import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor; import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
import com.facebook.flipper.plugins.network.NetworkFlipperPlugin; import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
@@ -50,7 +49,6 @@ public final class FlipperInitializer {
Arrays.asList( Arrays.asList(
new SharedPreferencesDescriptor("sample", Context.MODE_PRIVATE), new SharedPreferencesDescriptor("sample", Context.MODE_PRIVATE),
new SharedPreferencesDescriptor("other_sample", Context.MODE_PRIVATE)))); new SharedPreferencesDescriptor("other_sample", Context.MODE_PRIVATE))));
client.addPlugin(new LeakCanaryFlipperPlugin());
client.addPlugin(new FrescoFlipperPlugin()); client.addPlugin(new FrescoFlipperPlugin());
client.addPlugin(new ExampleFlipperPlugin()); client.addPlugin(new ExampleFlipperPlugin());
client.addPlugin(CrashReporterPlugin.getInstance()); client.addPlugin(CrashReporterPlugin.getInstance());

View File

@@ -39,9 +39,9 @@ android {
} }
dependencies { dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.32" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$KOTLIN_VERSION"
implementation "androidx.appcompat:appcompat:1.3.1" implementation "androidx.appcompat:appcompat:1.4.0"
implementation "androidx.core:core-ktx:1.5.0" implementation "androidx.core:core-ktx:1.7.0"
// Flipper // Flipper
// For simplicity, we use Flipper for both debug and release builds here. // For simplicity, we use Flipper for both debug and release builds here.
@@ -50,7 +50,6 @@ dependencies {
implementation project(':fresco-plugin') implementation project(':fresco-plugin')
implementation project(':network-plugin') implementation project(':network-plugin')
implementation project(':litho-plugin') implementation project(':litho-plugin')
implementation project(':leakcanary-plugin')
implementation deps.soloader implementation deps.soloader
// Litho // Litho

View File

@@ -14,12 +14,14 @@
<application <application
android:name=".TutorialApplication" android:name=".TutorialApplication"
android:allowBackup="true" android:allowBackup="true"
android:fullBackupOnly="true"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<activity android:name=".MainActivity"> <activity android:name=".MainActivity"
android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />

View File

@@ -20,7 +20,7 @@ import com.facebook.litho.fresco.FrescoImage
@LayoutSpec @LayoutSpec
object SingleImageComponentSpec { object SingleImageComponentSpec {
@PropDefault val imageAspectRatio = 1f @get:PropDefault val imageAspectRatio = 1f
@OnCreateLayout @OnCreateLayout
fun onCreateLayout( fun onCreateLayout(

View File

@@ -11,7 +11,7 @@ buildscript {
mavenCentral() mavenCentral()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:4.2.2' classpath 'com.android.tools.build:gradle:7.0.3'
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.18.0' classpath 'com.vanniktech:gradle-maven-publish-plugin:0.18.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VERSION" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VERSION"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.5.31" classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.5.31"
@@ -31,7 +31,6 @@ subprojects {
google() google()
mavenLocal() mavenLocal()
mavenCentral() mavenCentral()
jcenter()
if (isSnapshot()) { if (isSnapshot()) {
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
@@ -46,8 +45,8 @@ subprojects {
ext { ext {
minSdkVersion = 15 minSdkVersion = 15
targetSdkVersion = 30 targetSdkVersion = 31
compileSdkVersion = 30 compileSdkVersion = 31
buildToolsVersion = '30.0.2' buildToolsVersion = '30.0.2'
ndkVersion = '23.0.7599858' ndkVersion = '23.0.7599858'
} }

View File

@@ -19,9 +19,9 @@ POM_DEVELOPER_NAME=facebook
POM_ISSUES_URL=https://github.com/facebook/flipper/issues/ POM_ISSUES_URL=https://github.com/facebook/flipper/issues/
# Shared version numbers # Shared version numbers
LITHO_VERSION=0.39.0 LITHO_VERSION=0.41.1
ANDROIDX_VERSION=1.3.0 ANDROIDX_VERSION=1.3.0
KOTLIN_VERSION=1.3.72 KOTLIN_VERSION=1.6.0
# Gradle internals # Gradle internals
org.gradle.internal.repository.max.retries=10 org.gradle.internal.repository.max.retries=10