melos icon indicating copy to clipboard operation
melos copied to clipboard

bootstrap does not discriminate between dependencies and dev_dependencies

Open iapicca opened this issue 3 years ago • 0 comments

Is there an existing issue for this?

  • [X] 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.

iapicca avatar Sep 26 '22 12:09 iapicca