From 61de7da03251025191270e59797dc33a8bd26a66 Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Fri, 7 Jun 2024 11:02:40 -0700 Subject: [PATCH] PackageList2 -> PackageList (#44828) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/44828 I was using PackageList2 temporarily as I was migrating to Core Autolinking. Now we can rename everything to `PackageList` to reduce the number of changes to the template for users. Changelog: [Internal] [Changed] - PackageList2 -> PackageList Reviewed By: blakef Differential Revision: D58284661 fbshipit-source-id: 8e1cc54e248519ece05336d79bb79e3f4ca706f4 --- .../java/com/helloworld/MainApplication.kt | 4 ++-- .../react/tasks/GeneratePackageListTask.kt | 12 +++++------ .../tasks/GeneratePackageListTaskTest.kt | 20 +++++++++---------- .../java/com/helloworld/MainApplication.kt | 4 ++-- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/packages/helloworld/android/app/src/main/java/com/helloworld/MainApplication.kt b/packages/helloworld/android/app/src/main/java/com/helloworld/MainApplication.kt index 3a5a22a6c8267f..5db83cc76e4c29 100644 --- a/packages/helloworld/android/app/src/main/java/com/helloworld/MainApplication.kt +++ b/packages/helloworld/android/app/src/main/java/com/helloworld/MainApplication.kt @@ -8,7 +8,7 @@ package com.helloworld import android.app.Application -import com.facebook.react.PackageList2 +import com.facebook.react.PackageList import com.facebook.react.ReactApplication import com.facebook.react.ReactHost import com.facebook.react.ReactNativeHost @@ -23,7 +23,7 @@ class MainApplication : Application(), ReactApplication { override val reactNativeHost: ReactNativeHost = object : DefaultReactNativeHost(this) { override fun getPackages(): List = - PackageList2(this).packages.apply { + PackageList(this).packages.apply { // Packages that cannot be autolinked yet can be added manually here, for example: // add(MyReactNativePackage()) } diff --git a/packages/react-native-gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GeneratePackageListTask.kt b/packages/react-native-gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GeneratePackageListTask.kt index d47f9699a31dd2..6d3d7a0e1ec966 100644 --- a/packages/react-native-gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GeneratePackageListTask.kt +++ b/packages/react-native-gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GeneratePackageListTask.kt @@ -94,7 +94,7 @@ abstract class GeneratePackageListTask : DefaultTask() { .replace("{{ packageClassInstances }}", packageClassInstance) companion object { - const val GENERATED_FILENAME = "com/facebook/react/PackageList2.java" + const val GENERATED_FILENAME = "com/facebook/react/PackageList.java" /** * Before adding the package replacement mechanism, BuildConfig and R classes were imported @@ -137,25 +137,25 @@ abstract class GeneratePackageListTask : DefaultTask() { {{ packageImports }} - public class PackageList2 { + public class PackageList { private Application application; private ReactNativeHost reactNativeHost; private MainPackageConfig mConfig; - public PackageList2(ReactNativeHost reactNativeHost) { + public PackageList(ReactNativeHost reactNativeHost) { this(reactNativeHost, null); } - public PackageList2(Application application) { + public PackageList(Application application) { this(application, null); } - public PackageList2(ReactNativeHost reactNativeHost, MainPackageConfig config) { + public PackageList(ReactNativeHost reactNativeHost, MainPackageConfig config) { this.reactNativeHost = reactNativeHost; mConfig = config; } - public PackageList2(Application application, MainPackageConfig config) { + public PackageList(Application application, MainPackageConfig config) { this.reactNativeHost = null; this.application = application; mConfig = config; diff --git a/packages/react-native-gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GeneratePackageListTaskTest.kt b/packages/react-native-gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GeneratePackageListTaskTest.kt index 8c95d46f1a84f6..1b320c9c65099c 100644 --- a/packages/react-native-gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GeneratePackageListTaskTest.kt +++ b/packages/react-native-gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GeneratePackageListTaskTest.kt @@ -201,25 +201,25 @@ class GeneratePackageListTaskTest { - public class PackageList2 { + public class PackageList { private Application application; private ReactNativeHost reactNativeHost; private MainPackageConfig mConfig; - public PackageList2(ReactNativeHost reactNativeHost) { + public PackageList(ReactNativeHost reactNativeHost) { this(reactNativeHost, null); } - public PackageList2(Application application) { + public PackageList(Application application) { this(application, null); } - public PackageList2(ReactNativeHost reactNativeHost, MainPackageConfig config) { + public PackageList(ReactNativeHost reactNativeHost, MainPackageConfig config) { this.reactNativeHost = reactNativeHost; mConfig = config; } - public PackageList2(Application application, MainPackageConfig config) { + public PackageList(Application application, MainPackageConfig config) { this.reactNativeHost = null; this.application = application; mConfig = config; @@ -280,25 +280,25 @@ class GeneratePackageListTaskTest { // @react-native/another-package import com.facebook.react.anotherPackage; - public class PackageList2 { + public class PackageList { private Application application; private ReactNativeHost reactNativeHost; private MainPackageConfig mConfig; - public PackageList2(ReactNativeHost reactNativeHost) { + public PackageList(ReactNativeHost reactNativeHost) { this(reactNativeHost, null); } - public PackageList2(Application application) { + public PackageList(Application application) { this(application, null); } - public PackageList2(ReactNativeHost reactNativeHost, MainPackageConfig config) { + public PackageList(ReactNativeHost reactNativeHost, MainPackageConfig config) { this.reactNativeHost = reactNativeHost; mConfig = config; } - public PackageList2(Application application, MainPackageConfig config) { + public PackageList(Application application, MainPackageConfig config) { this.reactNativeHost = null; this.application = application; mConfig = config; diff --git a/packages/react-native/template/android/app/src/main/java/com/helloworld/MainApplication.kt b/packages/react-native/template/android/app/src/main/java/com/helloworld/MainApplication.kt index 11b7105dbc76b2..cdcd0d332184db 100644 --- a/packages/react-native/template/android/app/src/main/java/com/helloworld/MainApplication.kt +++ b/packages/react-native/template/android/app/src/main/java/com/helloworld/MainApplication.kt @@ -1,7 +1,7 @@ package com.helloworld import android.app.Application -import com.facebook.react.PackageList2 +import com.facebook.react.PackageList import com.facebook.react.ReactApplication import com.facebook.react.ReactHost import com.facebook.react.ReactNativeHost @@ -16,7 +16,7 @@ class MainApplication : Application(), ReactApplication { override val reactNativeHost: ReactNativeHost = object : DefaultReactNativeHost(this) { override fun getPackages(): List = - PackageList2(this).packages.apply { + PackageList(this).packages.apply { // Packages that cannot be autolinked yet can be added manually here, for example: // add(MyReactNativePackage()) }