Skip to content

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

@sigurdm

Description

@sigurdm

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

Metadata

Metadata

Labels

area-pkgUsed for miscellaneous pkg/ packages not associated with specific area- teams.cherry-pick-approvedLabel for approved cherrypick requestcherry-pick-reviewIssue that need cherry pick triage to approvetype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions