-
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.
Fix projects being broken on dependencies starting with
a..
(#41621)
Summary: Pull Request resolved: #41621 Currently, if you have a dependency that is alphabetically smaller than `app`, it's evaluation will happen before `app`. This means that the namespace auto-discovery and the JVM toolchain configuration won't be working and the project will fail to buid. This fixes it by introducing a root-project Gradle Plugin that takes care of enforcing the evaluation order on the `app` project. Fixes #41620 Changelog: [Android] [Fixed] - Fix projects being broken on dependencies starting with `a..` Reviewed By: huntie Differential Revision: D51547294 fbshipit-source-id: 65df7149548b7087dd8928e556fb803b3baf7b79
- Loading branch information
1 parent
8a62d61
commit 5ec2c01
Showing
3 changed files
with
36 additions
and
2 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
30 changes: 30 additions & 0 deletions
30
...s/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactRootProjectPlugin.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,30 @@ | ||
/* | ||
* 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 | ||
|
||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
|
||
/** | ||
* Gradle plugin applied to the `android/build.gradle` file. | ||
* | ||
* This plugin allows to specify project wide configurations that can be applied to both apps and | ||
* libraries before they're evaluated. | ||
*/ | ||
class ReactRootProjectPlugin : Plugin<Project> { | ||
override fun apply(project: Project) { | ||
project.subprojects { | ||
// As the :app project (i.e. ReactPlugin) configures both namespaces and JVM toolchains | ||
// for libraries, its evaluation must happen before the libraries' evaluation. | ||
// Eventually the configuration of namespace/JVM toolchain can be moved inside this plugin. | ||
if (it.path != ":app") { | ||
it.evaluationDependsOn(":app") | ||
} | ||
} | ||
} | ||
} |
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