Skip to content

Commit

Permalink
PackageList2 -> PackageList (#44828)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #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
  • Loading branch information
cortinico authored and facebook-github-bot committed Jun 7, 2024
1 parent 138d50f commit 61de7da
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -23,7 +23,7 @@ class MainApplication : Application(), ReactApplication {
override val reactNativeHost: ReactNativeHost =
object : DefaultReactNativeHost(this) {
override fun getPackages(): List<ReactPackage> =
PackageList2(this).packages.apply {
PackageList(this).packages.apply {
// Packages that cannot be autolinked yet can be added manually here, for example:
// add(MyReactNativePackage())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -16,7 +16,7 @@ class MainApplication : Application(), ReactApplication {
override val reactNativeHost: ReactNativeHost =
object : DefaultReactNativeHost(this) {
override fun getPackages(): List<ReactPackage> =
PackageList2(this).packages.apply {
PackageList(this).packages.apply {
// Packages that cannot be autolinked yet can be added manually here, for example:
// add(MyReactNativePackage())
}
Expand Down

0 comments on commit 61de7da

Please sign in to comment.