Skip to content

Commit

Permalink
fix(pub): Use the projectType for project references
Browse files Browse the repository at this point in the history
Do not hard-code "Pub" as the identifier type, as it might be a
(reference to a) project instead if a package.

Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed Jan 24, 2025
1 parent 955155a commit 59562ef
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions plugins/package-managers/pub/src/main/kotlin/Pub.kt
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ class Pub(
if (pkgInfoFromLockfile == null || pkgInfoFromLockfile.source == "sdk") return@forEach

val id = Identifier(
type = "Pub",
type = if (pkgInfoFromLockfile.isProject) projectType else "Pub",
namespace = "",
name = packageName,
version = pkgInfoFromLockfile.version.orEmpty()
Expand Down Expand Up @@ -629,7 +629,7 @@ class Pub(
}

val id = Identifier(
type = "Pub",
type = if (packageInfo.isProject) projectType else "Pub",
namespace = "",
name = rawName,
version = version
Expand Down Expand Up @@ -773,6 +773,9 @@ class Pub(
PackageManagerResult(projectResults.filterProjectPackages())
}

private val PackageInfo.isProject: Boolean
get() = source == "path" && description.url == null

/**
* Extract information about package authors from the given [pubspec].
*/
Expand Down

0 comments on commit 59562ef

Please sign in to comment.