dart-lang / pub-dev

The pub.dev website
https://pub.dev
BSD 3-Clause "New" or "Revised" License
775 stars 145 forks source link

"Issue with pana Tool Using Outdated Flutter SDK on pub.dev" #7888

Closed mg3994 closed 3 weeks ago

mg3994 commented 1 month ago

I recently uploaded the antinna_ui_kit package to pub.dev, which requires the Dart SDK version >=3.4.4 <4.0.0. However, during the analysis, it seems that pana is currently using Flutter version 3.22.2, Even though flutter new Stable version is there.

## Running analysis for "antinna_ui_kit" version "1.0.0"
STARTED: 2024-07-24T15:35:47.305052Z

### Starting pana
2024-07-24 15:36:02.615396 INFO: Running `/home/worker/dart/stable/bin/dart --version`...
2024-07-24 15:36:02.662876 INFO: Running `/home/worker/flutter/stable/bin/flutter --no-version-check --version --machine`...
2024-07-24 15:36:02.850325 INFO: Downloading package antinna_ui_kit 1.0.0 from https://pub.dev/api/archives/antinna_ui_kit-1.0.0.tar.gz
2024-07-24 15:36:03.054172 INFO: Running `/home/worker/flutter/stable/bin/flutter --no-version-check pub pub get --no-example`...
2024-07-24 15:36:04.328979 INFO: Running `/home/worker/flutter/stable/bin/flutter --no-version-check pub pub get --no-example`...
2024-07-24 15:36:07.455499 INFO: Running `webpinfo /tmp/pana_JXCNMJ/screenshots/antinna_copyrights.webp`...
2024-07-24 15:36:07.478643 INFO: Running `webpinfo /tmp/JWGTRH/gen/antinna_copyrights.webp`...
2024-07-24 15:36:07.498990 INFO: Running `cwebp -resize 0 100 /tmp/JWGTRH/gen/antinna_copyrights.webp -o /tmp/JWGTRH/gen/100x100/antinna_copyrights.webp`...
2024-07-24 15:36:07.525239 INFO: Running `cwebp -resize 0 190 /tmp/JWGTRH/gen/antinna_copyrights.webp -o /tmp/JWGTRH/gen/190x190/antinna_copyrights.webp`...
2024-07-24 15:36:07.555368 INFO: Running `dwebp /tmp/JWGTRH/gen/100x100/antinna_copyrights.webp -o /tmp/JWGTRH/gen/100x100/antinna_copyrights.png`...
2024-07-24 15:36:07.579246 INFO: Running `dwebp /tmp/JWGTRH/gen/190x190/antinna_copyrights.webp -o /tmp/JWGTRH/gen/190x190/antinna_copyrights.png`...
2024-07-24 15:36:08.708029 INFO: Running `git init`...
2024-07-24 15:36:08.732081 INFO: Running `git remote add origin https://github.com/antinna/antinna_ui_kit`...
2024-07-24 15:36:08.754786 INFO: Running `git remote show origin`...
2024-07-24 15:36:09.017817 INFO: Running `git fetch --depth 1 --no-recurse-submodules origin main`...
2024-07-24 15:36:09.598520 INFO: Running `git ls-tree -r --name-only --full-tree origin/main`...
2024-07-24 15:36:09.627163 INFO: Running `git show origin/main:example_projects/pubspec.yaml`...
2024-07-24 15:36:09.658720 INFO: Running `git show origin/main:pubspec.yaml`...
2024-07-24 15:36:10.537557 INFO: Analyzing pub downgrade...
2024-07-24 15:36:10.543714 INFO: Running `/home/worker/flutter/stable/bin/flutter --no-version-check packages pub downgrade --no-example`...
2024-07-24 15:36:11.839963 INFO: [pub-downgrade-error]
2024-07-24 15:36:11.840285 INFO: Resolving dependencies...
2024-07-24 15:36:11.840285 INFO: The current Dart SDK version is 3.4.3.
2024-07-24 15:36:11.840285 INFO: 
2024-07-24 15:36:11.840285 INFO: Because antinna_ui_kit requires SDK version >=3.4.4 <4.0.0, version solving failed.
2024-07-24 15:36:11.840285 INFO: 
2024-07-24 15:36:11.840285 INFO: 
2024-07-24 15:36:11.840285 INFO: You can try the following suggestion to make the pubspec resolve:
2024-07-24 15:36:11.840285 INFO: * Try using the Flutter SDK version: 3.22.3.
2024-07-24 15:36:11.848567 INFO: Running `/home/worker/flutter/stable/bin/flutter --no-version-check packages pub upgrade --no-example`...
2024-07-24 15:36:13.212554 INFO: Writing summary.json
2024-07-24 15:36:13.218063 INFO: Running dartdoc post-processing
2024-07-24 15:36:13.222252 INFO: Creating .tar.gz archive
2024-07-24 15:36:13.236450 INFO: Finished post-processing
2024-07-24 15:36:13.242229 INFO: Finished .tar.gz archive
### Execution of pana exited 0
STOPPED: 2024-07-24T15:36:13.325508Z

Screenshot 2024-07-24 211354

Suggested Solution:

Please upgrade the Flutter SDK used in the pub.dev for pana tool. As new Stable release is there Flutter release archive

jonasfj commented 1 month ago

We do strive to pana up-to-date, usually it takes us a couple of days. But we have reduced summer staffing at the moment (and I guess this release missed deployment last week).


However, if you specify SDK constraints on either Flutter or Dart SDK that is newer than the stable version we built into pana when we deployed pub.dev, then pana should dynamically download such version and use it for analysis.

This suggests a bug in our dynamic selection of Flutter analysis SDK. https://github.com/dart-lang/pub-dev/blob/master/pkg/pub_worker/lib/src/bin/pana_wrapper.dart#L186

The package in question has SDK constraints:

environment:
  sdk: ">=3.4.4 <4.0.0"
  flutter: ">=1.17.0"

Then it shouldn't pick a Flutter SDK that doesn't contains Dart 3.4.4 or newer.

isoos commented 1 month ago

I agree, the SDK selection could be improved. However, in this case, I'd also argue that if the package is expecting a later Flutter SKD, then it should specify it in its SDK dependencies, otherwise the constraint is a bit misleading.