Skip to content

Commit 665d564

Browse files
hurali97Copilot
andauthored
fix: missing runtime and duplicate dependencies (#250)
* fix: missing runtime and duplicate dependencies * Update gradle-plugins/react/brownfield/src/main/kotlin/com/callstack/react/brownfield/expo/ExpoPublishingHelper.kt Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * refactor: make the impl simpler * docs: add comments --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 6ea8da9 commit 665d564

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

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

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -353,18 +353,15 @@ 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
368365
val dependencyInfo =
369366
DependencyInfo(
370367
groupId = groupId,
@@ -384,11 +381,13 @@ open class ExpoPublishingHelper(val brownfieldAppProject: Project) {
384381
pkgProject: Project,
385382
dependencies: VersionMediatingDependencySet,
386383
) {
387-
val configurations = pkgProject.configurations.matching {
388-
it.name.contains("implementation", ignoreCase = true) || it.name.contains("api", ignoreCase = true)
389-
}
390-
configurations.forEach {
391-
it.dependencies.forEach { dep ->
384+
/**
385+
* Not accounting for variant specific configurations as Expo packages are not
386+
* using it. Should we face any issues/needs to account for it, we can do it here.
387+
*/
388+
listOf("implementation", "api", "runtime").forEach {
389+
val configuration = pkgProject.configurations.findByName(it)
390+
configuration?.dependencies?.forEach { dep ->
392391
if (dep.group != null) {
393392
dependencies.add(
394393
DependencyInfo.fromGradleDep(

0 commit comments

Comments
 (0)