-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RNGP - Monorepo: Make sure libraries are honoring codegenDir provided…
… by app (#36128) Summary: Pull Request resolved: #36128 This commit fixes a problem which is making harder to use the New Architecture in monorepos. Specifically if a user specifies a `codegenDir` in their app, libraries should honor it. This is not the case today. The fix is to register an extension on the root project which will "pass" values from app to libraries. I've also cleaned up some of the logic in `readPackageJsonFile` function restricting the access to those functions only to `.root` which is the only field they're accessing. Fixes #35495 Changelog: [Android] [Fixed] - Better Monorepo support for New Architecture Reviewed By: cipolleschi Differential Revision: D43186767 fbshipit-source-id: 5c5ca39397306120b6b6622cb728633bd331e021
- Loading branch information
1 parent
b67a4ae
commit 0487108
Showing
7 changed files
with
98 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...native-gradle-plugin/src/main/kotlin/com/facebook/react/internal/PrivateReactExtension.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
package com.facebook.react.internal | ||
|
||
import javax.inject.Inject | ||
import org.gradle.api.Project | ||
import org.gradle.api.file.DirectoryProperty | ||
import org.gradle.api.provider.ListProperty | ||
|
||
/** | ||
* A private extension we set on the rootProject to make easier to share values at execution time | ||
* between app project and library project. | ||
* | ||
* Specifically, the [codegenDir], [reactNativeDir] and other properties should be provided by apps | ||
* (for setups like a monorepo which are app specific) and libraries should honor those values. | ||
* | ||
* Users are not supposed to access directly this extension from their build.gradle file. | ||
*/ | ||
abstract class PrivateReactExtension @Inject constructor(project: Project) { | ||
|
||
private val objects = project.objects | ||
|
||
val root: DirectoryProperty = objects.directoryProperty() | ||
|
||
val reactNativeDir: DirectoryProperty = objects.directoryProperty() | ||
|
||
val nodeExecutableAndArgs: ListProperty<String> = objects.listProperty(String::class.java) | ||
|
||
val codegenDir: DirectoryProperty = objects.directoryProperty() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters