Skip to content

Commit cf71eaf

Browse files
committed
fix: missing runtime and duplicate dependencies
1 parent fed9d95 commit cf71eaf

1 file changed

Lines changed: 21 additions & 6 deletions

File tree

gradle-plugins/react/brownfield/src/main/kotlin/com/callstack/react/brownfield/expo/ExpoPublishingHelper.kt

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -353,18 +353,16 @@ open class ExpoPublishingHelper(val brownfieldAppProject: Project) {
353353
depNodeList.childNodes.forEach { depNode ->
354354
/**
355355
* below: some nodes are not dependencies, but pure text, in which case their name is '#text'
356-
*
357-
* Only add dependencies with compile scope, if scope is null, default to compile
358356
*/
359-
val scope = depNode.getChildNodeByName("scope")?.textContent
360-
if (depNode.nodeName == "dependency" && (scope == null || scope == "compile")) {
357+
if (depNode.nodeName == "dependency") {
361358
val groupId = depNode.getChildNodeByName("groupId")!!.textContent
362359
val maybeArtifactId = depNode.getChildNodeByName("artifactId")
363360

364361
val artifactId = maybeArtifactId!!.textContent
365362
val version = depNode.getChildNodeByName("version")?.textContent
366363
val optional = depNode.getChildNodeByName("optional")?.textContent
367-
364+
val scope = depNode.getChildNodeByName("scope")?.textContent
365+
368366
val dependencyInfo =
369367
DependencyInfo(
370368
groupId = groupId,
@@ -384,8 +382,25 @@ open class ExpoPublishingHelper(val brownfieldAppProject: Project) {
384382
pkgProject: Project,
385383
dependencies: VersionMediatingDependencySet,
386384
) {
385+
val excludedConfigurationNameParts =
386+
setOf(
387+
"test",
388+
"androidTest",
389+
"kapt",
390+
"annotationProcessor",
391+
"lint",
392+
"detached",
393+
)
387394
val configurations = pkgProject.configurations.matching {
388-
it.name.contains("implementation", ignoreCase = true) || it.name.contains("api", ignoreCase = true)
395+
val includeByName =
396+
it.name.contains("implementation", ignoreCase = true) ||
397+
it.name.contains("api", ignoreCase = true)
398+
399+
val excludedByName = excludedConfigurationNameParts.any { excluded ->
400+
it.name.contains(excluded, ignoreCase = true)
401+
}
402+
403+
includeByName && !excludedByName
389404
}
390405
configurations.forEach {
391406
it.dependencies.forEach { dep ->

0 commit comments

Comments
 (0)