-
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.
[0.74] Stub com.facebook.react.settings on 0.74 (#45720)
- Loading branch information
Showing
61 changed files
with
172 additions
and
78 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
build/ | ||
react-native-gradle-plugin/build/ | ||
settings-plugin/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
84 changes: 84 additions & 0 deletions
84
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,84 @@ | ||
/* | ||
* 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(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 | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
50 changes: 50 additions & 0 deletions
50
packages/react-native-gradle-plugin/settings-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,50 @@ | ||
/* | ||
* 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.tasks.testing.logging.TestExceptionFormat | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
plugins { | ||
alias(libs.plugins.kotlin.jvm) | ||
id("java-gradle-plugin") | ||
} | ||
|
||
repositories { | ||
google() | ||
mavenCentral() | ||
} | ||
|
||
gradlePlugin { | ||
plugins { | ||
create("react.settings") { | ||
id = "com.facebook.react.settings" | ||
implementationClass = "com.facebook.react.ReactSettingsPlugin" | ||
} | ||
} | ||
} | ||
|
||
group = "com.facebook.react" | ||
|
||
dependencies { | ||
implementation(gradleApi()) | ||
} | ||
|
||
// 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 | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...e-gradle-plugin/settings-plugin/src/main/kotlin/com/facebook/react/ReactSettingsPlugin.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,24 @@ | ||
/* | ||
* 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.initialization.Settings | ||
|
||
/** | ||
* This is a stub of the com.facebook.react.settings plugin. | ||
* | ||
* The plugin got added in 0.75, but to make it easier for 0.74 users to upgrade to 0.75, we're | ||
* creating a stub plugin that does nothing. This way, users can include a `id("com.facebook.react.settings")` | ||
* in their settings.gradle file without causing a build failure on 0.74. | ||
*/ | ||
class ReactSettingsPlugin : Plugin<Settings> { | ||
override fun apply(settings: Settings) { | ||
// Do nothing, just register the plugin. | ||
} | ||
} |
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