Skip to content

pub upgrade --major-version breaks sdk constraints #3486

Closed
@bsutton

Description

@bsutton

OS linux
OS version Linux 5.15.0-40-generic #43-Ubuntu SMP Wed Jun 15 12:54:21 UTC 2022
dart version 2.17.5

I have a project pub_release that has the following pubspec.yaml:

name: pub_release
version: 7.3.3
homepage: https://github.com/bsutton/pub_release
documentation: https://pubrelease.noojee.dev/
description: Automates the release of a dart package to pub.dev including running dartfmt, creating a git tag, incrementing the packages version no. and pushing the package to pub.dev.
environment: 
  sdk: '>=2.12.0 <3.0.0'
dependencies: 
  dcli: 1.20.1
  github: ^8.0.1
  meta: ^1.3.0
  mime: ^1.0.0
  pub_semver: ^2.1.0
  pubspec: ^2.3.0
  settings_yaml: ^3.0.6
dev_dependencies: 
  dependency_validator: ^3.0.0
  lint_hard: ^1.0.0
  test: ^1.16.2
executables: 
  pub_release: 
  github_release: 
  github_workflow_release: 
platforms: 
  linux: 
  windows: 
  macos: 

Note: the sdk constraint of >=2.12.0

I would assume that this means that pub_release will run on sdk 2.12.

I now run dart pub upgrade --major-versions with the resulting pubspec.yaml:

name: pub_release
version: 7.3.3
homepage: https://github.com/bsutton/pub_release
documentation: https://pubrelease.noojee.dev/
description: Automates the release of a dart package to pub.dev including running dartfmt, creating a git tag, incrementing the packages version no. and pushing the package to pub.dev.
environment: 
  sdk: '>=2.12.0 <3.0.0'
dependencies: 
  dcli: ^1.31.2
  github: ^9.4.0
  meta: ^1.3.0
  mime: ^1.0.0
  pub_semver: ^2.1.0
  pubspec: ^2.3.0
  settings_yaml: ^3.0.6
dev_dependencies: 
  dependency_validator: ^3.0.0
  lint_hard: ^2.0.0
  test: ^1.16.2
executables: 
  pub_release: 
  github_release: 
  github_workflow_release: 
platforms: 
  linux: 
  windows: 
  macos: 

Note the change of the dcli dependency from 1.20.1 to 1.31.2.

The pubspec.yaml for dcli 1.31.2 is:

name: dcli
version: 1.31.2
homepage: https://dcli.onepub.dev
documentation: https://dcli.onepub.dev
description: Dart console SDK - write console (cli) apps/scripts using dart.
repository: https://github.com/onepub-dev/dcli
environment: 
  sdk: '>=2.16.0 <3.0.0'
dependencies: 
  archive: ^3.0.0
  args: ^2.0.0
  async: ^2.5.0
  chunked_stream: ^1.4.1
...

Note that dcli has an sdk constraint of sdk: '>=2.16.0 <3.0.0'.

I would assume this means that dcli requires at least 2.16 to operate correctly.

As such it would appear that the pub upgrade command has incorrectly upgraded the pub_release package to use a version of dcli that breaks pub_release's sdk constraints.

I would have expect the the dcli dependency to remain at 1.20.1 as this is the last version that supported sdk 2.12.0

Activity

sigurdm

sigurdm commented on Jul 8, 2022

@sigurdm
Contributor

Yeah - this is a bit confusing.

The sdk constraint tells what sdk the code in the given package requires (and the lower bound also signifies the language version for that package) - all dependencies don't have to respect the same ranges.

This just mean that pub from a 2.12 sdk will never resolve a pub_release v7.3.3 (unless a new version of dcli is published that actually supports 2.12).

Closing as this is working as intended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @bsutton@sigurdm

        Issue actions

          pub upgrade --major-version breaks sdk constraints · Issue #3486 · dart-lang/pub