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

[CP] Pub: Validate lockfile before recompiling global executable #56930

Closed
sigurdm opened this issue Oct 21, 2024 · 4 comments
Closed

[CP] Pub: Validate lockfile before recompiling global executable #56930

sigurdm opened this issue Oct 21, 2024 · 4 comments
Assignees
Labels
area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams. cherry-pick-approved Label for approved cherrypick request cherry-pick-review Issue that need cherry pick triage to approve type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@sigurdm
Copy link
Contributor

sigurdm commented Oct 21, 2024

Commit(s) to merge

https://dart-review.googlesource.com/c/sdk/+/389720

Target

beta

Prepared changelist for beta/stable

https://dart-review.googlesource.com/c/sdk/+/391120

Issue Description

When running a dart pub global run of a package

  • the package was dart pub global activated with an earlier sdk
  • that depends on a sdk package (ie package:_macros)

Pub would not pick up that the package:_macros package has changed and

What is the fix

Validate the lockfile before recompiling the global executable

Why cherry-pick

This will avoid weird compilation errors about missing api when running globally activated packages like intl_utils.

$ ../../../.pub-cache/hosted/pub.dev/analyzer-6.5.0/lib/src/summary2/macro_application.dart:1261:7: Error: The non-abstract class '_StaticTypeImpl' is missing implementations for these members:
 - StaticType.asInstanceOf
Try to either
 - provide an implementation,
 - inherit an implementation from a superclass or mixin,
 - mark the class as abstract, or
 - provide a 'noSuchMethod' implementation.

class _StaticTypeImpl implements macro.StaticType {
      ^^^^^^^^^^^^^^^
/opt/flutter/bin/cache/dart-sdk/pkg/_macros/lib/src/api/introspection.dart:119:28: Context: 'StaticType.asInstanceOf' is defined here.
  Future<NamedStaticType?> asInstanceOf(TypeDeclaration declaration);

Risk

Medium-low

Issue link(s)

dart-lang/pub#4406

Extra Info

No response

@sigurdm sigurdm added the cherry-pick-review Issue that need cherry pick triage to approve label Oct 21, 2024
@dart-github-bot
Copy link
Collaborator

Summary: When running dart pub global run for a package activated with an older SDK that depends on a SDK package (e.g., package:_macros), Pub fails to recognize changes in the SDK package, leading to compilation errors. The fix validates the lockfile before recompiling the global executable.

@dart-github-bot dart-github-bot added area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams. triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Oct 21, 2024
@jonasfj
Copy link
Member

jonasfj commented Oct 21, 2024

LGTM, the _macros issue affects all globally activate packages that use package:analyzer.

@itsjustkevin
Copy link
Contributor

Approved CC @athomas

@itsjustkevin itsjustkevin added the cherry-pick-approved Label for approved cherrypick request label Oct 21, 2024
@lrhn lrhn removed the triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. label Oct 22, 2024
@sigurdm
Copy link
Contributor Author

sigurdm commented Oct 31, 2024

Landed

@sigurdm sigurdm closed this as completed Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams. cherry-pick-approved Label for approved cherrypick request cherry-pick-review Issue that need cherry pick triage to approve type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

8 participants