Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RNGP - Properly set the jsRootDir default value #35992

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ abstract class ReactExtension @Inject constructor(project: Project) {
/**
* The root directory for all JS files for the app.
*
* Default: [root] (i.e. ${rootProject.dir}/../)
* Default: the parent folder of the `/android` folder.
*/
val jsRootDir: DirectoryProperty = objects.directoryProperty().convention(root.get())
val jsRootDir: DirectoryProperty = objects.directoryProperty()

/**
* The library name that will be used for the codegen artifacts.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,15 @@ class ReactPlugin : Plugin<Project> {
// First, we set up the output dir for the codegen.
val generatedSrcDir = File(project.buildDir, "generated/source/codegen")

// We specify the default value (convention) for jsRootDir.
// It's the root folder for apps (so ../../ from the Gradle project)
// and the package folder for library (so ../ from the Gradle project)
if (isLibrary) {
extension.jsRootDir.convention(project.layout.projectDirectory.dir("../"))
} else {
extension.jsRootDir.convention(extension.root)
}

val buildCodegenTask =
project.tasks.register("buildCodegenCLI", BuildCodegenCLITask::class.java) {
it.codegenDir.set(extension.codegenDir)
Expand Down