google / flutter-desktop-embedding

Experimental plugins for Flutter for Desktop
Apache License 2.0
7.1k stars 604 forks source link

build_runner fails with 'Could not find a file named "pubspec.yaml"' on Windows #864

Closed technolion closed 3 years ago

technolion commented 3 years ago

Describe the bug Starting with flutter 2.3.0 the following error appeared when using the build_runner on Windows and having referenced a plugin from flutter-desktop-embedding:

flutter packages pub run build_runner build --delete-conflicting-outputs
Could not find a file named "pubspec.yaml" in "C:\Users\tom\AppData\Local\Pub\Cache\git\flutter-desktop-embedding-85dde09b702a0cb1f5e1392d2f030bdc3d4e5be3\plugins%5Cmenubar".

I checked the local file system, and the problem seems to be, that on Windows the path separator is a backslash. But somehow build_runnercannot deal with the encoded backslash %5C.

Doctor Output Please provide the output of flutter doctor -v:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, 2.3.0-24.1.pre, on Microsoft Windows [Version 10.0.19042.1052], locale en-US)
[X] Android toolchain - develop for Android devices
    X Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Professional 2019 16.8.2)
[!] Android Studio (not installed)
[√] VS Code (version 1.57.1)
[√] Connected device (3 available)

! Doctor found issues in 2 categories.
technolion commented 3 years ago

This might also be a build_runner bug. I used build_runner: 2.0.5. If so, please direct me where to move the issue to.

stuartmorgan commented 3 years ago

I'm sure how you believe that the packages in this repository would control how a completely separate package constructs and encodes string representation of paths. If you have evidence that this is somehow caused by a package here, please point me to the details of how and I can re-open the issue.

This might also be a build_runner bug. I used build_runner: 2.0.5. If so, please direct me where to move the issue to.

I don't know anything about how packages I don't maintain manage their issues. I would assume there's an issue link on the package page, as with any other package.

technolion commented 3 years ago

Well, here's how to reproduce it (on Windows):

flutter create build_runner_test
cd .\build_runner_test\

Add the following to pubspec.yaml in the dependencies section

  menubar:
    git:
      url: https://github.com/google/flutter-desktop-embedding.git
      path: plugins/menubar
flutter pub get
flutter packages pub run build_runner build

But thinking about it, it's probably caused by the path parameter in the git dependency. It should be possible though: https://dart.dev/tools/pub/dependencies

Adding a plugin from flutter desktop embedding like this is also recommended by you here: https://github.com/google/flutter-desktop-embedding/blob/master/plugins/README.md

stuartmorgan commented 3 years ago

Well, here's how to reproduce it

I didn't say that I don't believe the issue is reproducible; I asked for evidence that the issue is caused by the packages here. For instance, if you can demonstrate that doing the exact same thing with a different git repository has a different outcome, please include that.

Adding a plugin from flutter desktop embedding like this is also recommended by you here: https://github.com/google/flutter-desktop-embedding/blob/master/plugins/README.md

Yes, I'm aware that I provide an example of how to apply pub's git dependency syntax to the unpublished packages in this repository. I'm not sure what the relevance is; are you saying that those instructions are incorrect? Again, if so, please provide details.

technolion commented 3 years ago

I no longer think, that the issue is caused by this package and you rightfully closed this one here.

Yes, I'm aware that I provide an example of how to apply pub's git dependency syntax to the unpublished packages in this repository. I'm not sure what the relevance is; are you saying that those instructions are incorrect?

No, I am not.

Still I can image that many flutter desktop devs that use flutter-desktop-embedding might have this problem, so I would have loved to get some advice from a senior dev like you where to report the issue, because many aspects of the dart/flutter eco system are still unclear to me.

I tried my luck here.

sensuikan1973 commented 3 years ago

I wonder if this problem is like https://github.com/dart-lang/pub/issues/1756

sensuikan1973 commented 3 years ago

I found, https://github.com/dart-lang/pub/issues/3012