@react-native/gradle-plugin 0.84.0-rc.0 → 0.84.0-rc.2
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 +2 -2
- package/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/internal/PrivateReactExtension.kt +1 -1
- package/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/DependencyUtils.kt +2 -2
- package/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/ProjectUtils.kt +16 -8
- package/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/DependencyUtilsTest.kt +26 -12
- package/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/ProjectUtilsTest.kt +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native/gradle-plugin",
|
|
3
|
-
"version": "0.84.0-rc.
|
|
3
|
+
"version": "0.84.0-rc.2",
|
|
4
4
|
"description": "Gradle Plugin for React Native",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
],
|
|
17
17
|
"bugs": "https://github.com/facebook/react-native/issues",
|
|
18
18
|
"engines": {
|
|
19
|
-
"node": ">=
|
|
19
|
+
"node": ">= 20.19.4"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"build": "./gradlew build",
|
|
@@ -59,5 +59,5 @@ abstract class PrivateReactExtension @Inject constructor(project: Project) {
|
|
|
59
59
|
val codegenDir: DirectoryProperty =
|
|
60
60
|
objects.directoryProperty().convention(root.dir("node_modules/@react-native/codegen"))
|
|
61
61
|
|
|
62
|
-
val hermesV1Enabled: Property<Boolean> = objects.property(Boolean::class.java).convention(
|
|
62
|
+
val hermesV1Enabled: Property<Boolean> = objects.property(Boolean::class.java).convention(true)
|
|
63
63
|
}
|
package/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/DependencyUtils.kt
CHANGED
|
@@ -113,7 +113,7 @@ internal object DependencyUtils {
|
|
|
113
113
|
fun configureDependencies(
|
|
114
114
|
project: Project,
|
|
115
115
|
coordinates: Coordinates,
|
|
116
|
-
hermesV1Enabled: Boolean =
|
|
116
|
+
hermesV1Enabled: Boolean = true,
|
|
117
117
|
) {
|
|
118
118
|
if (
|
|
119
119
|
coordinates.versionString.isBlank() ||
|
|
@@ -149,7 +149,7 @@ internal object DependencyUtils {
|
|
|
149
149
|
|
|
150
150
|
internal fun getDependencySubstitutions(
|
|
151
151
|
coordinates: Coordinates,
|
|
152
|
-
hermesV1Enabled: Boolean =
|
|
152
|
+
hermesV1Enabled: Boolean = true,
|
|
153
153
|
): List<Triple<String, String, String>> {
|
|
154
154
|
val dependencySubstitution = mutableListOf<Triple<String, String, String>>()
|
|
155
155
|
val hermesVersion =
|
|
@@ -29,6 +29,8 @@ internal object ProjectUtils {
|
|
|
29
29
|
|
|
30
30
|
const val HERMES_FALLBACK = true
|
|
31
31
|
|
|
32
|
+
const val HERMES_V1_ENABLED_FALLBACK = true
|
|
33
|
+
|
|
32
34
|
internal fun Project.isNewArchEnabled(): Boolean = true
|
|
33
35
|
|
|
34
36
|
internal val Project.isHermesEnabled: Boolean
|
|
@@ -73,14 +75,20 @@ internal object ProjectUtils {
|
|
|
73
75
|
|
|
74
76
|
internal val Project.isHermesV1Enabled: Boolean
|
|
75
77
|
get() =
|
|
76
|
-
(
|
|
77
|
-
project.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
78
|
+
if (
|
|
79
|
+
project.hasProperty(HERMES_V1_ENABLED) || project.hasProperty(SCOPED_HERMES_V1_ENABLED)
|
|
80
|
+
) {
|
|
81
|
+
(project.hasProperty(HERMES_V1_ENABLED) &&
|
|
82
|
+
project.property(HERMES_V1_ENABLED).toString().toBoolean()) ||
|
|
83
|
+
(project.hasProperty(SCOPED_HERMES_V1_ENABLED) &&
|
|
84
|
+
project.property(SCOPED_HERMES_V1_ENABLED).toString().toBoolean()) ||
|
|
85
|
+
(project.extraProperties.has(HERMES_V1_ENABLED) &&
|
|
86
|
+
project.extraProperties.get(HERMES_V1_ENABLED).toString().toBoolean()) ||
|
|
87
|
+
(project.extraProperties.has(SCOPED_HERMES_V1_ENABLED) &&
|
|
88
|
+
project.extraProperties.get(SCOPED_HERMES_V1_ENABLED).toString().toBoolean())
|
|
89
|
+
} else {
|
|
90
|
+
HERMES_V1_ENABLED_FALLBACK
|
|
91
|
+
}
|
|
84
92
|
|
|
85
93
|
internal fun Project.needsCodegenFromPackageJson(rootProperty: DirectoryProperty): Boolean {
|
|
86
94
|
val parsedPackageJson = readPackageJsonFile(this, rootProperty)
|
package/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/DependencyUtilsTest.kt
CHANGED
|
@@ -290,6 +290,8 @@ class DependencyUtilsTest {
|
|
|
290
290
|
assertThat(forcedModules.any { it.toString() == "com.facebook.react:react-android:1.2.3" })
|
|
291
291
|
.isTrue()
|
|
292
292
|
assertThat(forcedModules.any { it.toString() == "com.facebook.hermes:hermes-android:4.5.6" })
|
|
293
|
+
.isFalse()
|
|
294
|
+
assertThat(forcedModules.any { it.toString() == "com.facebook.hermes:hermes-android:7.8.9" })
|
|
293
295
|
.isTrue()
|
|
294
296
|
}
|
|
295
297
|
|
|
@@ -325,10 +327,14 @@ class DependencyUtilsTest {
|
|
|
325
327
|
assertThat(appForcedModules.any { it.toString() == "com.facebook.react:react-android:1.2.3" })
|
|
326
328
|
.isTrue()
|
|
327
329
|
assertThat(appForcedModules.any { it.toString() == "com.facebook.hermes:hermes-android:4.5.6" })
|
|
330
|
+
.isFalse()
|
|
331
|
+
assertThat(appForcedModules.any { it.toString() == "com.facebook.hermes:hermes-android:7.8.9" })
|
|
328
332
|
.isTrue()
|
|
329
333
|
assertThat(libForcedModules.any { it.toString() == "com.facebook.react:react-android:1.2.3" })
|
|
330
334
|
.isTrue()
|
|
331
335
|
assertThat(libForcedModules.any { it.toString() == "com.facebook.hermes:hermes-android:4.5.6" })
|
|
336
|
+
.isFalse()
|
|
337
|
+
assertThat(libForcedModules.any { it.toString() == "com.facebook.hermes:hermes-android:7.8.9" })
|
|
332
338
|
.isTrue()
|
|
333
339
|
}
|
|
334
340
|
|
|
@@ -384,12 +390,20 @@ class DependencyUtilsTest {
|
|
|
384
390
|
assertThat(
|
|
385
391
|
appForcedModules.any { it.toString() == "io.github.test.hermes:hermes-android:4.5.6" }
|
|
386
392
|
)
|
|
393
|
+
.isFalse()
|
|
394
|
+
assertThat(
|
|
395
|
+
appForcedModules.any { it.toString() == "io.github.test.hermes:hermes-android:7.8.9" }
|
|
396
|
+
)
|
|
387
397
|
.isTrue()
|
|
388
398
|
assertThat(libForcedModules.any { it.toString() == "io.github.test:react-android:1.2.3" })
|
|
389
399
|
.isTrue()
|
|
390
400
|
assertThat(
|
|
391
401
|
libForcedModules.any { it.toString() == "io.github.test.hermes:hermes-android:4.5.6" }
|
|
392
402
|
)
|
|
403
|
+
.isFalse()
|
|
404
|
+
assertThat(
|
|
405
|
+
libForcedModules.any { it.toString() == "io.github.test.hermes:hermes-android:7.8.9" }
|
|
406
|
+
)
|
|
393
407
|
.isTrue()
|
|
394
408
|
}
|
|
395
409
|
|
|
@@ -430,7 +444,7 @@ class DependencyUtilsTest {
|
|
|
430
444
|
}
|
|
431
445
|
|
|
432
446
|
@Test
|
|
433
|
-
fun
|
|
447
|
+
fun getDependencySubstitutions_withDefaultGroup_substitutesCorrectly_withHermesV1() {
|
|
434
448
|
val dependencySubstitutions =
|
|
435
449
|
getDependencySubstitutions(DependencyUtils.Coordinates("0.42.0", "0.42.0", "0.43.0"))
|
|
436
450
|
|
|
@@ -442,7 +456,7 @@ class DependencyUtilsTest {
|
|
|
442
456
|
)
|
|
443
457
|
.isEqualTo(dependencySubstitutions[0].third)
|
|
444
458
|
assertThat("com.facebook.react:hermes-engine").isEqualTo(dependencySubstitutions[1].first)
|
|
445
|
-
assertThat("com.facebook.hermes:hermes-android:0.
|
|
459
|
+
assertThat("com.facebook.hermes:hermes-android:0.43.0")
|
|
446
460
|
.isEqualTo(dependencySubstitutions[1].second)
|
|
447
461
|
assertThat(
|
|
448
462
|
"The hermes-engine artifact was deprecated in favor of hermes-android due to https://github.com/facebook/react-native/issues/35210."
|
|
@@ -451,7 +465,7 @@ class DependencyUtilsTest {
|
|
|
451
465
|
}
|
|
452
466
|
|
|
453
467
|
@Test
|
|
454
|
-
fun
|
|
468
|
+
fun getDependencySubstitutions_withDefaultGroupAndFallback_substitutesCorrectly_withClassicHermes() {
|
|
455
469
|
val dependencySubstitutions =
|
|
456
470
|
getDependencySubstitutions(
|
|
457
471
|
DependencyUtils.Coordinates("0.42.0", "0.42.0", "0.43.0"),
|
|
@@ -475,7 +489,7 @@ class DependencyUtilsTest {
|
|
|
475
489
|
}
|
|
476
490
|
|
|
477
491
|
@Test
|
|
478
|
-
fun
|
|
492
|
+
fun getDependencySubstitutions_withCustomGroup_substitutesCorrectly_withHermesV1() {
|
|
479
493
|
val dependencySubstitutions =
|
|
480
494
|
getDependencySubstitutions(
|
|
481
495
|
DependencyUtils.Coordinates(
|
|
@@ -494,14 +508,14 @@ class DependencyUtilsTest {
|
|
|
494
508
|
)
|
|
495
509
|
.isEqualTo(dependencySubstitutions[0].third)
|
|
496
510
|
assertThat("com.facebook.react:hermes-engine").isEqualTo(dependencySubstitutions[1].first)
|
|
497
|
-
assertThat("io.github.test.hermes:hermes-android:0.
|
|
511
|
+
assertThat("io.github.test.hermes:hermes-android:0.43.0")
|
|
498
512
|
.isEqualTo(dependencySubstitutions[1].second)
|
|
499
513
|
assertThat(
|
|
500
514
|
"The hermes-engine artifact was deprecated in favor of hermes-android due to https://github.com/facebook/react-native/issues/35210."
|
|
501
515
|
)
|
|
502
516
|
.isEqualTo(dependencySubstitutions[1].third)
|
|
503
517
|
assertThat("com.facebook.react:hermes-android").isEqualTo(dependencySubstitutions[2].first)
|
|
504
|
-
assertThat("io.github.test.hermes:hermes-android:0.
|
|
518
|
+
assertThat("io.github.test.hermes:hermes-android:0.43.0")
|
|
505
519
|
.isEqualTo(dependencySubstitutions[2].second)
|
|
506
520
|
assertThat("The hermes-android artifact was moved to com.facebook.hermes publishing group.")
|
|
507
521
|
.isEqualTo(dependencySubstitutions[2].third)
|
|
@@ -510,14 +524,14 @@ class DependencyUtilsTest {
|
|
|
510
524
|
assertThat("The react-android dependency was modified to use the correct Maven group.")
|
|
511
525
|
.isEqualTo(dependencySubstitutions[3].third)
|
|
512
526
|
assertThat("com.facebook.react:hermes-android").isEqualTo(dependencySubstitutions[4].first)
|
|
513
|
-
assertThat("io.github.test.hermes:hermes-android:0.
|
|
527
|
+
assertThat("io.github.test.hermes:hermes-android:0.43.0")
|
|
514
528
|
.isEqualTo(dependencySubstitutions[4].second)
|
|
515
529
|
assertThat("The hermes-android dependency was modified to use the correct Maven group.")
|
|
516
530
|
.isEqualTo(dependencySubstitutions[4].third)
|
|
517
531
|
}
|
|
518
532
|
|
|
519
533
|
@Test
|
|
520
|
-
fun
|
|
534
|
+
fun getDependencySubstitutions_withCustomGroupAndFallbackToClassicHermes_substitutesCorrectly_withClassicHermes() {
|
|
521
535
|
val dependencySubstitutions =
|
|
522
536
|
getDependencySubstitutions(
|
|
523
537
|
DependencyUtils.Coordinates(
|
|
@@ -527,7 +541,7 @@ class DependencyUtilsTest {
|
|
|
527
541
|
"io.github.test",
|
|
528
542
|
"io.github.test.hermes",
|
|
529
543
|
),
|
|
530
|
-
hermesV1Enabled =
|
|
544
|
+
hermesV1Enabled = false,
|
|
531
545
|
)
|
|
532
546
|
|
|
533
547
|
assertThat("com.facebook.react:react-native").isEqualTo(dependencySubstitutions[0].first)
|
|
@@ -537,14 +551,14 @@ class DependencyUtilsTest {
|
|
|
537
551
|
)
|
|
538
552
|
.isEqualTo(dependencySubstitutions[0].third)
|
|
539
553
|
assertThat("com.facebook.react:hermes-engine").isEqualTo(dependencySubstitutions[1].first)
|
|
540
|
-
assertThat("io.github.test.hermes:hermes-android:0.
|
|
554
|
+
assertThat("io.github.test.hermes:hermes-android:0.42.0")
|
|
541
555
|
.isEqualTo(dependencySubstitutions[1].second)
|
|
542
556
|
assertThat(
|
|
543
557
|
"The hermes-engine artifact was deprecated in favor of hermes-android due to https://github.com/facebook/react-native/issues/35210."
|
|
544
558
|
)
|
|
545
559
|
.isEqualTo(dependencySubstitutions[1].third)
|
|
546
560
|
assertThat("com.facebook.react:hermes-android").isEqualTo(dependencySubstitutions[2].first)
|
|
547
|
-
assertThat("io.github.test.hermes:hermes-android:0.
|
|
561
|
+
assertThat("io.github.test.hermes:hermes-android:0.42.0")
|
|
548
562
|
.isEqualTo(dependencySubstitutions[2].second)
|
|
549
563
|
assertThat("The hermes-android artifact was moved to com.facebook.hermes publishing group.")
|
|
550
564
|
.isEqualTo(dependencySubstitutions[2].third)
|
|
@@ -553,7 +567,7 @@ class DependencyUtilsTest {
|
|
|
553
567
|
assertThat("The react-android dependency was modified to use the correct Maven group.")
|
|
554
568
|
.isEqualTo(dependencySubstitutions[3].third)
|
|
555
569
|
assertThat("com.facebook.react:hermes-android").isEqualTo(dependencySubstitutions[4].first)
|
|
556
|
-
assertThat("io.github.test.hermes:hermes-android:0.
|
|
570
|
+
assertThat("io.github.test.hermes:hermes-android:0.42.0")
|
|
557
571
|
.isEqualTo(dependencySubstitutions[4].second)
|
|
558
572
|
assertThat("The hermes-android dependency was modified to use the correct Maven group.")
|
|
559
573
|
.isEqualTo(dependencySubstitutions[4].third)
|
package/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/ProjectUtilsTest.kt
CHANGED
|
@@ -117,8 +117,8 @@ class ProjectUtilsTest {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
@Test
|
|
120
|
-
fun
|
|
121
|
-
assertThat(createProject().isHermesV1Enabled).
|
|
120
|
+
fun isHermesV1Enabled_returnsTrueByDefault() {
|
|
121
|
+
assertThat(createProject().isHermesV1Enabled).isTrue()
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
@Test
|