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

bootstrap does not discriminate between dependencies and dev_dependencies #384

Closed
1 task done
iapicca opened this issue Sep 26, 2022 · 2 comments · Fixed by #387
Closed
1 task done

bootstrap does not discriminate between dependencies and dev_dependencies #384

iapicca opened this issue Sep 26, 2022 · 2 comments · Fixed by #387
Assignees
Labels
bug Something isn't working

Comments

@iapicca
Copy link
Contributor

iapicca commented Sep 26, 2022

Is there an existing issue for this?

  • I have searched the existing issues.

Version

2.7.1

Description

melos bootstrap creates incompatibility between an application (in the example flutter_app)
and a package (test_package)
regardless the fact that said package is not used in the application itself
and only present in the dev_dependencies of the imported package

Steps to reproduce

  1. setup monorepo
steps
  • create folders as below
mkdir test_folder
mkdir test_folder/packages
mkdir test_folder/examples
  • add to test_folder a melos.yaml file with the content below
name: test_folder
packages:
  - examples/**
  - packages/**
ignore:
  - packages/**/example
  1. setup packages
steps
  • create the packages as below
cd test_folder/packages
dart create -t package test_package
dart create -t package feature_package
  • replace test_package's pubspec.yaml with the following
name: test_package
description: none
publish_to: 'none'

environment:
  sdk: '>=2.18.1 <3.0.0'

dependencies:
  test: ^1.21.6

dev_dependencies:
  lints: ^2.0.0
  • replace feature_package's pubspec.yaml with the following
name: feature_package
description: none
version: 1.0.0
publish_to: 'none'

environment:
  sdk: '>=2.18.1 <3.0.0'

dev_dependencies:
  lints: ^2.0.0
  test: ^1.21.6
  test_package:
    path: ../../packages/test_package
  1. setup examples
steps
  • create the following packages
cd ../examples
flutter create flutter_app
  • replace flutter_app's pubspec.yaml with the following
name: flutter_app
description: A new Flutter project.
publish_to: 'none'
version: 1.0.0+1

environment:
  sdk: '>=2.18.1 <3.0.0'

dependencies:
  flutter:
    sdk: flutter
  feature_package:
    path: ../../packages/feature_package

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^2.0.1

flutter:
  uses-material-design: true
  1. run flutter pub get/ dart pub get everywhere
cd packages/test_package && dart pub get
cd ../feature_package && dart pub get
cd ../../examples/flutter_app && flutter pub get

5 run melos bootstrap

Expected behavior

as pub get is successful I'd expect melos bootstrap to succeed as well

Actual behavior

melos boot throws the following

melos bootstrap
  └> /Volumes/ROG/dev/test_folder

Running "flutter pub get" in workspace packages...
  - flutter_app
    └> examples/flutter_app
       └> Failed to install.

Running "flutter pub get" in flutter_app...
Because every version of test_package from path depends on test ^1.21.6 which depends on test_api 0.4.14, every version of test_package from path requires test_api 0.4.14.
And because every version of flutter_test from sdk depends on test_api 0.4.12, test_package from path is incompatible with flutter_test from sdk.
So, because flutter_app depends on both flutter_test from sdk and test_package from path, version solving failed.
pub get failed (1; So, because flutter_app depends on both flutter_test from sdk and test_package from path, version solving failed.)
BootstrapException: Failed to install.: flutter_app at /Volumes/ROG/dev/test_folder/examples/flutter_app.

Additional context and comments

dart --version

Dart SDK version: 2.18.1 (stable) (Tue Sep 13 11:42:55 2022 +0200) on "macos_arm64"

flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.2, on macOS 12.5.1 21G83 darwin-arm, locale en-EE)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✓] Chrome - develop for the web
[!] Android Studio (not installed)
[✓] VS Code (version 1.71.2)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

! Doctor found issues in 1 category.
@blaugold
Copy link
Collaborator

@iapicca Thanks for the detailed issue! I've got a fix for it in #387.

@iapicca
Copy link
Contributor Author

iapicca commented Sep 29, 2022

@iapicca Thanks for the detailed issue! I've got a fix for it in #387.

@blaugold thank you for addressing this so quickly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants