@react-native/gradle-plugin 0.72.9 → 0.72.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native/gradle-plugin",
3
- "version": "0.72.9",
3
+ "version": "0.72.10",
4
4
  "description": "⚛️ Gradle Plugin for React Native",
5
5
  "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/react-native-gradle-plugin",
6
6
  "repository": {
@@ -19,6 +19,7 @@ import com.facebook.react.utils.BackwardCompatUtils.configureBackwardCompatibili
19
19
  import com.facebook.react.utils.DependencyUtils.configureDependencies
20
20
  import com.facebook.react.utils.DependencyUtils.configureRepositories
21
21
  import com.facebook.react.utils.DependencyUtils.readVersionAndGroupStrings
22
+ import com.facebook.react.utils.JdkConfiguratorUtils.configureJavaToolChains
22
23
  import com.facebook.react.utils.JsonUtils
23
24
  import com.facebook.react.utils.NdkConfiguratorUtils.configureReactNativeNdk
24
25
  import com.facebook.react.utils.ProjectUtils.needsCodegenFromPackageJson
@@ -78,6 +79,9 @@ class ReactPlugin : Plugin<Project> {
78
79
  project.pluginManager.withPlugin("com.android.library") {
79
80
  configureCodegen(project, extension, rootExtension, isLibrary = true)
80
81
  }
82
+
83
+ // App and Library Configurations
84
+ configureJavaToolChains(project)
81
85
  }
82
86
 
83
87
  private fun checkJvmVersion(project: Project) {
@@ -0,0 +1,40 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ package com.facebook.react.utils
9
+
10
+ import com.android.build.api.variant.AndroidComponentsExtension
11
+ import com.facebook.react.utils.PropertyUtils.INTERNAL_DISABLE_JAVA_VERSION_ALIGNMENT
12
+ import org.gradle.api.Action
13
+ import org.gradle.api.JavaVersion
14
+ import org.gradle.api.Project
15
+ import org.gradle.api.plugins.AppliedPlugin
16
+
17
+ internal object JdkConfiguratorUtils {
18
+ /**
19
+ * Function that takes care of configuring the JDK toolchain for all the projects projects. As we
20
+ * do decide the JDK version based on the AGP version that RNGP brings over, here we can safely
21
+ * configure the toolchain to 11.
22
+ */
23
+ fun configureJavaToolChains(input: Project) {
24
+ if (input.hasProperty(INTERNAL_DISABLE_JAVA_VERSION_ALIGNMENT)) {
25
+ return
26
+ }
27
+ input.rootProject.allprojects { project ->
28
+ val action =
29
+ Action<AppliedPlugin> {
30
+ project.extensions.getByType(AndroidComponentsExtension::class.java).finalizeDsl {
31
+ ext ->
32
+ ext.compileOptions.sourceCompatibility = JavaVersion.VERSION_11
33
+ ext.compileOptions.targetCompatibility = JavaVersion.VERSION_11
34
+ }
35
+ }
36
+ project.pluginManager.withPlugin("com.android.application", action)
37
+ project.pluginManager.withPlugin("com.android.library", action)
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,18 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ package com.facebook.react.utils
9
+
10
+ /** Collection of all the Gradle Propreties that are accepted by React Native Gradle Plugin. */
11
+ object PropertyUtils {
12
+
13
+ /**
14
+ * Internal Property that acts as a killswitch to configure the JDK version and align it for app
15
+ * and all the libraries.
16
+ */
17
+ const val INTERNAL_DISABLE_JAVA_VERSION_ALIGNMENT = "react.internal.disableJavaVersionAlignment"
18
+ }