-
Notifications
You must be signed in to change notification settings - Fork 24.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RNGP - Autolinking. Add support for linking projects. (#44799)
Summary: Pull Request resolved: #44799 This is the final part of core autolinking: 1. I split RNGP into an `app-plugin` and a `settings-plugin`. This was necessary as the Gradle modules need to be loaded inside the settings.gradle.kts. 2. I've introduced a Settings Plugin to take care of either invoking the `config` command from CLI or receiving a file in input. 3. I've removed the former `RunAutolinkingConfigTask` as now the command is invoked inside the settings plugin 4. I've added hashing computed based on the lockfiles so we won't be re-executing teh `config` command if the lockfiles are not changed. 5. I've updated RN-Tester to use the core autolinking rather than manual linking for the 2 libraries it's using. Changelog:linking [Internal] [Changed] - RNGP - Autolinking. Add support for linking projects Reviewed By: blakef Differential Revision: D58190363
- Loading branch information
1 parent
f57d624
commit e8af65f
Showing
103 changed files
with
983 additions
and
389 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
build/ | ||
app-plugin/build/ | ||
settings-plugin/build/ | ||
shared/build/ |
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
17 changes: 17 additions & 0 deletions
17
packages/react-native-gradle-plugin/react-native-gradle-plugin/README.md
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,17 @@ | ||
# React Native Gradle Plugin | ||
|
||
This plugin is used by React Native Apps to configure themselves. | ||
|
||
NOTE: It's important that this folder is called `react-native-gradle-plugin` as it's used | ||
by users in their `build.gradle` file as follows: | ||
|
||
```gradle | ||
buildscript { | ||
// ... | ||
dependencies { | ||
classpath("com.facebook.react:react-native-gradle-plugin") | ||
} | ||
} | ||
``` | ||
|
||
The name of the artifact is imposed by the folder name. |
86 changes: 86 additions & 0 deletions
86
packages/react-native-gradle-plugin/react-native-gradle-plugin/build.gradle.kts
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,86 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import org.gradle.api.internal.classpath.ModuleRegistry | ||
import org.gradle.api.tasks.testing.logging.TestExceptionFormat | ||
import org.gradle.configurationcache.extensions.serviceOf | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
plugins { | ||
alias(libs.plugins.kotlin.jvm) | ||
id("java-gradle-plugin") | ||
} | ||
|
||
repositories { | ||
google() | ||
mavenCentral() | ||
} | ||
|
||
gradlePlugin { | ||
plugins { | ||
create("react") { | ||
id = "com.facebook.react" | ||
implementationClass = "com.facebook.react.ReactPlugin" | ||
} | ||
create("reactrootproject") { | ||
id = "com.facebook.react.rootproject" | ||
implementationClass = "com.facebook.react.ReactRootProjectPlugin" | ||
} | ||
} | ||
} | ||
|
||
group = "com.facebook.react" | ||
|
||
dependencies { | ||
implementation(project(":shared")) | ||
|
||
implementation(gradleApi()) | ||
|
||
// The KGP/AGP version is defined by React Native Gradle plugin. | ||
// Therefore we specify an implementation dep rather than a compileOnly. | ||
implementation(libs.kotlin.gradle.plugin) | ||
implementation(libs.android.gradle.plugin) | ||
|
||
implementation(libs.gson) | ||
implementation(libs.guava) | ||
implementation(libs.javapoet) | ||
|
||
testImplementation(libs.junit) | ||
|
||
testRuntimeOnly( | ||
files( | ||
serviceOf<ModuleRegistry>() | ||
.getModule("gradle-tooling-api-builders") | ||
.classpath | ||
.asFiles | ||
.first())) | ||
} | ||
|
||
// We intentionally don't build for Java 17 as users will see a cryptic bytecode version | ||
// error first. Instead we produce a Java 11-compatible Gradle Plugin, so that AGP can print their | ||
// nice message showing that JDK 11 (or 17) is required first | ||
java { targetCompatibility = JavaVersion.VERSION_11 } | ||
|
||
kotlin { jvmToolchain(17) } | ||
|
||
tasks.withType<KotlinCompile>().configureEach { | ||
kotlinOptions { | ||
apiVersion = "1.6" | ||
// See comment above on JDK 11 support | ||
jvmTarget = "11" | ||
allWarningsAsErrors = true | ||
} | ||
} | ||
|
||
tasks.withType<Test>().configureEach { | ||
testLogging { | ||
exceptionFormat = TestExceptionFormat.FULL | ||
showExceptions = true | ||
showCauses = true | ||
showStackTraces = true | ||
} | ||
} |
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
Oops, something went wrong.