Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Pub's pubspec parsing to use a data class and KxS / kaml #9080

Merged
merged 4 commits into from
Sep 5, 2024

Conversation

fviernau
Copy link
Member

@fviernau fviernau commented Sep 5, 2024

See individual commits.

@fviernau fviernau requested a review from a team as a code owner September 5, 2024 08:27
Copy link

codecov bot commented Sep 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.32%. Comparing base (bd4e76e) to head (197d265).
Report is 4 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9080      +/-   ##
============================================
+ Coverage     68.30%   68.32%   +0.01%     
  Complexity     1153     1153              
============================================
  Files           237      237              
  Lines          7576     7576              
  Branches        865      865              
============================================
+ Hits           5175     5176       +1     
+ Misses         2048     2047       -1     
  Partials        353      353              
Flag Coverage Δ
funTest-docker 67.22% <ø> (ø)
funTest-non-docker 34.59% <ø> (-0.01%) ⬇️
test 37.79% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

plugins/package-managers/pub/src/main/kotlin/Pub.kt Outdated Show resolved Hide resolved
plugins/package-managers/pub/src/main/kotlin/Pub.kt Outdated Show resolved Hide resolved
) : Dependency
}

private class DependencyMapSerializer : KSerializer<Map<String, Dependency>> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this inherit from StdDeserializer instead to not have the "dummy override" for serialize (and to avoid the strict need for the descriptor override)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because StdSerializer extends from JsonSerializer, while this one is for YAML.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I mixed up the Jackson's StdSerializer with KxS's JsonTransformingSerializer anyway.

So I guess the missing KAML feature is charleskorn/kaml#29? If so, how about adding serializer class docs with a reference to that issue?

@@ -750,7 +750,7 @@ class Pub(
private fun containsFlutterSdk(workingDir: File): Boolean {
val pubspec = parsePubspec(workingDir.resolve(PUBSPEC_YAML))

return (pubspec.dependencies.orEmpty()["flutter"] as? Pubspec.SdkDependency)?.sdk == "flutter"
return pubspec.dependencies.orEmpty().values.any { (it as? Pubspec.SdkDependency)?.sdk == "flutter" }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit message:

  • "Take" -> "Make"
  • Please explain why that is better and safe to do. Maybe @MarcelBochtler can help to find an argument here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can have a dependency on flutter_driver (IIRC), which is part of the flutter SDK.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In one of our lockfile for example we have:

  sky_engine:
    dependency: transitive
    description: flutter
    source: sdk
    version: "0.0.99"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've split out this commit to #9082.

@fviernau fviernau force-pushed the pub-podspec-kxs branch 2 times, most recently from 5cccaac to 2a6f370 Compare September 5, 2024 10:10
@sschuberth
Copy link
Member

There's one Detekt issue left, it seems.

Avoid a naming conflict in an upcoming change.

Signed-off-by: Frank Viernau <[email protected]>
Align on `pubspec` as the term.

Signed-off-by: Frank Viernau <[email protected]>
@fviernau fviernau merged commit 399d507 into main Sep 5, 2024
22 checks passed
@fviernau fviernau deleted the pub-podspec-kxs branch September 5, 2024 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants