@react-native/gradle-plugin 0.75.0-rc.2 → 0.75.0-rc.4

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.75.0-rc.2",
3
+ "version": "0.75.0-rc.4",
4
4
  "description": "Gradle Plugin for React Native",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -112,9 +112,15 @@ abstract class ReactSettingsExtension @Inject constructor(val settings: Settings
112
112
 
113
113
  internal fun getLibrariesToAutolink(buildFile: File): Map<String, File> {
114
114
  val model = JsonUtils.fromAutolinkingConfigJson(buildFile)
115
- return model?.dependencies?.values?.associate { deps ->
116
- ":${deps.nameCleansed}" to File(deps.platforms?.android?.sourceDir)
117
- } ?: emptyMap()
115
+ return model
116
+ ?.dependencies
117
+ ?.values
118
+ // We handle scenarios where there are deps that are
119
+ // iOS-only or missing the Android configs.
120
+ ?.filter { it.platforms?.android?.sourceDir != null }
121
+ ?.associate { deps ->
122
+ ":${deps.nameCleansed}" to File(deps.platforms?.android?.sourceDir)
123
+ } ?: emptyMap()
118
124
  }
119
125
 
120
126
  internal fun computeSha256(lockFile: File) =
@@ -103,6 +103,35 @@ class ReactSettingsExtensionTest {
103
103
  map[":react-native_oss-library-example"])
104
104
  }
105
105
 
106
+ @Test
107
+ fun getLibrariesToAutolink_withiOSOnlyLibrary_returnsEmptyMap() {
108
+ val validJsonFile =
109
+ createJsonFile(
110
+ """
111
+ {
112
+ "reactNativeVersion": "1000.0.0",
113
+ "dependencies": {
114
+ "@react-native/oss-library-example": {
115
+ "root": "./node_modules/@react-native/oss-library-example",
116
+ "name": "@react-native/oss-library-example",
117
+ "platforms": {
118
+ "ios": {
119
+ "podspecPath": "./node_modules/@react-native/oss-library-example/OSSLibraryExample.podspec",
120
+ "version": "0.0.1",
121
+ "configurations": [],
122
+ "scriptPhases": []
123
+ }
124
+ }
125
+ }
126
+ }
127
+ }
128
+ """
129
+ .trimIndent())
130
+
131
+ val map = getLibrariesToAutolink(validJsonFile)
132
+ assertEquals(0, map.keys.size)
133
+ }
134
+
106
135
  @Test
107
136
  fun checkAndUpdateLockfiles_withNothingToCheck_returnsFalse() {
108
137
  val project = ProjectBuilder.builder().build()