Skip to content

Commit

Permalink
RNGP - Remove deprecated useJavaGenerator and reactRoot propertie…
Browse files Browse the repository at this point in the history
…s 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
  • Loading branch information
cortinico authored and facebook-github-bot committed Oct 20, 2022
1 parent ea15c3c commit 7383c00
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,39 +221,4 @@ abstract class ReactExtension @Inject constructor(project: Project) {
*/
val codegenJavaPackageName: Property<String> =
objects.property(String::class.java).convention("com.facebook.fbreact.specs")

/**
* Whether the Java Generator (based on Javapoet) should be used or not. Please note that this is
* currently deprecated as the Java generator is not supported anymore. Default: false
*/
@Deprecated(
level = DeprecationLevel.ERROR,
message =
"Please note that this is deprecated as the Java generator is not supported and react-native-codegen should be used instead.")
val useJavaGenerator: Property<Boolean> = objects.property(Boolean::class.java).convention(false)

/**
* The `reactRoot` property was confusing and should not be used.
*
* You should instead use either:
* - [root] to point to your root project (where the package.json lives)
* - [reactNativeDir] to point to the NPM package of react native.
*
* A valid configuration would look like:
*
* ```
* react {
* root = rootProject.file("..")
* reactNativeDir = rootProject.file("../node_modules/react-native")
* }
* ```
*
* Please also note that those are the default value and you most likely don't need those at all.
*/
@Deprecated(
"reactRoot was confusing and has been replace with root " +
"to point to your root project and reactNativeDir to point to " +
"the folder of the react-native NPM package",
replaceWith = ReplaceWith("reactNativeRoot"))
val reactRoot: DirectoryProperty = objects.directoryProperty()
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ class ReactPlugin : Plugin<Project> {
"generateCodegenArtifactsFromSchema", GenerateCodegenArtifactsTask::class.java) {
it.dependsOn(generateCodegenSchemaTask)
it.reactNativeDir.set(extension.reactNativeDir)
@Suppress("DEPRECATION") it.deprecatedReactRoot.set(extension.reactRoot)
it.nodeExecutableAndArgs.set(extension.nodeExecutableAndArgs)
it.codegenDir.set(extension.codegenDir)
it.generatedSrcDir.set(generatedSrcDir)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ abstract class GenerateCodegenArtifactsTask : Exec() {

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

// We're keeping this just to fire a warning at the user should they use the `reactRoot` property.
@get:Internal abstract val deprecatedReactRoot: DirectoryProperty

@get:InputFile
val combineJsToSchemaCli: Provider<RegularFile> =
codegenDir.file("lib/cli/combine/combine-js-to-schema-cli.js")
Expand All @@ -53,38 +50,11 @@ abstract class GenerateCodegenArtifactsTask : Exec() {
@get:OutputDirectory val generatedJniFiles: Provider<Directory> = generatedSrcDir.dir("jni")

override fun exec() {
checkForDeprecatedProperty()

val (resolvedLibraryName, resolvedCodegenJavaPackageName) = resolveTaskParameters()
setupCommandLine(resolvedLibraryName, resolvedCodegenJavaPackageName)
super.exec()
}

private fun checkForDeprecatedProperty() {
if (deprecatedReactRoot.isPresent) {
project.logger.error(
"""
********************************************************************************
The `reactRoot` property is deprecated and will be removed in
future versions of React Native. The property is currently ignored.
You should instead use either:
- [root] to point to your root project (where the package.json lives)
- [reactNativeDir] to point to the NPM package of react native.
You should be fine by just removing the `reactRoot` line entirely from
your build.gradle file. Otherwise a valid configuration would look like:
react {
root = rootProject.file('..')
reactNativeDir = rootProject.file('../node_modules/react-native')
}
********************************************************************************
"""
.trimIndent())
}
}

internal fun resolveTaskParameters(): Pair<String, String> {
val parsedPackageJson =
if (packageJsonFile.isPresent && packageJsonFile.get().asFile.exists()) {
Expand Down

0 comments on commit 7383c00

Please sign in to comment.