@ohos-ports/react-native-gradle-plugin 0.71.19-beta.0 → 0.86.0-beta.0
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/README.md +11 -4
- package/build.gradle.kts +33 -41
- package/gradle/libs.versions.toml +22 -0
- package/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/gradle/wrapper/gradle-wrapper.properties +3 -1
- package/gradle.properties +2 -0
- package/gradlew +32 -18
- package/gradlew.bat +22 -18
- package/package.json +21 -11
- package/react-native-gradle-plugin/README.md +17 -0
- package/react-native-gradle-plugin/build.gradle.kts +83 -0
- package/{src → react-native-gradle-plugin/src}/main/kotlin/com/facebook/react/ReactExtension.kt +78 -10
- package/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt +320 -0
- package/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactRootProjectPlugin.kt +86 -0
- package/{src → react-native-gradle-plugin/src}/main/kotlin/com/facebook/react/TaskConfiguration.kt +36 -25
- package/{src → react-native-gradle-plugin/src}/main/kotlin/com/facebook/react/internal/PrivateReactExtension.kt +11 -4
- package/{src → react-native-gradle-plugin/src}/main/kotlin/com/facebook/react/tasks/BundleHermesCTask.kt +60 -50
- package/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateAutolinkingNewArchitecturesFileTask.kt +252 -0
- package/{src → react-native-gradle-plugin/src}/main/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTask.kt +8 -3
- package/{src → react-native-gradle-plugin/src}/main/kotlin/com/facebook/react/tasks/GenerateCodegenSchemaTask.kt +11 -18
- package/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateEntryPointTask.kt +108 -0
- package/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GeneratePackageListTask.kt +214 -0
- package/{src/main/kotlin/com/facebook/react/tasks → react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal}/BuildCodegenCLITask.kt +24 -17
- package/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/CustomExecTask.kt +46 -0
- package/{src → react-native-gradle-plugin/src}/main/kotlin/com/facebook/react/tasks/internal/PrepareBoostTask.kt +10 -4
- package/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareGflagsTask.kt +119 -0
- package/{src → react-native-gradle-plugin/src}/main/kotlin/com/facebook/react/tasks/internal/PrepareGlogTask.kt +26 -18
- package/{src → react-native-gradle-plugin/src}/main/kotlin/com/facebook/react/tasks/internal/PreparePrefabHeadersTask.kt +28 -12
- package/{src → react-native-gradle-plugin/src}/main/kotlin/com/facebook/react/tasks/internal/utils/PrefabPreprocessingEntry.kt +4 -3
- package/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt +163 -0
- package/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/BackwardCompatUtils.kt +71 -0
- package/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/DependencyUtils.kt +299 -0
- package/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/JdkConfiguratorUtils.kt +64 -0
- package/{src → react-native-gradle-plugin/src}/main/kotlin/com/facebook/react/utils/NdkConfiguratorUtils.kt +59 -65
- package/{src → react-native-gradle-plugin/src}/main/kotlin/com/facebook/react/utils/PathUtils.kt +44 -30
- package/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/ProjectUtils.kt +119 -0
- package/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PropertyUtils.kt +96 -0
- package/settings-plugin/build.gradle.kts +73 -0
- package/settings-plugin/src/main/kotlin/com/facebook/react/ReactSettingsExtension.kt +217 -0
- package/settings-plugin/src/main/kotlin/com/facebook/react/ReactSettingsPlugin.kt +23 -0
- package/settings-plugin/src/test/kotlin/com/facebook/react/ReactSettingsExtensionTest.kt +475 -0
- package/settings.gradle.kts +10 -1
- package/shared/build.gradle.kts +52 -0
- package/shared/src/main/kotlin/com/facebook/react/model/ModelAutolinkingAndroidProjectJson.kt +18 -0
- package/shared/src/main/kotlin/com/facebook/react/model/ModelAutolinkingConfigJson.kt +14 -0
- package/shared/src/main/kotlin/com/facebook/react/model/ModelAutolinkingDependenciesJson.kt +18 -0
- package/shared/src/main/kotlin/com/facebook/react/model/ModelAutolinkingDependenciesPlatformAndroidJson.kt +23 -0
- package/shared/src/main/kotlin/com/facebook/react/model/ModelAutolinkingDependenciesPlatformJson.kt +12 -0
- package/shared/src/main/kotlin/com/facebook/react/model/ModelAutolinkingProjectJson.kt +10 -0
- package/{src → shared/src}/main/kotlin/com/facebook/react/model/ModelCodegenConfig.kt +2 -1
- package/{src → shared/src}/main/kotlin/com/facebook/react/model/ModelPackageJson.kt +1 -1
- package/shared/src/main/kotlin/com/facebook/react/utils/JsonUtils.kt +43 -0
- package/shared/src/main/kotlin/com/facebook/react/utils/KotlinStdlibCompatUtils.kt +32 -0
- package/{src → shared/src}/main/kotlin/com/facebook/react/utils/Os.kt +7 -6
- package/{src → shared/src}/main/kotlin/com/facebook/react/utils/TaskUtils.kt +4 -5
- package/shared/src/test/kotlin/com/facebook/react/utils/JsonUtilsTest.kt +382 -0
- package/shared/src/test/kotlin/com/facebook/react/utils/KotlinStdlibCompatUtilsTest.kt +82 -0
- package/shared/src/test/kotlin/com/facebook/react/utils/OsTest.kt +87 -0
- package/shared/src/test/kotlin/com/facebook/react/utils/TaskUtilsTest.kt +76 -0
- package/shared-testutil/build.gradle.kts +46 -0
- package/shared-testutil/src/main/kotlin/com/facebook/react/tests/OsRule.kt +52 -0
- package/shared-testutil/src/main/kotlin/com/facebook/react/tests/WithOs.kt +17 -0
- package/build/libs/react-native-gradle-plugin.jar +0 -0
- package/index.js +0 -73
- package/src/main/kotlin/com/facebook/react/ReactPlugin.kt +0 -212
- package/src/main/kotlin/com/facebook/react/tasks/internal/PrepareJSCTask.kt +0 -50
- package/src/main/kotlin/com/facebook/react/tasks/internal/PrepareLibeventTask.kt +0 -51
- package/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt +0 -54
- package/src/main/kotlin/com/facebook/react/utils/BackwardCompatUtils.kt +0 -48
- package/src/main/kotlin/com/facebook/react/utils/DependencyUtils.kt +0 -109
- package/src/main/kotlin/com/facebook/react/utils/JsonUtils.kt +0 -21
- package/src/main/kotlin/com/facebook/react/utils/ProjectUtils.kt +0 -55
- /package/{src → react-native-gradle-plugin/src}/main/kotlin/com/facebook/react/utils/FileUtils.kt +0 -0
- /package/{src → shared/src}/main/kotlin/com/facebook/react/model/ModelCodegenConfigAndroid.kt +0 -0
|
@@ -1,109 +0,0 @@
|
|
|
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 java.io.File
|
|
11
|
-
import java.net.URI
|
|
12
|
-
import java.util.*
|
|
13
|
-
import org.gradle.api.Project
|
|
14
|
-
import org.gradle.api.artifacts.repositories.MavenArtifactRepository
|
|
15
|
-
|
|
16
|
-
internal const val DEFAULT_GROUP_STRING = "com.facebook.react"
|
|
17
|
-
|
|
18
|
-
internal object DependencyUtils {
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* This method takes care of configuring the repositories{} block for both the app and all the 3rd
|
|
22
|
-
* party libraries which are auto-linked.
|
|
23
|
-
*/
|
|
24
|
-
fun configureRepositories(project: Project, reactNativeDir: File) {
|
|
25
|
-
project.rootProject.allprojects { eachProject ->
|
|
26
|
-
with(eachProject) {
|
|
27
|
-
if (hasProperty("REACT_NATIVE_MAVEN_LOCAL_REPO")) {
|
|
28
|
-
val mavenLocalRepoPath = property("REACT_NATIVE_MAVEN_LOCAL_REPO") as String
|
|
29
|
-
mavenRepoFromURI(File(mavenLocalRepoPath).toURI())
|
|
30
|
-
}
|
|
31
|
-
// We add the snapshot for users on nightlies.
|
|
32
|
-
mavenRepoFromUrl("https://oss.sonatype.org/content/repositories/snapshots/")
|
|
33
|
-
repositories.mavenCentral()
|
|
34
|
-
// Android JSC is installed from npm
|
|
35
|
-
mavenRepoFromURI(File(reactNativeDir, "../jsc-android/dist").toURI())
|
|
36
|
-
repositories.google()
|
|
37
|
-
mavenRepoFromUrl("https://www.jitpack.io")
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* This method takes care of configuring the resolution strategy for both the app and all the 3rd
|
|
44
|
-
* party libraries which are auto-linked. Specifically it takes care of:
|
|
45
|
-
* - Forcing the react-android/hermes-android version to the one specified in the package.json
|
|
46
|
-
* - Substituting `react-native` with `react-android` and `hermes-engine` with `hermes-android`.
|
|
47
|
-
*/
|
|
48
|
-
fun configureDependencies(
|
|
49
|
-
project: Project,
|
|
50
|
-
versionString: String,
|
|
51
|
-
groupString: String = DEFAULT_GROUP_STRING
|
|
52
|
-
) {
|
|
53
|
-
if (versionString.isBlank()) return
|
|
54
|
-
project.rootProject.allprojects { eachProject ->
|
|
55
|
-
eachProject.configurations.all { configuration ->
|
|
56
|
-
// Here we set a dependencySubstitution for both react-native and hermes-engine as those
|
|
57
|
-
// coordinates are voided due to https://github.com/facebook/react-native/issues/35210
|
|
58
|
-
// This allows users to import libraries that are still using
|
|
59
|
-
// implementation("com.facebook.react:react-native:+") and resolve the right dependency.
|
|
60
|
-
configuration.resolutionStrategy.dependencySubstitution {
|
|
61
|
-
it.substitute(it.module("com.facebook.react:react-native"))
|
|
62
|
-
.using(it.module("${groupString}:react-android:${versionString}"))
|
|
63
|
-
.because(
|
|
64
|
-
"The react-native artifact was deprecated in favor of react-android due to https://github.com/facebook/react-native/issues/35210.")
|
|
65
|
-
it.substitute(it.module("com.facebook.react:hermes-engine"))
|
|
66
|
-
.using(it.module("${groupString}:hermes-android:${versionString}"))
|
|
67
|
-
.because(
|
|
68
|
-
"The hermes-engine artifact was deprecated in favor of hermes-android due to https://github.com/facebook/react-native/issues/35210.")
|
|
69
|
-
if (groupString != DEFAULT_GROUP_STRING) {
|
|
70
|
-
it.substitute(it.module("com.facebook.react:react-android"))
|
|
71
|
-
.using(it.module("${groupString}:react-android:${versionString}"))
|
|
72
|
-
.because(
|
|
73
|
-
"The react-android dependency was modified to use the correct Maven group.")
|
|
74
|
-
it.substitute(it.module("com.facebook.react:hermes-android"))
|
|
75
|
-
.using(it.module("${groupString}:hermes-android:${versionString}"))
|
|
76
|
-
.because(
|
|
77
|
-
"The hermes-android dependency was modified to use the correct Maven group.")
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
configuration.resolutionStrategy.force(
|
|
81
|
-
"${groupString}:react-android:${versionString}",
|
|
82
|
-
"${groupString}:hermes-android:${versionString}",
|
|
83
|
-
)
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
fun readVersionAndGroupStrings(propertiesFile: File): Pair<String, String> {
|
|
89
|
-
val reactAndroidProperties = Properties()
|
|
90
|
-
propertiesFile.inputStream().use { reactAndroidProperties.load(it) }
|
|
91
|
-
val versionStringFromFile = reactAndroidProperties["VERSION_NAME"] as? String ?: ""
|
|
92
|
-
// If on a nightly, we need to fetch the -SNAPSHOT artifact from Sonatype.
|
|
93
|
-
val versionString =
|
|
94
|
-
if (versionStringFromFile.startsWith("0.0.0")) {
|
|
95
|
-
"$versionStringFromFile-SNAPSHOT"
|
|
96
|
-
} else {
|
|
97
|
-
versionStringFromFile
|
|
98
|
-
}
|
|
99
|
-
// Returns Maven group for repos using different group for Maven artifacts
|
|
100
|
-
val groupString = reactAndroidProperties["GROUP"] as? String ?: DEFAULT_GROUP_STRING
|
|
101
|
-
return Pair(versionString, groupString)
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
fun Project.mavenRepoFromUrl(url: String): MavenArtifactRepository =
|
|
105
|
-
project.repositories.maven { it.url = URI.create(url) }
|
|
106
|
-
|
|
107
|
-
fun Project.mavenRepoFromURI(uri: URI): MavenArtifactRepository =
|
|
108
|
-
project.repositories.maven { it.url = uri }
|
|
109
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
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.facebook.react.model.ModelPackageJson
|
|
11
|
-
import com.google.gson.Gson
|
|
12
|
-
import java.io.File
|
|
13
|
-
|
|
14
|
-
object JsonUtils {
|
|
15
|
-
private val gsonConverter = Gson()
|
|
16
|
-
|
|
17
|
-
fun fromCodegenJson(input: File): ModelPackageJson? =
|
|
18
|
-
input.bufferedReader().use {
|
|
19
|
-
runCatching { gsonConverter.fromJson(it, ModelPackageJson::class.java) }.getOrNull()
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
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.facebook.react.model.ModelPackageJson
|
|
11
|
-
import org.gradle.api.Project
|
|
12
|
-
import org.gradle.api.file.DirectoryProperty
|
|
13
|
-
|
|
14
|
-
internal object ProjectUtils {
|
|
15
|
-
internal val Project.isNewArchEnabled: Boolean
|
|
16
|
-
get() =
|
|
17
|
-
project.hasProperty("newArchEnabled") &&
|
|
18
|
-
project.property("newArchEnabled").toString().toBoolean()
|
|
19
|
-
|
|
20
|
-
const val HERMES_FALLBACK = true
|
|
21
|
-
|
|
22
|
-
internal val Project.isHermesEnabled: Boolean
|
|
23
|
-
get() =
|
|
24
|
-
if (project.hasProperty("hermesEnabled")) {
|
|
25
|
-
project.property("hermesEnabled").toString().lowercase().toBooleanStrictOrNull() ?: true
|
|
26
|
-
} else if (project.extensions.extraProperties.has("react")) {
|
|
27
|
-
@Suppress("UNCHECKED_CAST")
|
|
28
|
-
val reactMap = project.extensions.extraProperties.get("react") as? Map<String, Any?>
|
|
29
|
-
when (val enableHermesKey = reactMap?.get("enableHermes")) {
|
|
30
|
-
is Boolean -> enableHermesKey
|
|
31
|
-
is String -> enableHermesKey.lowercase().toBooleanStrictOrNull() ?: true
|
|
32
|
-
else -> HERMES_FALLBACK
|
|
33
|
-
}
|
|
34
|
-
} else {
|
|
35
|
-
HERMES_FALLBACK
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
internal fun Project.needsCodegenFromPackageJson(rootProperty: DirectoryProperty): Boolean {
|
|
39
|
-
val parsedPackageJson = readPackageJsonFile(this, rootProperty)
|
|
40
|
-
return needsCodegenFromPackageJson(parsedPackageJson)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
internal fun Project.needsCodegenFromPackageJson(model: ModelPackageJson?): Boolean {
|
|
44
|
-
return model?.codegenConfig != null
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
internal fun Project.getReactNativeArchitectures(): List<String> {
|
|
48
|
-
val architectures = mutableListOf<String>()
|
|
49
|
-
if (project.hasProperty("reactNativeArchitectures")) {
|
|
50
|
-
val architecturesString = project.property("reactNativeArchitectures").toString()
|
|
51
|
-
architectures.addAll(architecturesString.split(",").filter { it.isNotBlank() })
|
|
52
|
-
}
|
|
53
|
-
return architectures
|
|
54
|
-
}
|
|
55
|
-
}
|
/package/{src → react-native-gradle-plugin/src}/main/kotlin/com/facebook/react/utils/FileUtils.kt
RENAMED
|
File without changes
|
/package/{src → shared/src}/main/kotlin/com/facebook/react/model/ModelCodegenConfigAndroid.kt
RENAMED
|
File without changes
|