Skip to content

Commit 7383c00

Browse files
cortinicofacebook-github-bot
authored andcommitted
RNGP - Remove deprecated useJavaGenerator and reactRoot properties from extension
Summary: This is part of a series of diffs to make the React Native Gradle Plugin (RNGP) variant-aware. Here I'm removing two deprecated properties `useJavaGenerator` and `reactRoot`. They were both not widely used, we had a deprecation warning and now they're just making the whole setup harder. Changelog: [Internal] [Changed] - RNGP - RNGP - Setup tasks to cleanup the Apk/Aab from unused .so Reviewed By: cipolleschi Differential Revision: D40547688 fbshipit-source-id: c4b8c1cef3a2abae1060e8ce2540e45d0313a4be
1 parent ea15c3c commit 7383c00

File tree

3 files changed

+0
-66
lines changed

3 files changed

+0
-66
lines changed

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

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -221,39 +221,4 @@ abstract class ReactExtension @Inject constructor(project: Project) {
221221
*/
222222
val codegenJavaPackageName: Property<String> =
223223
objects.property(String::class.java).convention("com.facebook.fbreact.specs")
224-
225-
/**
226-
* Whether the Java Generator (based on Javapoet) should be used or not. Please note that this is
227-
* currently deprecated as the Java generator is not supported anymore. Default: false
228-
*/
229-
@Deprecated(
230-
level = DeprecationLevel.ERROR,
231-
message =
232-
"Please note that this is deprecated as the Java generator is not supported and react-native-codegen should be used instead.")
233-
val useJavaGenerator: Property<Boolean> = objects.property(Boolean::class.java).convention(false)
234-
235-
/**
236-
* The `reactRoot` property was confusing and should not be used.
237-
*
238-
* You should instead use either:
239-
* - [root] to point to your root project (where the package.json lives)
240-
* - [reactNativeDir] to point to the NPM package of react native.
241-
*
242-
* A valid configuration would look like:
243-
*
244-
* ```
245-
* react {
246-
* root = rootProject.file("..")
247-
* reactNativeDir = rootProject.file("../node_modules/react-native")
248-
* }
249-
* ```
250-
*
251-
* Please also note that those are the default value and you most likely don't need those at all.
252-
*/
253-
@Deprecated(
254-
"reactRoot was confusing and has been replace with root " +
255-
"to point to your root project and reactNativeDir to point to " +
256-
"the folder of the react-native NPM package",
257-
replaceWith = ReplaceWith("reactNativeRoot"))
258-
val reactRoot: DirectoryProperty = objects.directoryProperty()
259224
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ class ReactPlugin : Plugin<Project> {
117117
"generateCodegenArtifactsFromSchema", GenerateCodegenArtifactsTask::class.java) {
118118
it.dependsOn(generateCodegenSchemaTask)
119119
it.reactNativeDir.set(extension.reactNativeDir)
120-
@Suppress("DEPRECATION") it.deprecatedReactRoot.set(extension.reactRoot)
121120
it.nodeExecutableAndArgs.set(extension.nodeExecutableAndArgs)
122121
it.codegenDir.set(extension.codegenDir)
123122
it.generatedSrcDir.set(generatedSrcDir)

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

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ abstract class GenerateCodegenArtifactsTask : Exec() {
3838

3939
@get:Input abstract val libraryName: Property<String>
4040

41-
// We're keeping this just to fire a warning at the user should they use the `reactRoot` property.
42-
@get:Internal abstract val deprecatedReactRoot: DirectoryProperty
43-
4441
@get:InputFile
4542
val combineJsToSchemaCli: Provider<RegularFile> =
4643
codegenDir.file("lib/cli/combine/combine-js-to-schema-cli.js")
@@ -53,38 +50,11 @@ abstract class GenerateCodegenArtifactsTask : Exec() {
5350
@get:OutputDirectory val generatedJniFiles: Provider<Directory> = generatedSrcDir.dir("jni")
5451

5552
override fun exec() {
56-
checkForDeprecatedProperty()
57-
5853
val (resolvedLibraryName, resolvedCodegenJavaPackageName) = resolveTaskParameters()
5954
setupCommandLine(resolvedLibraryName, resolvedCodegenJavaPackageName)
6055
super.exec()
6156
}
6257

63-
private fun checkForDeprecatedProperty() {
64-
if (deprecatedReactRoot.isPresent) {
65-
project.logger.error(
66-
"""
67-
********************************************************************************
68-
The `reactRoot` property is deprecated and will be removed in
69-
future versions of React Native. The property is currently ignored.
70-
71-
You should instead use either:
72-
- [root] to point to your root project (where the package.json lives)
73-
- [reactNativeDir] to point to the NPM package of react native.
74-
75-
You should be fine by just removing the `reactRoot` line entirely from
76-
your build.gradle file. Otherwise a valid configuration would look like:
77-
78-
react {
79-
root = rootProject.file('..')
80-
reactNativeDir = rootProject.file('../node_modules/react-native')
81-
}
82-
********************************************************************************
83-
"""
84-
.trimIndent())
85-
}
86-
}
87-
8858
internal fun resolveTaskParameters(): Pair<String, String> {
8959
val parsedPackageJson =
9060
if (packageJsonFile.isPresent && packageJsonFile.get().asFile.exists()) {

0 commit comments

Comments
 (0)