From 0538f45e45acf494fdafda0757c090a60e730746 Mon Sep 17 00:00:00 2001 From: Carmi Grushko Date: Tue, 2 Aug 2022 00:25:12 -0700 Subject: [PATCH] Update ktfmt component on FBS:master Reviewed By: strulovich Differential Revision: D38301968 fbshipit-source-id: 24e2658a83de67ce98cfcf876fd0fd4271827c65 --- .../kotlin/com/facebook/react/ReactPlugin.kt | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt index a98491efccb31b..bcd4b42fdd9ae6 100644 --- a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt @@ -86,39 +86,39 @@ class ReactPlugin : Plugin { val generateCodegenSchemaTask = project.tasks.register( "generateCodegenSchemaFromJavaScript", GenerateCodegenSchemaTask::class.java) { it -> - it.dependsOn(buildCodegenTask) - it.nodeExecutableAndArgs.set(extension.nodeExecutableAndArgs) - it.codegenDir.set(extension.codegenDir) - it.generatedSrcDir.set(generatedSrcDir) - - // We're reading the package.json at configuration time to properly feed - // the `jsRootDir` @Input property of this task. Therefore, the - // parsePackageJson should be invoked inside this lambda. - val packageJson = findPackageJsonFile(project, extension) - val parsedPackageJson = packageJson?.let { JsonUtils.fromCodegenJson(it) } - - val jsSrcsDirInPackageJson = parsedPackageJson?.codegenConfig?.jsSrcsDir - if (jsSrcsDirInPackageJson != null) { - it.jsRootDir.set(File(packageJson.parentFile, jsSrcsDirInPackageJson)) - } else { - it.jsRootDir.set(extension.jsRootDir) - } - } + it.dependsOn(buildCodegenTask) + it.nodeExecutableAndArgs.set(extension.nodeExecutableAndArgs) + it.codegenDir.set(extension.codegenDir) + it.generatedSrcDir.set(generatedSrcDir) + + // We're reading the package.json at configuration time to properly feed + // the `jsRootDir` @Input property of this task. Therefore, the + // parsePackageJson should be invoked inside this lambda. + val packageJson = findPackageJsonFile(project, extension) + val parsedPackageJson = packageJson?.let { JsonUtils.fromCodegenJson(it) } + + val jsSrcsDirInPackageJson = parsedPackageJson?.codegenConfig?.jsSrcsDir + if (jsSrcsDirInPackageJson != null) { + it.jsRootDir.set(File(packageJson.parentFile, jsSrcsDirInPackageJson)) + } else { + it.jsRootDir.set(extension.jsRootDir) + } + } // We create the task to generate Java code from schema. val generateCodegenArtifactsTask = project.tasks.register( "generateCodegenArtifactsFromSchema", GenerateCodegenArtifactsTask::class.java) { - it.dependsOn(generateCodegenSchemaTask) - it.reactNativeDir.set(extension.reactNativeDir) - it.deprecatedReactRoot.set(extension.reactRoot) - it.nodeExecutableAndArgs.set(extension.nodeExecutableAndArgs) - it.codegenDir.set(extension.codegenDir) - it.generatedSrcDir.set(generatedSrcDir) - it.packageJsonFile.set(findPackageJsonFile(project, extension)) - it.codegenJavaPackageName.set(extension.codegenJavaPackageName) - it.libraryName.set(extension.libraryName) - } + it.dependsOn(generateCodegenSchemaTask) + it.reactNativeDir.set(extension.reactNativeDir) + it.deprecatedReactRoot.set(extension.reactRoot) + it.nodeExecutableAndArgs.set(extension.nodeExecutableAndArgs) + it.codegenDir.set(extension.codegenDir) + it.generatedSrcDir.set(generatedSrcDir) + it.packageJsonFile.set(findPackageJsonFile(project, extension)) + it.codegenJavaPackageName.set(extension.codegenJavaPackageName) + it.libraryName.set(extension.libraryName) + } // We add dependencies & generated sources to the project. // Note: This last step needs to happen after the project has been evaluated.