Open buchen opened 4 months ago
I can't help with the limited information given. I'd need a complete example
But it sounds to me like you're missing a pub get
or have incorrectly installed your dependencies. The error is complaining about unresolved imports afterall
I'd need a complete example
@rrousselGit Fair. For what it's worth, here is the full error log: issue228_full_log.txt
It looks to me that the dependency resolution works, but somehow something is different in the environment on the build server and it does not get passed to the analysis server.
BTW, downgrading to this version shows the same issue:
But downgrading these version fixes the issue:
FYI, to narrow it down, I converted the pubspec dependencies to ones pointing to git commits - including some dependencyOverrides - in this style:
custom_lint:
git:
url: https://github.com/invertase/dart_custom_lint.git
ref: c5fccae54fa305d60302f453f8b192f7b51977ea
path: packages/custom_lint
This commit still does work: c5fccae54fa305d60302f453f8b192f7b51977ea With the next commit, it starts failing: 346824c1815f578bfde8410927cea5e59f1d35c2 Which doesn't make any sense to me as (as a newbie to the dart/flutter ecosystem) as the last commit 'only' changes release versions.
I'm having the same problem with Github Actions.
flutter doctor Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.16.9, on macOS 14.2.1 23C71 darwin-arm64, locale ko-KR) [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2) [✓] Xcode - develop for iOS and macOS (Xcode 15.0.1) [✓] Chrome - develop for the web [✓] Android Studio (version 2023.1) [✓] IntelliJ IDEA Community Edition (version 2023.3.1) [✓] VS Code (version 1.86.0) [✓] Connected device (2 available) [✓] Network resources
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^3.0.0
freezed: ^2.4.7
mockito: 5.4.4
build_runner: ^2.4.8
injectable_generator:
json_serializable: ^6.7.1
riverpod_generator: ^2.3.11
riverpod_analyzer_utils: ^0.5.1
melos: ^3.0.0
custom_lint: 0.6.0
custom_lint_builder: 0.6.0
custom_lint_core: 0.6.0
riverpod_lint: ^2.3.9
My hack: Because I don't want to do without the Riverpod lints locally, I remove the custom_lint plugin on the build server.
sed -i '' '/custom_lint/d' analysis_options.yaml
flutter analyze lib
Could you share a small repository to reproduce the issue?
I assume your project, with all sources deleted, should be enough
@rrousselGit I have the same problem in my project. Here is a repository that showcases the issue. https://github.com/re-ckart/dart_custom_lint_gh_action_error/pull/1
The Github Action fails in the PR with the following error
Error from the analysis server: Error: Couldn't resolve the package 'custom_lint_builder' in 'package:custom_lint_builder/src/channel.dart'.
Error: Couldn't resolve the package 'riverpod_lint' in 'package:riverpod_lint/riverpod_lint.dart'.
lib/custom_lint_client.dart:3:8: Error: Not found: 'package:custom_lint_builder/src/channel.dart'
import 'package:custom_lint_builder/src/channel.dart';
^
lib/custom_lint_client.dart:4:8: Error: Not found: 'package:riverpod_lint/riverpod_lint.dart'
import 'package:riverpod_lint/riverpod_lint.dart' as riverpod_lint;
^
lib/custom_lint_client.dart:16:[37](https://github.com/re-ckart/dart_custom_lint_gh_action_error/actions/runs/7918129033/job/21615819522?pr=1#step:5:38): Error: Undefined name 'createPlugin'.
{'riverpod_lint': riverpod_lint.createPlugin,
^^^^^^^^^^^^
lib/custom_lint_client.dart:11:3: Error: Method not found: 'runSocket'.
runSocket(
^^^^^^^^^
Error from the analysis server: Failed to start plugins
@re-ckart You need to run flutter pub get
. Your workflow never does it.
@rrousselGit
flutter analyze should run this by default or am I reading the help wrong?
$ flutter analyze -h
Usage: flutter analyze [arguments]
-h, --help Print this usage information.
--[no-]current-package Analyze the current project, if applicable.
(defaults to on)
--watch Run analysis continuously, watching the filesystem for changes.
--write=<file> Also output the results to a file. This is useful with "--watch" if you want a file to always contain the latest results.
--[no-]suggestions Show suggestions about the current flutter project.
--[no-]pub Whether to run "flutter pub get" before executing this command.
(defaults to on)
But nevertheless, I updated my workflow to run pub
get before analyze
and I still get the same error. (see last commit in the PR I linked before)
Hey @rrousselGit I'm also getting the same thing and my current solution is to work around it the way @buchen mentioned. I'm posting this reply to give you some more context on the problem.
✓] Flutter (Channel stable, 3.19.1, on Ubuntu 22.04.4 LTS 6.2.0-1019-azure, locale C.UTF-8)
• Flutter version 3.19.1 on channel stable at /opt/hostedtoolcache/flutter/stable-3.19.1-x64
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision abb292a07e (24 hours ago), 2024-02-20 14:35:05 -0[8](https://github.com/gbassisp/flutter_dev_toys/actions/runs/7996396291/job/21839120638#step:6:9)00
• Engine revision 04817c[9](https://github.com/gbassisp/flutter_dev_toys/actions/runs/7996396291/job/21839120638#step:6:10)9c9
• Dart version 3.3.0
• DevTools version 2.31.1
[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /usr/local/lib/android/sdk • Platform android-34, build-tools 34.0.0 • ANDROID_HOME = /usr/local/lib/android/sdk • ANDROID_SDK_ROOT = /usr/local/lib/android/sdk ✗ Android SDK file not found: adb. • Try re-installing or updating your Android SDK, visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions.
[✓] Chrome - develop for the web • Chrome at google-chrome
[✗] Linux toolchain - develop for Linux desktop • Ubuntu clang version 14.0.0-1ubuntu1.1 • cmake version 3.28.3 ✗ ninja is required for Linux development. It is likely available from your distribution (e.g.: apt install ninja-build), or can be downloaded from https://github.com/ninja-build/ninja/releases • pkg-config version 0.29.2 ✗ GTK 3.0 development libraries are required for Linux development. They are likely available from your distribution (e.g.: apt install libgtk-3-dev)
[!] Android Studio (not installed) • Android Studio not found; download from https://developer.android.com/studio/index.html (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).
[✓] Connected device (2 available) • Linux (desktop) • linux • linux-x64 • Ubuntu 22.04.4 LTS 6.2.0-1019-azure • Chrome (web) • chrome • web-javascript • Google Chrome 121.0.6167.184
[✓] Network resources • All expected network resources are available.
With workaround it passes: https://github.com/gbassisp/flutter_dev_toys/actions/runs/7998286873/job/21844214242
Without it fails: https://github.com/gbassisp/flutter_dev_toys/actions/runs/7996396291/job/21839120638
dart analyze works fine (line 158 of run make web step): https://github.com/gbassisp/flutter_dev_toys/actions/runs/7996396202/job/21838777176
@rrousselGit Are there any updates regarding this issue?
My hack: Because I don't want to do without the Riverpod lints locally, I remove the custom_lint plugin on the build server.
sed -i '' '/custom_lint/d' analysis_options.yaml flutter analyze lib
As a note to this workaround: For my workflows using ubuntu-latest
, I needed to slightly change it to:
sed -i '/custom_lint/d' analysis_options.yaml
Nevertheless, I am really thankful for the workaround! Having same issue as people above.
I ran into the same issue, this is my github workflow, I bumped Flutter stable to 3.19 from the previous stable release and pulled Dart to 3.3 - my guess is that this is where the issue is coming from.
environment:
sdk: ">=3.3.0 <4.0.0"
custom_lint: ^0.5.8
riverpod_lint: ^2.1.1
jobs:
build:
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v2.5.0
with:
flutter-version: "3.19.5"
channel: "stable"
cache: true
- name: Install Dependencies
run: flutter packages get
- name: Format
run: dart format --set-exit-if-changed lib test
- name: Analyze
run: flutter analyze lib test
I am experiencing the same issue in my GitHub Action when running dart run custom_lint
and flutter analyze lib
Describe the bug
My projects is using riverpod and has a custom lint sub-package. The issue started to occur after updating
custom_lint_builder
andcustom_lint
to version 0.6.0.Running locally,
dart analyze lib
runs fine. Running on codemagic CI, however, I get the following error message:I'd appreciate any hint in which direction to investigate
This is (part of) the verbose output. The ~5.5K output contains the resolution of the packages which all come up to
Flutter version (on stable channel)