Skip to content

Commit

Permalink
feat(pub): Use PackageManager.getFallbackProjectName
Browse files Browse the repository at this point in the history
If no name can be determine from the package metadata, use the
`getFallbackProjectName` helper function to align with other package
manager implementations.

Signed-off-by: Martin Nonnenmacher <[email protected]>
  • Loading branch information
mnonnenmacher committed Jan 15, 2024
1 parent 39ff433 commit 375e67e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/package-managers/pub/src/main/kotlin/Pub.kt
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ class Pub(

private fun parseProject(definitionFile: File, pubspec: JsonNode, scopes: Set<Scope>): Project {
// See https://dart.dev/tools/pub/pubspec for supported fields.
val rawName = pubspec["name"]?.textValue() ?: definitionFile.parentFile.name
val rawName = pubspec["name"]?.textValue() ?: getFallbackProjectName(analysisRoot, definitionFile)
val homepageUrl = pubspec["homepage"].textValueOrEmpty()
val repositoryUrl = pubspec["repository"].textValueOrEmpty()
val authors = parseAuthors(pubspec)
Expand Down

0 comments on commit 375e67e

Please sign in to comment.