@react-native/gradle-plugin 0.78.0-rc.1 → 0.79.0-nightly-20250121-140b3b38d
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 +1 -1
- package/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt +0 -19
- package/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareBoostTask.kt +7 -2
- package/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareGlogTask.kt +8 -4
- package/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/ProjectUtils.kt +1 -47
- package/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareBoostTaskTest.kt +10 -2
- package/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareGlogTaskTest.kt +12 -2
- package/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/ProjectUtilsTest.kt +0 -283
package/package.json
CHANGED
|
@@ -27,7 +27,6 @@ import com.facebook.react.utils.JsonUtils
|
|
|
27
27
|
import com.facebook.react.utils.NdkConfiguratorUtils.configureReactNativeNdk
|
|
28
28
|
import com.facebook.react.utils.ProjectUtils.isNewArchEnabled
|
|
29
29
|
import com.facebook.react.utils.ProjectUtils.needsCodegenFromPackageJson
|
|
30
|
-
import com.facebook.react.utils.ProjectUtils.shouldWarnIfNewArchFlagIsSetInPrealpha
|
|
31
30
|
import com.facebook.react.utils.findPackageJsonFile
|
|
32
31
|
import java.io.File
|
|
33
32
|
import kotlin.system.exitProcess
|
|
@@ -42,7 +41,6 @@ class ReactPlugin : Plugin<Project> {
|
|
|
42
41
|
override fun apply(project: Project) {
|
|
43
42
|
checkJvmVersion(project)
|
|
44
43
|
val extension = project.extensions.create("react", ReactExtension::class.java, project)
|
|
45
|
-
checkIfNewArchFlagIsSet(project, extension)
|
|
46
44
|
|
|
47
45
|
// We register a private extension on the rootProject so that project wide configs
|
|
48
46
|
// like codegen config can be propagated from app project to libraries.
|
|
@@ -112,23 +110,6 @@ class ReactPlugin : Plugin<Project> {
|
|
|
112
110
|
}
|
|
113
111
|
}
|
|
114
112
|
|
|
115
|
-
private fun checkIfNewArchFlagIsSet(project: Project, extension: ReactExtension) {
|
|
116
|
-
if (project.shouldWarnIfNewArchFlagIsSetInPrealpha(extension)) {
|
|
117
|
-
project.logger.warn(
|
|
118
|
-
"""
|
|
119
|
-
|
|
120
|
-
********************************************************************************
|
|
121
|
-
|
|
122
|
-
WARNING: This version of React Native is ignoring the `newArchEnabled` flag you set. Please set it to true or remove it to suppress this warning.
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
********************************************************************************
|
|
126
|
-
|
|
127
|
-
"""
|
|
128
|
-
.trimIndent())
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
113
|
/** This function sets up `react-native-codegen` in our Gradle plugin. */
|
|
133
114
|
@Suppress("UnstableApiUsage")
|
|
134
115
|
private fun configureCodegen(
|
|
@@ -8,9 +8,11 @@
|
|
|
8
8
|
package com.facebook.react.tasks.internal
|
|
9
9
|
|
|
10
10
|
import java.io.File
|
|
11
|
+
import javax.inject.Inject
|
|
11
12
|
import org.gradle.api.DefaultTask
|
|
12
13
|
import org.gradle.api.file.ConfigurableFileCollection
|
|
13
14
|
import org.gradle.api.file.DirectoryProperty
|
|
15
|
+
import org.gradle.api.file.FileSystemOperations
|
|
14
16
|
import org.gradle.api.provider.Property
|
|
15
17
|
import org.gradle.api.tasks.*
|
|
16
18
|
|
|
@@ -21,16 +23,19 @@ import org.gradle.api.tasks.*
|
|
|
21
23
|
abstract class PrepareBoostTask : DefaultTask() {
|
|
22
24
|
|
|
23
25
|
@get:InputFiles abstract val boostPath: ConfigurableFileCollection
|
|
26
|
+
@get:InputDirectory abstract val boostThirdPartyJniPath: DirectoryProperty
|
|
24
27
|
|
|
25
28
|
@get:Input abstract val boostVersion: Property<String>
|
|
26
29
|
|
|
27
30
|
@get:OutputDirectory abstract val outputDir: DirectoryProperty
|
|
28
31
|
|
|
32
|
+
@get:Inject abstract val fs: FileSystemOperations
|
|
33
|
+
|
|
29
34
|
@TaskAction
|
|
30
35
|
fun taskAction() {
|
|
31
|
-
|
|
36
|
+
fs.copy { it ->
|
|
32
37
|
it.from(boostPath)
|
|
33
|
-
it.from(
|
|
38
|
+
it.from(boostThirdPartyJniPath)
|
|
34
39
|
it.include(
|
|
35
40
|
"CMakeLists.txt",
|
|
36
41
|
"boost_${boostVersion.get()}/boost/**/*.hpp",
|
|
@@ -8,11 +8,13 @@
|
|
|
8
8
|
package com.facebook.react.tasks.internal
|
|
9
9
|
|
|
10
10
|
import java.io.File
|
|
11
|
+
import javax.inject.Inject
|
|
11
12
|
import org.apache.tools.ant.filters.ReplaceTokens
|
|
12
13
|
import org.gradle.api.DefaultTask
|
|
13
14
|
import org.gradle.api.file.ConfigurableFileCollection
|
|
14
15
|
import org.gradle.api.file.DirectoryProperty
|
|
15
16
|
import org.gradle.api.file.DuplicatesStrategy
|
|
17
|
+
import org.gradle.api.file.FileSystemOperations
|
|
16
18
|
import org.gradle.api.provider.Property
|
|
17
19
|
import org.gradle.api.tasks.*
|
|
18
20
|
|
|
@@ -23,16 +25,18 @@ import org.gradle.api.tasks.*
|
|
|
23
25
|
abstract class PrepareGlogTask : DefaultTask() {
|
|
24
26
|
|
|
25
27
|
@get:InputFiles abstract val glogPath: ConfigurableFileCollection
|
|
26
|
-
|
|
28
|
+
@get:InputDirectory abstract val glogThirdPartyJniPath: DirectoryProperty
|
|
27
29
|
@get:Input abstract val glogVersion: Property<String>
|
|
28
30
|
|
|
29
31
|
@get:OutputDirectory abstract val outputDir: DirectoryProperty
|
|
30
32
|
|
|
33
|
+
@get:Inject abstract val fs: FileSystemOperations
|
|
34
|
+
|
|
31
35
|
@TaskAction
|
|
32
36
|
fun taskAction() {
|
|
33
|
-
|
|
37
|
+
fs.copy { action ->
|
|
34
38
|
action.from(glogPath)
|
|
35
|
-
action.from(
|
|
39
|
+
action.from(glogThirdPartyJniPath)
|
|
36
40
|
action.include("glog-${glogVersion.get()}/src/**/*", "CMakeLists.txt", "config.h")
|
|
37
41
|
action.duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
|
38
42
|
action.includeEmptyDirs = false
|
|
@@ -63,7 +67,7 @@ abstract class PrepareGlogTask : DefaultTask() {
|
|
|
63
67
|
action.into(outputDir)
|
|
64
68
|
}
|
|
65
69
|
val exportedDir = File(outputDir.asFile.get(), "exported/glog/").apply { mkdirs() }
|
|
66
|
-
|
|
70
|
+
fs.copy { action ->
|
|
67
71
|
action.from(outputDir)
|
|
68
72
|
action.include(
|
|
69
73
|
"stl_logging.h",
|
|
@@ -17,7 +17,6 @@ import com.facebook.react.utils.PropertyUtils.REACT_NATIVE_ARCHITECTURES
|
|
|
17
17
|
import com.facebook.react.utils.PropertyUtils.SCOPED_HERMES_ENABLED
|
|
18
18
|
import com.facebook.react.utils.PropertyUtils.SCOPED_NEW_ARCH_ENABLED
|
|
19
19
|
import com.facebook.react.utils.PropertyUtils.SCOPED_REACT_NATIVE_ARCHITECTURES
|
|
20
|
-
import java.io.File
|
|
21
20
|
import org.gradle.api.Project
|
|
22
21
|
import org.gradle.api.file.DirectoryProperty
|
|
23
22
|
|
|
@@ -29,8 +28,7 @@ internal object ProjectUtils {
|
|
|
29
28
|
return (project.hasProperty(NEW_ARCH_ENABLED) &&
|
|
30
29
|
project.property(NEW_ARCH_ENABLED).toString().toBoolean()) ||
|
|
31
30
|
(project.hasProperty(SCOPED_NEW_ARCH_ENABLED) &&
|
|
32
|
-
project.property(SCOPED_NEW_ARCH_ENABLED).toString().toBoolean())
|
|
33
|
-
shouldEnableNewArchForReactNativeVersion(project.reactNativeDir(extension))
|
|
31
|
+
project.property(SCOPED_NEW_ARCH_ENABLED).toString().toBoolean())
|
|
34
32
|
}
|
|
35
33
|
|
|
36
34
|
internal val Project.isHermesEnabled: Boolean
|
|
@@ -83,50 +81,6 @@ internal object ProjectUtils {
|
|
|
83
81
|
internal fun Project.reactNativeDir(extension: ReactExtension): String =
|
|
84
82
|
extension.reactNativeDir.get().asFile.absolutePath
|
|
85
83
|
|
|
86
|
-
internal fun shouldEnableNewArchForReactNativeVersion(reactNativeDir: String): Boolean {
|
|
87
|
-
val packageJsonFile = File(reactNativeDir, "package.json")
|
|
88
|
-
if (!packageJsonFile.exists()) {
|
|
89
|
-
return false
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
val rnPackageJson = JsonUtils.fromPackageJson(packageJsonFile)
|
|
93
|
-
if (rnPackageJson == null) {
|
|
94
|
-
return false
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// This regex describe the version syntax for React Native in the shape of
|
|
98
|
-
// major.minor.patch[-<prerelease>[[-.]k]]
|
|
99
|
-
// Where
|
|
100
|
-
// major is a number
|
|
101
|
-
// minor is a number
|
|
102
|
-
// patch is a number
|
|
103
|
-
// <prerelease>[-.]k is optional, but if present is preceeded by a `-`
|
|
104
|
-
// the <prerelease> tag is a string.
|
|
105
|
-
// it can be followed by `-` or `.` and k is a number.
|
|
106
|
-
val regex = """^(\d+)\.(\d+)\.(\d+)(?:-(\w+(?:[-.]\d+)?))?$""".toRegex()
|
|
107
|
-
|
|
108
|
-
val matchResult = regex.find(rnPackageJson.version)
|
|
109
|
-
|
|
110
|
-
if (matchResult == null) {
|
|
111
|
-
return false
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
val prerelease = matchResult.groupValues[4].toString()
|
|
115
|
-
return prerelease.contains("prealpha")
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
internal fun Project.shouldWarnIfNewArchFlagIsSetInPrealpha(extension: ReactExtension): Boolean {
|
|
119
|
-
|
|
120
|
-
val propertySetToFalse =
|
|
121
|
-
(this.hasPropertySetToFalse(NEW_ARCH_ENABLED)) ||
|
|
122
|
-
(this.hasPropertySetToFalse(SCOPED_NEW_ARCH_ENABLED))
|
|
123
|
-
|
|
124
|
-
val shouldEnableNewArch =
|
|
125
|
-
shouldEnableNewArchForReactNativeVersion(this.reactNativeDir(extension))
|
|
126
|
-
|
|
127
|
-
return shouldEnableNewArch && propertySetToFalse
|
|
128
|
-
}
|
|
129
|
-
|
|
130
84
|
internal fun Project.hasPropertySetToFalse(property: String): Boolean =
|
|
131
85
|
this.hasProperty(property) && this.property(property).toString().toBoolean() == false
|
|
132
86
|
}
|
|
@@ -34,13 +34,15 @@ class PrepareBoostTaskTest {
|
|
|
34
34
|
val boostpath = tempFolder.newFolder("boostpath")
|
|
35
35
|
val output = tempFolder.newFolder("output")
|
|
36
36
|
val project = createProject()
|
|
37
|
+
val boostThirdPartyJniPath = File(project.projectDir, "src/main/jni/third-party/boost/")
|
|
37
38
|
val task =
|
|
38
39
|
createTestTask<PrepareBoostTask>(project = project) {
|
|
39
40
|
it.boostPath.setFrom(boostpath)
|
|
41
|
+
it.boostThirdPartyJniPath.set(boostThirdPartyJniPath)
|
|
40
42
|
it.boostVersion.set("1.0.0")
|
|
41
43
|
it.outputDir.set(output)
|
|
42
44
|
}
|
|
43
|
-
File(
|
|
45
|
+
File(boostThirdPartyJniPath, "CMakeLists.txt").apply {
|
|
44
46
|
parentFile.mkdirs()
|
|
45
47
|
createNewFile()
|
|
46
48
|
}
|
|
@@ -52,10 +54,12 @@ class PrepareBoostTaskTest {
|
|
|
52
54
|
@Test
|
|
53
55
|
fun prepareBoostTask_copiesAsmFiles() {
|
|
54
56
|
val boostpath = tempFolder.newFolder("boostpath")
|
|
57
|
+
val boostThirdPartyJniPath = tempFolder.newFolder("boostpath/jni")
|
|
55
58
|
val output = tempFolder.newFolder("output")
|
|
56
59
|
val task =
|
|
57
|
-
createTestTask<PrepareBoostTask>
|
|
60
|
+
createTestTask<PrepareBoostTask> {
|
|
58
61
|
it.boostPath.setFrom(boostpath)
|
|
62
|
+
it.boostThirdPartyJniPath.set(boostThirdPartyJniPath)
|
|
59
63
|
it.boostVersion.set("1.0.0")
|
|
60
64
|
it.outputDir.set(output)
|
|
61
65
|
}
|
|
@@ -71,10 +75,12 @@ class PrepareBoostTaskTest {
|
|
|
71
75
|
@Test
|
|
72
76
|
fun prepareBoostTask_copiesBoostSourceFiles() {
|
|
73
77
|
val boostpath = tempFolder.newFolder("boostpath")
|
|
78
|
+
val boostThirdPartyJniPath = tempFolder.newFolder("boostpath/jni")
|
|
74
79
|
val output = tempFolder.newFolder("output")
|
|
75
80
|
val task =
|
|
76
81
|
createTestTask<PrepareBoostTask> {
|
|
77
82
|
it.boostPath.setFrom(boostpath)
|
|
83
|
+
it.boostThirdPartyJniPath.set(boostThirdPartyJniPath)
|
|
78
84
|
it.boostVersion.set("1.0.0")
|
|
79
85
|
it.outputDir.set(output)
|
|
80
86
|
}
|
|
@@ -90,10 +96,12 @@ class PrepareBoostTaskTest {
|
|
|
90
96
|
@Test
|
|
91
97
|
fun prepareBoostTask_copiesVersionlessBoostSourceFiles() {
|
|
92
98
|
val boostpath = tempFolder.newFolder("boostpath")
|
|
99
|
+
val boostThirdPartyJniPath = tempFolder.newFolder("boostpath/jni")
|
|
93
100
|
val output = tempFolder.newFolder("output")
|
|
94
101
|
val task =
|
|
95
102
|
createTestTask<PrepareBoostTask> {
|
|
96
103
|
it.boostPath.setFrom(boostpath)
|
|
104
|
+
it.boostThirdPartyJniPath.set(boostThirdPartyJniPath)
|
|
97
105
|
it.boostVersion.set("1.0.0")
|
|
98
106
|
it.outputDir.set(output)
|
|
99
107
|
}
|
|
@@ -31,13 +31,15 @@ class PrepareGlogTaskTest {
|
|
|
31
31
|
val glogpath = tempFolder.newFolder("glogpath")
|
|
32
32
|
val output = tempFolder.newFolder("output")
|
|
33
33
|
val project = createProject()
|
|
34
|
+
val glogThirdPartyJniPath = File(project.projectDir, "src/main/jni/third-party/glog/")
|
|
34
35
|
val task =
|
|
35
36
|
createTestTask<PrepareGlogTask>(project = project) {
|
|
36
37
|
it.glogPath.setFrom(glogpath)
|
|
38
|
+
it.glogThirdPartyJniPath.set(glogThirdPartyJniPath)
|
|
37
39
|
it.glogVersion.set("1.0.0")
|
|
38
40
|
it.outputDir.set(output)
|
|
39
41
|
}
|
|
40
|
-
File(
|
|
42
|
+
File(glogThirdPartyJniPath, "CMakeLists.txt").apply {
|
|
41
43
|
parentFile.mkdirs()
|
|
42
44
|
createNewFile()
|
|
43
45
|
}
|
|
@@ -51,13 +53,15 @@ class PrepareGlogTaskTest {
|
|
|
51
53
|
val glogpath = tempFolder.newFolder("glogpath")
|
|
52
54
|
val output = tempFolder.newFolder("output")
|
|
53
55
|
val project = createProject()
|
|
56
|
+
val glogThirdPartyJniPath = File(project.projectDir, "src/main/jni/third-party/glog/")
|
|
54
57
|
val task =
|
|
55
58
|
createTestTask<PrepareGlogTask>(project = project) {
|
|
56
59
|
it.glogPath.setFrom(glogpath)
|
|
60
|
+
it.glogThirdPartyJniPath.set(glogThirdPartyJniPath)
|
|
57
61
|
it.glogVersion.set("1.0.0")
|
|
58
62
|
it.outputDir.set(output)
|
|
59
63
|
}
|
|
60
|
-
File(
|
|
64
|
+
File(glogThirdPartyJniPath, "config.h").apply {
|
|
61
65
|
parentFile.mkdirs()
|
|
62
66
|
createNewFile()
|
|
63
67
|
}
|
|
@@ -69,10 +73,12 @@ class PrepareGlogTaskTest {
|
|
|
69
73
|
@Test
|
|
70
74
|
fun prepareGlogTask_copiesSourceCode() {
|
|
71
75
|
val glogpath = tempFolder.newFolder("glogpath")
|
|
76
|
+
val glogThirdPartyJniPath = tempFolder.newFolder("glogpath/jni")
|
|
72
77
|
val output = tempFolder.newFolder("output")
|
|
73
78
|
val task =
|
|
74
79
|
createTestTask<PrepareGlogTask> {
|
|
75
80
|
it.glogPath.setFrom(glogpath)
|
|
81
|
+
it.glogThirdPartyJniPath.set(glogThirdPartyJniPath)
|
|
76
82
|
it.glogVersion.set("1.0.0")
|
|
77
83
|
it.outputDir.set(output)
|
|
78
84
|
}
|
|
@@ -89,10 +95,12 @@ class PrepareGlogTaskTest {
|
|
|
89
95
|
@Test
|
|
90
96
|
fun prepareGlogTask_replacesTokenCorrectly() {
|
|
91
97
|
val glogpath = tempFolder.newFolder("glogpath")
|
|
98
|
+
val glogThirdPartyJniPath = tempFolder.newFolder("glogpath/jni")
|
|
92
99
|
val output = tempFolder.newFolder("output")
|
|
93
100
|
val task =
|
|
94
101
|
createTestTask<PrepareGlogTask> {
|
|
95
102
|
it.glogPath.setFrom(glogpath)
|
|
103
|
+
it.glogThirdPartyJniPath.set(glogThirdPartyJniPath)
|
|
96
104
|
it.glogVersion.set("1.0.0")
|
|
97
105
|
it.outputDir.set(output)
|
|
98
106
|
}
|
|
@@ -111,10 +119,12 @@ class PrepareGlogTaskTest {
|
|
|
111
119
|
@Test
|
|
112
120
|
fun prepareGlogTask_exportsHeaderCorrectly() {
|
|
113
121
|
val glogpath = tempFolder.newFolder("glogpath")
|
|
122
|
+
val glogThirdPartyJniPath = tempFolder.newFolder("glogpath/jni")
|
|
114
123
|
val output = tempFolder.newFolder("output")
|
|
115
124
|
val task =
|
|
116
125
|
createTestTask<PrepareGlogTask> {
|
|
117
126
|
it.glogPath.setFrom(glogpath)
|
|
127
|
+
it.glogThirdPartyJniPath.set(glogThirdPartyJniPath)
|
|
118
128
|
it.glogVersion.set("1.0.0")
|
|
119
129
|
it.outputDir.set(output)
|
|
120
130
|
}
|
package/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/ProjectUtilsTest.kt
CHANGED
|
@@ -15,7 +15,6 @@ import com.facebook.react.utils.ProjectUtils.getReactNativeArchitectures
|
|
|
15
15
|
import com.facebook.react.utils.ProjectUtils.isHermesEnabled
|
|
16
16
|
import com.facebook.react.utils.ProjectUtils.isNewArchEnabled
|
|
17
17
|
import com.facebook.react.utils.ProjectUtils.needsCodegenFromPackageJson
|
|
18
|
-
import com.facebook.react.utils.ProjectUtils.shouldWarnIfNewArchFlagIsSetInPrealpha
|
|
19
18
|
import java.io.File
|
|
20
19
|
import org.assertj.core.api.Assertions.assertThat
|
|
21
20
|
import org.junit.Rule
|
|
@@ -75,78 +74,6 @@ class ProjectUtilsTest {
|
|
|
75
74
|
assertThat(project.isNewArchEnabled(extension)).isFalse()
|
|
76
75
|
}
|
|
77
76
|
|
|
78
|
-
@Test
|
|
79
|
-
fun isNewArchEnabled_withRNVersionPrealpha_returnTrue() {
|
|
80
|
-
val project = createProject()
|
|
81
|
-
val extension = TestReactExtension(project)
|
|
82
|
-
File(tempFolder.root, "package.json").apply {
|
|
83
|
-
writeText(
|
|
84
|
-
// language=json
|
|
85
|
-
"""
|
|
86
|
-
{
|
|
87
|
-
"version": "0.0.0-prealpha-202310916"
|
|
88
|
-
}
|
|
89
|
-
"""
|
|
90
|
-
.trimIndent())
|
|
91
|
-
}
|
|
92
|
-
extension.reactNativeDir.set(tempFolder.root)
|
|
93
|
-
assertThat(project.isNewArchEnabled(extension)).isTrue()
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
@Test
|
|
97
|
-
fun isNewArchEnabled_withRNVersion1PrereleaseString_returnTrue() {
|
|
98
|
-
val project = createProject()
|
|
99
|
-
val extension = TestReactExtension(project)
|
|
100
|
-
File(tempFolder.root, "package.json").apply {
|
|
101
|
-
writeText(
|
|
102
|
-
// language=json
|
|
103
|
-
"""
|
|
104
|
-
{
|
|
105
|
-
"version": "1.2.3-prealpha0"
|
|
106
|
-
}
|
|
107
|
-
"""
|
|
108
|
-
.trimIndent())
|
|
109
|
-
}
|
|
110
|
-
extension.reactNativeDir.set(tempFolder.root)
|
|
111
|
-
assertThat(project.isNewArchEnabled(extension)).isTrue()
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
@Test
|
|
115
|
-
fun isNewArchEnabled_withRNVersion1PrereleaseStringDotNumber_returnTrue() {
|
|
116
|
-
val project = createProject()
|
|
117
|
-
val extension = TestReactExtension(project)
|
|
118
|
-
File(tempFolder.root, "package.json").apply {
|
|
119
|
-
writeText(
|
|
120
|
-
// language=json
|
|
121
|
-
"""
|
|
122
|
-
{
|
|
123
|
-
"version": "1.2.3-prealpha.0"
|
|
124
|
-
}
|
|
125
|
-
"""
|
|
126
|
-
.trimIndent())
|
|
127
|
-
}
|
|
128
|
-
extension.reactNativeDir.set(tempFolder.root)
|
|
129
|
-
assertThat(project.isNewArchEnabled(extension)).isTrue()
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
@Test
|
|
133
|
-
fun isNewArchEnabled_withRNVersion1PrereleaseStringDashNumber_returnTrue() {
|
|
134
|
-
val project = createProject()
|
|
135
|
-
val extension = TestReactExtension(project)
|
|
136
|
-
File(tempFolder.root, "package.json").apply {
|
|
137
|
-
writeText(
|
|
138
|
-
// language=json
|
|
139
|
-
"""
|
|
140
|
-
{
|
|
141
|
-
"version": "1.2.3-prealpha-0"
|
|
142
|
-
}
|
|
143
|
-
"""
|
|
144
|
-
.trimIndent())
|
|
145
|
-
}
|
|
146
|
-
extension.reactNativeDir.set(tempFolder.root)
|
|
147
|
-
assertThat(project.isNewArchEnabled(extension)).isTrue()
|
|
148
|
-
}
|
|
149
|
-
|
|
150
77
|
@Test
|
|
151
78
|
fun isNewArchEnabled_withRNVersion1000_returnFalse() {
|
|
152
79
|
val project = createProject()
|
|
@@ -320,214 +247,4 @@ class ProjectUtilsTest {
|
|
|
320
247
|
assertThat(archs[2]).isEqualTo("x86")
|
|
321
248
|
assertThat(archs[3]).isEqualTo("x86_64")
|
|
322
249
|
}
|
|
323
|
-
|
|
324
|
-
@Test
|
|
325
|
-
fun shouldWarnIfNewArchFlagIsSetInPrealpha_whenNewArchIsSetToFalseAndOnPrealpha_returnTrue() {
|
|
326
|
-
val project = createProject()
|
|
327
|
-
project.extensions.extraProperties.set("newArchEnabled", "false")
|
|
328
|
-
val extension = TestReactExtension(project)
|
|
329
|
-
File(tempFolder.root, "package.json").apply {
|
|
330
|
-
writeText(
|
|
331
|
-
// language=json
|
|
332
|
-
"""
|
|
333
|
-
{
|
|
334
|
-
"version": "0.0.0-prealpha-2023100915"
|
|
335
|
-
}
|
|
336
|
-
"""
|
|
337
|
-
.trimIndent())
|
|
338
|
-
}
|
|
339
|
-
extension.reactNativeDir.set(tempFolder.root)
|
|
340
|
-
assertThat(project.shouldWarnIfNewArchFlagIsSetInPrealpha(extension)).isTrue()
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
@Test
|
|
344
|
-
fun shouldWarnIfNewArchFlagIsSetInPrealpha_whenScopedNewArchIsSetToFalseAndOnPrealpha_returnTrue() {
|
|
345
|
-
val project = createProject()
|
|
346
|
-
project.extensions.extraProperties.set("react.newArchEnabled", "false")
|
|
347
|
-
val extension = TestReactExtension(project)
|
|
348
|
-
File(tempFolder.root, "package.json").apply {
|
|
349
|
-
writeText(
|
|
350
|
-
// language=json
|
|
351
|
-
"""
|
|
352
|
-
{
|
|
353
|
-
"version": "0.0.0-prealpha-2023100915"
|
|
354
|
-
}
|
|
355
|
-
"""
|
|
356
|
-
.trimIndent())
|
|
357
|
-
}
|
|
358
|
-
extension.reactNativeDir.set(tempFolder.root)
|
|
359
|
-
assertThat(project.shouldWarnIfNewArchFlagIsSetInPrealpha(extension)).isTrue()
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
@Test
|
|
363
|
-
fun shouldWarnIfNewArchFlagIsSetInPrealpha_whenBothAreSetToFalseAndOnPrealpha_returnTrue() {
|
|
364
|
-
val project = createProject()
|
|
365
|
-
project.extensions.extraProperties.set("newArchEnabled", "false")
|
|
366
|
-
project.extensions.extraProperties.set("react.newArchEnabled", "false")
|
|
367
|
-
val extension = TestReactExtension(project)
|
|
368
|
-
File(tempFolder.root, "package.json").apply {
|
|
369
|
-
writeText(
|
|
370
|
-
// language=json
|
|
371
|
-
"""
|
|
372
|
-
{
|
|
373
|
-
"version": "0.0.0-prealpha-2023100915"
|
|
374
|
-
}
|
|
375
|
-
"""
|
|
376
|
-
.trimIndent())
|
|
377
|
-
}
|
|
378
|
-
extension.reactNativeDir.set(tempFolder.root)
|
|
379
|
-
assertThat(project.shouldWarnIfNewArchFlagIsSetInPrealpha(extension)).isTrue()
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
@Test
|
|
383
|
-
fun shouldWarnIfNewArchFlagIsSetInPrealpha_whenNewArchIsSetToTrueAndOnPrealpha_returnFalse() {
|
|
384
|
-
val project = createProject()
|
|
385
|
-
project.extensions.extraProperties.set("newArchEnabled", "true")
|
|
386
|
-
val extension = TestReactExtension(project)
|
|
387
|
-
File(tempFolder.root, "package.json").apply {
|
|
388
|
-
writeText(
|
|
389
|
-
// language=json
|
|
390
|
-
"""
|
|
391
|
-
{
|
|
392
|
-
"version": "0.0.0-prealpha-2023100915"
|
|
393
|
-
}
|
|
394
|
-
"""
|
|
395
|
-
.trimIndent())
|
|
396
|
-
}
|
|
397
|
-
extension.reactNativeDir.set(tempFolder.root)
|
|
398
|
-
assertThat(project.shouldWarnIfNewArchFlagIsSetInPrealpha(extension)).isFalse()
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
@Test
|
|
402
|
-
fun shouldWarnIfNewArchFlagIsSetInPrealpha_whenScopedNewArchIsSetToTrueAndOnPrealpha_returnFalse() {
|
|
403
|
-
val project = createProject()
|
|
404
|
-
project.extensions.extraProperties.set("react.newArchEnabled", "true")
|
|
405
|
-
val extension = TestReactExtension(project)
|
|
406
|
-
File(tempFolder.root, "package.json").apply {
|
|
407
|
-
writeText(
|
|
408
|
-
// language=json
|
|
409
|
-
"""
|
|
410
|
-
{
|
|
411
|
-
"version": "0.0.0-prealpha-2023100915"
|
|
412
|
-
}
|
|
413
|
-
"""
|
|
414
|
-
.trimIndent())
|
|
415
|
-
}
|
|
416
|
-
extension.reactNativeDir.set(tempFolder.root)
|
|
417
|
-
assertThat(project.shouldWarnIfNewArchFlagIsSetInPrealpha(extension)).isFalse()
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
@Test
|
|
421
|
-
fun shouldWarnIfNewArchFlagIsSetInPrealpha_whenBothAreSetToTrueAndOnPrealpha_returnFalse() {
|
|
422
|
-
val project = createProject()
|
|
423
|
-
project.extensions.extraProperties.set("newArchEnabled", "true")
|
|
424
|
-
project.extensions.extraProperties.set("react.newArchEnabled", "true")
|
|
425
|
-
val extension = TestReactExtension(project)
|
|
426
|
-
File(tempFolder.root, "package.json").apply {
|
|
427
|
-
writeText(
|
|
428
|
-
// language=json
|
|
429
|
-
"""
|
|
430
|
-
{
|
|
431
|
-
"version": "0.0.0-prealpha-2023100915"
|
|
432
|
-
}
|
|
433
|
-
"""
|
|
434
|
-
.trimIndent())
|
|
435
|
-
}
|
|
436
|
-
extension.reactNativeDir.set(tempFolder.root)
|
|
437
|
-
assertThat(project.shouldWarnIfNewArchFlagIsSetInPrealpha(extension)).isFalse()
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
@Test
|
|
441
|
-
fun shouldWarnIfNewArchFlagIsSetInPrealpha_whenNoneAreSetAndOnPrealpha_returnFalse() {
|
|
442
|
-
val project = createProject()
|
|
443
|
-
val extension = TestReactExtension(project)
|
|
444
|
-
File(tempFolder.root, "package.json").apply {
|
|
445
|
-
writeText(
|
|
446
|
-
// language=json
|
|
447
|
-
"""
|
|
448
|
-
{
|
|
449
|
-
"version": "0.0.0-prealpha-2023100915"
|
|
450
|
-
}
|
|
451
|
-
"""
|
|
452
|
-
.trimIndent())
|
|
453
|
-
}
|
|
454
|
-
extension.reactNativeDir.set(tempFolder.root)
|
|
455
|
-
assertThat(project.shouldWarnIfNewArchFlagIsSetInPrealpha(extension)).isFalse()
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
@Test
|
|
459
|
-
fun shouldWarnIfNewArchFlagIsSetInPrealpha_whenNewArchIsSetToTrueAndNotOnPrealpha_returnFalse() {
|
|
460
|
-
val project = createProject()
|
|
461
|
-
project.extensions.extraProperties.set("newxArchEnabled", "true")
|
|
462
|
-
val extension = TestReactExtension(project)
|
|
463
|
-
File(tempFolder.root, "package.json").apply {
|
|
464
|
-
writeText(
|
|
465
|
-
// language=json
|
|
466
|
-
"""
|
|
467
|
-
{
|
|
468
|
-
"version": "0.73.0"
|
|
469
|
-
}
|
|
470
|
-
"""
|
|
471
|
-
.trimIndent())
|
|
472
|
-
}
|
|
473
|
-
extension.reactNativeDir.set(tempFolder.root)
|
|
474
|
-
assertThat(project.shouldWarnIfNewArchFlagIsSetInPrealpha(extension)).isFalse()
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
@Test
|
|
478
|
-
fun shouldWarnIfNewArchFlagIsSetInPrealpha_whenScopedNewArchIsSetToTrueAndNotOnPrealpha_returnFalse() {
|
|
479
|
-
val project = createProject()
|
|
480
|
-
project.extensions.extraProperties.set("react.newxArchEnabled", "true")
|
|
481
|
-
val extension = TestReactExtension(project)
|
|
482
|
-
File(tempFolder.root, "package.json").apply {
|
|
483
|
-
writeText(
|
|
484
|
-
// language=json
|
|
485
|
-
"""
|
|
486
|
-
{
|
|
487
|
-
"version": "0.73.0"
|
|
488
|
-
}
|
|
489
|
-
"""
|
|
490
|
-
.trimIndent())
|
|
491
|
-
}
|
|
492
|
-
extension.reactNativeDir.set(tempFolder.root)
|
|
493
|
-
assertThat(project.shouldWarnIfNewArchFlagIsSetInPrealpha(extension)).isFalse()
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
@Test
|
|
497
|
-
fun shouldWarnIfNewArchFlagIsSetInPrealpha_whenBothAreSetToTrueAndNotOnPrealpha_returnFalse() {
|
|
498
|
-
val project = createProject()
|
|
499
|
-
project.extensions.extraProperties.set("newArchEnabled", "true")
|
|
500
|
-
project.extensions.extraProperties.set("react.newxArchEnabled", "true")
|
|
501
|
-
val extension = TestReactExtension(project)
|
|
502
|
-
File(tempFolder.root, "package.json").apply {
|
|
503
|
-
writeText(
|
|
504
|
-
// language=json
|
|
505
|
-
"""
|
|
506
|
-
{
|
|
507
|
-
"version": "0.73.0"
|
|
508
|
-
}
|
|
509
|
-
"""
|
|
510
|
-
.trimIndent())
|
|
511
|
-
}
|
|
512
|
-
extension.reactNativeDir.set(tempFolder.root)
|
|
513
|
-
assertThat(project.shouldWarnIfNewArchFlagIsSetInPrealpha(extension)).isFalse()
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
@Test
|
|
517
|
-
fun shouldWarnIfNewArchFlagIsSetInPrealpha_whenNoneAreSetAndNotOnPrealpha_returnFalse() {
|
|
518
|
-
val project = createProject()
|
|
519
|
-
val extension = TestReactExtension(project)
|
|
520
|
-
File(tempFolder.root, "package.json").apply {
|
|
521
|
-
writeText(
|
|
522
|
-
// language=json
|
|
523
|
-
"""
|
|
524
|
-
{
|
|
525
|
-
"version": "0.73.0"
|
|
526
|
-
}
|
|
527
|
-
"""
|
|
528
|
-
.trimIndent())
|
|
529
|
-
}
|
|
530
|
-
extension.reactNativeDir.set(tempFolder.root)
|
|
531
|
-
assertThat(project.shouldWarnIfNewArchFlagIsSetInPrealpha(extension)).isFalse()
|
|
532
|
-
}
|
|
533
250
|
}
|