Upgrade react-native-flipper Android to Gradle 7 (#2619)

Summary:
- Resolve https://github.com/facebook/flipper/issues/2221

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

Test Plan:
- Tested working example https://github.com/leotm/react-native-template-typescript
  - Commit 2fd5737c33

![Screenshot 2021-07-26 at 09 07 06](https://user-images.githubusercontent.com/1881059/126955174-cd96087f-5201-4d4a-bb4a-18c951979c86.png)

Reviewed By: cekkaewnumchai

Differential Revision: D29933807

Pulled By: passy

fbshipit-source-id: 1440eee21da134e9d9087a28ad95724738786f10
This commit is contained in:
LeoTM
2021-07-28 15:42:29 -07:00
committed by Facebook GitHub Bot
parent c2812a92ee
commit 64469f5557

View File

@@ -7,6 +7,25 @@
// android/build.gradle // android/build.gradle
buildscript {
// The Android Gradle plugin is only required when opening the android folder stand-alone.
// This avoids unnecessary downloads and potential conflicts when the library is included as a
// module dependency in an application project.
// ref: https://docs.gradle.org/current/userguide/tutorial_using_tasks.html#sec:build_script_external_dependencies
if (project == rootProject) {
repositories {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.1'
}
}
}
plugins {
id 'maven-publish'
}
// based on: // based on:
// //
// * https://github.com/facebook/react-native/blob/0.60-stable/template/android/build.gradle // * https://github.com/facebook/react-native/blob/0.60-stable/template/android/build.gradle
@@ -27,26 +46,6 @@ def safeExtGet(prop, fallback) {
} }
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
apply plugin: 'maven'
buildscript {
// The Android Gradle plugin is only required when opening the android folder stand-alone.
// This avoids unnecessary downloads and potential conflicts when the library is included as a
// module dependency in an application project.
// ref: https://docs.gradle.org/current/userguide/tutorial_using_tasks.html#sec:build_script_external_dependencies
if (project == rootProject) {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
}
}
}
apply plugin: 'com.android.library'
apply plugin: 'maven'
android { android {
compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION) compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
@@ -74,7 +73,6 @@ repositories {
url "$rootDir/../node_modules/jsc-android/dist" url "$rootDir/../node_modules/jsc-android/dist"
} }
google() google()
jcenter()
} }
dependencies { dependencies {
@@ -120,17 +118,14 @@ afterEvaluate { project ->
task androidJavadoc(type: Javadoc) { task androidJavadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs source = android.sourceSets.main.java.srcDirs
classpath += files(android.bootClasspath) classpath += files(android.bootClasspath)
classpath += files(project.getConfigurations().getByName('compile').asList())
include '**/*.java' include '**/*.java'
} }
task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) { task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
classifier = 'javadoc'
from androidJavadoc.destinationDir from androidJavadoc.destinationDir
} }
task androidSourcesJar(type: Jar) { task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs from android.sourceSets.main.java.srcDirs
include '**/*.java' include '**/*.java'
} }
@@ -148,13 +143,4 @@ afterEvaluate { project ->
archives androidSourcesJar archives androidSourcesJar
archives androidJavadocJar archives androidJavadocJar
} }
task installArchives(type: Upload) {
configuration = configurations.archives
repositories.mavenDeployer {
// Deploy to react-native-event-bridge/maven, ready to publish to npm
repository url: "file://${projectDir}/../android/maven"
configureReactNativePom pom
}
}
} }