Skip to content

Commit c23cd8a

Browse files
cortinicokosmydel
authored andcommitted
RNGP - Add autolinking fields to ReactExtensions (facebook#44220)
Summary: Pull Request resolved: facebook#44220 This diff is part of RFC0759 react-native-community/discussions-and-proposals#759 Here we're looking into splitting the autolinking into a component that will live inside core (specifically inside the React Native Gradle Plugin - RNGP) and another component that will live inside the Community CLI. Here I start by adding 2 fields to RNGP extension, that frameworks and templates can use to provide their autolinking config. Changelog: [Internal] [Changed] - RNGP - Add autolinking fields to ReactExtensions Reviewed By: cipolleschi Differential Revision: D55475597 fbshipit-source-id: 316d1919a113a94c57426710f487f334c6128345
1 parent c998ea3 commit c23cd8a

File tree

1 file changed

+32
-0
lines changed
  • packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react

1 file changed

+32
-0
lines changed

packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import com.facebook.react.utils.projectPathToLibraryName
1111
import javax.inject.Inject
1212
import org.gradle.api.Project
1313
import org.gradle.api.file.DirectoryProperty
14+
import org.gradle.api.file.FileCollection
1415
import org.gradle.api.file.RegularFileProperty
1516
import org.gradle.api.provider.ListProperty
1617
import org.gradle.api.provider.Property
@@ -147,4 +148,35 @@ abstract class ReactExtension @Inject constructor(project: Project) {
147148
*/
148149
val codegenJavaPackageName: Property<String> =
149150
objects.property(String::class.java).convention("com.facebook.fbreact.specs")
151+
152+
/** Auto-linking Config */
153+
154+
/**
155+
* Location of the JSON file used to configure autolinking. This file is the output of the
156+
* `@react-native-community/cli` config command.
157+
*
158+
* If not specified, RNGP will just invoke whatever you pass as [autolinkConfigCommand].
159+
*/
160+
val autolinkConfigFile: RegularFileProperty = objects.fileProperty()
161+
162+
/**
163+
* The command to invoke as source of truth for the autolinking configuration. Default is `["npx",
164+
* "@react-native-community/cli", "config"]`.
165+
*/
166+
val autolinkConfigCommand: ListProperty<String> =
167+
objects
168+
.listProperty(String::class.java)
169+
.convention(listOf("npx", "@react-native-community/cli", "config"))
170+
171+
/**
172+
* Location of the lock files used to consider wether autolinking [autolinkConfigCommand] should
173+
* re-execute or not. If file collection is unchanged, the autolinking command will not be
174+
* re-executed.
175+
*
176+
* If not specified, RNGP will just look for both yarn.lock and package.lock in the [root] folder.
177+
*/
178+
val autolinkLockFiles: Property<FileCollection> =
179+
objects
180+
.property(FileCollection::class.java)
181+
.convention(root.files("../yarn.lock", "../package-lock.json"))
150182
}

0 commit comments

Comments
 (0)